MCP server for historically accurate Enigma machine emulators
Project description
Enigma Python MCP Server
An MCP (Model Context Protocol) server that brings the capabilities of the enigmapython library to LLMs, allowing them to encrypt and decrypt messages using historically accurate Enigma machine emulators.
Features
- Exposes all known Enigma machine models: Enigma M3, Enigma M4, Enigma I, Enigma K, Enigma Z, Enigma D, and more.
- Dynamic Configuration: LLMs can specify rotors, initial positions, ring settings, reflectors, and plugboard pairs for the encryption.
- Local and Network Mode: Supports both
stdiotransport for local MCP integrations (like Claude Desktop) andssetransport to expose the tools over a network. - Dockerized: Easy portability and execution across platforms.
Exposed Tools
encrypt_message
Encrypt or decrypt a message using a configured Enigma machine.
Arguments:
machine_model(str): Model name. Supported:'M3','M4','I','I_Norway','I_Sondermaschine','K','K_Swiss','D','Z','B_A133'.message(str): The plaintext or ciphertext to process.rotors(list[object]): List ofRotorConfigobjects. Each object specifiesrotor_type(str),ring_setting(int, default=0), andinitial_position(int | str, default=0). IMPORTANT: The list MUST be ordered exactly as:[Fastest/Rightmost, Middle, Slowest/Leftmost, Greek (if M4)].reflector(object): AReflectorConfigobject specifyingreflector_type(str), and optionallyring_setting(int) andinitial_position(int | str) for rotating reflectors.plugboard_pairs(dict, optional): Dictionary mapping plugboard connections (e.g.,{"A": "B", "C": "D"}).
Running the Server
Using Python
Requires Python 3.11+.
-
Install the package from PyPI:
pip install enigmapython-mcp
(Alternatively, you can just run
uvx enigmapython-mcpif you haveuvinstalled!) -
Run via stdio (for local MCP client):
enigmapython-mcp --transport stdio
-
Run via SSE (exposing over network):
enigmapython-mcp --transport sse --host 0.0.0.0 --port 8000
Using Docker
-
Build the container:
docker build -t enigmapython-mcp .
-
Run via stdio (default):
docker run -i enigmapython-mcp
-
Run via SSE:
docker run -p 8000:8000 enigmapython-mcp --transport sse --host 0.0.0.0 --port 8000
Client Configuration (Claude Desktop)
We provide two distinct mcpb bundles for 1-click installation on Claude Desktop. Simply download your preferred bundle from the GitHub Releases page and drag-and-drop it into Claude Desktop's Extensions menu:
enigmapython-mcp-docker.mcpb: Extremely lightweight, relies on your local Docker daemon to run the server in an isolated container. (Recommended)enigmapython-mcp-python.mcpb: Contains the full Python source. Claude Desktop will natively build a virtual environment and run the server without needing Docker.
If you prefer manual configuration via claude_desktop_config.json, use the settings below:
Using Python (uvx recommended)
{
"mcpServers": {
"enigma": {
"command": "uvx",
"args": ["enigmapython-mcp", "--transport", "stdio"]
}
}
}
Using Docker
(Note: Make sure you have built the Docker image first: docker build -t enigmapython-mcp .)
{
"mcpServers": {
"enigma": {
"command": "docker",
"args": ["run", "-i", "--rm", "enigmapython-mcp"]
}
}
}
Client Configuration (OpenCode)
To use this server with OpenCode, add the following to your ~/.config/opencode/opencode.json (global) or opencode.json (project-level) under the mcp section:
Using Python (uvx recommended)
{
"mcp": {
"enigma": {
"type": "local",
"command": [
"uvx",
"enigmapython-mcp",
"--transport",
"stdio"
],
"enabled": true
}
}
}
Using Docker
(Note: Make sure you have built the Docker image first: docker build -t enigmapython-mcp .)
{
"mcp": {
"enigma": {
"type": "local",
"command": [
"docker",
"run",
"-i",
"--rm",
"enigmapython-mcp"
],
"enabled": true
}
}
}
Example Prompts
Once the server is configured, you can test it by sending the following prompts to your LLM:
Example 1: Basic Encryption (Enigma M3)
"I need to encrypt the message 'TOPSECRET' using an Enigma M3. The rotors, ordered from fastest to slowest, are III, II, and I. All starting at position 0 with ring settings at 0. Use reflector 'UKWB' and no plugboard. What is the ciphertext?"
Example 2: Historical Decryption (Enigma I)
"Decrypt this 1930 Enigma I message. The ciphertext is 'GCDSEAHUGWTQGRK'. The machine settings, strictly ordered from Fastest to Slowest, are: Rotors III, I, and II. Their respective ring settings are 21, 12, and 23. Their initial positions are 11, 1, and 0. The reflector is 'UKWA'. The plugboard swaps are: A/M, F/I, N/V, P/S, T/U, W/Z."
Example 3: Complex M4 Configuration
"Use the Enigma M4 to encrypt the message 'DIVE DIVE DIVE'. The machine uses the 'UKWBThin' reflector. The rotors, explicitly ordered as [Fastest, Middle, Slowest, Greek], are: VIII (pos 2), III (pos 6), IV (pos 12), and Gamma (pos 21). All ring settings are 0. Please process this."
Testing
A comprehensive test suite is included in tests/test_server.py. It tests the encryption and decryption reversibility for all 10 supported Enigma models.
To run the tests:
# Activate your virtual environment first
source .venv/bin/activate
pip install pytest
export PYTHONPATH=$PYTHONPATH:$(pwd)/src/enigmapython_mcp && pytest tests/*
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 enigmapython_mcp-0.1.0.tar.gz.
File metadata
- Download URL: enigmapython_mcp-0.1.0.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd60f4e58456b40d9b654efe62ce26a3d1304e860e68d93ee5e83a6f222c0213
|
|
| MD5 |
745644cebe444f27dd728e43acb086f7
|
|
| BLAKE2b-256 |
17996776b20d7c85931343ed639c663469bb746de68e999be2640550f5a304af
|
Provenance
The following attestation bundles were made for enigmapython_mcp-0.1.0.tar.gz:
Publisher:
publish.yml on denismaggior8/enigma-python-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
enigmapython_mcp-0.1.0.tar.gz -
Subject digest:
fd60f4e58456b40d9b654efe62ce26a3d1304e860e68d93ee5e83a6f222c0213 - Sigstore transparency entry: 1402472212
- Sigstore integration time:
-
Permalink:
denismaggior8/enigma-python-mcp@95e2b0cb3495b8099288eff39940ab8d37ed8d92 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/denismaggior8
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@95e2b0cb3495b8099288eff39940ab8d37ed8d92 -
Trigger Event:
push
-
Statement type:
File details
Details for the file enigmapython_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: enigmapython_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab1fa28ce34582c275e497939772267a8610b0e2084c0a57606af73548704b2b
|
|
| MD5 |
9fc8d5e04fd51bc3e999a6a698dbf795
|
|
| BLAKE2b-256 |
fdc05ff3496bda06004dcae92104470533fdbb8ad40495d407af899908cff3d5
|
Provenance
The following attestation bundles were made for enigmapython_mcp-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on denismaggior8/enigma-python-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
enigmapython_mcp-0.1.0-py3-none-any.whl -
Subject digest:
ab1fa28ce34582c275e497939772267a8610b0e2084c0a57606af73548704b2b - Sigstore transparency entry: 1402472289
- Sigstore integration time:
-
Permalink:
denismaggior8/enigma-python-mcp@95e2b0cb3495b8099288eff39940ab8d37ed8d92 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/denismaggior8
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@95e2b0cb3495b8099288eff39940ab8d37ed8d92 -
Trigger Event:
push
-
Statement type: