StatsPAI — Claude Code MCP server: features and setup
StatsPAI — an MCP server for Claude Code gives an agent tools for econometrics and causal inference. It handles requests involving DiD, IV, RD, and synthetic control.
MIT ★ 378 updated 2026-11-13
claude mcp add --env STATSPAI_MCP_DATA_ROOTS=<STATSPAI_MCP_DATA_ROOTS> --env STATSPAI_MCP_PROFILE=<STATSPAI_MCP_PROFILE> --transport stdio statspai -- uvx statspaiWhat StatsPAI does
StatsPAI exposes Python functions for econometric models and causal analysis through MCP. Its methods cover difference-in-differences, instrumental variables, regression discontinuity, and synthetic control; the project also describes DML. Some routines follow conventions familiar to Stata and R users.
Validation varies by function. Some estimates were compared with R or Stata using the same data; others were tested with simulations whose true results were known. Many functions have a stable API without a claim of numerical parity, and each function has its own validation status. The server install command runs StatsPAI through uvx.
What it helps with
- estimate an intervention effect with DiD
- fit a model with instrumental variables
- test a regression discontinuity design
- build a synthetic control
Example prompts for the agent
- Estimate the program's effect with DiD using this dataset.
- Run a regression discontinuity analysis and explain the result.
- Build a synthetic control for this panel dataset.
How to install StatsPAI
Platform CLI
claude mcp add --env STATSPAI_MCP_DATA_ROOTS=<STATSPAI_MCP_DATA_ROOTS> --env STATSPAI_MCP_PROFILE=<STATSPAI_MCP_PROFILE> --transport stdio statspai -- uvx statspaiReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from statspai <command>
Platform CLI
codex mcp add statspai --env STATSPAI_MCP_DATA_ROOTS=<STATSPAI_MCP_DATA_ROOTS> --env STATSPAI_MCP_PROFILE=<STATSPAI_MCP_PROFILE> -- uvx statspaiReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from statspai <command>
Config file
{
"mcpServers": {
"statspai": {
"command": "uvx",
"args": [
"statspai"
],
"env": {
"STATSPAI_MCP_DATA_ROOTS": "<STATSPAI_MCP_DATA_ROOTS>",
"STATSPAI_MCP_PROFILE": "<STATSPAI_MCP_PROFILE>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from statspai <command>
Config file
{
"servers": {
"statspai": {
"type": "stdio",
"command": "uvx",
"args": [
"statspai"
],
"env": {
"STATSPAI_MCP_DATA_ROOTS": "<STATSPAI_MCP_DATA_ROOTS>",
"STATSPAI_MCP_PROFILE": "<STATSPAI_MCP_PROFILE>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from statspai <command>
Platform CLI
gemini mcp add -e STATSPAI_MCP_DATA_ROOTS=<STATSPAI_MCP_DATA_ROOTS> -e STATSPAI_MCP_PROFILE=<STATSPAI_MCP_PROFILE> statspai uvx statspaiReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from statspai <command>
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about StatsPAI
How do I install StatsPAI in Claude Code?
Run claude mcp add statspai -- uvx statspai. To configure environment variables, use `claude mcp add --env STATSPAI_MCP_DATA_ROOTS=<STATSPAI_MCP_DATA_ROOTS> --env STATSPAI_MCP_PROFILE=<STATSPAI_MCP_PROFILE> --transport stdio statspai -- uvx statspai` instead.
What does StatsPAI do?
It provides MCP clients with StatsPAI functions for econometrics and causal inference, including DiD, instrumental-variable models, and regression discontinuity.
How are StatsPAI methods validated?
Validation differs across functions. Some were checked against R or Stata on matching data, while others were tested with simulations that have known results. Each function has a validation status.