MCP server for the Pexels API: search & fetch stock photos, videos, and collections.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent โ or use 1-click editor setup below.
๐ก Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
A production-ready Model Context Protocol (MCP) server for the Pexels API. It gives AI assistants โ Claude Desktop, Claude Code, Cursor, VS Code, Windsurf, and any MCP client โ tools to search and fetch Pexels photos, videos, and collections, covering every endpoint the Pexels API documents.
[!IMPORTANT] Unofficial project. This is not affiliated with, endorsed by, or sponsored by Pexels. "Pexels" is a trademark of its respective owner. You use it under your own Pexels API account and are responsible for complying with the Pexels License.
credit (text + HTML), and the server's instructions steer the model around the license restrictions that do apply (no resale of unaltered content, no redistribution to other stock platforms, no trademark/logo use, no implied endorsement).src URLs (original/large2x/large/medium/small/portrait/landscape/tiny); each video returns its video_files renditions (trimmed to the highest-resolution few in list results, complete on a single-item lookup).isError results the model can recover from, plus retries/backoff, timeouts, and rate-limit-aware quota short-circuiting (Pexels omits its rate-limit headers on a 429, so the client caches the last-known reset time instead of guessing).npx, no telemetry.Create a free account at pexels.com/api and you'll receive an API key instantly โ no app review, no approval wait.
Claude Desktop โ edit claude_desktop_config.json:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.jsonRestart the client. See Configuration for every supported variable.
Claude Code (CLI):
Cursor โ ~/.cursor/mcp.json (global) or .cursor/mcp.json (per-project): use the exact same mcpServers block as Claude Desktop above.
Windsurf โ ~/.codeium/windsurf/mcp_config.json: same mcpServers block as Claude Desktop above.
VS Code โ .vscode/mcp.json (note the top-level key is servers, not mcpServers):
Any other MCP client โ run the server over stdio with:
Point your client's stdio transport at command: npx, args: ["-y", "@hanoak/pexels-mcp-server"], and pass the key via env.
Restart your client and ask:
"Find me a photo of mountains on Pexels."
A typical flow: the model calls pexels_search_photos, picks a result, and presents the image with its courtesy credit.
You: Find a landscape photo of a foggy pine forest.
Assistant: (calls
pexels_search_photoswithquery: "foggy pine forest",orientation: "landscape", picks the best result) Here's a great match โ photo by Jane Doe on Pexels โ along with the image URL and a ready-to-use credit line.
Each tool returns a compact JSON payload. Here's the shape of a single photo result (illustrative values):
Every tool result includes a rate_limit object (limit, remaining, resetEpoch) read from the Pexels response headers. List/search tools wrap results in photos/videos/collections/media arrays with pagination fields (total_results, page, per_page, has_next_page).
Configuration is entirely via environment variables โ no config files, no flags for secrets.
| Environment variable | Required | Description |
|---|---|---|
PEXELS_API_KEY | yes | Your Pexels API key. The server exits at startup with a clear message if it is missing or blank. |
LOG_LEVEL | no | debug | info | warn | error (default info). All logs go to stderr; stdout carries only the MCP protocol. |
CLI flags: --version and --help are supported (e.g. npx @hanoak/pexels-mcp-server --version).
All tools are namespaced pexels_* and every one is read-only (readOnlyHint: true) โ Pexels' API has no write endpoints, so a client can safely auto-approve the entire server. per_page is clamped to a max of 80 (Pexels' own documented max), and page is 1-based.
| Domain | Tools |
|---|---|
| Photos | search_photos, curated_photos, get_photo |
| Videos | search_videos, popular_videos, get_video |
| Collections | list_featured_collections, list_my_collections, get_collection_media |
No reviews yet โ be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/pexels-mcp-server)<a href="https://allmcps.com/mcp/pexels-mcp-server"><img src="https://allmcps.com/api/badge/pexels-mcp-server?style=directory" alt="Pexels MCP Server on AllMCPs" /></a>