# Pexels — how to use (mcp.ai)

Connect your Pexels account and use 9 tools for images and design straight from your AI agent. Connect with your own API key. Pexels offers a free API that provides access to a vast library of high-quality photos and videos, enabling seamless integration into applications and websites.

## Option A — via MCP (recommended)
Remote MCP endpoint (HTTP, streamable): `https://api.mcp.ai/p_pexels?ms=1787295780000`
Add it as a custom/remote MCP connector in your client (Claude, Cursor, VS Code…), then authenticate when prompted. Once connected, ask the agent to use the server's tools (e.g. `pexels_collection_media`).

## Option B — via direct REST API
Base URL: `https://api.mcp.ai/api/pexels`
Auth: `Authorization: Bearer sk_live_…` — create a workspace API key at https://mcp.ai/settings/api-keys
Discover endpoints: `GET https://api.mcp.ai/api/pexels/_endpoints`

### Endpoints
- `POST https://api.mcp.ai/api/pexels/collection/media` — Tool to get all media within a collection by its ID. Use when you need to fetch paginated media from a specific collection.
  - body: { id: string, page?: integer, per_page?: integer }
- `POST https://api.mcp.ai/api/pexels/curated/photos` — Tool to get real-time curated photos. Use when you need to fetch curated photos with pagination support.
  - body: { page?: integer, per_page?: integer }
- `POST https://api.mcp.ai/api/pexels/featured/collections` — Tool to get featured collections. Use when you need curated collections of photos and videos with pagination support.
  - body: { page?: integer, per_page?: integer }
- `POST https://api.mcp.ai/api/pexels/get/photo` — Tool to retrieve detailed information about a specific photo. Use when you have a valid photo ID to fetch metadata including dimensions, photographer details, and image URLs. Use after confirming the 
  - body: { id: integer }
- `POST https://api.mcp.ai/api/pexels/get/video/by/id` — Tool to retrieve detailed information about a specific video from Pexels. Use when you have a valid video ID to fetch metadata including dimensions, duration, videographer details, and available video
  - body: { id: integer }
- `POST https://api.mcp.ai/api/pexels/my/collections` — Tool to get all of the user's collections on Pexels. Use when you need to list a user's collections with pagination support.
  - body: { page?: integer, per_page?: integer }
- `POST https://api.mcp.ai/api/pexels/popular/videos` — Tool to retrieve current popular Pexels videos. Use when you want to fetch trending videos from Pexels.
  - body: { page?: integer, per_page?: integer }
- `POST https://api.mcp.ai/api/pexels/search/photos` — Tool to search for photos on Pexels. Use when you need to retrieve photos by a search term and optional filters. Call after confirming you have a valid Pexels API key. Response image URLs are nested u
  - body: { page?: integer, size?: string, color?: string, query: string, locale?: string, per_page?: integer, orientation?: string }
- `POST https://api.mcp.ai/api/pexels/search/videos` — Tool to search for videos on Pexels by query and optional filters. Use when you need to find relevant video assets. Combining multiple filters with a narrow query may return few or no results; only ap
  - body: { page?: integer, size?: string, query: string, per_page?: integer, orientation?: string }

## Example prompts
- "What can I do in Pexels?"
- "Show me a summary of my Pexels account"

## More
- Page: https://mcp.ai/pexels
- Agent spec (llms.txt): https://mcp.ai/pexels/llms.txt
- Postman collection: https://mcp.ai/pexels/postman.json
