MCP图像提取器
一种模型上下文协议服务器,可以从URL或base64数据中提取图像,并将它们转换为适合LLM分析的格式,从而让AI模型能够处理和理解视觉内容。
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"image-extractor": {
"command": "mcp-image-extractor",
"disabled": false
}
}
}
可用工具 (3 个)
该服务在 MCP 协议中暴露的工具,AI 可按需调用
extract_image_from_file 4 个参数 需填 1 项
必填参数:file_path
extract_image_from_url 4 个参数 需填 1 项
必填参数:url
extract_image_from_base64 5 个参数 需填 1 项
必填参数:base64
服务介绍
MCP 图像提取器
MCP 服务器用于提取和转换图像为 base64 格式,以便进行 LLM 分析。
此 MCP 服务器为 AI 助手提供了以下工具:
- 从本地文件中提取图像
- 从 URL 中提取图像
- 处理 base64 编码的图像
在 Cursor 中的外观:
适用场景:
- 分析 Playwright 测试结果:截图
对于 Cursor 或其他客户端
手动安装
# Clone and install
git clone https://github.com/ifmelate/mcp-image-extractor.git
cd mcp-image-extractor
npm install
npm run build
npm link
这将使 mcp-image-extractor 命令全局可用。
使用 .cursor/mcp.json 文件
对于本地开发或在特定项目中工作时,您可以在项目根目录中添加一个 .cursor/mcp.json 文件:
{
"mcpServers": {
"image-extractor": {
"command": "node",
"args": ["/full/path/to/mcp-image-extractor/dist/index.js"],
"disabled": false
}
}
}
或者,如果您通过 npm link 安装:
{
"mcpServers": {
"image-extractor": {
"command": "mcp-image-extractor",
"disabled": false
}
}
}
Cursor 用户的重要提示:如果您看到 "Failed to create client" 错误,请尝试以下替代方法:
选项 1:使用直接 GitHub 安装
git clone https://github.com/ifmelate/mcp-image-extractor.git cd mcp-image-extractor npm install npm run build npm link然后在
.cursor/mcp.json中配置:{ "mcpServers": { "image-extractor": { "command": "mcp-image-extractor", "disabled": false } } }选项 2:克隆并在本地运行
git clone https://github.com/ifmelate/mcp-image-extractor.git cd mcp-image-extractor npm install npm run build然后在
.cursor/mcp.json中配置:{ "mcpServers": { "image-extractor": { "command": "node", "args": ["/full/path/to/mcp-image-extractor/dist/index.js"], "disabled": false } } }
可用工具
extract_image_from_file
从本地文件中提取图像并将其转换为 base64。
参数:
file_path(必需):本地图像文件的路径
注意:所有图像都会自动调整到最佳尺寸(最大 512x512),以限制 base64 输出的大小并优化上下文窗口使用。
extract_image_from_url
从 URL 中提取图像并将其转换为 base64。
参数:
url(必需):要提取的图像的 URL
注意:所有图像都会自动调整到最佳尺寸(最大 512x512),以限制 base64 输出的大小并优化上下文窗口使用。
extract_image_from_base64
处理 base64 编码的图像以进行 LLM 分析。
参数:
base64(必需):Base64 编码的图像数据mime_type(可选,默认:"image/png"):图像的 MIME 类型
注意: 所有图片都会被自动调整到最优尺寸(最大512x512),以便限制base64输出的大小并优化上下文窗口的使用。
示例用法
以下是如何使用来自Claude工具的一个示例:
Please extract the image from this local file: images/photo.jpg
Claude将自动使用extract_image_from_file工具来加载和分析图片内容。
Please extract the image from this URL: https://example.com/image.jpg
Claude将自动使用extract_image_from_url工具来获取和分析图片内容。
Docker
使用Docker构建和运行:
docker build -t mcp-image-extractor .
docker run -p 8000:8000 mcp-image-extractor
许可证
MIT