MCP Server (wraquant-mcp)¶
wraquant-mcp exposes wraquant’s 1,097 quantitative finance functions as MCP (Model Context Protocol) tools that Claude, LangChain, and other AI agents can call directly. Instead of writing Python scripts, an AI agent can fit GARCH models, detect market regimes, compute VaR, optimize portfolios, and generate tearsheets – all through structured tool calls with persistent DuckDB state.
Quick Start¶
Install¶
pip install wraquant-mcp
Claude Desktop¶
Add the following to your Claude Desktop config file
(~/.claude/claude_desktop_config.json on macOS/Linux):
{
"mcpServers": {
"wraquant": {
"command": "wraquant-mcp",
"env": {
"PYTHONUNBUFFERED": "1"
}
}
}
}
Then restart Claude Desktop. All 218 tools and 327 prompts are immediately available.
CLI (stdio)¶
wraquant-mcp # Start stdio server for Claude Desktop
HTTP (LangChain / hosted deployments)¶
wraquant-mcp --transport http # Start HTTP server on port 8000
wraquant-mcp --transport http --port 9000 # Custom port
Python (programmatic)¶
from wraquant_mcp import create_server
mcp = create_server("my-quant-server")
mcp.run() # stdio
# or
mcp.run(transport="streamable-http", host="0.0.0.0", port=8000)
Architecture¶
wraquant-mcp is designed to compose with other MCP servers for end-to-end quant workflows:
AI Agent (Claude / LangChain)
|
----------------+----------------
| | |
wraquant-mcp OpenBB MCP DuckDB MCP
(analysis) (market data) (SQL queries)
| | |
+-------+-------+-------+-------+
| |
Shared DuckDB Jupyter MCP
(data.duckdb) (notebooks)
|
Alpaca MCP
(execution)
How it works:
OpenBB MCP fetches market data and stores it in DuckDB
wraquant-mcp reads data from DuckDB, runs analysis, stores results back
DuckDB MCP lets the agent query any stored dataset with SQL
Jupyter MCP connects to the same DuckDB file for notebook exploration
Alpaca MCP executes trades based on wraquant analysis
All MCPs share the same DuckDB file
(~/.wraquant/workspaces/default/data.duckdb), enabling seamless
composition without data copying.
Tool Tiers¶
Tier |
Description |
Count |
Loading |
|---|---|---|---|
Tier 1 |
Discovery and workspace tools |
5 |
Always loaded |
Tier 2 |
Hand-crafted analysis tools across 22 modules |
205 |
Always loaded |
Tier 3 |
Auto-registered wraquant functions via ToolAdaptor |
~900+ |
Always loaded |
Prompts |
Guided multi-step workflow templates |
327 |
Always loaded |
Tier 2 tools are curated, optimized wrappers with domain-specific logic.
Tier 3 tools are auto-generated from wraquant’s __all__ exports –
every public function is available, wrapped with automatic DuckDB dataset
resolution and JSON-safe output serialization.
Tool Reference by Module¶
Discovery tools (Tier 1)¶
list_modules– List all 22+ analysis modules with descriptions and function countslist_tools– List available tools in a specific moduleworkspace_status– Show current datasets, models, and journal stateworkspace_history– Show recent operations in the journaladd_note– Add a research note to the workspace journal
Common operations (Tier 1)¶
analyze– Comprehensive analysis (stats, risk, stationarity, regime, GARCH)compute_returns– Compute simple or log returns from pricescompute_indicator– Compute any of 265 TA indicatorsfit_garch– Fit GARCH/EGARCH/GJR volatility modelsdetect_regimes– Detect market regimes (HMM, GMM, changepoint)risk_metrics– Compute Sharpe, Sortino, max drawdown, hit ratiodataset_info– Get schema, stats, lineage, and sample rows for a datasetstore_data– Store inline data as a workspace dataset
Module tools (Tier 2, 22 modules)¶
Module |
Tools |
Key tools |
|---|---|---|
risk |
15 |
|
data |
17 |
|
microstructure |
16 |
|
viz |
14 |
|
math |
14 |
|
regimes |
12 |
|
vol |
11 |
|
stats |
11 |
|
ta |
11 |
|
ts |
10 |
|
backtest |
10 |
|
execution |
10 |
|
ml |
9 |
|
price |
9 |
|
opt |
8 |
|
causal |
7 |
|
bayes |
7 |
|
econometrics |
6 |
|
forex |
6 |
|
experiment |
5 |
|
fundamental |
5 |
|
news |
5 |
|
Supervisor tools (Tier 2)¶
recommend_workflow– Given an analysis goal, recommend tools and step ordermodule_guide– Get a usage guide for any wraquant module
Workspace management (Tier 2)¶
create_workspace– Create a new isolated research workspaceopen_workspace– Open an existing workspace, restoring all statelist_workspaces– List all workspaces with metadatasnapshot– Create a named checkpoint of the current workspacerestore_snapshot– Restore workspace to a previous snapshotdelete_workspace– Delete a workspace and all its dataquery_data– Run SQL (SELECT) against the workspace DuckDB
Prompt Catalog¶
327 prompt templates organized across 16 categories. Each template guides an AI agent through a multi-step quantitative finance workflow, explaining which tools to call, in what order, and how to interpret results.
Categories:
Risk analysis – VaR estimation, stress testing, risk decomposition, tail risk, copula analysis, credit risk
Volatility – GARCH fitting, model selection, forecasting, realized vol, stochastic vol, news impact
Regime detection – HMM fitting, state interpretation, regime statistics, regime-conditional portfolios
Portfolio optimization – MVO, risk parity, Black-Litterman, HRP, efficient frontier, rebalancing
Technical analysis – Indicator computation, signal scanning, pattern recognition, multi-timeframe
Backtesting – Strategy backtesting, walk-forward, regime backtesting, performance analysis
Machine learning – Feature engineering, training, walk-forward ML, PCA, isolation forest, online learning
Pricing – Options pricing, Greeks, implied vol, SABR, bond duration, yield curve, process simulation
Statistical analysis – Regression, correlation, distribution fitting, cointegration, stationarity
Time series – Forecasting, decomposition, changepoints, anomaly detection, SSA
Econometrics – VAR, panel regression, structural breaks, impulse response, event studies
Microstructure – Liquidity metrics, toxicity, market quality, spread decomposition
Execution – Optimal scheduling, transaction cost analysis, Almgren-Chriss, slippage
Causal inference – Granger causality, DID, synthetic control, regression discontinuity
Fundamental analysis – Financial ratios, DCF valuation, stock screening, financial health
News & sentiment – Sentiment scoring, earnings analysis, insider tracking, SEC filings
Full Documentation¶
For the complete tool catalog, prompt listing, and advanced configuration options, see the wraquant-mcp README on GitHub.
See also
Getting Started – Installing wraquant and wraquant-mcp
Changelog – Version history and release notes
API Reference – Full Python API reference