exif-mcp
一个 MCP 服务器,允许 LLM(或人工)按需读取图像元数据,完全离线。它基于优秀的 exifr 库,速度极快,并且不依赖任何外部工具。
用例:
- 分析图像元数据并将其可视化
- 分析你的图片库:我最常用的相机有哪些?镜头分布如何?每周哪天我拍照最多?最喜欢的拍摄地点有哪些?
- 调试图像处理代码。
该工具被反向地理定位服务PlaceSpotter广泛用于开发和测试。
概述
exif-mcp
是一个模型上下文协议 (MCP) 服务器,提供从图像中提取各种元数据片段的工具。它基于 TypeScript 构建,并利用优秀的exifr库来解析 JPEG、PNG、TIFF 和 HEIC 等常见格式的图像元数据。这使得该服务无需执行任何外部工具即可解析图像元数据,从而既高效又安全。
特征
- 本地操作:完全离线工作,无需远程网络
- 多个片段:提取 EXIF、GPS、XMP、ICC、IPTC、JFIF 和 IHDR 元数据
- 多种输入格式:支持 JPEG、TIFF、HEIC/AVIF 和 PNG
- 灵活的图像源:从文件系统、URL、base64 数据或缓冲区读取
- 专用工具:获取方向、旋转信息、GPS 坐标和缩略图
安装
用法
克劳德桌面
将其放入 Claude 配置文件(claude_desktop_config.json):
重启 Claude。现在您可以让 Claude 帮您检查图片,例如查找特定相机拍摄的文件。此功能最好与文件系统 MCP 工具结合使用,这样 Claude 就可以查找文件并列出目录。
启动服务器
该服务器使用 MCP SDK 中的StdioServerTransport
,使其与任何支持 STDIO 传输的 MCP 客户端兼容。
您可以使用 mcp-proxy 来启用远程访问。
可用工具
服务器提供以下工具:
工具名称 | 描述 |
---|---|
read-metadata | 读取所有或指定的元数据段 |
read-exif | 专门读取 EXIF 数据 |
read-xmp | 读取 XMP 数据 |
read-icc | 读取 ICC 颜色配置文件数据 |
read-iptc | 读取 IPTC 元数据 |
read-jfif | 读取JFIF段数据 |
read-ihdr | 读取 IHDR 段数据 |
orientation | 获取图像方向(1-8) |
rotation-info | 获取旋转和翻转信息 |
gps-coordinates | 提取 GPS 坐标 |
thumbnail | 提取嵌入的缩略图 |
使用 MCP Inspector 进行调试
- 启动检查器:
npx @modelcontextprotocol/inspector node dist/server.js
- 使用 STDIO 传输与 MCP Inspector 连接
- 调用一个工具,例如带有参数的
read-metadata
: - 您还可以像这样使用 MCP 检查器命令行:
npx @modelcontextprotocol/inspector --cli node dist/server.js --method tools/call --tool-name read-exif --tool-arg image='{"kind": "path", "path": "/path/to/image.jpeg"}' --tool-arg pick="[]"
图像源类型
服务器支持多种方式提供图像数据:
发展
运行测试
项目结构
错误处理
服务器针对常见问题提供了标准化的错误处理:
- 不支持的格式或缺少元数据
- 网络获取失败
- 超大有效载荷
- 内部 exifr 错误
执照
BSD 2 条款
致谢
- exifr - 极其快速且强大的 EXIF 解析库
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
离线 MCP 服务器允许 LLM 或人类使用 exifr 库从图像中提取和分析元数据,无需外部工具即可支持各种图像格式和元数据段。
Related Resources
Related MCP Servers
- -securityAlicense-qualityAn MCP server for analyzing images using OpenRouter vision models, offering capabilities like automatic image resizing, model configuration, and handling custom queries about images.Last updated -5JavaScriptMIT License
- AsecurityAlicenseAqualityImage Tools MCP is a Model Context Protocol (MCP) service that retrieves image dimensions and compresses images from URLs and local files using the TinyPNG API. It supports converting images to formats like webp, jpeg/jpg, and png, providing detailed information on width, height, type, and compressiLast updated -41313JavaScriptMIT License
- AsecurityFlicenseAqualityA MCP server that allows searching for files in the filesystem based on path fragments, returning file metadata including name, path, size, and creation date.Last updated -1Python
- -securityAlicense-qualityMCP server that enables LLMs to interact with Tripadvisor API, supporting location data, reviews, and photos through standardized MCP interfacesLast updated -PythonMIT License