Agent Integration

Use the RiskModels API with your AI assistant of choice to perform quant research, graph residuals, and analyze hedge ratios—all from natural language.

Fastest — Start in 60 seconds
Any Terminal

Install the npm package globally. No AI configuration needed — your agent can also call these commands from its terminal panel.

npm install -g riskmodels-cli
riskmodels config set apiKey YOUR_API_KEY

Get your API key at riskmodels.app/get-key

Enhanced — Native AI tool calls via MCP
Cursor
Cursor

Paste the Rules for AI prompt below so Cursor understands RiskModels field names automatically. Optionally add the MCP server for live inline tool calls inside the chat panel.

Claude Desktop
Claude Desktop

Add the RiskModels MCP server to your Claude Desktop config so Claude can fetch live risk data, compute hedge ratios, and generate plots autonomously.

Zed
Zed

Add the MCP server to your Zed assistant config. Zed auto-discovers available tools so you can query live risk data inline as you code. See MCP setup ↓


Cursor Rules for AI Prompt

Paste this into Project Settings → Rules for AI (or save as .cursorrules in your project root):

You are a RiskModels Analyst. Your goal is to help me perform quant research.

1. Use the RiskModels MCP server for discovery: `riskmodels_list_endpoints`,
   `riskmodels_get_capability`, `riskmodels_get_schema` (see mcp/README.md).
2. For live data (metrics, batch portfolio, L3 series), call the REST API or use
   `riskmodels-py` — the repo MCP server does not expose separate portfolio/decomposition tools.
3. When asked to "graph the residuals," fetch L3 decomposition or returns via
   GET /api/l3-decomposition or GET /api/ticker-returns (or the Python SDK) and plot
   explained-risk or residual columns per SEMANTIC_ALIASES.md.
4. For hedge ratios in user-facing tables, prefer semantic names: l3_market_hr,
   l3_sector_hr, l3_subsector_hr (SDK); raw JSON may use l3_mkt_hr-style keys.
5. Refer to SEMANTIC_ALIASES.md in the workspace for math definitions.

If I ask: "Graph market residuals for META," fetch the appropriate time series from
the API or SDK and generate a Python plot.

MCP Server Setup

Add to .cursor/mcp.json (or your Claude Desktop / Zed config):

# Build the MCP server first (required before first use)
cd mcp && npm ci && npm run build
{
  "mcpServers": {
    "riskmodels-api": {
      "command": "node",
      "args": ["/absolute/path/to/RiskModels_API/mcp/dist/index.js"]
    }
  }
}

The args path must point to mcp/dist/index.js — the compiled output. If dist/ does not exist, run the build command above.

Restart your editor after saving. See the MCP server README for full setup.


Related