Skip to main content
Glama
README.md
# aadc-mcp

<!-- mcp-name: com.matlogica/aadc-mcp -->

**MatLogica's AADC engine and AADC Tracer, from your coding agent, on your own machine.**

`aadc-mcp` is a local [MCP](https://modelcontextprotocol.io) server. It runs over stdio inside the Python
environment where the AADC packages are installed, and gives an agent in Claude Code, Cursor, Codex or any other MCP
client three things:

- **a measured environment check**: which packages and versions are here, whether the engine runs (it records,
  replays and differentiates a two-line function and checks the answer), whether QuantLib tracing attributes anything,
  and the pip command for whatever is missing;
- **tracing of your own script with no code changes**: the script runs with recording on and leaves a tape; a
  QuantLib pricer written against `aadc-quantlib-tracing` needs nothing added;
- **the questions a tape answers**: the constants the price depends on that nobody passed in, each at its C++ line;
  every decision frozen at record time and how far it was from going the other way; where a printed number was
  computed and the formula behind it; the source line with the recorded values written in, hash-checked against the
  compiled file; and a replay at new inputs that is exact when every recorded decision can be re-checked, and
  otherwise withheld, naming the decision it cannot vouch for.

Every number and every `file:line` in an answer is the engine's own output. The agent narrates; it never computes.

## Install

```sh
python3 -m venv aadc-env && . aadc-env/bin/activate
pip install "aadc-mcp[quantlib]"      # Linux x86-64, macOS arm64: aadc + QuantLib 1.41 with source tracing
pip install aadc-mcp                   # elsewhere: aadc only (tracing of QuantLib needs Linux x86-64 or macOS arm64)
pip install "aadc-mcp[greeks]"         # adds aadc-quantlib: QuantLib 1.38 with exact AAD sensitivities, every platform
```

`aadc-mcp --check` prints what runs here, and the pip command for anything missing, before you register anything.

Register it with the absolute path of the console script, so the client always finds the right interpreter:

```sh
claude mcp add aadc -- /absolute/path/to/aadc-env/bin/aadc-mcp
```

```json
{ "mcpServers": { "aadc": { "command": "/absolute/path/to/aadc-env/bin/aadc-mcp" } } }
```

## First three calls

```
check_environment()
run_example("european_option")                               -> tape_id
inspect_tape(tape_id, "branches order=margin limit=5")       -> the decisions closest to flipping, with file:line
```

Then on your own code: `trace_script("/path/to/my_pricer.py")`, `inspect_tape(tape_id, "leaves kind=constant")`,
`inspect_tape(tape_id, "find value=<the printed price>")`, `replay(tape_id, "#<input>=<value>", "#<output>")`.

## Tools

| tool | what it does |
|---|---|
| `check_environment` | packages, platform, licence state, engine self-test, tracing self-test, findings with fixes |
| `trace_script` | run a `.py` file with tracing on, keep the tape, return stdout, census and stats |
| `inspect_tape` | one question in the engine's grammar: `stats`, `leaves`, `branches`, `sites`, `at`, `find`, `origin`, `uses`, `cone`, `source` |
| `replay` | re-evaluate the tape at new inputs; exact when every recorded decision re-checks, withheld when one flips or cannot be checked |
| `set_source_root` | map the compiled source prefix to a local tree so `at` shows code, with `hash=ok` or `hash=MISMATCH` |
| `load_tape`, `list_tapes` | register a tape written elsewhere; list what the server holds |
| `list_examples`, `get_example`, `run_example` | six bundled scripts: plain AADC (any platform) and unmodified QuantLib pricers |

Resources: two how-tos whose every snippet the tests run (using AADC: record once, replay, exact derivatives, batch,
QuantLib sensitivities; using the Tracer: the two ways to record, the switches, the questions in order, when a replay
is exact), the agent guide and the release notes shipped inside the `aadc` wheel, the verbs reference, a get-started
page, the package and platform matrix, and the tracing documentation (for agents, for people, model validation, how it
works). Prompts: `get_started`, `validate_pricer`, `add_sensitivities`.

## Scope

The server runs your code on your machine; it is a developer tool, not a sandbox or a hosted service. A tape is one
execution at one input point: it supports "this executed" and "this constant is declared at file:line", never "this is
the only path". The source behind a line is shown when you point `set_source_root` at a matching QuantLib 1.41 `ql/`
tree; the answer says whether the file matches the compiled one.

Platforms follow the packages: `aadc` on Linux x86-64 and arm64, macOS arm64 and Windows x86-64 (CPython 3.10 to 3.14);
`aadc-quantlib-tracing` on Linux x86-64 and macOS arm64. Intel Macs are not supported: the engine has no wheel for them.

## Licence

Proprietary, MatLogica. The `aadc` engine installs in Community Edition: non-commercial and academic use. Commercial
use needs a licence: info@matlogica.com.

TDQS

A3.5/5.0

Scored across 10 tools

Disambiguation4/5

Most tools have clearly distinct purposes across the tracing lifecycle: environment check, trace/run, load/list, inspect, replay, source mapping, and examples. Minor overlap exists because inspect_tape supports a 'replay' verb despite a dedicated replay tool, and run_example and trace_script both run code and produce tapes, though their scopes are clearly differentiated.

Naming Consistency4/5

Names are consistently snake_case and mostly follow a verb_noun pattern such as check_environment, trace_script, inspect_tape, load_tape, and set_source_root. The only notable deviation is the bare verb 'replay', which is still clear but breaks the otherwise predictable pattern.

Tool Count5/5

Ten tools is well-scoped for a tracing, inspection, and replay server. Each tool corresponds to a meaningful stage or object in the workflow, with no obviously redundant or trivial tools.

Completeness4/5

The surface covers the core lifecycle: environment validation, tracing scripts and examples, loading and listing tapes, inspecting and replaying tapes, source-root mapping, and example discovery. Minor gaps remain around tape cleanup/removal or export, but agents can work around them for the stated tracing and debugging purpose.

Maintenance

ActivityMaintained
ResponsivenessNo issues