mcp-divination
# divinatory
An MCP server providing AI agents with an entropy source modelled on
traditional divination.
## Getting started
Set up a 3.12 or later Python environment, then:
`pip install divinatory`
Then, from the root of a project:
`divinatory init`
That registers the server with Claude Code and GitHub Copilot CLI
(`.mcp.json`), Codex (`.codex/config.toml`) and Cursor (`.cursor/mcp.json`),
using an absolute path into the environment it was installed in. Only the
server's own entry is written. Re-run it after moving or rebuilding the
environment; `--dry-run` shows what would change. `divinatory uninit`
takes the entries out again.
## Tools
* `secure_seed`: a fresh 128-bit seed, as hex.
* `secure_random`: one-off integers, floats, choices from a list, or a deal
without repeats, from the operating system's secure source.
* `random`: integers, floats or choices from a seed and offset, with
replacement. Repeatable, and continued across calls from the `next_offset`
each result gives.
* `deal`: a deck (a list, or the integers `low` to `high`) shuffled by a seed
and dealt without repeats, continued the same way.
## Documentation
* **[The MCP tools](docs/tools.md)**: every tool's parameters, defaults and
results, and the instructions the server gives a client.
* **[The command line](docs/cli.md)**: `divinatory init` and `uninit`.
* **[The API reference](docs/reference.md)**: the Python package, module by
module.
All three are generated from the source and committed. After changing a
docstring, a tool or the command line, regenerate them; the tests fail until
they match:
```sh
pip install -e ".[docs]"
make -C docs documents
```
## Development
```sh
conda env create -f environment.yml
conda activate divinatory
pip install -e ".[dev]"
pytest
ruff check . && ruff format --check .
```
TDQS
Scored across 4 tools
The four tools have mostly distinct roles: seed generation, OS-secure randomness, seeded repeatable streams, and seeded no-repeat deals. The main overlap is that secure_random can also produce a no-repeat 'deal' and one-off values similar to random, so an agent may occasionally hesitate between secure_random and random/deal. The descriptions explicitly cross-reference each other, which helps resolve most confusion.
Names are all lowercase and readable, but the convention is mixed: secure_seed and secure_random use a secure_ prefix, while random (which is seeded) and deal do not follow a parallel pattern. A cleaner scheme might be generate_seed / secure_random / seeded_random / seeded_deal, but the current set is still interpretable.
Four tools is a tight, well-scoped surface for a randomness/divination server. Each tool covers a distinct mode of operation and none feels redundant. It is slightly thin, but appropriate for the narrow purpose.
The surface covers seed generation, secure one-off randomness, seeded streams, and seeded deals without repeats, which is a coherent lifecycle for the domain. Minor gaps exist, such as no explicit state introspection or reset, but these are workable by taking a new seed.