A Model Context Protocol server that enables fetching and processing images from URLs, local file paths, and numpy arrays, returning them as base64-encoded strings with proper MIME types.
A Model Context Protocol (MCP) server that provides tools for fetching and processing images from URLs, local file paths, and numpy arrays. The server includes a tool called fetch_images that returns images as base64-encoded strings along with their MIME types.
If you find this project helpful and would like to support future projects, consider buying us a coffee! Your support helps us continue building innovative AI solutions.
Your contributions go a long way in fueling our passion for creating intelligent and user-friendly applications.
uv venv # On Windows: .venv\Scripts\activate # On Unix/MacOS: source .venv/bin/activate
uv pip install -r requirements.txt
There are two ways to run the MCP server:
To start the MCP server directly:
uv run python mcp_image.py
To add this MCP server to Windsurf:
{ "mcpServers": { "image": { "command": "uv", "args": ["--directory", "/path/to/mcp-image", "run", "mcp_image.py"] } } }
To add this MCP server to Cursor:
{ "mcpServers": { "image": { "command": "uv", "args": ["--directory", "/path/to/mcp-image", "run", "mcp_image.py"] } } }
The server provides the following tools:
fetch_images: Fetch and process images from URLs or local file paths Parameters: image_sources: List of URLs or file paths to images Returns: List of processed images with base64 encoding and MIME types
You can now use commands like:
# URL-only test
[
"https://upload.wikimedia.org/wikipedia/commons/thumb/7/70/Chocolate_%28blue_background%29.jpg/400px-Chocolate_%28blue_background%29.jpg",
"https://imgs.search.brave.com/Sz7BdlhBoOmU4wZjnUkvgestdwmzOzrfc3GsiMr27Ik/rs:fit:860:0:0:0/g:ce/aHR0cHM6Ly9pbWdj/ZG4uc3RhYmxlZGlm/ZnVzaW9ud2ViLmNv/bS8yMDI0LzEwLzE4/LzJmOTY3NTViLTM0/YmQtNDczNi1iNDRh/LWJlMTVmNGM5MDBm/My5qcGc",
"https://shigacare.fukushi.shiga.jp/mumeixxx/img/main.png"
]
# Mixed URL and local file test
[
"https://upload.wikimedia.org/wikipedia/commons/thumb/7/70/Chocolate_%28blue_background%29.jpg/400px-Chocolate_%28blue_background%29.jpg",
"C:\\Users\\username\\Pictures\\image1.jpg",
"https://imgs.search.brave.com/Sz7BdlhBoOmU4wZjnUkvgestdwmzOzrfc3GsiMr27Ik/rs:fit:860:0:0:0/g:ce/aHR0cHM6Ly9pbWdj/ZG4uc3RhYmxlZGlm/ZnVzaW9ud2ViLmNv/bS8yMDI0LzEwLzE4/LzJmOTY3NTViLTM0/YmQtNDczNi1iNDRh/LWJlMTVmNGM5MDBm/My5qcGc",
"C:\\Users\\username\\Pictures\\image2.jpg"
]
If you encounter any issues:
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
Discover shared experiences
Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!