Executes Stata do-files, installs ado packages, reads logs, and explores data structures via MCP-for-Stata server. Useful for regression analysis, syntax debugging, and data exploration.
Ships in stata-toolbox. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Official plugin for MCP-for-Stata maintained in collaboration with SepineTam.
MCP-for-Stata (Stata-MCP) is an MCP (Model Context Protocol) server that exposes Stata's statistical and econometric capabilities to LLMs. This toolset supports executing do-files, querying data file structures, installing ado packages, reading Stata logs, and looking up command documentation.
This skill requires the MCP-for-Stata server to be installed and running. If you have not configured it yet, follow @references/installation.md. After installation, verify with uvx stata-mcp doctor. Restart your AI client after installation (required for the first-time setup).
Trigger this skill when the user mentions any of the following scenarios:
get_data_infoWhen the user provides a data file path (.dta, .csv, .xlsx, .sav) or says "look at this data," call get_data_info first.
Key points:
data_path: absolute path to the data filevars_list: if the user only cares about specific variables, pass a list of variable names; otherwise omit (defaults to all)head: defaults to 0 (no preview rows). Only set to a positive integer when the user explicitly asks to see rowsReturn value includes: data source, number of observations, variable list, variable types, and descriptive statistics (mean, standard error, min, max) for each variable.
Note: results are cached based on MD5 hash of file content. Repeated queries on the same file hit the cache.
stata_doWhen the user asks to run Stata commands, perform regression analysis, generate graphs, process data, etc., call stata_do.
Pre-requisites:
.do file (using the Write tool)<WORKING_DIR>/.statamcp/stata-mcp-dofile/ or <WORKING_DIR>)stata_do(dofile_path=..., log_file_name=...)Key parameters:
dofile_path: absolute path to the do-filelog_file_name: custom log filename without timestamp, optionalread_log_when_error: defaults to false. When true, only returns log content when Stata returns an error code (e.g., r(198))enable_smcl: defaults to true, also generates .smcl log (Unix only)Return value: log_file_path (text and smcl paths); may contain log_content on error.
Notes:
ado_package_installTreat ado_package_install as a high-risk, opt-in tool. Do not call it merely
because a command is missing. First identify the exact package and source, then
ask the user to approve that package and source. The MCP tool is available only
when the operator starts the MCP server with the unsafe profile.
Key parameters:
package: package name. For GitHub source, use "user/repo" formatsource: "ssc" (default), "github", or "net"is_replace: defaults to falsepackage_source_from: required only when source="net", specifies a validated HTTPS URLAuthorization and validation: SSC and net package names may contain only
ASCII letters and numbers. GitHub repositories must use owner/repository
format and match the exact repository allowlist.
Unknown sources, local paths, IP hosts, credentials, queries, fragments, and
non-default ports are rejected. The MCP client will ask the user to approve the
exact request during the tool call; do not attempt to bypass or pre-answer it.
The Python API does not require caller confirmation. The CLI prompts unless
-y or --yes is supplied.
Examples:
ado_package_install("outreg2") — request approval to install an SSC packageado_package_install("SepineTam/TexIV", source="github") — request approval to install an allowlisted GitHub repositoryNote: GitHub repository contents receive no security protection. Inspect the
repository before installation. The tool never installs the GitHub helper.
Successful installs automatically attempt help(..., replace=true) for the
likely command name; if the package exposes other commands, refresh those
commands explicitly.
helpWhen the user asks about the syntax, options, or usage of a Stata command, or wants to verify a command before troubleshooting an error, call help.
Key parameter:
cmd: Stata command name (e.g., "regress", "describe", "xtset")replace: defaults to false. When true, bypasses cached help and refreshes it from StataReturn value: Stata help text string. A cache hit is prefixed with
Saved result for {cmd} or Cached result for {cmd}.
Notes:
help(cmd=..., replace=true) to refresh itread_logWhen the user asks to view a Stata execution log, analyze output results, or wants to inspect the full log after stata_do execution, call read_log.
Key parameters:
file_path: absolute path to the log fileoutput_format: "core" (default, removes framework lines), "dict" (structured command-result pairs), or "full" (all original content)lines: content truncation. 0 returns all; positive returns first N items; negative returns last |N| itemsNotes:
<WORKING_DIR>/<FOLDER_TAG>/ (security boundary)[BETA] enable_structured_log and is disabled by defaultWhen the user has NOT specified how an output should be produced, apply these presets — do not ask, do not invent alternatives. An explicit user request always overrides them.
| Output | Default | Detailed example |
|---|---|---|
| Regression | reghdfe with fixed effects in absorb() and vce(cluster <id>) at the treatment/assignment level; never regress when fixed effects are involved, never reflex , robust | @examples/esttab-senior-guidance.md (setup section also covers reghdfe/ftools installation) |
| Regression tables | esttab (from estout), .tex with label booktabs fragment for papers, .rtf/.csv for quick sharing | @examples/esttab-senior-guidance.md |
| Figures | graph export name.png, width(2000) replace; PDF only for LaTeX papers | @examples/graph-export-guidance.md |
Package availability: reghdfe (+ ftools) and estout may not be installed.
Check with help(cmd=...); if missing, use ado_package_install per section 3
— never ssc install inside a do-file. If installation is unavailable, tell
the user exactly what to install manually.
get_data_info — explore data structureado_package_install; inspect GitHub repositories firststata_do — execute the do-fileread_log — inspect execution results if neededhelp — look up official command documentation (Unix only)stata_do — re-execute to verifyado_package_install("pkgname") — request approval and install the packagehelp(cmd="pkg_name", replace=true) — explicitly refresh and check package usagestata_do — executeSTATA_MCP__IS_GUARD=false (not recommended)STATA_MCP__IS_MONITOR=true and STATA_MCP__RAM_LIMITado_package_install from SSC source may take time; skip if the package is already installed| Name | Location | Description |
|---|---|---|
| Installation | @references/installation.md | Installation and configuration guide for MCP-for-Stata |
| stata_do | @references/stata_do.md | Detailed guide for the execution tool |
| get_data_info | @references/get_data_info.md | Detailed guide for the data exploration tool |
| help | @references/help.md | Detailed guide for the documentation tool |
| read_log | @references/read_log.md | Detailed guide for the log reader tool |
| ado_package_install | @references/ado_package_install.md | Detailed guide for the package installer tool |
| esttab example | @examples/esttab-senior-guidance.md | Senior-level example for exporting regression tables |
| graph export example | @examples/graph-export-guidance.md | Defaults and pitfalls example for exporting figures |
| Documentation | sepinetam.github.io/mcp-for-stata | Full user documentation |
| Homepage | MCP-for-Stata official website | Project homepage |
| Source Code | github.com/sepinetam/mcp-for-stata | GitHub repository |
examples/esttab-senior-guidance.md (opens in a new tab)examples/graph-export-guidance.md (opens in a new tab)references/ado_package_install.md (opens in a new tab)references/get_data_info.md (opens in a new tab)references/help.md (opens in a new tab)references/installation.md (opens in a new tab)references/read_log.md (opens in a new tab)references/stata_do.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
4 skills in this plugin
/diagnostic-dofileUse this skill when the user needs to inspect, audit, or diagnose the safety of a Stata do-file. Typical scenarios include: uncertainty about whether a .do file is safe; receiving a complete do-file from an unofficial source (not the Stata website, not a well-known academic institution or professor's official site); asking to check a batch of do-files; or requesting a read-only security/risk/portability diagnostic report. The skill does not modify the original file; it only emits a JSON report. Note that this is not a mandatory step for every do-file; run it only when a security review is warranted.
/stata-auditInspect, validate, summarize, and render local Stata-MCP audit evidence under .statamcp. Use when a user asks what tools ran, whether a security guard blocked anything, how one run links across JSONL files, whether snapshots are intact, or wants an interactive audit dashboard./stata-discoverUse this skill when you need to find Stata on the user's machine or configure `stata-mcp` to use it. `stata-discover` provides the workflow for discovering Stata executables and the official way to configure `stata-mcp`. If the user's computer has multiple Stata executables available, this skill also provides the version the user most likely wants to use./stata-toolbox:stata-skillfrom stata-toolbox
npx claudepluginhub sepinetam/mcp-for-stata --plugin stata-toolbox2 plugins ship this exact skill · first indexed Oct 1, 2026
Other plugins' skills for the same job