Skip to main content
Glama
denismaggior8

enigma-python-mcp

Servidor MCP Enigma Python

Un servidor MCP (Protocolo de Contexto de Modelo) que aporta las capacidades de la biblioteca enigmapython a los LLM, permitiéndoles cifrar y descifrar mensajes utilizando emuladores de máquinas Enigma históricamente precisos.

Integración con Claude Desktop

Versión de PyPI Versiones de Python Descargas Licencia: MIT Estado de publicación

Este servidor MCP aparece en Glama.ai con esta puntuación:

Servidor MCP enigma-python-mcp

Características

  • Expone todos los modelos conocidos de máquinas Enigma: Enigma M3, Enigma M4, Enigma I, Enigma K, Enigma Z, Enigma D y más.

  • Configuración dinámica: Los LLM pueden especificar rotores, posiciones iniciales, ajustes de anillo, reflectores y pares de clavijero para el cifrado.

  • Modo local y de red: Admite tanto el transporte stdio para integraciones MCP locales (como Claude Desktop) como el transporte sse para exponer las herramientas a través de una red.

  • Dockerizado: Fácil portabilidad y ejecución en todas las plataformas.

Related MCP server: MCP Server Example

Herramientas expuestas

encrypt_message

Cifra o descifra un mensaje utilizando una máquina Enigma configurada.

Argumentos:

  • machine_model (str): Nombre del modelo. Soportados: 'M3', 'M4', 'I', 'I_Norway', 'I_Sondermaschine', 'K', 'K_Swiss', 'D', 'Z', 'B_A133'.

  • message (str): El texto plano o cifrado a procesar.

  • rotors (list[object]): Lista de objetos RotorConfig. Cada objeto especifica rotor_type (str), ring_setting (int, por defecto=0) y initial_position (int | str, por defecto=0). IMPORTANTE: La lista DEBE estar ordenada exactamente como: [Más rápido/Derecha, Medio, Más lento/Izquierda, Griego (si es M4)].

  • reflector (object): Un objeto ReflectorConfig que especifica reflector_type (str), y opcionalmente ring_setting (int) y initial_position (int | str) para reflectores rotativos.

  • plugboard_pairs (dict, opcional): Diccionario que mapea las conexiones del clavijero (p. ej., {"A": "B", "C": "D"}).

Ejecución del servidor

Usando Python

Requiere Python 3.11+.

  1. Instale el paquete desde PyPI:

    pip install enigmapython-mcp

    (Alternativamente, puede ejecutar uvx enigmapython-mcp si tiene instalado uv)

  2. Ejecutar vía stdio (para cliente MCP local):

    enigmapython-mcp --transport stdio
  3. Ejecutar vía SSE (exponiendo a través de la red):

    enigmapython-mcp --transport sse --host 0.0.0.0 --port 8000

Usando Docker

  1. Construya el contenedor:

    docker build -t enigmapython-mcp .
  2. Ejecutar vía stdio (por defecto):

    docker run -i enigmapython-mcp
  3. Ejecutar vía SSE:

    docker run -p 8000:8000 enigmapython-mcp --transport sse --host 0.0.0.0 --port 8000

Configuración del cliente (Claude Desktop)

Proporcionamos dos paquetes mcpb distintos para la instalación con un solo clic en Claude Desktop. Simplemente descargue su paquete preferido desde la página de GitHub Releases y arrástrelo y suéltelo en el menú de Extensiones de Claude Desktop:

  1. enigmapython-mcp-docker.mcpb: Extremadamente ligero, depende de su demonio Docker local para ejecutar el servidor en un contenedor aislado. (Recomendado)

  2. enigmapython-mcp-python.mcpb: Contiene el código fuente completo en Python. Claude Desktop creará de forma nativa un entorno virtual y ejecutará el servidor sin necesidad de Docker.

Si prefiere la configuración manual a través de claude_desktop_config.json, utilice los ajustes a continuación:

Usando Python (se recomienda uvx)

{
  "mcpServers": {
    "enigma": {
      "command": "uvx",
      "args": ["enigmapython-mcp", "--transport", "stdio"]
    }
  }
}

Usando Docker

(Nota: Asegúrese de haber construido primero la imagen de Docker: docker build -t enigmapython-mcp .)

{
  "mcpServers": {
    "enigma": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "enigmapython-mcp"]
    }
  }
}

Configuración del cliente (OpenCode)

Para usar este servidor con OpenCode, añada lo siguiente a su ~/.config/opencode/opencode.json (global) o opencode.json (a nivel de proyecto) bajo la sección mcp:

Usando Python (se recomienda uvx)

{
  "mcp": {
    "enigma": {
      "type": "local",
      "command": [
        "uvx",
        "enigmapython-mcp",
        "--transport",
        "stdio"
      ],
      "enabled": true
    }
  }
}

Usando Docker

(Nota: Asegúrese de haber construido primero la imagen de Docker: docker build -t enigmapython-mcp .)

{
  "mcp": {
    "enigma": {
      "type": "local",
      "command": [
        "docker",
        "run",
        "-i",
        "--rm",
        "enigmapython-mcp"
      ],
      "enabled": true
    }
  }
}

Ejemplos de prompts

Una vez configurado el servidor, puede probarlo enviando los siguientes prompts a su LLM:

Ejemplo 1: Cifrado básico (Enigma M3)

"Necesito cifrar el mensaje 'TOPSECRET' usando una Enigma M3. Los rotores, ordenados de más rápido a más lento, son III, II y I. Todos comienzan en la posición 0 con ajustes de anillo en 0. Usa el reflector 'UKWB' y sin clavijero. ¿Cuál es el texto cifrado?"

Ejemplo 2: Descifrado histórico (Enigma I)

"Descifra este mensaje de la Enigma I de 1930. El texto cifrado es 'GCDSEAHUGWTQGRK'. Los ajustes de la máquina, estrictamente ordenados de más rápido a más lento, son: Rotores III, I y II. Sus respectivos ajustes de anillo son 21, 12 y 23. Sus posiciones iniciales son 11, 1 y 0. El reflector es 'UKWA'. Los intercambios del clavijero son: A/M, F/I, N/V, P/S, T/U, W/Z."

Ejemplo 3: Configuración compleja de M4

"Usa la Enigma M4 para cifrar el mensaje 'DIVE DIVE DIVE'. La máquina usa el reflector 'UKWBThin'. Los rotores, ordenados explícitamente como [Más rápido, Medio, Más lento, Griego], son: VIII (pos 2), III (pos 6), IV (pos 12) y Gamma (pos 21). Todos los ajustes de anillo son 0. Por favor, procesa esto."

Pruebas

Se incluye un conjunto completo de pruebas en tests/test_server.py. Prueba la reversibilidad del cifrado y descifrado para los 10 modelos de Enigma soportados.

Para ejecutar las pruebas:

# Activate your virtual environment first
source .venv/bin/activate

pip install pytest
export PYTHONPATH=$PYTHONPATH:$(pwd)/src/enigmapython_mcp && pytest tests/* 

Probar el servidor SSE de forma interactiva

Debido a que el Protocolo de Contexto de Modelo requiere un protocolo de enlace de inicialización con estado antes de que se pueda llamar a cualquier herramienta, probar manualmente el endpoint SSE con curl es bastante complejo.

La forma más fácil y oficialmente recomendada de probar el servidor es utilizando el Inspector MCP:

  1. Asegúrese de que su servidor se esté ejecutando en modo SSE:

    uv run enigmapython-mcp --transport sse --host 0.0.0.0 --port 8000
  2. En una segunda terminal, inicie el Inspector:

    npx @modelcontextprotocol/inspector
  3. Se abrirá una interfaz web en su navegador (normalmente en http://localhost:5173).

  4. Cambie el Tipo de transporte a SSE.

  5. Introduzca http://localhost:8000/sse como URL y haga clic en Conectar.

  6. ¡Ahora puede configurar y ejecutar visualmente la herramienta encrypt_message!

Available Tools

1 tool
encrypt_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.
ParametersJSON Schema
NameRequiredDescriptionDefault
rotorsYes
messageYes
reflectorYes
machine_modelYes
plugboard_pairsNo

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It adds valuable behavioral context such as message character restrictions per machine model, rotor ordering, and plugboard being ignored when absent. However, it does not disclose return behavior, error handling, or side effects, leaving some transparency gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose, then structured as an 'Args' list. It is lengthy due to the complexity, but each line adds necessary value. A slightly more compressed format could be achieved without losing information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complex nested schema and no output schema, the description covers all input parameters thoroughly, including valid values and constraints. It does not explicitly state the return value, but that is implied by the encrypt/decrypt purpose. Overall, it is complete enough for a well-equipped agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 0% top-level description coverage, but the description provides exhaustive semantics for every parameter: allowed machine models, per-model message constraints, rotor ordering, reflector guidance, and plugboard behavior. This fully compensates for the missing schema documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with 'Encrypt or decrypt a message using a specified Enigma machine configuration,' which clearly states the verb and resource. However, there are no sibling tools to differentiate from, so it loses a point for not distinguishing alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives (though there are none), nor any prerequisites, exclusions, or context beyond the first sentence. The detailed parameter constraints are helpful but do not address usage scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 1 tool updatev0.1.4
    • Changedencrypt_message1 field changed
      • changedInput schema / $defs / ReflectorConfig / properties / reflector_type / description
        Previous value: -"Exact Reflector identifier. Valid options: 'UKWA', 'UKWB', 'UKWC', 'UKWBThin', 'UKWCThin', 'UKW_EnigmaCommercial', 'UKW_EnigmaINorway', 'UKW_EnigmaISonder', 'UKW_EnigmaB_A133'."New value: +"Exact Reflector identifier. Valid options: 'UKWA', 'UKWB', 'UKWC', 'UKWBThin', 'UKWCThin', 'UKW_EnigmaCommercial', 'UKW_EnigmaINorway', 'UKW_EnigmaISonder', 'UKW_EnigmaB_A133', 'UKW_EnigmaT'."
  2. 1 tool updatev0.1.0
    • First observedencrypt_message

TDQS

A3.8/5.0

Scored across 1 tool

Disambiguation5/5

Only one tool exists, so there is no ambiguity between tools. The single tool's purpose is clear from its description.

Naming Consistency5/5

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.

Tool Count3/5

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.

Completeness4/5

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

ActivitySlowing
ResponsivenessUnresponsive

Related MCP Connectors

Related MCP Servers