From stata-toolbox
Runs Stata do-files, queries data structure, installs ado packages, reads .smcl/.log files, and looks up command documentation via the MCP-for-Stata server.
How this skill is triggered — by the user, by Claude, or both
Slash command
/stata-toolbox:stata-skillThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
> Official plugin for MCP-for-Stata maintained in collaboration with [SepineTam](https://github.com/sepinetam).
Official plugin for MCP-for-Stata maintained in collaboration with SepineTam.
MCP-for-Stata 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_installWhen the user mentions a Stata command does not exist or needs to install packages like outreg2, reghdfe, estout, etc., call ado_package_install.
Key parameters:
package: package name. For GitHub source, use "user/repo" formatsource: "ssc" (default), "github", or "net"is_replace: defaults to true, forces reinstallationpackage_source_from: required only when source="net", specifies directory or URLExamples:
ado_package_install("outreg2") — install from SSCado_package_install("SepineTam/TexIV", source="github") — install from GitHubNote: SSC installations can be slow. If the package may already be installed, ask the user whether to skip.
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")Return value: Stata help text string. If cache is hit, prefix shows "Cached result for {cmd}: ..."
Notes:
~/.statamcp/help/)STATA_MCP__CACHE_HELP=false to force a refreshread_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: "dict" (recommended, structured command-result pairs), "full" (all original content), "core" (removes framework lines)is_beta: defaults to false. When true, uses structured parsing (Unix only, recommended for .smcl + dict format)lines: content truncation. 0 returns all; positive returns first N items; negative returns last |N| itemsNotes:
stata-mcp-folder directory (security boundary)write_dofile is marked as deprecated. Modern AI agents have native file-writing capabilities. Use the Write tool to create do-files instead of calling this MCP tool.
This tool is disabled by default and only available when STATA_MCP__ENABLE_WRITE_DOFILE=true. It will be removed in a future version.
get_data_info — explore data structureado_package_install — install third-party packages if neededstata_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("pkg_name") — installhelp pkg_name — 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 |
| Documentation | docs.statamcp.com | Full user documentation |
| Homepage | statamcp.com | Project homepage |
| Source Code | github.com/sepinetam/mcp-for-stata | GitHub repository |
npx claudepluginhub sepinetam/mcp-for-stataDispatches Stata tasks for commands, .do files, regressions, econometrics, graphs, dataset inspection, replication, and errors to mcp-stata tools and specialized research skills.
Executes Stata code, debugs .do files, repairs errors, and interprets results using the stata-code MCP server. Generates self-contained do-files when offline.
Provides Stata reference for .do files, data management, econometrics, causal inference, graphics, Mata programming, and packages like reghdfe, estout, did, rdrobust. Aids writing, debugging, explaining code.