Skip to main content

aadc-mcp

MatLogica's AADC engine and AADC Tracer, from your coding agent, on your own machine: exact AAD derivatives and Greeks, the AADC documentation, and a trace of where a price came from.

Reach for it when your agent is working on any of these:

  • adding automatic adjoint differentiation (AAD) to a Python pricer, or getting exact Greeks instead of bumping;
  • AAD derivatives that jump at a branch or a kink: the record shows every decision taken and how close it was to going the other way;
  • how to record once and replay many times, batch the evaluation, or get QuantLib sensitivities with AADC: the how-tos and the engine's own agent guide ship inside the server, and every snippet in them runs as written;
  • where a number in a QuantLib or Python pricing came from: which constants, which branches, which source line.

aadc-mcp is a local MCP 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 four 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;
  • a live session for what-ifs: a script that records explicitly with marked inputs stays alive in its own process, so a replay at new inputs is answered by the recording itself and is exact.

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

Install

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:

claude mcp add aadc -- /absolute/path/to/aadc-env/bin/aadc-mcp
{ "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>").

For an exact what-if on a script that records explicitly: open_session("/path/to/my_pricer.py") -> session_id, ask_session(session_id, "leaves kind=input by=leaf"), replay_session(session_id, "#<input>=<value>", "#<output>"), close_session(session_id). The bundled european_greeks is a script of that kind: get_example("european_greeks") returns its path.

Tools

tool what it does
check_environment packages, platform, the licence in one sentence, 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
open_session run a script that records explicitly and keep its process alive; returns session_id, stdout and stats
ask_session the same questions as inspect_tape, answered by the live recording
replay_session replay the live recording at new inputs: exact when the recorded path holds, withheld with the decision named when it does not
close_session, list_sessions end a session and free its process; list the sessions the server holds (idle ones close themselves)

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: free for non-commercial and academic use. Commercial use, including evaluation inside a company, needs a licence: https://matlogica.com/products/aadc-tracer (info@matlogica.com). aadc-mcp --check says which edition runs on your machine.

Metadata

Release files for aadc-mcp 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aadc-mcp 0.2.1
File Size Uploaded Provenance Actions
aadc_mcp-0.2.1.tar.gz 51.9 kB Without provenance Details for aadc_mcp-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aadc-mcp 0.2.1
File Interpreter ABI Platform Actions
aadc_mcp-0.2.1-py3-none-any.whl Python 3 none any Details for aadc_mcp-0.2.1-py3-none-any.whl

Total release size: 113.4 kB

Release files / aadc_mcp-0.2.1.tar.gz

Download URL aadc_mcp-0.2.1.tar.gz
Size 51.9 kB
Tags Source
SHA-256 checksum
How to use checksums
eea543311a7aa1b120ef7b98562c1200777c8ed575b02fc7d20a068dd3d78d44
BLAKE2b-256 checksum
How to use checksums
a6e6d4bb34926260e81e0bd445cfeb64324b87d97cebd310fdb4fc7743f3a380
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.2

Release files / aadc_mcp-0.2.1-py3-none-any.whl

Download URL aadc_mcp-0.2.1-py3-none-any.whl
Size 61.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
74671c535944b3da00a988f886427a3b1da3db177f780198ba5dcd807504fbed
BLAKE2b-256 checksum
How to use checksums
79bf2a9571f61e61feb5802d65e1ce4a71f41b8b930e4db89519f63f92980b55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.2

Security for aadc-mcp 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page