stata-code MCP

stata-code runs Stata from Claude Code and Cursor: DiD, IV and RDD, esttab tables and a compact result format.

  • 55 ★ on the repository
  • Last commit
MCP server

Extended access

Why this level

  • The agent runs Stata code on your machine, which can reach files and shell commands, under your licence.
All reasons and checks

brycewang-stanford/stata-code

Install

In your terminal, with SkillFoxx CLI

npx skillfoxx add mcp/stata-code

Detects the agents on your machine, shows the access level and pins the version.

Other ways to install

Access and checks

How we review

Extended accessThe tool runs code or makes network calls and only reads external data.

  • The agent runs Stata code on your machine, which can reach files and shell commands, under your licence.

This is third-party code. Review the repository files before installing.

What it does

stata-code is a bridge between an agent and Stata for empirical research. The `stata-code-mcp` MCP server runs Stata code, returns results in a typed format with errors and suggestions, and has the agent build difference-in-differences, instrumental variable and regression discontinuity models. Ready-made workflows are one-step MCP prompts and tables come out through `esttab`. The same core works as a Jupyter kernel, a VS Code extension and the `stata-code run` command, and estimates can be cross-checked against the StatsPAI Python library. The server works with the copy of Stata installed on your machine. A quick start in Claude Code is a single `claude mcp add` command.

Who it is for. Economists and analysts who work in Stata and want to run an empirical study in conversation with an agent rather than writing do-files by hand.

Good fit when

  • The effect of a programme must be estimated with difference-in-differences on a panel and a table exported.
  • The agent must write a do-file, run it and read results in a compact format.
  • An estimate must be re-checked in Python to confirm that both implementations agree.
  • Work runs in Jupyter or VS Code and a Stata kernel is needed with the same result format.

Not a fit when

  • There is no Stata licence: without it the server computes nothing.
  • Analysis runs in R or Python without Stata and only their own tooling is needed.
  • A one-off calculation without MCP is wanted: an ordinary do-file run is enough.

Example request

Take data/cfps_panel.dta, estimate a two-way fixed-effects model for wages, test heterogeneity with Callaway-Sant'Anna and export an esttab table.

MCP

Transport
stdio
Authentication
not required

Limitations

Python 3.10 or newer and a licensed Stata 17 or newer are needed for `pystata`, or Stata 13 and later through the console mode with no state between runs. The main documentation is in Chinese, with English in `README.en.md`. The agent runs Stata code, which may execute shell commands, so do-files are worth reading before running. Version 0.12 is an early release and the interface may change. The last commit was in November 2026.

How to disable. Run `claude mcp remove stata-code` and in other clients delete the `stata-code` entry from MCP settings. Remove the package with `pip uninstall stata-code`.

FAQ

Is a Stata licence needed?

Yes, it is needed. The server runs Stata from your machine, so nothing can be computed without a licence.

How do I connect it to Claude Code?

With `claude mcp add stata-code --scope user -- uvx --from "stata-code[mcp]" stata-code-mcp`. Cursor and Claude Desktop have examples in the README.

What can I compute?

Difference-in-differences, instrumental variable and regression discontinuity models plus `esttab` tables. Workflows come as ready MCP prompts.

Is there a way without MCP?

Yes, the `stata-code run` command, the Jupyter kernel and the VS Code extension share the same core and result format.

How do I verify a result?

Ask the agent to re-estimate in StatsPAI on Python and compare: the project calls it a cross-check of two stacks.

Discussion

No questions or reviews yet.

An MCP server that lets an agent run local Stata: regressions, econometrics, replicating computations from papers

MCP serverExtended access276Repository stars

A Stata command line for agents: runs do-files, returns regression results as JSON and keeps a daemon for fast repeats.

CLIExtended access59Repository stars

MCP server that connects Claude Code and Codex to an open R or Python session in RStudio and Positron, where your data lives

MCP serverBroad access372Repository stars
Official

An MCP server and the dbcode-cli skill: an agent runs SQL through connections already saved in the DBCode editor extension.

MCP serverBroad access366Repository stars

StatsClaw assembles nine Claude Code agents to build statistical packages from a paper or formulas with isolated pipelines.

PluginExtended access101Repository stars

README in short

Describes the agent-to-Stata bridge, the MCP, Jupyter, VS Code and console frontends, the result schema, requirements, installation and sample prompts.

README badge

Report a problem