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 contentfile_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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_base64-0.1.1.tar.gz.
File metadata
- Download URL: mcp_base64-0.1.1.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ae2bc70afa968cc1ebfcdd7575e2f8e7b97e1d019ae639e38c0c2c10a770eb2
|
|
| MD5 |
1cdddaab822a48ee71adfe52d4ce4634
|
|
| BLAKE2b-256 |
7c3fdc3a82f87c7874364452239b0eac91804f3bae7cbe8a2084fe8270ecca8d
|
File details
Details for the file mcp_base64-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mcp_base64-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7240abe8bd39089bfe5651d0d6baa44081505f1a541cadc7d1902bacab46e3c3
|
|
| MD5 |
6791e0a4d9cda1f74355c8a3cc66a2c0
|
|
| BLAKE2b-256 |
b51048c2d96c7eb73e6ecbf052d9b7d9425ec100d7ffd88705a41af403c40391
|