# stata-mcp

An MCP server that lets your AI agent call local Stata for regressions, econometrics and paper replication. Your data and license stay on your machine.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 270
- Author: SepineTam
- License: AGPL-3.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/SepineTam/mcp-for-stata
- Updated: 2026-10-19
- HTML: https://affpapa.org/en/nevibecode/mcp/stata-mcp

## What it does

The server wires your agent to the Stata install on your device. The agent writes do-files, runs them and reads the logs, so you stop switching windows. There is also a CLI mode and Stata skills that ship with the server.

Inside you get command guards, resource monitoring and automatic log capture. One command sets it up for every supported client: `uvx stata-mcp install --all`. For Claude alone, `claude mcp add stata-mcp -- uvx stata-mcp` is enough. You need `uv`/`uvx` available and a working Stata license on the machine — without the license the server starts but the analysis does not.

The project is AGPL-3.0. It moved there from Apache-2.0 after someone copied the repo and claimed sole maintainership; that fork was later taken down via DMCA. Fork it and redistribute a build, and the AGPL terms apply to you.

## Requirements
- Needs: Python and uv (commands run via uvx)

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add stata-mcp -- uvx stata-mcp
```
uvx runs the command named after the package; if the README names another one, use uvx --from stata-mcp <command>

### Codex

**Platform CLI**
```bash
codex mcp add stata-mcp -- uvx stata-mcp
```
uvx runs the command named after the package; if the README names another one, use uvx --from stata-mcp <command>

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "stata-mcp": {
            "command": "uvx",
            "args": [
                "stata-mcp"
            ]
        }
    }
}
```
uvx runs the command named after the package; if the README names another one, use uvx --from stata-mcp <command>

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "stata-mcp": {
            "type": "stdio",
            "command": "uvx",
            "args": [
                "stata-mcp"
            ]
        }
    }
}
```
uvx runs the command named after the package; if the README names another one, use uvx --from stata-mcp <command>

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add stata-mcp uvx stata-mcp
```
uvx runs the command named after the package; if the README names another one, use uvx --from stata-mcp <command>

## When to use it
- run a panel-data regression from a do-file
- replicate the numbers in a paper against its dataset
- collect logs from several Stata runs in one place
- keep the agent away from commands that touch your files
- install the MCP server across several editors at once

## Example prompts
- Run a regression on this table in Stata and show me the coefficients
- Check my `analysis.do` and fix the syntax errors
- Pull the logs from the last Stata runs and tell me what failed

## Similar
- [stata-data-cleaning](https://affpapa.org/en/nevibecode/skills/stata-data-cleaning.md) — skill · 351 installs
- [r-econometrics](https://affpapa.org/en/nevibecode/skills/r-econometrics.md) — skill · 331 installs
- [statsmodels](https://affpapa.org/en/nevibecode/skills/statsmodels.md) — skill · 97 installs
- [capture-environment](https://affpapa.org/en/nevibecode/skills/capture-environment.md) — skill · ★ 1668
- [scaffold-exercises](https://affpapa.org/en/nevibecode/skills/pedrohcgs-scaffold-exercises.md) — skill · ★ 1668
- [hunt](https://affpapa.org/en/nevibecode/skills/hunt.md) — skill · 14900 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
