图像分析工具MCP

一个为Claude提供精确图像分析工具的服务,支持图像测量、颜色提取、OCR和形状检测等功能,适用于技术文档和UI分析。

  • by ironsheep
  • Go
  • 本地部署
  • 7 星标
  • 更新于
在 GitHub 查看 ironsheep/image_tools_mcp

使用说明

图像工具MCP

模型上下文协议(MCP)服务器,为Claude提供精确的图像分析工具。该服务器弥合了Claude的视觉理解与图表重建、UI分析和技术文档等任务所需的精确测量之间的差距。

为什么存在

当Claude查看图像时,它可以理解其中的内容,但不能:

  • 测量元素之间的精确像素距离
  • 提取精确的颜色值(十六进制、RGB、HSL)
  • 可靠地阅读小型或风格化的文本
  • 检测并定位具有精确坐标的形状
  • 放大特定区域进行详细检查

此MCP服务器提供 18种专用工具 这为克劳德提供了关于图像的精确数值数据。

主要用例:通过提供精确的测量值、颜色、文本内容和形状位置,使Claude能够将图表准确地重建为TikZ/LaTeX代码。

特性

类别 工具
基本信息 image_load, image_dimensions
区域运营 image_crop, image_crop_quadrant
颜色 image_sample_color, image_sample_colors_multi, image_dominant_colors
测量 image_measure_distance, image_grid_overlay
光学字符识别 image_ocr_full, image_ocr_region, image_detect_text_regions
形状检测 image_detect_rectangles, image_detect_lines, image_detect_circles, image_edge_detect
分析 image_check_alignment, image_compare_regions

快速开始

1.下载

从以下网址下载适用于您平台的二进制文件 发布 页面。

平台 二进制 OCR
Linux AMD64 image-tools-mcp-v*-linux-amd64 嵌入式
Linux ARM64 image-tools-mcp-v*-linux-arm64 嵌入式
macOS英特尔 image-tools-mcp-v*-darwin-amd64 需要Tesseract
macOS苹果硅 image-tools-mcp-v*-darwin-arm64 需要Tesseract
Windows AMD64 image-tools-mcp-v*-windows-amd64.exe 需要Tesseract
Windows ARM64 image-tools-mcp-v*-windows-arm64.exe 需要Tesseract

看 安装.md 有关详细的设置说明,包括Tesseract安装。

2.配置MCP客户端

添加到您的Claude桌面或Claude代码配置:

{
  "mcpServers": {
    "image-tools": {
      "command": "/path/to/image-tools-mcp"
    }
  }
}

3.与Claude一起使用

配置后,Claude可以使用以下工具:

"Load the image and tell me its dimensions"
→ image_load("/path/to/diagram.png")

"What color is the header at position (100, 50)?"
→ image_sample_color with x=100, y=50

"Find all the boxes in this diagram"
→ image_detect_rectangles

"Read the text in the image"
→ image_ocr_full

文档

示例工作流:重新创建图表

1. Get dimensions          → image_dimensions → {width: 800, height: 600}
2. Extract colors          → image_dominant_colors → [#FFFFFF, #336699, #333333]
3. Read text labels        → image_ocr_full → "Input → Process → Output"
4. Find boxes              → image_detect_rectangles → [{x:50, y:80, w:100, h:60}, ...]
5. Find connecting arrows  → image_detect_lines → [{start, end, has_arrow: true}, ...]
6. Zoom into details       → image_crop with scale=2.0

平台说明

Linux(AMD64和ARM64) 包括嵌入式Tesseract OCR-无需额外设置即可实现完整功能。Linux二进制文件是 完全静态 (零共享库依赖,嵌入OCR数据):单个二进制文件在任何Linux基础映像上都能以相同的方式运行——Debian、Ubuntu、裸Alpine或 scratch/无发行版容器——无需安装Tesseract或Leptonica系统。

macOS和Windows 使用CLI回退进行OCR。安装Tesseract以获得完整的OCR支持:

  • macOS: brew install tesseract 或 sudo port install tesseract
  • 窗户: UB曼海姆安装工 或 choco install tesseract

非OCR工具(图像加载、裁剪、颜色采样、测量、形状检测)无需额外设置即可在所有平台上工作。

容器部署

要添加到现有的Docker容器中,请下载 container-tools-*.tar.gz 来自Release的包。看 安装.md 了解详情。

发展

# Clone and build
git clone https://github.com/ironsheep/image_tools_mcp.git
cd image_tools_mcp
make build

# Run tests
make test

# Test MCP protocol
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | ./image-tools-mcp

许可证

MIT许可证-请参阅 许可证 文件。

贡献

欢迎投稿!请在提交PR之前打开一个问题来讨论更改。