base64hub

v1.1.0
com.base64hub/mcp Checked 4 hours ago Published 8 days ago

Exact Base64 for AI agents: encode, decode and validate (standard, URL-safe, data URIs).

An MCP server that gives AI assistants exact Base64: encode, decode and validate. Language models are unreliable at Base64 by hand; with this server Claude, Cursor, VS Code and any other Model Context Protocol client get byte-exact results from three small tools. The server is started by your MCP client with npx -y base64hub-mcp. Node.js 18 or newer must be installed. Add --scope user to make it available in every project.

Summary extracted from the README.

base64hub-mcp

An MCP server that gives AI assistants exact Base64: encode, decode and validate. Language models are unreliable at Base64 by hand; with this server Claude, Cursor, VS Code and any other Model Context Protocol client get byte-exact results from three small tools.

  • Runs locally over stdio, nothing leaves your machine, no network access, no API key
  • Also hosted at https://mcp.base64hub.com/mcp for clients that connect by URL
  • Zero dependencies, a few hundred lines of plain Node.js (18 or newer)
  • Standard and URL-safe alphabets, padding control, line wrapping, data URIs
  • Lenient decoding with precise errors: invalid character '!' at position 4
  • Binary results are reported as hex instead of mangled text

Setup

The server is started by your MCP client with npx -y base64hub-mcp. Node.js 18 or newer must be installed.

Claude Code

claude mcp add base64hub -- npx -y base64hub-mcp

Add --scope user to make it available in every project.

Claude Desktop

Open Settings → Developer → Edit Config and add the server to claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/, Windows: %APPDATA%\Claude\), then restart Claude:

{
  "mcpServers": {
    "base64hub": {
      "command": "npx",
      "args": ["-y", "base64hub-mcp"]
    }
  }
}

Cursor

Add it to ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (one project):

{
  "mcpServers": {
    "base64hub": {
      "command": "npx",
      "args": ["-y", "base64hub-mcp"]
    }
  }
}

VS Code

From a terminal:

code --add-mcp '{"name":"base64hub","type":"stdio","command":"npx","args":["-y","base64hub-mcp"]}'

Or in a workspace file. .vscode/mcp.json uses a top-level servers object:

{
  "servers": {
    "base64hub": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "base64hub-mcp"]
    }
  }
}

The portable .mcp.json at the workspace root (also read by Copilot) uses mcpServers with the same command and args as the Cursor example.

Docker

The server is also published as a container image, for clients that run MCP servers in Docker:

{
  "mcpServers": {
    "base64hub": {
      "command": "docker",
      "args": ["run", "--rm", "-i", "ghcr.io/base64hub-com/base64hub-mcp"]
    }
  }
}

Other clients

Any client that launches stdio servers works with command npx and arguments -y base64hub-mcp. On Windows, if a client can't find npx, use command cmd with arguments /c npx -y base64hub-mcp.

Hosted server

The same three tools are served over Streamable HTTP, with no key and no account:

https://mcp.base64hub.com/mcp

Use it when Node.js is not installed or the client only takes a URL.

claude mcp add --transport http base64hub https://mcp.base64hub.com/mcp
  • Claude (web and desktop): Settings → Connectors → Add custom connector, paste the URL.
  • Cursor: {"mcpServers": {"base64hub": {"url": "https://mcp.base64hub.com/mcp"}}}
  • VS Code: {"servers": {"base64hub": {"type": "http", "url": "https://mcp.base64hub.com/mcp"}}}

The text you convert is sent to the server. It is processed in memory and is neither stored nor logged; for data that must not leave your machine, use the local server above. One request is limited to 256 KB, and an IP address to 20 requests per 10 seconds.

The hosted server is a Cloudflare Worker built from the same core.js and protocol.js as the local one: worker.js is generated by node scripts/build-worker.js, and DEPLOY.md describes how to run your own copy.

Tools

All tools are read-only. The local server works offline.

base64_encode

Encode text (as UTF-8) to Base64.

Argument Type Default Meaning
text string required Text to encode
url_safe boolean false URL-safe alphabet (- and _, RFC 4648 §5)
padding boolean true Add = padding
wrap integer 0 Line break after every N characters (76 = MIME)

{"text": "Hello, hub!"} → SGVsbG8sIGh1YiE=

base64_decode

Decode Base64 to text. Accepts both alphabets (even mixed), missing padding, spaces, tabs and line breaks, and data:...;base64, URIs.

Argument Type Meaning
data string Base64 text or a data URI

{"data": "SGVsbG8sIGh1YiE"} → Hello, hub!

When the bytes are not valid UTF-8 (an image, for example), the result says so and gives them as hex. Invalid input returns a tool error with the reason, such as Invalid Base64: invalid character '!' at position 4.

base64_validate

Check a string without decoding it. Returns JSON, also as structured content:

Field Meaning
valid true exactly when base64_decode would succeed
variant standard (+ or / seen), url (- or _ seen), mixed (both) or either (neither)
padded the length including = is a multiple of 4
bytes decoded size in bytes
error the error base64_decode would report (only when valid is false)

{"data": "a+b_"} → {"valid":true,"variant":"mixed","padded":true,"bytes":3}

Protocol

JSON-RPC 2.0 over stdio, one message per line, written without an SDK. Supported MCP revisions: 2026-07-28 (stateless requests with per-request _meta and server/discover) and, through the initialize handshake, 2025-11-25, 2025-06-18, 2025-03-26 and 2024-11-05. Logs go to stderr only.

The hosted server speaks the same revisions over Streamable HTTP: every POST /mcp is answered with one JSON body, there are no sessions and no SSE streams, and 2026-07-28 requests have their MCP-Protocol-Version, Mcp-Method and Mcp-Name headers checked against the body.

License

MIT