Skip to main content
Glama
liuyazui

Base64 MCP Server

by liuyazui

Base64编码解码MCP服务器

English Version

一个简单高效的MCP服务器,专注于提供Base64编码和解码功能,支持文本和图片的Base64转换。

功能特点

  • 文本Base64编码和解码

  • 图片Base64编码和解码

  • 支持Data URL格式

  • 简单易用的API

  • 使用uv进行依赖管理

Related MCP server: EasyOCR MCP Server

安装

使用uv安装

# 创建虚拟环境
uv venv

# 激活虚拟环境(Linux/macOS)
source .venv/bin/activate

# 激活虚拟环境(Windows)
.venv\Scripts\activate

# 安装包(开发模式)
uv pip install -e .

# 安装带开发依赖的包
uv pip install -e ".[dev]"

安装Smithery

使用Smithery为Claude桌面安装Base64编码解码MCP服务器,使用以下命令:

npx -y @smithery/cli install @liuyazui/base64_server --client claude

使用方法

使用MCP Inspector测试

# 使用MCP Inspector测试服务器
uv run mcp dev base64_server.py

与MCP client集成

  1. 添加服务器配置:

    {
      "mcpServers": {
         "base64-encoder": {
         "command": "uv",
         "args": [
           "run",
           "--with",
           "mcp[cli]",
           "mcp",
           "run",
           "[path to base64_server.py]"
         ]
       }
      }
    }

API参考

工具(Tools)

  • base64_encode_text(text: str) -> str:将文本转换为Base64编码

  • base64_decode_text(encoded: str) -> str:将Base64编码解码为文本

  • base64_encode_image(image_path: str) -> str:将图片转换为Base64编码

  • base64_decode_image(encoded: str, output_path: str, mime_type: str = "image/png") -> str:将Base64编码解码为图片

资源(Resources)

  • encode://base64/text/{text}:获取文本的Base64编码

  • decode://base64/text/{encoded}:获取Base64编码的解码结果

  • encode://base64/image/{image_path}:获取图片的Base64编码

  • decode://base64/image/{encoded}:获取Base64编码的解码图片

提示模板(Prompts)

  • base64_usage_guide(): 提供Base64服务的基本使用指南

  • encode_text_prompt(text: str): 文本编码提示模板

  • encode_image_prompt(image_path: str): 图片编码提示模板

  • error_handling_prompt(error_message: str): 错误处理提示模板

使用示例:

# 获取使用指南提示
messages = await client.get_prompt("base64_usage_guide")

# 获取文本编码提示
messages = await client.get_prompt("encode_text_prompt", {"text": "Hello World"})

开发

许可证

MIT

Available Tools

4 tools
base64_decode_imageA

将Base64编码解码为图片

Args:
    encoded: Base64编码的字符串
    output_path: 输出图片的路径
    mime_type: 图片的MIME类型 (默认为image/png)

Returns:
    解码结果
ParametersJSON Schema
NameRequiredDescriptionDefault
encodedYes
output_pathYes
mime_typeNoimage/png

TDQS

A3.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. While it states the tool decodes Base64 to an image and saves it to a file path, it doesn't disclose important behavioral aspects like: what happens if the file path already exists (overwrites? fails?), what happens with invalid Base64 data, whether there are file size limits, or what specific '解码结果' (decoding result) is returned. The description provides basic operation but lacks critical implementation details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly structured and concise - a clear purpose statement followed by organized sections for Args and Returns. Every sentence earns its place, with no redundant information. The bilingual presentation (Chinese purpose, English parameter labels) is efficient for an international context.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 3-parameter tool with no annotations and no output schema, the description provides adequate basic information but has significant gaps. It explains what the tool does and what parameters mean, but doesn't describe the return value ('解码结果') in any detail, doesn't cover error conditions, and doesn't provide behavioral transparency about file operations. Given the complexity of file I/O operations, more completeness would be expected.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description compensates well by clearly explaining all three parameters: 'encoded' is the Base64 string, 'output_path' is where to save the image, and 'mime_type' is the image format with a default value. It adds meaningful context beyond the bare schema, though it could provide more guidance on valid mime_type values or output_path format requirements.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('将Base64编码解码为图片' - decodes Base64 encoding to an image) and distinguishes it from sibling tools like base64_decode_text (which decodes to text) and base64_encode_image (which encodes from image). It precisely identifies both the input (Base64 string) and output (image) resources.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool (when you have Base64-encoded image data that needs to be saved as an image file). It doesn't explicitly state when NOT to use it or name alternatives, but the sibling tool names make the distinction obvious - use this for image decoding, not text decoding or encoding operations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

base64_decode_textA

将Base64编码解码为文本

Args:
    encoded: Base64编码的字符串

Returns:
    解码后的文本
ParametersJSON Schema
NameRequiredDescriptionDefault
encodedYes

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses the basic behavior (decoding Base64 to text) and mentions the return value ('解码后的文本' meaning decoded text), but lacks details on error handling, character encoding assumptions, or performance traits. It adds some context but is not comprehensive for behavioral transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, with a clear purpose statement followed by structured sections for Args and Returns. Every sentence earns its place without redundancy, making it efficient and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (1 parameter, no output schema, no annotations), the description is mostly complete, covering purpose, input, and output. However, it lacks details on error cases or encoding specifics, which could be useful for full contextual understanding in a decoding operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage and 1 parameter, the description compensates by explaining the parameter 'encoded' as 'Base64编码的字符串' (Base64-encoded string), adding semantic meaning beyond the schema's basic type. It clarifies the expected input format, though it could provide more detail on constraints or examples.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('解码' meaning decode) and resource ('Base64编码' meaning Base64 encoding), distinguishing it from sibling tools like base64_encode_text and base64_decode_image. It explicitly indicates the transformation from Base64 to text, making the function unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context by specifying 'Base64编码的字符串' (Base64-encoded string) as input, which helps differentiate it from image-decoding siblings. However, it does not explicitly state when to use this tool versus alternatives like base64_decode_image or base64_encode_text, missing explicit exclusions or comparative guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

base64_encode_imageA

将图片转换为Base64编码

Args:
    image_path: 图片文件路径

Returns:
    Base64编码结果
ParametersJSON Schema
NameRequiredDescriptionDefault
image_pathYes

TDQS

A3.5/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden. It states what the tool does (converts image to Base64) but lacks behavioral details like whether it reads local files vs URLs, file size limits, supported image formats, error handling, or performance characteristics. The return statement is minimal.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized with three clear sections (purpose, args, returns). The first sentence states the core functionality, though the structure could be more front-loaded by integrating parameter details into the main description rather than separate 'Args' and 'Returns' lines.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and a single parameter with 0% schema coverage, the description is incomplete. It lacks details on input constraints (e.g., file types, size), output format specifics, error conditions, and comparison to sibling tools, which are needed for proper tool selection and invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It provides the parameter name 'image_path' and clarifies it's for image files, adding meaning beyond the schema's generic 'Image Path' title. However, it doesn't specify path format (absolute/relative) or supported file systems.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('将图片转换为' - converts image to) and resource ('Base64编码' - Base64 encoding). It distinguishes from siblings by specifying it works with images rather than text, unlike base64_encode_text.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context through the parameter name 'image_path', suggesting this tool is for encoding image files. However, it doesn't explicitly state when to use this vs alternatives like base64_encode_text or when not to use it (e.g., for non-image files).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

base64_encode_textA

将文本转换为Base64编码

Args:
    text: 要编码的文本

Returns:
    Base64编码结果
ParametersJSON Schema
NameRequiredDescriptionDefault
textYes

TDQS

A3.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It only states the transformation function without mentioning any behavioral traits like error handling, encoding standards (e.g., UTF-8), performance characteristics, or whether the operation is idempotent. This leaves significant gaps for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly structured with a clear purpose statement followed by parameter and return value sections. Every sentence earns its place with zero wasted words, making it easy to parse and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter transformation tool with no annotations and no output schema, the description covers the basic purpose and parameter meaning adequately. However, it lacks details about the return format (e.g., string format, encoding specifics) and behavioral aspects that would make it complete for safe agent invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaningful context for the single parameter ('text: 要编码的文本' - 'text: the text to encode'), which compensates for the 0% schema description coverage. While it doesn't elaborate on constraints like maximum length or character encoding, it clearly explains the parameter's purpose beyond the schema's basic type definition.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('将文本转换为Base64编码' - 'Convert text to Base64 encoding') and distinguishes it from sibling tools that handle image encoding/decoding. It explicitly identifies the resource (text) and verb (encode), making the purpose unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context by specifying it's for text encoding, which implicitly distinguishes it from the image encoding sibling tool. However, it doesn't explicitly state when to use this versus the decode_text alternative or mention any prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 4 tool updates
    • First observedbase64_decode_image
    • First observedbase64_decode_text
    • First observedbase64_encode_image
    • First observedbase64_encode_text

TDQS

A4.1/5.0
Disambiguation5/5

Every tool has a clearly distinct purpose with no ambiguity. The four tools cleanly separate into two decode operations (image vs text) and two encode operations (image vs text), each targeting specific data types and use cases. An agent can easily distinguish between them based on the input/output type and operation direction.

Naming Consistency5/5

All tools follow a perfectly consistent verb_noun pattern with 'base64_' prefix, then operation (encode/decode), then target type (image/text). The naming is predictable, readable, and follows the same convention throughout without any deviations or mixed styles.

Tool Count5/5

Four tools is ideal for this server's purpose. It provides complete coverage of the Base64 domain with exactly the right granularity: encode and decode operations for both text and image data types. No tool feels redundant or missing, and the count is well-scoped for the functionality offered.

Completeness5/5

The tool surface is complete for Base64 operations. It covers both encoding and decoding for the two primary data types (text and images) that Base64 typically handles. There are no gaps in the CRUD/lifecycle for this domain, and agents can perform all expected Base64 transformations without workarounds.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    The MCP server offers the function of extracting images from local files and urls and converting them to base64 format, which is suitable for LLM analysis.
    3
    2
    Apache 2.0
  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that provides OCR capabilities using the EasyOCR library, supporting over 80 languages and GPU acceleration. It enables processing images from base64 strings, local files, or URLs with options for text-only or detailed coordinate and confidence output.
    2
    Apache 2.0
  • F
    license
    A
    quality
    C
    maintenance
    A lightweight MCP server providing everyday developer utilities such as JSON formatting, UUID generation, Base64 conversion, HTTP status lookup, and Unix timestamp conversion as tools and resources.
    5
    -

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/liuyazui/base64_server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server