base64hub

com.base64hub由 base64hub.com 发布v1.0.0更新于 Nov 22, 2026

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

已验证STDIO仅桌面文件与存储开发者工具

概览

AI 生成的概览

本地 stdio MCP 服务器,让助手获得逐字节精确的 Base64 编码、解码与校验,支持 URL 安全字母表和 data URI。

可以做什么
  • 将 UTF-8 文本编码为 Base64,可选 URL 安全字母表、填充控制和按行换行。
  • 解码 Base64 或 data URI,兼容两种字母表、缺失填充和空白字符,二进制结果以十六进制返回。
  • 在不解码的情况下校验字符串,返回是否有效、字母表类型、填充状态、字节大小和错误信息。
  • 三个工具均为只读,可离线使用。
适用场景
适合助手需要可靠的 Base64 结果而非凭猜测的场景:生成令牌或载荷、检查已编码字符串、判断某个值是否为合法 Base64,或转换 data URI。
运行要求
需要本地运行时:Node.js 18 或更高版本,由 MCP 客户端通过 npx 启动。无需 API 密钥、账号或网络访问。
安装前请注意
工具均为只读,README 称数据不会离开本机且不使用网络。编码或解码并不等于保护机密,请勿随意把敏感值粘贴进对话,除非你接受它出现在聊天记录中。

安装

在 SourceWeft 中

  1. 打开 控制台中的 base64hub,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

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
  • 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

sh
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:

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

Cursor

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

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

VS Code

From a terminal:

sh
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:

json
{  "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.

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.

Tools

All tools are read-only and work offline.

base64_encode

Encode text (as UTF-8) to Base64.

ArgumentTypeDefaultMeaning
textstringrequiredText to encode
url_safebooleanfalseURL-safe alphabet (- and _, RFC 4648 §5)
paddingbooleantrueAdd = padding
wrapinteger0Line 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.

ArgumentTypeMeaning
datastringBase64 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:

FieldMeaning
validtrue exactly when base64_decode would succeed
variantstandard (+ or / seen), url (- or _ seen), mixed (both) or either (neither)
paddedthe length including = is a multiple of 4
bytesdecoded size in bytes
errorthe 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.

Links

License

MIT

来源:README.md,提交 70ad43d

工具

3

base64_encode

Base64 encode

Encode text to Base64. The text is converted to UTF-8 bytes first, so any language and emoji work. Set url_safe for the URL- and filename-safe alphabet (- and _ instead of + and /, as in JWTs and URLs), padding=false to drop the trailing '=' characters, and wrap to break the output into lines (76 for MIME email). Returns only the Base64 string.

输入参数text必填wrappaddingurl_safe

base64_decode

Base64 decode

Decode Base64 back to text. Accepts the standard and the URL-safe alphabet (even mixed), missing '=' padding, spaces and line breaks, and data URIs such as data:image/png;base64,... Returns the decoded UTF-8 text exactly. If the bytes are not valid UTF-8 (an image, compressed or encrypted data), says so and returns them as hex instead. Invalid input fails with the reason and the position of the offending character.

输入参数data必填

base64_validate

Base64 validate

Check whether a string is valid Base64 and describe it, without returning the decoded content. Uses the same lenient rules as base64_decode. Returns JSON: valid, variant (standard if + or / occurs, url if - or _ occurs, mixed if both, either if neither), padded (whether the '=' padding is complete) and bytes (decoded size); or valid: false with the error base64_decode would report, such as the offending character and its position.

输入参数data必填

版本历史

1
  1. v1.0.0最新Nov 22, 2026

评分

已满足适用检查项的 90%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分
  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分