Image Extractor

Image Extractor

🚀 图像提取器 MCP 服务器

本项目为 AI 助手提供工具,可从本地文件、URL 和 base64 编码的图像中提取并转换图像,以供大语言模型(LLM)分析。其价值在于为图像分析工作提供了便捷、高效的图像提取与转换途径,提升了 AI 助手处理图像数据的能力。

🚀 快速开始

本 MCP 服务器具备以下功能:

  • 从本地文件中提取图像
  • 从 URL 中提取图像
  • 处理 base64 编码的图像

在 Cursor 中的显示效果如下:

适用场景:

  • 分析 Playwright 测试结果:截图

📦 安装指南

使用 .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(必需):本地图像文件的路径

注意:所有图像都会自动以 base64 编码格式输出,适合在需要编码的环境中使用。

extract_image_from_url

从 URL 中提取图像并将其转换为 base64 编码。 参数:

  • url(必需):包含要提取图像的 URL 地址

注意:请确保您提供的 URL 是合法且可访问的。如果 URL 无效或无法访问,可能会导致错误。

extract_image_from_base64

将 base64 编码的字符串解码为图像文件。 参数:

  • base64_string(必需):要转换的 base64 编码字符串

注意:此工具仅接受有效的 base64 字符串。如果输入无效,可能会导致错误。

📚 详细文档

Docker 配置

使用 Docker 构建和运行:

docker build -t mcp-image-extractor .
docker run -p 8000:8000 mcp-image-extractor

访问 http://localhost:8000 查看服务状态。

📄 许可证

本项目采用 MIT 许可证。

  • 0 关注
  • 0 收藏,22 浏览
  • system 提出于 2025-10-01 07:45

相似服务问题

相关AI产品