stata

Write and execute Stata commands for econometric analysis through a persistent MCP session.

Updated Aug 2, 2026
One-click install
npx skills add https://github.com/aliveranme/stata-mcp --skill stata-aliveranme
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: stata
Source: https://github.com/aliveranme/stata-mcp/tree/main/plugin/skills/stata
Command: npx skills add https://github.com/aliveranme/stata-mcp --skill stata-aliveranme

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Running Stata analysis through an AI agent normally means guessing commands, losing session state between calls, and drowning in oversized raw output. This Skill provides a complete Stata programming guide plus a 75-tool MCP Server that executes commands in one persistent Stata session, so data loaded once stays in memory across loading, cleaning, modeling, diagnostics, and export. ## Core Features & Use Cases - Full statistical workflow: Run regressions (OLS, logit, probit, Poisson, quantile), panel models (xtreg), IV/2SLS, DID, t-tests, and post-estimation diagnostics (VIF, heteroskedasticity, Hausman) via dedicated tools or arbitrary commands through stata_run. - Data management: Load .dta files, import Excel/CSV/SAS/SPSS, merge, append, reshape, collapse, and clean datasets with structured parameter validation. - Output and export control: Paginate large outputs, export graphs (PNG/PDF/SVG), and produce regression tables with the official etable command to Word, Excel, LaTeX, or HTML. - Use Case: Ask the agent to load auto.dta, regress price on weight and mpg, test for heteroskedasticity with estat hettest, and export the residual-vs-fitted plot as a PNG file. ## Quick Start Ask the agent to load your .dta dataset, summarize the variables, run a regression of your outcome on the predictors, and export the results table to Word.

Frequently Asked Questions about stata

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run a Stata regression from Claude Code?

Use the stata_regress tool with the dependent variable and regressors, or send arbitrary commands through stata_run. The MCP server executes them in a persistent Stata session via pystata, so previously loaded data stays in memory for follow-up diagnostics like estat hettest.

How do I export Stata regression tables to Word or Excel?

Use stata_etable, which wraps the official etable command in Stata 17+ and exports directly to .docx, .xlsx, .pdf, .tex, .html, and more without third-party packages. The older estout-based path only produces CSV and requires installing estout first.

What Stata version does the MCP server require?

The server requires StataNow 19 or Stata 18+ (MP, SE, or BE editions) with the pystata utilities included. It runs on Windows or macOS and connects locally over stdio, loading the Stata runtime in-process through ctypes.

Why does my Stata command chain stop after the first error?

Multi-command chains in stata_run halt at the first failing command by design, matching Stata do-file semantics, so later commands never run on a corrupted state. Wrap commands expected to fail in capture, fix the first reported error, then rerun the chain.

Can I install SSC packages like reghdfe or ivreg2 through the agent?

Yes, use stata_install_package with the package name and source ssc, optionally raising the timeout to 120 seconds. Do not embed ssc install inside stata_run, because network blocking there freezes the serial session lock.

What are the output size limits when listing Stata data?

Raw output is hard-capped at 120K characters and anything beyond is discarded, so always restrict list with an in range such as list in 1/10. Outputs over 4000 characters paginate automatically and can be browsed with stata_more.