Skip to main content
Glama
Cat-Drink

photo-get-skill

by Cat-Drink

photo-get-skill

一个基于 Model Context Protocol (MCP) 的图片抓取工具服务器。通过指定关键词,从 Pixabay 图片库(evergreen.photos 背后的数据源)搜索并下载图片到本地目录。

功能

  • 按关键词搜索免版权图片

  • 指定下载数量(1–200)

  • 选择图片尺寸(预览图 / 网络尺寸 / 原始大图)

  • 安全搜索(过滤成人内容)

  • 返回每张图片的本地路径、URL、作者、标签、尺寸等元数据

Related MCP server: Google Images Search MCP

环境要求

  • Node.js >= 18(需要原生 ESM 支持和 fetch API)

  • 可访问互联网(访问 pixabay.comcdn.pixabay.com

安装

npm install

依赖:

配置 API Key

默认内置了 evergreen.photos 使用的公开 API Key。如需使用自己的 Key(可在 https://pixabay.com/api/docs/ 免费申请),设置环境变量:

# Linux / macOS
export PHOTO_GET_API_KEY=your_key_here

# Windows (PowerShell)
$env:PHOTO_GET_API_KEY = "your_key_here"

使用方式

1. 作为 MCP 服务器(推荐)

启动服务器,它通过 stdin/stdout 与 MCP 客户端通信:

node src/server.js

2. 在 Claude Desktop / Trae / Cursor 等 MCP 客户端中配置

将服务器添加到 MCP 客户端的配置文件中。

Claude Desktop 配置示例(macOS: ~/Library/Application Support/Claude/claude_desktop_config.json,Windows: %APPDATA%\Claude\claude_desktop_config.json):

{
  "mcpServers": {
    "photo-get-skill": {
      "command": "node",
      "args": [
        "d:/Program/photo-get-skill/src/server.js"
      ]
    }
  }
}

路径请替换为你的实际项目路径。Windows 路径建议用正斜杠 /

重启客户端后,助手即可发现并调用 search_and_download_images 工具。

3. 直接运行 Pixabay 搜索测试

# 搜索 "nature" 并获取前 5 张图片元数据
node src/pixabay.js nature 5

MCP 工具说明

search_and_download_images

按关键词搜索并下载图片到指定目录。

参数:

参数

类型

必填

默认值

说明

keyword

string

搜索关键词,例如 naturecatlandscape

save_dir

string

图片保存目录(绝对路径或相对路径),不存在会自动创建

count

number

10

下载数量,范围 1–200

size

string

webformat

图片尺寸:preview(150px)/ webformat(640px)/ large(原图)

safesearch

boolean

true

是否启用安全搜索

返回(JSON 文本):

{
  "total": 3,
  "downloaded": [
    {
      "local_path": "D:/.../tmp/nature/7373484-landscape.jpg",
      "original_url": "https://cdn.pixabay.com/photo/...jpg",
      "author": "Kanenori",
      "tags": "landscape, rainbow, beautiful nature",
      "width": 3150,
      "height": 2100,
      "pixabay_id": 7373484
    }
    // ...
  ],
  "failed": [],
  "save_dir": "D:/.../tmp/nature",
  "summary": "已下载 3 张图片至 tmp/nature,0 张失败。关键词: nature"
}

示例调用(告诉助手):

帮我搜索 5 张 sunset beach 主题的大图,保存到 D:/images/sunset/

项目结构

photo-get-skill/
├── src/
│   ├── server.js        # MCP 服务器入口(McpServer + StdioServerTransport)
│   ├── tools.js         # 工具 schema、handler(单元测试使用)
│   ├── pixabay.js       # Pixabay API 客户端
│   └── downloader.js    # 图片下载 + 目录管理 + 并发控制
├── tests/
│   ├── tools.test.js          # Zod schema 校验测试(4 用例)
│   ├── server-handshake.test.js # MCP 握手测试(4 用例)
│   └── e2e.test.js            # 端到端下载测试(8 用例)
├── tmp/                 # 测试和下载产物(git 忽略)
├── package.json
└── README.md

测试

node --test tests/tools.test.js tests/server-handshake.test.js tests/e2e.test.js

测试套件覆盖:参数校验、MCP 握手、工具列表、真实网络下载。

测试结果示例:

# tests 18
# pass 18
# fail 0

关于 evergreen.photos

evergreen.photos 本身无自有图片数据库,其前端直接调用 Pixabay 的公开 REST API。因此本工具直接接入 Pixabay API 以实现程序化抓取。图片版权遵循 Pixabay Content License(免费商用,无需署名)。

许可证

MIT

Available Tools

1 tool
search_and_download_imagesA

按关键词从 Pixabay 和/或 Picjumbo 搜索图片并保存到本地目录。返回图片元数据与本地保存路径。

ParametersJSON Schema
NameRequiredDescriptionDefault
keywordYes搜索关键词,例如 nature、cat、landscape
save_dirYes图片保存目录(绝对路径或相对路径),若不存在会自动创建
countNo下载图片数量,默认 10,范围 1-200
sizeNo图片尺寸,默认 webformat(640px)webformat
safesearchNo是否启用安全搜索(过滤成人内容),默认 true
sourceNo图片来源,支持 'pixabay' 和 'picjumbo'。可以是字符串或数组。默认 ['pixabay']

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden for behavioral transparency. It correctly identifies the main actions (search, download, save) and return value, but lacks details on side effects like file creation, overwrite behavior, or network usage. Thus, it is adequate but not comprehensive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise: two sentences that convey the core functionality and return value without any unnecessary words. It is well-structured and front-loaded with the key action.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite having no output schema, the description covers the main points: search sources, download, and return metadata with path. However, it could be more explicit about what the metadata includes (e.g., URL, dimensions). Still, it is largely complete for the tool's complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, so the schema already explains each parameter. The tool description does not add extra meaning beyond what is in the schema. Baseline 3 is appropriate given the high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action (search and download images), resources (Pixabay and/or Picjumbo), and output (metadata and local save path). It uses a specific verb and resource, making the purpose unambiguous even without sibling tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implicitly indicates when to use this tool: when you need to search and download images from Pixabay or Picjumbo. However, it does not provide explicit when-not-to-use guidance or alternatives, which would be necessary for a perfect score.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 1 tool updatev1.0.0
    • First observedsearch_and_download_images

TDQS

A4/5.0

Scored across 1 tool

Disambiguation5/5

Only one tool exists, so there is no possibility of confusing it with others. Disambiguation is perfect.

Naming Consistency5/5

With a single tool, naming consistency is irrelevant but inherently consistent. The name 'search_and_download_images' follows a clear verb_noun pattern.

Tool Count3/5

A single tool feels thin for a server, but the tool itself performs a non-trivial operation (search and download). It is borderline appropriate.

Completeness3/5

The tool covers the core task of searching and downloading images, but there are no additional tools for managing, organizing, or retrieving previously downloaded images, which are minor gaps.

Maintenance

ActivityMaintained
ResponsivenessSyncing

Related MCP Connectors

Related MCP Servers