exif-mcp

BSD 2-Clause "Simplified" License

Integrations

  • Licensed under BSD 2-clause, allowing users to modify and distribute the software under the terms of this permissive license.

  • Hosted on GitHub where users can clone the repository to install and use the exif-mcp server.

  • Extracts EXIF, GPS, XMP, ICC, IPTC, JFIF metadata from JPEG images, providing tools for analyzing orientation, rotation info, GPS coordinates, and thumbnails.

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 坐标和缩略图

安装

# Clone the repository git clone https://github.com/stass/exif-mcp.git cd exif-mcp # Install dependencies npm install # Build the project npm run build

用法

克劳德桌面

将其放入 Claude 配置文件(claude_desktop_config.json):

"mcpServers": { "exif-mcp": { "command": "node", "args": [ "/path/to/exif-mcp/dist/server.js" ] } },

重启 Claude。现在您可以让 Claude 帮您检查图片,例如查找特定相机拍摄的文件。此功能最好与文件系统 MCP 工具结合使用,这样 Claude 就可以查找文件并列出目录。

启动服务器

# Start the server npm start # For development with auto-reload npm run dev

该服务器使用 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 进行调试

  1. 启动检查器: npx @modelcontextprotocol/inspector node dist/server.js
  2. 使用 STDIO 传输与 MCP Inspector 连接
  3. 调用一个工具,例如带有参数的read-metadata
    { "image": { "kind": "path", "path": "/path/to/image.jpg" } }
  4. 您还可以像这样使用 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="[]"

图像源类型

服务器支持多种方式提供图像数据:

// From local file system { "kind": "path", "path": "/path/to/image.jpg" } // From URL (http, https, or file://) { "kind": "url", "url": "https://example.com/image.jpg" } // From base64 data (raw or data URI) { "kind": "base64", "data": "data:image/jpeg;base64,/9j/4AAQSkZ..." } // From base64 buffer { "kind": "buffer", "buffer": "/9j/4AAQSkZ..." }

发展

运行测试

# Run tests npm test # Run tests with watch mode npm run test:watch

项目结构

exif-mcp/ ├── src/ │ ├── server.ts # Main entry point │ ├── tools/ │ │ ├── index.ts # Tool registration │ │ ├── loaders.ts # Image loading utilities │ │ └── segments.ts # exifr options builders │ └── types/ │ └── image.ts # Type definitions ├── tests/ # Test files └── README.md

错误处理

服务器针对常见问题提供了标准化的错误处理:

  • 不支持的格式或缺少元数据
  • 网络获取失败
  • 超大有效载荷
  • 内部 exifr 错误

执照

BSD 2 条款

致谢

  • exifr - 极其快速且强大的 EXIF 解析库

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

离线 MCP 服务器允许 LLM 或人类使用 exifr 库从图像中提取和分析元数据,无需外部工具即可支持各种图像格式和元数据段。

  1. 概述
    1. 特征
  2. 安装
    1. 用法
      1. 克劳德桌面
      2. 启动服务器
      3. 可用工具
      4. 使用 MCP Inspector 进行调试
      5. 图像源类型
    2. 发展
      1. 运行测试
      2. 项目结构
    3. 错误处理
      1. 执照
        1. 致谢

          Related MCP Servers

          • -
            security
            A
            license
            -
            quality
            An 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 -
            5
            JavaScript
            MIT License
          • A
            security
            A
            license
            A
            quality
            Image 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 compressi
            Last updated -
            4
            11
            3
            JavaScript
            MIT License
            • Apple
          • A
            security
            F
            license
            A
            quality
            A 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 -
            1
            Python
            • Apple
          • -
            security
            A
            license
            -
            quality
            MCP server that enables LLMs to interact with Tripadvisor API, supporting location data, reviews, and photos through standardized MCP interfaces
            Last updated -
            Python
            MIT License
            • Linux
            • Apple

          View all related MCP servers

          ID: 5hxbqhlnlk