╭─╮╭┬╮╶┬╴ ╭─╮╷ ╷╶┬╮╭─╮╷╭ ╷ ╷
╰─╮│││ │ ╰─╮│ │ │││ │├┴╮│ │
╰─╯╵ ╵ ╵ ╰─╯╰─╯╶┴╯╰─╯╵ ╵╰─╯
smt-sudoku-mcp
Now, your agents can play Sudoku confidently!
An MCP server that demonstrates the power of satisfiability modulo theories (SMT) solving, using Z3, through the classic constraint-satisfaction puzzle of Sudoku.
Sudoku maps cleanly onto SMT primitives: generating a puzzle means finding a model that satisfies the Sudoku constraints and then proving a reduced set of clues still has only one solution; validating a grid means checking those same constraints against given cell values; solving a puzzle means finding a model or proving none exists.
Tools
All four tools are stateless: every call takes and/or returns a complete grid explicitly, with no server-side session state.
A Sudoku grid is represented as {"rows": [[...9 ints...], ...9 rows...]}, where each cell is 1-9 for a given digit or 0 for an empty cell. Any tool result that names a specific cell (a conflict) reports row/col as 1-indexed, matching how Sudoku cells are conventionally described in text (row 1, column 1 is the top-left cell).
generate_sudoku_puzzle
Generates a new, uniquely-solvable Sudoku puzzle.
- Input:
difficulty— one of"easy","medium", or"hard"(default"medium"), mapping to an approximate target clue count. - Output:
{"puzzle": <grid>, "difficulty": <str>, "givens": <int>}—givensis the actual number of filled cells, which may be slightly above the target if removing further cells would have broken uniqueness.
validate_partial_sudoku_solution
Checks whether a partially-filled grid is conflict-free and, if so, whether it can still be completed.
- Input:
grid— a partial grid (0 for empty cells). - Output:
{"has_conflicts": <bool>, "conflicts": [<cell>, ...], "is_completable": <bool | null>}—is_completableisnullwhen conflicts are present, since completability is not a meaningful question until they are resolved.
validate_full_sudoku_solution
Checks whether a fully-filled grid is a correct Sudoku solution.
- Input:
grid— expected to have no empty cells. - Output:
{"is_valid": <bool>, "has_empty_cells": <bool>, "conflicts": [<cell>, ...]}.
solve_sudoku_puzzle
Solves an unsolved grid, or reports why it cannot be solved.
- Input:
grid— a partial grid to solve (0 for empty cells). - Output:
{"status": "satisfiable" | "conflicting_givens" | "unsatisfiable", "solution": <grid | null>, "conflicts": [<cell>, ...]}.conflictsis only populated whenstatusis"conflicting_givens"(two given cells directly violate a row/column/box rule);"unsatisfiable"means the givens are pairwise conflict-free but no completion exists.
Installation
Requires Python 3.13+ and uv.
uv sync
uv run smt-sudoku-mcp
Configuration
Environment variables, all optional:
| Variable | Default | Description |
|---|---|---|
SMT_SUDOKU_MCP_TRANSPORT |
stdio |
stdio or streamable-http |
SMT_SUDOKU_MCP_HOST |
127.0.0.1 |
Bind host, streamable-http only |
SMT_SUDOKU_MCP_PORT |
8000 |
Bind port, streamable-http only |
SMT_SUDOKU_MCP_ALLOWED_ORIGINS |
(none) | Comma-separated browser origins to trust, streamable-http only |
Development
See AGENTS.md for architecture notes and the full set of development commands (just -l).
Contributing
Issues and pull requests are welcome.
License
MIT.
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 smt_sudoku_mcp-0.1.0.tar.gz.
File metadata
- Download URL: smt_sudoku_mcp-0.1.0.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.6 {"installer":{"name":"uv","version":"0.12.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
298c3aaf0ff3308cac48ac39604855ac87d78085c56a11c47676a327d368d47b
|
|
| MD5 |
8fdd9522ada03d4d7f5e30ea23642329
|
|
| BLAKE2b-256 |
fab0bc0ee05aacbdaa98c543aa0294c9c12c0fa4a9467afdad3d8f11bf138cdc
|
File details
Details for the file smt_sudoku_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: smt_sudoku_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.6 {"installer":{"name":"uv","version":"0.12.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f18cc87c5b622e0c061bbd5cae342acb97a8c486f33f1a838089f4c7ac2b8f8
|
|
| MD5 |
6dc9102cfeb85a6792fffc21215e74b4
|
|
| BLAKE2b-256 |
6bea635c4cec5732b402aa9a75bcadd4980d29c9fd6b6fc4f6def93248d277f7
|