# StatsPAI

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.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 378 repo stars
- Author: brycewang-stanford
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/brycewang-stanford/StatsPAI
- Updated: 2026-11-13
- Security check: automated, 2026-11-17 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/mcp/statspai

## What it 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`.

## Requirements
- Needs: Python and uv (commands run via uvx)
- Environment variables: `STATSPAI_MCP_DATA_ROOTS`, `STATSPAI_MCP_PROFILE` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add --env STATSPAI_MCP_DATA_ROOTS=<STATSPAI_MCP_DATA_ROOTS> --env STATSPAI_MCP_PROFILE=<STATSPAI_MCP_PROFILE> --transport stdio statspai -- uvx statspai
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from statspai <command>

### Codex

**Platform CLI**
```bash
codex mcp add statspai --env STATSPAI_MCP_DATA_ROOTS=<STATSPAI_MCP_DATA_ROOTS> --env STATSPAI_MCP_PROFILE=<STATSPAI_MCP_PROFILE> -- uvx statspai
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from statspai <command>

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "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>

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "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>

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e STATSPAI_MCP_DATA_ROOTS=<STATSPAI_MCP_DATA_ROOTS> -e STATSPAI_MCP_PROFILE=<STATSPAI_MCP_PROFILE> statspai uvx statspai
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from statspai <command>

## When to use it
- estimate an intervention effect with DiD
- fit a model with instrumental variables
- test a regression discontinuity design
- build a synthetic control

## Example prompts
- 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.

## Similar
- [StatsPAI_skill](https://affpapa.org/en/nevibecode/skills/statspai-skill.md) — skill · ★ 240 repo stars
- [r-econometrics](https://affpapa.org/en/nevibecode/skills/r-econometrics.md) — skill · 340 installs
- [stata-regression](https://affpapa.org/en/nevibecode/skills/stata-regression.md) — skill · 430 installs
- [stata](https://affpapa.org/en/nevibecode/skills/franklee16-stata.md) — skill · ★ 240 repo stars
- [Causal Inference](https://affpapa.org/en/nevibecode/skills/causal-inference.md) — skill · 544 installs

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
