Skip to main content

A simple MCP server that reads local images and returns them as ImageContent for LLM vision analysis

Project description

MCP Image Reader

PyPI version License: MIT

A simple Model Context Protocol (MCP) server that reads local images and returns them as ImageContent for LLM vision analysis.

Install in VS Code

Features

  • 📷 Read local images and return as base64-encoded ImageContent
  • 🔧 Single tool: read_image - simple and focused
  • 🚀 One-click installation for VS Code
  • 📦 Install via PyPI with uvx - no environment setup needed

Supported Formats

PNG, JPEG, GIF, WebP, BMP, SVG

Installation

VS Code (Recommended)

Click the button above, or manually add to your VS Code settings:

For a specific version (recommended for security):

{
  "mcp": {
    "servers": {
      "local-image-reader": {
        "command": "uvx",
        "args": ["mcp-local-image-reader==0.1.0"]
      }
    }
  }
}

For the latest version:

{
  "mcp": {
    "servers": {
      "local-image-reader": {
        "command": "uvx",
        "args": ["mcp-local-image-reader"]
      }
    }
  }
}

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "local-image-reader": {
      "command": "uvx",
      "args": ["mcp-local-image-reader==0.1.0"]
    }
  }
}

Usage

In your AI assistant, ask it to read an image:

Please read the image at C:\Users\me\Pictures\screenshot.png and describe what you see.

The assistant will use the read_image tool to load the image and analyze it.

Security

Version Pinning

For production use, always pin to a specific version:

"args": ["mcp-local-image-reader==0.1.0"]

This ensures you won't automatically pull potentially malicious updates.

Source Code

This project is intentionally minimal (~100 lines) for easy auditing. The entire implementation is in server.py.

Known Issues

⚠️ Gemini Does Not Recognize Images from MCP

When using VS Code Copilot with Gemini models, images returned via MCP ImageContent are not visually recognized. The tool execution succeeds, but Gemini cannot "see" the image content.

Model MCP Image Recognition
Claude ✅ Works
GPT ✅ Works
Gemini ❌ Not working

Root Cause: This is a known issue with how Gemini handles non-text content types in MCP responses.

Related Issue: gemini-cli #15851 - Only text content type supported

Workaround: Use Claude or GPT models for image analysis tasks until this issue is resolved.

Tool Reference

read_image

Reads an image from the filesystem and returns it as base64-encoded ImageContent.

Parameters:

  • file_path (string, required): Absolute path to the image file

Returns:

  • ImageContent with base64-encoded image data and appropriate MIME type

Example:

{
  "name": "read_image",
  "arguments": {
    "file_path": "/path/to/image.png"
  }
}

Development

# Clone the repository
git clone https://github.com/masachika-kamada/mcp-image-reader.git
cd mcp-image-reader

# Install dependencies
uv sync

# Run locally
uv run python server.py

# Test with MCP Inspector
npx @modelcontextprotocol/inspector uv run python server.py

License

MIT License - see LICENSE for details.

Contributing

Issues and pull requests are welcome! Please feel free to contribute.

Related Projects

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_local_image_reader-0.1.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_local_image_reader-0.1.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file mcp_local_image_reader-0.1.0.tar.gz.

File metadata

File hashes

Hashes for mcp_local_image_reader-0.1.0.tar.gz
Algorithm Hash digest
SHA256 88eb59aa5557bacd004bbcba62082a4a798043b64a8feed952c04f764cfa1ec5
MD5 47640fada457325762a797f4a93e9312
BLAKE2b-256 f39bd212f6c810f1cbd4fda6f19b85c896987e956e1beed256a6d31520f5c175

See more details on using hashes here.

File details

Details for the file mcp_local_image_reader-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_local_image_reader-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 78c55bf2b88ca7c9e8c64cf81c7c4df4383b883736ade673becfcb21ccffc7fb
MD5 b3415699d81e5d30c23a2f0122fa035c
BLAKE2b-256 f3a15bac4ec0fd1c2e0b08e5734517b3ae14246fe76e1849d6226e299d1d1416

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page