A comprehensive Model Context Protocol (MCP) server supporting all Python hashing algorithms, HMAC operations, and algorithm discovery. This server enables LLMs to perform a wide range of cryptographic hashing operations efficiently.
The server offers 4 main tools:
hash: Universal hashing tool supporting all Python hashlib algorithms (MD5, SHA family, SHA-3, BLAKE2, etc.)hmac: Hash-based Message Authentication Code using any supported hash algorithm
The server provides 2 resources for algorithm discovery:
algorithms://available: Lists all available hashing algorithmsalgorithms://properties/{algorithm}: Provides properties for a specific algorithm
The server dynamically discovers and supports all algorithms available in your Python installation, typically including:
- MD Family: md5
- SHA-1: sha1
- SHA-2: sha224, sha256, sha384, sha512
- SHA-3: sha3_224, sha3_256, sha3_384, sha3_512
- BLAKE2: blake2b, blake2s
- Others: ripemd160, and more depending on your system
# Basic SHA-256 hashing
await hash(data="hello world", algorithm="sha256")
# Returns: "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9"
# MD5 with base64 output
await hash(data="test", algorithm="md5", output_format="base64")
# Returns: "CY9rzUYh03PK3k6DJie09g=="
# BLAKE2b with custom digest size
await hash(data="hello", algorithm="blake2b", kwargs='{"digest_size": 16}')
# Returns: 32-character hex string (16 bytes)
# SHA-3 hashing
await hash(data="secure data", algorithm="sha3_256")
# Returns: SHA-3 256-bit hash# HMAC with SHA-256
await hmac(data="message", key="secret_key", algorithm="sha256")
# Returns: HMAC-SHA256 digest
# HMAC with MD5 and base64 output
await hmac(data="data", key="key", algorithm="md5", output_format="base64")
# Returns: Base64-encoded HMAC-MD5 digest# Get all available algorithms
algorithms = await access_resource("algorithms://available")
# Returns: JSON with hash_algorithms array
# Get properties for SHA-256
properties = await access_resource("algorithms://properties/sha256")
# Returns: JSON with digest_size, block_size, category, descriptionThe server processes requests and returns corresponding cryptographic hashes for any supported algorithm. It works with Claude Desktop, VS Code, and other MCP clients.
- To Run via Docker: Docker installed and running.
- To Run Directly: Python 3.13+ and a virtual environment tool (
venv,uv). - To Contribute/Develop: Git, Python 3.13+,
uv(recommended) orpip, Docker (optional, for testing build).
This is the simplest way to run the server without managing Python environments directly.
1. Get the Docker Image:
- Pull from Docker Hub (Easiest):
docker pull kunalpathak13/mcp-hashing-server:latest2. Configure Your MCP Client:
-
VS Code (
settings.json):"mcp": { "servers": { "hashing-docker": { "command": "docker", "args": [ "run", "-i", // Keep STDIN open for communication "--rm", // Clean up container after exit "kunalpathak13/mcp-hashing-server:latest" // Change the tag to your version if needed e.g. "mcp-hashing-server:X.Y.Z" ] } } }
-
Claude Desktop (
claude_desktop_config.json):{ "mcpServers": { "hashing-docker": { "command": "docker", "args": [ "run", "-i", "--rm", "kunalpathak13/mcp-hashing-server:latest" // Change the tag to your version if needed e.g. "mcp-hashing-server:X.Y.Z" ] } } } -
Other Clients: Adapt according to their docs, using
dockeras the command andrun -i --rm IMAGE_NAMEas arguments. Refer to their official documentation for precise configuration steps:
3. Test the Integration:
Ask your MCP client questions like:
- "Calculate the SHA-256 hash of 'hello world'"
- "Generate an HMAC-SHA256 for 'message' with key 'secret'"
- "What hashing algorithms are available?"
- "Show me the properties of the BLAKE2b algorithm"
Use this method if you prefer not to use Docker or for development purposes.
1. Set Up Environment & Install:
# Create a dedicated directory and navigate into it
mkdir my_mcp_setup && cd my_mcp_setup
# Create & Activate Virtual Environment
uv venv
source .venv/bin/activate # Linux/macOS
# .venv\Scripts\activate # Windows
# Install the package
uv pip install mcp-hashing-server2. Find the Executable Path:
# On Linux/macOS:
which mcp-hashing-server
# On Windows:
where mcp-hashing-server3. Configure Your MCP Client:
Use the absolute path in your client configuration:
-
VS Code (
settings.json):"mcp": { "servers": { "hashing": { "command": "/full/path/to/your/virtualenv/bin/mcp-hashing-server" } } }
-
Claude Desktop (
claude_desktop_config.json):{ "mcpServers": { "hashing": { "command": "/full/path/to/your/virtualenv/bin/mcp-hashing-server" } } }
1. Clone the Repository:
git clone https://github.com/kanad13/MCP-Server-for-Hashing.git
cd MCP-Server-for-Hashing2. Set Up Development Environment:
# Create & Activate Virtual Environment
uv venv
source .venv/bin/activate # Linux/macOS
# .venv\Scripts\activate # Windows
# Install in editable mode with development dependencies
uv pip install -e ".[dev]"(This installs the package such that code changes in src/ take effect immediately without reinstalling. It also installs tools defined in [project.optional-dependencies.dev] like pytest)
3. Running Locally During Development: Ensure your development virtual environment is active. You can run the server using:
# Run the installed script (available due to -e flag)
mcp-hashing-server4. Running Locally During Development:
# Run the installed script
mcp-hashing-server
# Or execute the module directly
python -m mcp_hashing.cliasync def hash(
data: str, # Data to hash
algorithm: str, # Algorithm name (e.g., 'sha256', 'blake2b')
encoding: str = "utf-8", # Text encoding
output_format: str = "hex", # 'hex' or 'base64'
**kwargs # Algorithm-specific parameters
) -> strasync def hmac(
data: str, # Data to authenticate
key: str, # Secret key
algorithm: str, # Hash algorithm to use
encoding: str = "utf-8", # Text encoding
output_format: str = "hex" # 'hex' or 'base64'
) -> str- Input Length Limits: Prevents DoS attacks with configurable limits (default: 1MB)
- Algorithm Validation: Only allows algorithms available in the system
- Parameter Sanitization: Validates all input parameters
- Secure Key Handling: Proper handling of HMAC keys
- Comprehensive Logging: Detailed logging for monitoring and debugging
This project is licensed under the MIT License - see the LICENSE file for details.