loading…
Search for a command to run...
loading…
Search and find free images and videos from Pexels.com. (free api key required)
Search and find free images and videos from Pexels.com. (free api key required)
An MCP server for Pexels stock photo and video search. Optimized for LLMs.
Lint MCP License smithery badge mcp-server-pexels MCP server

Pexels provides free stock photos and videos.
For LLM agents: See docs/agents/AGENTS.md for agent-optimized documentation — tool semantics, caching behaviour, response structure, and attribution requirements.
Sign up at pexels.com/api — free, no credit card.
npm install && npm run build
Open ~/Library/Application Support/Claude/claude_desktop_config.json (Mac) or %APPDATA%\Claude\claude_desktop_config.json (Windows), add:
{
"mcpServers": {
"pexels": {
"command": "node",
"args": ["/absolute/path/to/mcp-server-pexels/build/index.js"],
"env": {
"PEXELS_API_KEY": "YOUR_PEXELS_API_KEY"
}
}
}
}
Windows note: Use
node.exefull path or add Node to PATH. Forward slashes in paths work on Windows.
The server is now available as pexels_search_photos, pexels_search_videos, and pexels_get_details.
Add to your .mcp.json or claude_desktop_config.json:
{
"mcpServers": {
"pexels": {
"command": "node",
"args": ["/absolute/path/to/build/index.js"],
"env": {
"PEXELS_API_KEY": "YOUR_API_KEY"
}
}
}
}
Set PEXELS_API_KEY in your environment. For local dev, create a .env file:
PEXELS_API_KEY=your_pexels_api_key
npm run dev # watch mode
npm run inspector # MCP Inspector
npm test # build + run all tests (125+)
npm run lint # check code style with Biome
npm run format # auto-format with Biome
LLM-optimized docs for agent consumers are at docs/agents/AGENTS.md.
| Tool | Description |
|---|---|
pexels_search_photos |
Search for photos by query |
pexels_search_videos |
Search for videos |
pexels_get_details |
Get details by ID and type |
src/index.ts — Entry point, MCP server setupsrc/tools/ — Tool implementationssrc/shared/ — Cache, API client, errors, types, video selectorsrc/utils/ — Zod validation schemas| Decision | Rationale |
|---|---|
| Cache-first architecture | Pexels API allows 200 requests/hour. Caching (10m TTL for searches, 60m for ID lookups) preserves quota, reduces latency to <5ms on cache hit, and demonstrates awareness of API costs — critical for production AI systems where agents frequently re-request the same context. |
| Fail-fast at call time | MCP servers are spawned as child processes — starting is not the time to fail. Server warns on startup but fails gracefully on first tool call with structured isError: true. |
| Zod validation schemas | MCP v2 SDK requires z.object() wrappers. Catches invalid input before it reaches the API. |
| resource_link for media | Remote images and videos are provided as MCP resource_link content blocks with proper mimeType. The markdown image link in the text block remains as a fallback for clients that do not render resource_link. |
| Pure video selection | Video selection logic isolated in video-selector.ts — testable independently from tool handler. |
| Hardcoded attribution | Required by Pexels Terms of Service. Embedded in every text response. |
Tested with @modelcontextprotocol/sdk v1.29+ via StdioClientTransport. The integration test suite spawns the built server and validates every tool call against the SDK's CallToolResultSchema and ContentBlockSchema.
A structured JSON block is appended as the last content element in every successful response, containing typed data (id, kind, creatorName, dimensions, URLs). Downstream clients and agent frameworks can parse this block directly instead of regex-parsing the markdown text.
Unofficial community project. Not affiliated with Pexels.
Выполни в терминале:
claude mcp add mcp-server-pexels -- npx Да, Server Pexels MCP бесплатный — установка в один клик через Unyly без оплаты.
Нет, Server Pexels работает без API-ключей и переменных окружения.
Доступен hosted-вариант: Unyly запускает сервер в облаке, локальная установка не обязательна.
Открой Server Pexels на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
CSA PROJECT - FZCO © 2026 IFZA Business Park, DDP, Premises Number 31174 - 001
Безопасность
Низкий рискАвтоматическая эвристика по публичным данным — не гарантия безопасности.