This MCP Server provides tools for fetching and processing images from URLs, local file paths, and numpy arrays. It converts images to base64-encoded strings with proper MIME types, making it easy to handle images in your AI applications.
Create and activate a virtual environment using uv:
uv venv
# On Windows:
.venv\Scripts\activate
# On Unix/MacOS:
source .venv/bin/activate
Install dependencies:
uv pip install -r requirements.txt
Start the MCP server directly:
uv run python mcp_image.py
~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"image": {
"command": "uv",
"args": ["--directory", "/path/to/mcp-image", "run", "mcp_image.py"]
}
}
}
{
"mcpServers": {
"image": {
"command": "uv",
"args": ["--directory", "/path/to/mcp-image", "run", "mcp_image.py"]
}
}
}
The server provides a fetch_images
tool that processes images from URLs or local file paths.
You can 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 issues:
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.