Pexels MCP Server
Provides tools for searching Pexels photos by keyword with filters, retrieving curated photos, and getting detailed information about specific photos via the Pexels API.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Pexels MCP Server find some blue mountain landscape photos for a presentation"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Pexels MCP Server
基于 Model Context Protocol (MCP) 的 Pexels API 服务器,允许 AI 助手通过工具调用访问 Pexels 的免费高质量图片库。
功能特性
🔍 搜索照片 - 根据关键词搜索 Pexels 上的免费照片
🎨 获取精选照片 - 获取 Pexels 团队精选的高质量照片
📸 照片详情 - 获取特定照片的详细信息
🔧 丰富的过滤选项 - 支持按方向、尺寸、颜色等过滤搜索结果
⚡ 高性能 - 基于 TypeScript 和现代 Node.js 构建
Related MCP server: Unsplash MCP Server
安装
前置要求
Node.js 18 或更高版本
Pexels API 密钥(免费获取:Pexels API)
1. 克隆项目
git clone https://github.com/your-username/pexels-mcp.git
cd pexels-mcp2. 安装依赖
npm install3. 设置环境变量
创建 .env 文件:
PEXELS_API_KEY=your_pexels_api_key_here或者直接导出环境变量:
export PEXELS_API_KEY=your_pexels_api_key_here4. 构建项目
npm run build配置
Claude Desktop
在你的 Claude Desktop 配置文件中添加 MCP 服务器:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\\Claude\\claude_desktop_config.json
{
"mcpServers": {
"pexels": {
"command": "node",
"args": ["/path/to/pexels-mcp/dist/index.js"],
"env": {
"PEXELS_API_KEY": "your_pexels_api_key_here"
}
}
}
}其他 MCP 客户端
对于其他 MCP 客户端,使用以下命令运行服务器:
PEXELS_API_KEY=your_api_key node dist/index.js可用工具
1. search_photos
根据关键词搜索照片。
参数:
query(必需): 搜索关键词per_page(可选): 每页结果数量 (1-80, 默认: 15)page(可选): 页码 (默认: 1)orientation(可选): 照片方向 (landscape,portrait,square)size(可选): 最小尺寸 (large,medium,small)color(可选): 主要颜色过滤 (red,orange,yellow,green,turquoise,blue,violet,pink,brown,black,gray,white)
示例:
{
\"query\": \"mountain landscape\",
\"per_page\": 10,
\"orientation\": \"landscape\",
\"color\": \"blue\"
}2. get_curated_photos
获取 Pexels 团队精选的高质量照片。
参数:
per_page(可选): 每页结果数量 (1-80, 默认: 15)page(可选): 页码 (默认: 1)
示例:
{
\"per_page\": 20,
\"page\": 1
}3. get_photo_details
获取特定照片的详细信息。
参数:
id(必需): 照片 ID
示例:
{
\"id\": 1234567
}使用示例
在 Claude Desktop 中使用
安装配置完成后,你可以直接与 Claude 对话:
用户:帮我找一些关于海滩日落的照片
Claude:我来为您搜索海滩日落的照片...用户:给我看一些 Pexels 上的精选照片
Claude:让我为您获取一些精选照片...API 响应示例
照片数据包含以下信息:
照片基本信息(ID、尺寸、URL)
摄影师信息
多种尺寸的图片链接
平均颜色
ALT 文本
开发
启动开发服务器
npm run dev运行测试
npm test构建生产版本
npm run buildAPI 限制
Pexels API 有以下限制:
免费账户: 每小时 200 次请求,每月 20,000 次请求
所有照片都是免费使用的,但建议标注来源
许可协议
本项目采用 MIT 许可协议 - 详情请查看 LICENSE 文件。
贡献
欢迎提交 Pull Request 和 Issue!
Fork 本项目
创建特性分支 (
git checkout -b feature/amazing-feature)提交更改 (
git commit -m 'Add some amazing feature')推送到分支 (
git push origin feature/amazing-feature)打开 Pull Request
致谢
Pexels - 提供免费高质量图片
Model Context Protocol - 标准化 AI 助手工具接口
支持
如果你觉得这个项目有用,请给它一个 ⭐️!
如有问题或建议,请创建 Issue。
Available Tools
3 toolsget_curated_photosC
Get curated photos from Pexels
Inputs: page, per_page.
get_photo_detailsB
Get details of a specific photo by its ID
Inputs: id (required).
search_photosC
Search for photos on Pexels using a query string
Inputs: query (required), page, size, color, +2 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool targets a distinct access path: query-based search, a curated feed with no input, and ID-based detail lookup. There is no realistic scenario where an agent would confuse search_photos with get_curated_photos or get_photo_details.
All three follow a clean verb_noun pattern (search_photos, get_curated_photos, get_photo_details) with consistent snake_case. The verbs accurately signal the operation type.
Three tools is on the thin side but well-matched to a focused, read-only photo browsing server. Nothing feels redundant, though a bit more surface would make it feel complete.
Search, curated browsing, and detail lookup cover the core read-only discovery lifecycle for photos. Gaps exist for collections, videos, or download/link retrieval, but agents can work around these for the stated photo-search purpose.
Maintenance
Related MCP Connectors
Find free-to-use stock photos by words, by image or by similarity; every result names its licence.
Search photos and video moments by visual meaning, people, dates, and folders across local libraries, Apple Photos, and OneDrive. Manage collections, groups, favorites, people, and duplicate review. Synced metadata remains searchable while the desktop is offline; local and Apple Photos media access needs the owning device online with remote access enabled. OneDrive media can be accessed directly from the cloud. OAuth or Bearer API keys. Paid Cloud Access required; hosted visual search uses prepaid credits. Text-in-image search is semantic matching, not guaranteed exact OCR. Setup: https://organizewith.ai/en/guides/connect-ai-assistants
Search CC0 photos and build placeholder image URLs at exact sizes with Lorem Picsum.
Search and license documentary photos. AI agents pay on their own with a prepaid wallet key.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables searching and retrieving high-quality stock photos from Pexels with advanced filtering options including orientation, size, color, and localization support.MIT
- AlicenseAqualityBmaintenanceProvides access to the Unsplash API, enabling AI assistants to search and retrieve high-quality photos, browse collections, view photographer profiles, and get photo statistics with advanced filtering options.10MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to search, recommend, and deliver professional stock photos from Unsplash with intelligent context awareness and automatic attribution management.17 npm64MIT
- AlicenseNot gradedqualityDmaintenanceEnables searching and retrieving free photos and videos from Pexels using natural language queries, with support for filters like orientation, size, color, and duration.MIT