Skip to main content
Glama
JACTUS MCP Server

JACTUS MCP Server

by pedronahum

JACTUS MCP Server

Standalone MCP server for JACTUS — Enables AI assistants like Claude Code to directly access JACTUS financial contract simulation capabilities.

What is this?

Model Context Protocol (MCP) is a protocol that allows AI assistants to interact with external tools. This package gives Claude (and other MCP-compatible assistants) the ability to discover, validate, and simulate all 18 ACTUS financial contract types powered by JACTUS.

Related MCP server: Structured-Products-MCP-Server

Installation

pip install jactus-mcp

This installs the MCP server and pulls jactus as a dependency automatically.

Download Docs & Examples

After installing, optionally download JACTUS documentation and examples from GitHub:

jactus-mcp setup

This downloads the matching version's docs/ and examples/ into ~/.jactus-mcp/data/. You can also specify a tag:

jactus-mcp setup --tag v0.2.0   # specific version
jactus-mcp setup --force         # re-download
jactus-mcp status                # check what's downloaded
jactus-mcp clean                 # remove downloaded data

From GitHub

pip install git+https://github.com/pedronahum/JACTUS-MCP.git

For Development

git clone https://github.com/pedronahum/JACTUS-MCP.git
cd JACTUS-MCP
pip install -e ".[dev]"

Configuration

Claude Code

Add to your Claude Code MCP settings (.mcp.json or settings):

{
  "mcpServers": {
    "jactus": {
      "command": "jactus-mcp"
    }
  }
}

Or using Python module:

{
  "mcpServers": {
    "jactus": {
      "command": "python",
      "args": ["-m", "jactus_mcp"]
    }
  }
}

Claude Desktop

Add to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "jactus": {
      "command": "jactus-mcp"
    }
  }
}

Transport Options

# Default: stdio transport (for local clients)
jactus-mcp
# or
python -m jactus_mcp

# Streamable HTTP transport (for remote clients)
python -m jactus_mcp --transport streamable-http

Features

Core Tools (always available)

These tools work with just pip install jactus-mcp — no source tree needed:

Tool

Description

jactus_list_contracts

List all 18 contract types by category

jactus_get_contract_info

Get detailed info about a contract type

jactus_get_contract_schema

Get required/optional parameters for all 18 types

jactus_get_event_types

List all ACTUS event types

jactus_list_risk_factor_observers

List all risk factor observer types

jactus_simulate_contract

Simulate a contract and get structured cash flows

jactus_validate_attributes

Validate contract attributes before simulation

jactus_compute_risk

Compute DV01, delta, gamma, PV01 risk metrics

jactus_simulate_portfolio

Simulate a portfolio with aggregation

jactus_get_topic_guide

Structured guides on 7 topics

jactus_get_quick_start

Built-in PAM quick start example

jactus_health_check

Verify installation and JACTUS availability

jactus_get_version_info

Version information

Docs & Example Tools (requires setup)

These tools require JACTUS docs/examples. Enable them with jactus-mcp setup:

Tool

Description

jactus_search_docs

Search across JACTUS documentation

jactus_get_doc_structure

Browse documentation files and headers

jactus_list_examples

List Python scripts and notebooks

jactus_get_example

Retrieve example source code

jactus_run_example

Execute an example

Alternatively, point to a local JACTUS checkout:

export JACTUS_ROOT=/path/to/JACTUS

MCP Resources

Resource URI

Description

jactus://docs/architecture

System architecture guide

jactus://docs/pam

PAM contract walkthrough

jactus://docs/derivatives

Derivative contracts guide

jactus://docs/readme

Project overview

jactus://contract/{type}

Dynamic contract info + schema

MCP Prompts

Prompt

Description

create_contract

Guide to create a new contract

troubleshoot_error

Help troubleshoot errors

understand_contract

Explain a contract type

compare_contracts

Compare two contract types

Quick Example

With the MCP server running, ask Claude:

"Simulate a $100k PAM loan at 5% interest maturing in 1 year"

Claude will:

  1. Call jactus_get_contract_schema("PAM") to get required fields

  2. Call jactus_simulate_contract with the attributes

  3. Return structured cash flow events (IED, IP, MD) with payoff amounts

Contract Types

JACTUS implements all 18 ACTUS contract types:

  • Principal: PAM, LAM, LAX, NAM, ANN, CLM

  • Non-Principal: UMP, CSH, STK

  • Exotic: COM

  • Derivatives: FXOUT, OPTNS, FUTUR, SWPPV, SWAPS, CAPFL, CEG, CEC

Development

Running Tests

# Unit tests
pytest tests/ -v --ignore=tests/test_mcp_integration.py

# Integration tests (requires MCP stdio client)
pytest tests/test_mcp_integration.py -v

# All tests
pytest tests/ -v

Architecture

JACTUS-MCP/
├── src/jactus_mcp/
│   ├── __init__.py            # Package version
│   ├── __main__.py            # python -m jactus_mcp entry point
│   ├── server.py              # FastMCP server (tools, resources, prompts)
│   ├── models.py              # Pydantic response models
│   └── tools/
│       ├── _utils.py          # Shared utilities (get_jactus_root, type conversion)
│       ├── contracts.py       # Contract discovery & schema (18 types)
│       ├── simulate.py        # Contract simulation
│       ├── examples.py        # Example retrieval & execution
│       ├── validation.py      # Attribute validation
│       ├── documentation.py   # Documentation search & topic guides
│       ├── risk.py            # Risk analytics (DV01, delta, gamma)
│       └── system.py          # Health checks & version info
├── tests/                     # Comprehensive test suite
├── pyproject.toml             # Package configuration
└── README.md

License

Apache License 2.0

Available Tools

18 tools
jactus_compute_riskA

Compute risk metrics (DV01, delta, gamma, PV01) for a contract.

Uses finite difference approximation on the nominal interest rate. Returns the metric value, base PV, and computation parameters.

Args: attributes: Contract attributes dict (same format as simulate). risk_metric: One of "dv01", "delta", "gamma", "pv01". base_rate: Base nominal interest rate (default 0.05). bump_size: Finite difference bump size (default 0.0001 = 1bp).

Inputs: attributes (required), base_rate, bump_size, risk_metric. Returns: object

jactus_get_contract_infoA

Get detailed information about a specific ACTUS contract type.

Returns the contract description, category, implementation class, MCP simulatability status, and whether a ChildContractObserver is required. Use this to understand what a contract type represents and whether it can be simulated via MCP.

Args: contract_type: ACTUS contract type code. Examples: PAM (bonds/loans), LAM (amortizing loans), ANN (mortgages), SWPPV (interest rate swaps), OPTNS (options), FXOUT (FX forwards).

Inputs: contract_type (required). Returns: object

jactus_get_contract_schemaA

Get required and optional parameters for a contract type.

Returns field names, types, descriptions, and example Python code — everything needed to build valid attributes for jactus_simulate_contract. This is the authoritative source for contract parameters; there is no need to read source code.

Also indicates whether the contract can be simulated via MCP or requires the Python API (e.g., contracts needing a ChildContractObserver).

Args: contract_type: ACTUS contract type code (e.g., PAM, LAM, SWPPV).

Inputs: contract_type (required). Returns: object

jactus_get_doc_structureA

Get the structure of JACTUS documentation, listing all files with their section headers.

Returns available documentation files with their headers, useful for understanding what documentation is available before searching.

Note: Requires JACTUS source tree access. Set JACTUS_ROOT env var if needed.

Inputs: no named parameters. Returns: object

jactus_get_event_typesA

List all ACTUS event types with descriptions.

Returns event type codes (IED, IP, PR, MD, RR, etc.) and their meanings. Events represent cash flows and state transitions during a contract's life. Use this to understand the events returned by jactus_simulate_contract.

Inputs: no named parameters. Returns: object

jactus_get_exampleA

Retrieve a specific code example's source code.

Returns the full source code, docstring, and metadata for an example. Use jactus_list_examples first to see available examples.

Note: Requires JACTUS source tree access. Set JACTUS_ROOT env var if needed.

Args: example_name: Name of the example (e.g., pam_example, interest_rate_swap_example).

Inputs: example_name (required). Returns: object

jactus_get_quick_startA

Get a simple quick start example showing a basic PAM contract simulation.

Returns ready-to-run Python code that creates a PAM (Principal at Maturity) contract and simulates it. Good starting point for learning the JACTUS API.

Inputs: no named parameters. Returns: result

jactus_get_topic_guideA

Get a structured guide for a specific JACTUS topic.

Returns a comprehensive markdown guide on the requested topic. More focused than jactus_search_docs for common areas.

Args: topic: Topic name. Available: "contracts" (overview of all types), "behavioral" (behavioral observers, callout events, prepayment/deposit models), "scenario" (scenario management, bundling observers), "jax" (JAX integration and autodiff), "events" (event types and lifecycle), "attributes" (contract parameters and conventions), "array_mode" (batch simulation, portfolio API, GPU/TPU acceleration).

Inputs: topic (required). Returns: object

jactus_get_version_infoA

Get JACTUS and MCP server version information.

Returns versions for both the MCP server and the JACTUS library, plus Python version and compatibility status.

Inputs: no named parameters. Returns: object

jactus_health_checkA

Verify MCP server and JACTUS are working correctly.

Checks that JACTUS is installed and importable, examples and docs are accessible, and contracts are registered. Returns status ("healthy", "degraded", or "unhealthy") with specific check results.

Inputs: no named parameters. Returns: object

jactus_list_contractsA

List all 18 available ACTUS contract types organized by category.

Returns contract types grouped into: principal (PAM, LAM, LAX, NAM, ANN, CLM), non-principal (UMP, CSH, STK), exotic (COM), and derivative (FXOUT, OPTNS, FUTUR, SWPPV, SWAPS, CAPFL, CEG, CEC).

Start here to discover which contract type matches your financial instrument. Follow up with jactus_get_contract_info for details or jactus_get_contract_schema for the required parameters.

Inputs: no named parameters. Returns: object

jactus_list_examplesA

List all available code examples in JACTUS.

Returns Python scripts and Jupyter notebooks from the examples directory. Use jactus_get_example to retrieve the code or jactus_run_example to execute it.

Note: Requires JACTUS source tree access. Set JACTUS_ROOT env var if needed.

Inputs: no named parameters. Returns: object

jactus_list_risk_factor_observersA

List all available risk factor observer types with usage guidance.

Returns observer types organized by complexity, from simple constant values to advanced time-series and curve observers. Each entry includes a description, typical use case, and whether it's available via MCP or requires the Python API.

Use this to determine which risk factor approach to use with jactus_simulate_contract. For MCP simulation, you can use: constant_value (default), risk_factors (dict), or time_series (time-varying). For advanced observers (curves, composites, callbacks, JAX), use the Python API directly.

Also includes behavioral observers (PrepaymentSurfaceObserver, DepositTransactionObserver) that inject callout events into the simulation timeline. These require the Python API.

Inputs: no named parameters. Returns: object

jactus_run_exampleA

Execute a JACTUS example and return its output.

Runs the example in a subprocess with a 30-second timeout and returns stdout, stderr, and return code. Use jactus_list_examples to see available examples.

Note: Requires JACTUS source tree access. Set JACTUS_ROOT env var if needed.

Args: example_name: Name of the example (e.g., pam_example, lam_example).

Inputs: example_name (required). Returns: object

jactus_search_docsA

Search JACTUS documentation for specific topics.

Searches across architecture docs, contract guides, and the README. Returns matching lines with context. Use jactus_get_topic_guide for structured guides on common topics.

Note: Requires JACTUS source tree access. Set JACTUS_ROOT env var if needed.

Args: query: Search query (e.g., 'day count convention', 'state transition', 'rate reset', 'prepayment').

Inputs: query (required). Returns: object

jactus_simulate_contractA

Simulate an ACTUS contract and return structured cash flow events.

Creates a contract from the provided attributes, runs the ACTUS simulation engine, and returns all generated events with payoffs, timing, and optional contract state snapshots. Supports ALL 18 contract types including composite contracts (SWAPS, CAPFL, CEG, CEC) via the child_contracts parameter.

Common workflow:

  1. Use jactus_get_contract_schema to get required fields for your contract type

  2. Build the attributes dict with those fields

  3. Call this tool to simulate

  4. Examine the events and summary in the response

Risk factor observer selection (in priority order):

  1. time_series - Time-varying market data with interpolation (for rate resets)

  2. risk_factors - Fixed per-identifier values (for static market data)

  3. constant_value - Single constant for all risk factors (default: 0.0)

Output size management:

  • For contracts with many events, use event_limit and event_offset to paginate

  • If include_states=True produces output that is too large, events are auto-truncated to first 5 + last 5, with a pagination hint in the response

Args: attributes: Contract attributes dict. Must include contract_type (e.g., "PAM"), status_date (ISO date), contract_role ("RPA" or "RPL"), and type-specific required fields. Use jactus_get_contract_schema to see required fields. risk_factors: Dict mapping risk factor identifiers to constant values. Example: {"LIBOR-3M": 0.05, "USD/EUR": 1.18} time_series: Dict mapping identifiers to time-value pairs for time-varying data. Each entry is [date_string, value]. Example: {"LIBOR-3M": [["2024-01-01", 0.04], ["2024-07-01", 0.045]]} interpolation: Interpolation method for time_series: "step" (default) or "linear". Step uses the most recent known value; linear interpolates between points. Note: both modes give identical results when query dates exactly match data points. To see differences, use data points at different dates than resets. extrapolation: Extrapolation method for time_series: "flat" (default) or "raise". Flat returns the nearest endpoint value; raise returns an error. constant_value: Constant risk factor value (default 0.0). Used only when neither risk_factors nor time_series is provided. include_states: If True, include contract state before/after each event. Warning: this significantly increases output size for contracts with many events. event_limit: Maximum number of events to return. Use with event_offset for pagination. The summary always covers all events regardless. event_offset: Number of events to skip from the beginning (default 0). child_contracts: Dict mapping child identifiers to their attribute dicts. Required for composite contracts (SWAPS, CAPFL, CEG, CEC). Each child is simulated first, then its results are fed into the parent contract. The identifiers must match those referenced in the parent's contract_structure. Example for SWAPS: {"LEG1": {PAM attrs...}, "LEG2": {PAM attrs...}} Example for CAPFL/CEG/CEC: {"LOAN-001": {PAM attrs...}}

Returns: Dict with: success, contract_type, num_events, events (list of event dicts), summary (total_inflows, total_outflows, net_cashflow, first/last_event), initial_state, final_state, child_results (if child_contracts provided). If paginated: includes pagination dict. On error: success=False, error, error_type, hint.

Inputs: attributes (required), event_limit, time_series, event_offset, +6 more. Returns: object

jactus_simulate_portfolioA

Simulate a portfolio of contracts and return aggregate results.

Simulates each contract and aggregates total inflows, outflows, and net cashflow across the portfolio. Returns per-contract summaries.

Args: contracts: Array of contract attribute dicts (same format as simulate). risk_factor_rate: Flat risk factor rate for all contracts (default 0.05).

Inputs: contracts (required), risk_factor_rate. Returns: object

jactus_validate_attributesA

Validate contract attributes for correctness before simulation.

Checks that all required fields are present, values are valid, and types are correct. Returns field-level error messages and warnings for unknown fields. Call this before jactus_simulate_contract to catch errors early.

Args: attributes: Contract attributes dictionary to validate. Should include contract_type, status_date, contract_role, and type-specific fields.

Inputs: attributes (required). Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.5/5.0

    Scored across 18 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: listing contracts, getting info/schema, simulating single or portfolio, computing risk, validating, searching docs, etc. No overlap causes ambiguity.

    Naming Consistency5/5

    All tools follow the pattern `jactus_verb_noun` in snake_case, e.g., `jactus_list_contracts`, `jactus_simulate_contract`. No mixing of styles.

    Tool Count5/5

    18 tools is appropriate for a financial contract simulation server, covering the full workflow (exploration, simulation, risk, validation, documentation) without being excessive.

    Completeness5/5

    The tool surface covers the entire lifecycle: discovery (list, info, schema), simulation (single, portfolio, risk), validation, documentation search, and health checks. No obvious gaps.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to perform high-precision Price and Yield calculations for fixed income securities, including institutional risk metrics, using the industry-standard SSCMFI Bond Math Engine.
      -
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI agents to perform fixed-income analytics with built-in validation: every duration is checked numerically and each valuation is tested against the bounds a correct answer must satisfy.
      6
      22 PyPI
      2
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      Enables AI agents to calculate Basel III SA-CCR exposure, run Monte Carlo PFE simulations, compute portfolio VaR/CVaR, and aggregate option Greeks through standard MCP tools and resources.
      4
      MIT