本项目是一个实现与 Unsplash API 交互的 MCP(管理控制平面)服务器,允许用户通过命令行工具搜索和下载图片,为图片获取提供便捷途径。
git clone https://github.com/yourusername/unsplash-mcp-server.git
cd unsplash-mcp-server
npm install -g unsplash-mcp-server
开发模式
npm run dev
生产环境
npm start
UNSPLASH_ACCESS_KEY 配置访问密钥,便于身份验证。git clone https://github.com/yourusername/unsplash-mcp-server.git
cd unsplash-mcp-server
npm install -g unsplash-mcp-server
开发模式
npm run dev
生产环境
npm start
search_photos)cline search_photos --query "nature" --per_page 10 --orientation landscape
输入参数:
--query:必填,搜索关键词。--page:可选,默认为第一页。--per_page:每页结果数量,默认为 20。--orientation:可选,筛选图片方向(portrait 或 landscape)。输出结果:返回 JSON 格式的搜索结果列表,包含图片 ID、URL 等信息。
download_photo)cline download_photo --photo_id abc123 --size large
输入参数:
--photo_id:必填,目标图片的唯一标识符。--size:可选,默认为中等分辨率。创建或修改 .env 文件,添加以下内容:
UNSPLASH_ACCESS_KEY=your_actual_key_here
/path/to/your/unsplash-mcp-server/build/index.js在项目的 .roo/mcp.json 文件中添加以下配置:
{
"mcpServers": {
"unsplash-mcp-server": {
"command": "bun",
"args": [
"/path/to/your/unsplash-mcp-server/build/index.js"
],
"env": {
"UNSPLASH_ACCESS_KEY": "your_actual_key_here"
}
}
}
}
开发模式
npm run dev
生产构建
npm run build
使用 npm run watch 命令实时监控代码变化,并通过 npm run lint 进行代码检查。
本项目遵循 MIT 许可证,具体内容请参考 LICENSE 文件。
⚠️ 重要提示
徽章链接中的用户名 "benjaming" 需要替换为实际的中文项目负责人或团队名称。同时,请将
yourusername替换为实际的 GitHub 账号。