Skip to main content
Glama
liuyazui

Base64 MCP Server

base64_decode_text

Decode Base64-encoded strings into readable text. This tool converts encoded data back to its original text format for processing or analysis.

Instructions

将Base64编码解码为文本

Args:
    encoded: Base64编码的字符串

Returns:
    解码后的文本

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
encodedYes

Implementation Reference

  • The main handler function for the 'base64_decode_text' tool, decorated with @mcp.tool() for registration in the FastMCP server. It performs input cleaning, Base64 validation, decoding using base64.b64decode, and returns the result with error handling.
    @mcp.tool()
    def base64_decode_text(encoded: str) -> str:
        """将Base64编码解码为文本
    
        Args:
            encoded: Base64编码的字符串
    
        Returns:
            解码后的文本
        """
        try:
            # 清理输入,移除可能的前缀和空白
            encoded = encoded.strip()
            if "Base64编码结果:" in encoded:
                encoded = encoded.split("Base64编码结果:")[1].strip()
    
            # 验证是否为有效的Base64字符串
            if not all(
                c in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
                for c in encoded
            ):
                return "错误: 输入包含非Base64字符"
    
            # 尝试解码
            decoded = base64.b64decode(encoded).decode("utf-8")
            return f"Base64解码结果: {decoded}"
        except Exception as e:
            return f"解码失败: {str(e)}"

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