imgtobase64-mcp-server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@imgtobase64-mcp-server Fetch https://example.com/photo.jpg and convert it to base64."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
imgtobase64-mcp-server
An MCP (Model Context Protocol) server that converts images to base64-encoded data. Designed for LLMs with vision capabilities that need images as base64 input.
Works with any MCP-compatible client — Claude Desktop, Claude Code, Cursor, and more — over stdio (local) or HTTP (remote/Docker).
Tools
image_url_to_base64
Fetch an image from a URL and convert it to base64.
Parameter | Type | Required | Description |
| string | Yes | Image URL to fetch |
| number | No | Request timeout in ms (1000–120000, default 30000) |
image_file_to_base64
Read a local image file and convert it to base64.
Parameter | Type | Required | Description |
| string | Yes | Path to the local image file |
Response format
Both tools return a JSON object:
{
"base64": "iVBORw0KGgo...",
"mimeType": "image/png",
"sizeBytes": 24680,
"width": 800,
"height": 600,
"dataUri": "data:image/png;base64,iVBORw0KGgo..."
}image_file_to_base64 also includes resolvedPath (the absolute path that was read).
width and height are extracted from image headers when possible (PNG, JPEG, GIF, BMP, WebP) without any native dependencies.
Supported formats
PNG, JPEG, GIF, WebP, BMP, SVG, TIFF, ICO, AVIF
MIME type is detected via magic bytes (file-type) with a fallback to file extension. Maximum file size is 20 MB.
Related MCP server: llm-vision-mcp
Getting started
Prerequisites
Node.js >= 20
Install and build
npm install
npm run buildRun locally (stdio)
node dist/index.jsRun locally (HTTP)
TRANSPORT=http node dist/index.js
# or
node dist/index.js --transport httpThe server listens on http://0.0.0.0:3000 by default. Check with:
curl http://localhost:3000/healthClient configuration
Claude Desktop
Add to your Claude Desktop config (claude_desktop_config.json):
{
"mcpServers": {
"imgtobase64": {
"command": "node",
"args": ["/absolute/path/to/dist/index.js"]
}
}
}Claude Code
claude mcp add imgtobase64 node /absolute/path/to/dist/index.jsCursor
Add to .cursor/mcp.json:
{
"mcpServers": {
"imgtobase64": {
"command": "node",
"args": ["/absolute/path/to/dist/index.js"]
}
}
}Remote (HTTP) clients
Point your client to http://<host>:3000/mcp. The server implements the Streamable HTTP transport with session management.
Docker
Docker Compose
docker compose up --buildStandalone
docker build -t imgtobase64-mcp-server .
docker run -p 3000:3000 imgtobase64-mcp-serverThe Docker image:
Uses a multi-stage build (compile in builder, run with production deps only)
Runs as non-root user
mcpuserDefaults to HTTP transport on port 3000
Includes a health check at
/health
Environment variables
Variable | Default | Description |
|
| Transport mode: |
|
| HTTP server port (HTTP mode only) |
|
| Log verbosity: |
The --transport CLI flag takes precedence over the TRANSPORT env var.
All logs are written to stderr (JSON format), keeping stdout clean for the MCP stdio protocol.
HTTP endpoints
Method | Path | Description |
|
| MCP protocol (initialize + tool calls) |
|
| SSE stream for notifications |
|
| Terminate a session |
|
| Health check |
Development
npm run dev # Watch mode (recompile on change)
npm run lint # Check with Biome
npm run lint:fix # Auto-fix lint/format issues
npm run inspect # Open MCP InspectorProject structure
src/
├── index.ts # Entry point — transport selection (stdio/http)
├── server.ts # McpServer creation + tool registration
├── tools/
│ ├── imageUrlToBase64.ts # image_url_to_base64 tool
│ └── imageFileToBase64.ts # image_file_to_base64 tool
└── utils/
├── imageUtils.ts # MIME detection, base64 encoding, dimension parsing
└── logger.ts # stderr-only JSON loggerLicense
Available Tools
2 toolsimage_file_to_base64A
Read a local image file and convert it to base64. Returns base64 data, MIME type, size, dimensions, resolved path, and a ready-to-use data URI.
Inputs: file_path (required).
image_url_to_base64A
Fetch an image from a URL and convert it to base64. Returns base64 data, MIME type, size, dimensions, and a ready-to-use data URI.
Inputs: url (required), timeout_ms.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools are near-identical in function and differ only by input source (remote URL vs local file path), which the descriptions state clearly. An agent could plausibly hesitate over which to use if the source is ambiguous, but the split is logical and well-signposted.
Both names follow the exact same pattern: image_<source>_to_base64. Verb/object ordering and casing are perfectly consistent.
Two tools is thin in absolute terms but fits a narrowly scoped single-purpose server whose only job is producing base64 from images. Nothing extraneous is present, though the surface is close to the borderline of 'too few'.
The inbound direction is covered for both remote and local sources, but the inverse operation (base64 back to image) and batch/validation options are absent. For a one-directional converter this is acceptable, but it leaves notable functional gaps.
Maintenance
Related MCP Connectors
Image & PDF tools for AI agents: compress, convert, resize, PDF, AI vision, pipeline.
Convert and resize static image URLs to WebP, PNG or JPEG for uploads and agent workflows.
Generate detailed AI image prompts from image URLs or base64 data using a remote MCP server.
Image and PDF toolkit: convert to AVIF/WebP/JXL, resize, crop, remove backgrounds, optimize PDFs.
Related MCP Servers
- AlicenseAqualityDmaintenanceConverts local images or remote image URLs to Base64 format via the MCP protocol, enabling AI assistants to process images.11ISC
- AlicenseAqualityCmaintenanceGives text-only LLM coding agents vision by routing images to a multimodal model and returning detailed textual descriptions. Supports local files, URLs, clipboard, base64, raw bytes, and multiple providers like OpenAI, Anthropic, and Gemini.113MIT
- AlicenseAqualityCmaintenanceEnables pure text LLMs to understand images by acting as a proxy to vision models via OpenAI-compatible APIs. Supports local files, URLs, and base64 inputs for image analysis.2MIT
- AlicenseAqualityCmaintenanceEnables converting images (JPEG, PNG, GIF, WebP) into text descriptions using OpenAI-compatible vision models, with support for both local files and URLs.2MIT