Skip to content
Conduit

mcp server

polya

Typed, bounded operations that puzzle-solving agents can discover, inspect and run. Ciphers, constraints, automata and exact checks via Python, a JSON CLI and MCP.

Amal-David/polyacommunitylistedunreviewed

Set up

Runs on your computer. Pick your agent and operating system.

Before you start

  • uv (`curl -LsSf https://astral.sh/uv/install.sh | sh`)
~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "polya": {
      "command": "uvx",
      "args": [
        "polya-puzzles"
      ]
    }
  }
}

same format Cursor, GitHub Copilot CLI, Junie, JetBrains AI Assistant, Augment (Auggie CLI), Factory Droid, Kiro, Devin CLI +12

Values in angle brackets are placeholders. Restart Claude Desktop after editing its config.Claude Desktop docs

README

synced Oct 28, 2026

Polya gives AI agents operations for cipher decoding, symbolic constraints, automata and exact candidate checks. Python, a JSON CLI and a stdio MCP server share the same contracts. The agent picks the strategy; each operation does one bounded computation and says what its result covers.

See it work

Three short CLI recordings, using synthetic inputs and the base install.

Find an operation and inspect its input. Search for Vigenere, then ask for a ready-to-run JSON example.

Decode a supplied cipher. With key LEMON, LXFOPVEFRNHR becomes ATTACKATDAWN. The result includes source offsets and the transformation's scope.

Enumerate a finite constraint system. Two binary variables must differ. Polya returns both assignments and reports COMPLETE after exhausting this system.

Copy the commands or re-record the demos.

Quick start

python -m pip install "git+https://github.com/Amal-David/polya.git"

The distribution will be polya-puzzles on PyPI; publication is pending. Optional extras (images, Z3, CP-SAT, AALpy) are listed in getting started.

polya find vigenere --limit 1
polya inspect cipher.polyalphabetic --example
polya run cipher.polyalphabetic --result-only \
  --json '{"text":"LXFOPVEFRNHR","key":"LEMON","variant":"vigenere"}'

The decoded text is ATTACKATDAWN. Omit --result-only to include the execution receipt. Use polya list for the full catalogue, or polya inspect <operation_id> for its contract; add --schema for the full JSON schema.

The same Vigenere example in Python:

from polya import run

result = run("cipher.polyalphabetic", {
    "text": "LXFOPVEFRNHR",
    "key": "LEMON",
    "variant": "vigenere",
})["result"]
assert result["text"] == "ATTACKATDAWN"

Use with agents

Run polya mcp as a local stdio server, or deploy the included remote HTTPS adapter to Render. Both expose puzzle.find to search for or inspect an operation, and puzzle.run to execute one. Start with the complete agent workflow for evidence, model checks, experiment choice, execution and continuation. See also MCP and agent setup.

Investigation council

Use the evidence-first council and investigation guide for evidence packets, local artifact handles, next-test ranking, bounded unknown-key proposals and matched agent evaluation. Four read-only subagent definitions are included; the host supplies actual model execution. No vote is treated as proof.

For educational puzzles, source-backed method selection adds six cited teaching cases, method.retrieve, and offline fresh-context/evaluation helpers. These are development references; no learned solving gain is claimed.

What it covers

AreaOperations
Image evidenceartifact.png_bitplane: lossless PNG channel and bit selection with source hashes and pixel coordinates
Ciphers and decodingcipher.polyalphabetic, cipher.bifid, cipher.checkerboard, cipher.periodic_cribs, grid.traverse, text.symbol_map, bytes.from_radix
Mechanism searchmechanism.recipe_scan over recipe products; mechanism.plan_scan over typed artifact-to-target plans with resumable paging
Crypto targetscrypto.openssl_scan calibrated multi-lock scans, crypto.target_check SHA256 and P2PKH checks, pattern.equality_check whole-output patterns
Constraintssymbolic.solve, symbolic.analyze, hypotheses.compare over Z3, CP-SAT or a reference solver; constraints.solve for finite tables
Automataautomata.simulate_many, automata.distinguish for shortest distinguishing inputs, automata.learn_local for bounded active learning
Mathematicsjacobian.find and jacobian.run delegate to an optional, separately installed Jacobian runtime

Every operation is listed in the operation reference.

Scope and limits

Results describe the model and inputs you supply, not the puzzle author's intent. UNKNOWN, timeouts and unavailable backends are not negatives; valid padding is not a solution; bounded conformance does not prove equivalence. Source labels are caller claims, and receipts are not independent reproduction. Raw audio and semantic image interpretation are not implemented. No new open-puzzle solve or agent speedup is claimed.

Documentation

Development

python -m pip install -e ".[test,imaging,z3,learning]"
python -m pytest -q

Pre-stable. See contributing and the maintainer guide in AGENTS.md.

Inspired by Jacobian. MIT; catalogue attribution is in third-party notices.

For compound crypto experiments, use preflight and typed pipelines to compose the existing ciphers, extraction steps and exact checks without custom glue.

↑↓ navigate openesc close