enigma-python-mcp
Enigma Python MCP Server
enigmapythonライブラリの機能をLLMに提供し、歴史的に正確なエニグマ暗号機エミュレーターを使用してメッセージの暗号化と復号化を可能にするMCP(Model Context Protocol)サーバーです。

このMCPサーバーはGlama.aiに掲載されており、以下のスコアを獲得しています。
機能
既知のエニグマ暗号機モデルをすべて公開: Enigma M3、Enigma M4、Enigma I、Enigma K、Enigma Z、Enigma Dなど。
動的設定: LLMは暗号化のためにローター、初期位置、リング設定、リフレクター、プラグボードのペアを指定できます。
ローカルおよびネットワークモード: ローカルMCP統合(Claude Desktopなど)用の
stdioトランスポートと、ネットワーク経由でツールを公開するためのsseトランスポートの両方をサポートしています。Docker化: プラットフォーム間での移植と実行が容易です。
Related MCP server: MCP Server Example
公開ツール
encrypt_message
設定されたエニグマ暗号機を使用してメッセージを暗号化または復号化します。
引数:
machine_model(str): モデル名。サポート対象:'M3','M4','I','I_Norway','I_Sondermaschine','K','K_Swiss','D','Z','B_A133'。message(str): 処理する平文または暗号文。rotors(list[object]):RotorConfigオブジェクトのリスト。各オブジェクトはrotor_type(str)、ring_setting(int, デフォルト=0)、initial_position(int | str, デフォルト=0)を指定します。重要: リストは必ず[最速/右端, 中央, 最遅/左端, ギリシャ文字(M4の場合)]の順序である必要があります。reflector(object):reflector_type(str)、およびオプションで回転リフレクター用のring_setting(int)とinitial_position(int | str)を指定するReflectorConfigオブジェクト。plugboard_pairs(dict, オプション): プラグボード接続をマッピングする辞書(例:{"A": "B", "C": "D"})。
サーバーの実行
Pythonを使用する場合
Python 3.11以上が必要です。
PyPIからパッケージをインストールします:
pip install enigmapython-mcp(
uvがインストールされている場合は、単にuvx enigmapython-mcpを実行することもできます!)stdio経由で実行(ローカルMCPクライアント用):
enigmapython-mcp --transport stdioSSE経由で実行(ネットワーク経由で公開):
enigmapython-mcp --transport sse --host 0.0.0.0 --port 8000
Dockerを使用する場合
コンテナをビルドします:
docker build -t enigmapython-mcp .stdio経由で実行(デフォルト):
docker run -i enigmapython-mcpSSE経由で実行:
docker run -p 8000:8000 enigmapython-mcp --transport sse --host 0.0.0.0 --port 8000
クライアント設定 (Claude Desktop)
Claude Desktopにワンクリックでインストールできる2つの異なるmcpbバンドルを提供しています。GitHub Releasesページからお好みのバンドルをダウンロードし、Claude Desktopの拡張機能メニューにドラッグ&ドロップしてください:
enigmapython-mcp-docker.mcpb: 非常に軽量で、ローカルのDockerデーモンを使用して隔離されたコンテナ内でサーバーを実行します。(推奨)enigmapython-mcp-python.mcpb: Pythonソースコード全体が含まれています。Claude Desktopがネイティブに仮想環境を構築し、Dockerなしでサーバーを実行します。
claude_desktop_config.jsonによる手動設定を希望する場合は、以下の設定を使用してください:
Pythonを使用する場合 (uvx推奨)
{
"mcpServers": {
"enigma": {
"command": "uvx",
"args": ["enigmapython-mcp", "--transport", "stdio"]
}
}
}Dockerを使用する場合
(注: 事前にDockerイメージをビルドしていることを確認してください: docker build -t enigmapython-mcp .)
{
"mcpServers": {
"enigma": {
"command": "docker",
"args": ["run", "-i", "--rm", "enigmapython-mcp"]
}
}
}クライアント設定 (OpenCode)
OpenCodeでこのサーバーを使用するには、~/.config/opencode/opencode.json(グローバル)またはopencode.json(プロジェクトレベル)のmcpセクションに以下を追加してください:
Pythonを使用する場合 (uvx推奨)
{
"mcp": {
"enigma": {
"type": "local",
"command": [
"uvx",
"enigmapython-mcp",
"--transport",
"stdio"
],
"enabled": true
}
}
}Dockerを使用する場合
(注: 事前にDockerイメージをビルドしていることを確認してください: docker build -t enigmapython-mcp .)
{
"mcp": {
"enigma": {
"type": "local",
"command": [
"docker",
"run",
"-i",
"--rm",
"enigmapython-mcp"
],
"enabled": true
}
}
}プロンプト例
サーバーの設定が完了したら、LLMに以下のプロンプトを送信してテストできます:
例1: 基本的な暗号化 (Enigma M3)
"Enigma M3を使用してメッセージ'TOPSECRET'を暗号化する必要があります。ローターは最速から最遅の順にIII、II、Iです。すべて位置0から開始し、リング設定は0です。リフレクター'UKWB'を使用し、プラグボードはなしです。暗号文は何ですか?"
例2: 歴史的な復号化 (Enigma I)
"この1930年のEnigma Iメッセージを復号してください。暗号文は'GCDSEAHUGWTQGRK'です。マシンの設定は、最速から最遅の順に、ローターIII、I、IIです。それぞれのリング設定は21、12、23です。初期位置は11、1、0です。リフレクターは'UKWA'です。プラグボードの交換はA/M、F/I、N/V、P/S、T/U、W/Zです。"
例3: 複雑なM4設定
"Enigma M4を使用してメッセージ'DIVE DIVE DIVE'を暗号化してください。マシンは'UKWBThin'リフレクターを使用します。ローターは[最速, 中央, 最遅, ギリシャ文字]の順で、VIII(位置2)、III(位置6)、IV(位置12)、Gamma(位置21)です。すべてのリング設定は0です。処理してください。"
テスト
包括的なテストスイートがtests/test_server.pyに含まれています。サポートされている10種類すべてのエニグマモデルについて、暗号化と復号化の可逆性をテストします。
テストを実行するには:
# Activate your virtual environment first
source .venv/bin/activate
pip install pytest
export PYTHONPATH=$PYTHONPATH:$(pwd)/src/enigmapython_mcp && pytest tests/* SSEサーバーの対話的なテスト
Model Context Protocolではツールを呼び出す前にステートフルな初期化ハンドシェイクが必要なため、curlを使用してSSEエンドポイントを手動でテストするのは非常に複雑です。
サーバーをテストする最も簡単で公式に推奨される方法は、MCP Inspectorを使用することです:
サーバーがSSEモードで実行されていることを確認します:
uv run enigmapython-mcp --transport sse --host 0.0.0.0 --port 80002つ目のターミナルでInspectorを起動します:
npx @modelcontextprotocol/inspectorブラウザでWebインターフェースが開きます(通常は
http://localhost:5173)。Transport TypeをSSEに変更します。
URLとして
http://localhost:8000/sseを入力し、Connectをクリックします。これで
encrypt_messageツールを視覚的に設定して実行できるようになります!
Available Tools
1 toolencrypt_messageA
Encrypt or decrypt a message using a specified Enigma machine configuration.
Args:
machine_model: Exact machine model name. MUST be one of: 'M3', 'M4', 'I', 'I_Norway', 'I_Sondermaschine', 'K', 'K_Swiss', 'D', 'Z', 'B_A133', 'T'. Do not add 'Enigma' prefix.
Supported models and their explicitly required reflectors:
- 'M3', 'I': UKWA, UKWB, UKWC
- 'M4': UKWBThin, UKWCThin
- 'I_Norway': UKW_EnigmaINorway
- 'I_Sondermaschine': UKW_EnigmaISonder
- 'K', 'K_Swiss', 'D': UKW_EnigmaCommercial
- 'Z': UKW_EnigmaZ
- 'B_A133': UKW_EnigmaB_A133
- 'T': UKW_EnigmaT
message: The plaintext or ciphertext to process.
- For Enigma Z: MUST contain ONLY digits (1234567890).
- For Enigma B_A133: MUST contain ONLY Swedish letters (abcdefghijklmnopqrstuvxyzåäö). Note: 'w' is strictly forbidden.
- For all other machines: MUST contain ONLY standard letters (A-Z).
- Spaces, punctuation, and special characters are strictly forbidden in all machines.
rotors: List of RotorConfig objects. MUST be ordered exactly as: [Fastest/Rightmost, Middle, Slowest/Leftmost, Greek (if M4)].
reflector: The ReflectorConfig object.
plugboard_pairs: Optional dict for plugboard connections (e.g. {"A": "B", "C": "D"}). Ignored if the machine has no plugboard.
Inputs: rotors (required), message (required), reflector (required), machine_model (required), +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 1 tool
Only one tool exists, so there is no ambiguity between tools. The single tool's purpose is clear from its description.
The single tool name 'encrypt_message' follows a clear verb_noun pattern, and there are no other tools to create inconsistency. The name is slightly misleading as it also performs decryption, but this does not affect consistency across tools.
With only one tool, the server feels very thin for an Enigma machine library. However, the single tool is comprehensive, covering encryption and decryption for many machine models.
The tool covers both encryption and decryption, which are the core operations. It also supports a wide range of Enigma models. There could be additional tools for listing models or validating configurations, but these are minor gaps.
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
Enable secure connectivity between Sentry issues and debugging data, and LLM clients, using a Model Context Protocol (MCP) server.
MCP server for AI dialogue using various LLM models via AceDataCloud
Related MCP Servers
- AlicenseDqualityDmaintenanceA Model Context Protocol server that gives LLMs the ability to interact with Ethereum networks, manage wallets, query blockchain data, and execute smart contract operations through a standardized interface.5414MIT
- AlicenseBqualityDmaintenanceAn educational implementation of a Model Context Protocol server that demonstrates how to build a functional MCP server for integrating with various LLM clients like Claude Desktop.1162MIT
- AlicenseBqualityDmaintenanceAn educational implementation of a Model Context Protocol server that demonstrates how to build a functional MCP server integrating with various LLM clients.2MIT
- FlicenseNot gradedqualityDmaintenanceA foundational implementation of a Model Context Protocol (MCP) server designed for educational purposes. It demonstrates the complete interaction between an LLM, an inference engine, and a client during an agentic call.-