Skip to main content
Glama
Image Reader MCP Server

Image Reader MCP Server

by x0chaoren0s

Image Reader MCP Server

一个用于读取图片元数据和内容的 MCP (Model Context Protocol) 服务。

功能

工具

描述

get_image_info

获取图片元数据(尺寸、宽高比、文件大小、格式等)

get_image_content

获取图片内容(base64编码,自动缩放)

list_images_in_directory

列出目录中所有图片及其信息

Related MCP server: mcp-image-tools

安装

git clone https://github.com/x0chaoren0s/image-reader-mcp.git
cd image-reader-mcp
uv sync

运行

uv run python image_reader_server.py

Cursor MCP 配置

将以下配置添加到 Cursor 的 MCP 设置中(~/.cursor/mcp.json):

{
  "mcpServers": {
    "image-reader-mcp": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/image-reader-mcp", "python", "image_reader_server.py"],
      "env": {
        "IMAGE_DEFAULT_MAX_SIZE": "400"
      }
    }
  }
}

注意:请将 /path/to/image-reader-mcp 替换为你实际的项目路径。

环境变量

变量名

默认值

说明

IMAGE_DEFAULT_MAX_SIZE

800

get_image_content 返回图片的最大尺寸(像素),较小的值可节省上下文

推荐值:

  • 200 - 极度节省上下文,仅用于识别图片主体

  • 400 - 节省上下文,适合快速预览

  • 800 - 平衡质量与大小(默认)

  • 1200 - 高清晰度,占用更多上下文

工具详情

get_image_info

获取图片的详细元数据:

  • 文件名和路径

  • 宽度、高度(像素)

  • 宽高比(数值和描述,如 "16:9 (宽屏)")

  • 文件大小(字节和MB)

  • 图片格式(PNG, JPEG等)

  • 推荐的PPT放置尺寸

get_image_content

获取图片的实际内容:

  • 自动缩放到合理尺寸(默认最大800像素)

  • 返回base64编码的PNG数据

  • 适合AI"查看"图片内容

list_images_in_directory

列出目录中的所有图片:

  • 支持递归扫描子目录

  • 可选择是否包含详细信息

  • 返回文件总数和总大小

支持的图片格式

  • PNG

  • JPG/JPEG

  • GIF

  • BMP

  • WebP

  • TIFF/TIF

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables an AI agent to inspect images, resize and compress them to size budgets, strip EXIF/GPS metadata, generate thumbnails, and safely batch-process files inside a directory sandbox.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables coding agents to generate and edit images from text prompts, reference images, or saved files through any OpenAI-images-compatible backend, returning each result inline as a downscaled preview (full-res on disk) so the agent can inspect and iterate. Also supports prompt expansion, exact-pixel resizing/recompression, and listing or re-serving saved images.
      AGPL 3.0