Skip to main content

MCP server for Base64 file conversion (stdio transport)

Project description

MCP Base64 Server

A Python MCP (Model Context Protocol) server for Base64 file conversion with stdio transport.

Features

  • encode_file_to_base64: Encode any file to base64 string
  • decode_base64_to_file: Decode base64 content to file
  • Security-focused: Only accepts absolute paths, validates against path traversal
  • Binary-safe: Handles both text and binary files correctly

Installation

python3 -m venv .venv
./.venv/bin/python -m pip install --upgrade pip
./.venv/bin/python -m pip install -e .

Usage

Direct Execution

Run the MCP server:

PYTHONPATH=src ./.venv/bin/python -m mcp_base64.server

IDE Configuration

For IDE plugins, add this server to your MCP configuration JSON:

{
  "mcpServers": {
    "mcp-base64": {
      "command": "<PATH-TO-PROJECT/.venv/bin/python",
      "args": ["-m", "mcp_base64.server"]
    }
  }
}

Tools

encode_file_to_base64(file_path: str) -> str

Encodes a file to base64 string.

Parameters:

  • file_path (str): Absolute path to file to encode

Returns: Base64 encoded string

decode_base64_to_file(base64_content: str, file_path: str) -> str

Decodes base64 string to file.

Parameters:

  • base64_content (str): Base64 encoded content
  • file_path (str): Absolute path where to save decoded file

Returns: Success message with file path

Development

Install development dependencies:

./.venv/bin/python -m pip install -e .[dev]

Run tests:

./.venv/bin/python -m pytest -q

Run linting:

./.venv/bin/python -m ruff check .

License

See LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_base64-0.1.0.tar.gz (124.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_base64-0.1.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file mcp_base64-0.1.0.tar.gz.

File metadata

  • Download URL: mcp_base64-0.1.0.tar.gz
  • Upload date:
  • Size: 124.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mcp_base64-0.1.0.tar.gz
Algorithm Hash digest
SHA256 394ddb73ffec00ac74550db334c69dab35fa6a769fbafeb4da5e976e208bd670
MD5 695a435cb4c937497ae13678c8e87027
BLAKE2b-256 dbdb1d7f95868fa1d0e9d9eb35f9768f6ae8f08227c5280a36c061c4fcaa73d7

See more details on using hashes here.

File details

Details for the file mcp_base64-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mcp_base64-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mcp_base64-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 245858c242b9b6f0bed9edb934d9b54ad586be4aaf37a49d222533a8015f4bcf
MD5 3b35dc9551a4fe404036e7d318b3dd5d
BLAKE2b-256 8f03da4b30fc2e4954169c18747360916f49baff3e412d2d2aedd7cadf843972

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page