Stata Mcp
About
Perform regression analysis using Stata with the help of an LLM. Requires a local Stata installation and an external LLM API key.
Details
- Author
- SepineTam
- Downloads
- 366
- Categories
- Developer Tools, Other, AI
Jump to
- Integrates LLMs with Stata for regression tasks
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
Stata McpCommand (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
One Click Installation For All Clients
No config, no manual JSON editing. Just one command installs MCP-for-Stata forevery supported agent(Claude Code, Codex, OpenClaw, Cursor, Gemini CLI, and more):
If you don't haveuv,](https://github.com/github/dmca/blob/master/2025/12/2025-12-30-stata-mcp.md)see the uv installation guideto install it. Or, use our beta install script (auto-installsuvif missing):
curl -fsSL https://raw.githubusercontent.com/SepineTam/mcp-for-stata/master/scripts/install.sh | bash
irm https://raw.githubusercontent.com/SepineTam/mcp-for-stata/master/scripts/install.ps1 | iex
If you don't know how to use them,download the installation scriptsand double-click it in your device.install.batfor Windows users, andinstall.commandfor macOS users.
As we find Claude Code is the best agent for MCP-for-Stata as its prefect agentic ability, we recommend using it, and there are lots of advanced usage following:
Before using it, please make sure you have ever installClaude Code, if you don't know how to install it, visit onGitHub
Generally, you can install MCP-for-Stata globally for one time, you can run:
claude mcp add stata-mcp --scope user -- uvx stata-mcp
Then, you do not need to watch it again.
If you want to install it locally only for the certain workspace, you cancdto your working directory, and run:
claude mcp add stata-mcp --env STATA_MCP__CWD=$(pwd) --scope local -- uvx --directory $(pwd) stata-mcp
It would nothing happen, you can typeclaudeand type/mcpto find the status.
Also, collaboration is an essential part of research. You can share your MCP config with your co-authors using:
claude mcp add stata-mcp --scope project -- uvx stata-mcp
In your working directory, you can find a file named.mcp.json, your mcp config will be placed here.
Then, you can use MCP-for-Stata in Claude Code. Here are some scenarios for using it:
- Paper Replication: Replicate empirical studies from economics papers
- Quick Hypothesis Testing: Validate economic hypotheses through regression analysis
- Stata Learning Assistant: Learn econometrics with step-by-step Stata explanations
- Code Organization: Review and optimize existing Stata do-files
- Result Interpretation: Understand complex statistical outputs and regression results
If you use Claude Code inside IDEs (either the integrated terminal or the Claude Code Extension), installing our plugin includingMCP-for-StataandStata LSPmaintained by @euglevi.
# Add the MCP-for-Stata marketplace claude plugin marketplace add SepineTam/mcp-for-stata # Install the plugin to local, project or user scope claude plugin install stata-toolbox -s project
The language server gives AI-generated Stata code better syntax awareness and completion, which improves output quality. We package the LSP in compliance with its license and give full attribution to the original author.
We find that many researchers are using Codex as their agent, therefore we also provide instructions for Codex users.
I figure that researchers are not using Codex CLI but Codex Desktop, so we can say it is easier to config MCP-for-Stata than other agents.
You just need to sayInstall MCP-for-Stata for yourself globally from https://www.statamcp.com or visit https://github.com/SepineTam/mcp-for-statathen restart your Codex Desktop after it say ready.
Also, if you want to install it manually, here are two ways:
- Open your Codex Desktop APP
- ClickSettingsin the bottom-left corner
- FindMCP serverson the left side
- ClickAdd server
- Fill with the following:
Name: stata-mcp Command to launch: uvx Arguments: stata-mcp
For CLI mode, just run the following command in your terminal
codex mcp add stata-mcp -- uvx stata-mcp
Claude Science runs MCP servers inside a strict sandbox that blocks access to the home directory (~) by default. If you try to launch MCP-for-Stata the standard way, you may see:
Couldn't load tools: MCP error -32000: Connection closed FileNotFoundError: [Errno 2] No such file or directory
To fix this, allowlist the paths whereuv tool install stata-mcpplaces its files. Create or edit~/.claude-science/config.toml:
[sandbox] user_write_paths = [ "~/.local/bin", "~/.local/share/uv/tools/stata-mcp", ]
- Name:stata-mcp
- Command:~/.local/bin/stata-mcp
Restart Claude Science and the tools will load. For the full walkthrough, see theClaude Science guide.
Standard config requires: please make sure the stata is installed at the default path, and the stata cli (for macOS and Linux) exists.
The standard config json as follows, you can DIY your config via add envs.
{ "mcpServers": { "stata-mcp": { "command": "uvx", "args": [ "stata-mcp" ] } } }
For more detailed usage information, visit theUsage guide.
If you want to check whether your device is supported, you can run:
It displays basic information about your device and checks whether your setup is supported.
stata-mcp v1.17.0 — Doctor Report [PASS] os: macOS (Darwin 25.3.0, arm64) [PASS] python: 3.13.5 [PASS] uv: uv 0.11.13 [PASS] dependencies: all required packages available [PASS] stata_cli: /usr/local/bin/stata-mp (from env) [PASS] stata_execution: OK (0.1s) [PASS] config: /Users/sepinetam/.statamcp/config.toml (loaded) [PASS] working_dir: /Users/sepinetam/Documents/Github/stata-mcp (writable) [PASS] guard: enabled, loaded 27 rules [PASS] monitor: disabled (psutil available) [PASS] pypi: reachable (4.86s) [PASS] cleanup: 0 old files (0 B) found; cleanup disabled (CLEAN_LOG_DAYS=-1) Summary: 12 passed, 0 failed, 0 warning(s), 0 skipped
- If you are located in China and package downloads are slow, see thesolution.
- Claude is the best choice for MCP-for-Stata, for Chinese, I recommend to use DeepSeek as your model provider as it is cheap and powerful, also the score is highest in China provider, if you are increased in it, visit the reportHow to use StataMCP improve your social science research.
There are several Stata-related MCP projects. The table below was generated by Claude Code after analyzing each codebase directly.
MCP-for-Stata documents visithttps://sepinetam.github.io/mcp-for-stata
- Complete Documentation: Full documentation site with all features
- Configuration Guide: Unified TOML-based configuration system
- Security Guard: Security validation for dangerous commands
- Monitoring System: RAM monitoring and resource limits
- Architecture Overview: System design and integration patterns
- Security Guard: Blocks dangerous commands (!,shell,erase, etc.)
- RAM Monitoring: Prevents memory exhaustion with configurable limits
- Layered Configuration: User, project, environment, and Linux system config support
- Beta asyncstata_doexecution: Supports concurrent MCP calls for multi-client workflows
- Configurable data access boundaries: Data info URL guard and optional directread_logboundary
- Cross-platform support (macOS, Windows, Linux)
- Automatic log capture and error reporting
If you encounter any bugs or have feature requests, pleaseopen an issue.
If you use MCP-for-Stata in your research, and it really helps you, you can cite this repository using one of the following formats:
@software{sepinetam2025stata, author = {Song Tan}, title = {MCP-for-Stata: Integrate Stata into your agent}, year = {2025}, url = {https://github.com/sepinetam/mcp-for-stata}, version = {1.22.0} }
Song Tan. (2025). MCP-for-Stata: Integrate Stata into your agent (Version 1.22.0) [Computer software]. https://github.com/sepinetam/mcp-for-stata
Song Tan. 2025. "MCP-for-Stata: Integrate Stata into your agent." Version 1.22.0. https://github.com/sepinetam/mcp-for-stata.
Or contribute directly by submitting aPull Request! We welcome contributions of all kinds, from bug fixes to new features.
This project is licensed underAGPL-3.0. The project maintainers accept no liability for any loss or damage arising solely from the use of this project's code or documentation.
More information: refer to the Chinese version atREADME.zh-CN.md; in case of any conflict, the Chinese version shall prevail.
This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.
Query and analyze your Opik logs, traces, prompts and all other telemtry data from your LLMs in natural language.
Get access to Kaggle's datasets, models, competitions, notebook and benchmarks.
Interact with your MLOps and LLMOps pipelines through your ZenML MCP server
AI-powered document extraction infrastructure. Convert PDFs, Excel files, and scanned documents into structured JSON.
An MCP server for interacting with Dappier's Retrieval-Augmented Generation (RAG) models.
Solve optimization problems formulated by an LLM using the on-device Gurobi solver.
An MCP server for Hierarchical Event Descriptors (HED) that automates sidecar creation and annotation for BIDS event files using LLMs.
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"stata mcp": {
"stata-mcp": {
"command": "uv",
"args": [
"--directory",
"/path/to/the/repo/",
"run",
"stata_mcp.py"
]
}
}
}
}
McpServers
{
"stata-mcp": {
"command": "uv",
"args": [
"--directory",
"/path/to/the/repo/",
"run",
"stata_mcp.py"
]
}
}
MCP-for-Stata: Integrate Stata into your agent
Enable Claude Code, Codex, OpenClaw, and other AI agents to safely invoke Stata on your local device for data analysis.
Stata is a registered trademark of StataCorp LLC. This project is an independent community-developed tool and is not affiliated with, endorsed by, or sponsored by StataCorp LLC.
- 🚀DeepSeek Harness Day 0 Support: Install MCP-for-Stata in DeepSeek Harness withuvx stata-mcp install -c dsh. See theDeepSeek Harness guide.
- 🧪Claude Science Support: MCP-for-Stata now works in Claude Science with a sandbox allowlist. See theClaude Science guide.
- Find more in WeChat:Why I made it?, and8 figures find out Stata-MCP
- 🦞OpenClaw Support: Standalone CLI tools for OpenClaw integration (stata-mcp tool), seeOpenClaw guide
- ✨Claude Code Plugin Support: Official plugin package with MCP server and Stata LSP integration
- Use MCP-for-Stata in Claude Code, seeClaude Code advanced usage, or in Codex seeCodex advanced usage
Finding ournewest research?View latest research reports.
- A session based MCP server for Stata,mcp-stata
- IDEs (VScode or Cursor) integratedstata-mcp for VSCode. Confused them? 💡Comparison
The AGPL 3.0 License is a type of open-source license. It does not affect your daily use, and allows you to use, modify, and distribute this software free of charge, provided that you comply with its terms, such as retaining the original copyright notices.
Notes: While we strive to make open source accessible to everyone, we regret that we can no longer maintain the Apache-2.0 License. Due to individuals directly copying this project and claiming to be its maintainers, we have decided to change the license to AGPL-3.0 to prevent misuse of the project in ways that go against our original vision.
Notes: 尽管我们希望尽可能让所有人都能从开源中获益,但我们很遗憾地宣布无法继续保持 Apache-2.0 License。由于有人直接抄袭本项目并标榜其为项目维护者,我们不得不将 License 更改为 AGPL-3.0,以防止有人滥用本项目进行违背项目初心的事情。
Update: The infringing project has been taken down via GitHub DMCA.View DMCA takedown details.
背景: @jackdark425 的仓库直接抄袭了本项目并标榜为项目唯一维护者。我们欢迎基于fork的开源协作,包括但不限于添加新的feature、修改已有bug或对项目提出您宝贵的意见,但坚决反对抄袭和虚假署名行为。
更新: 侵权项目已通过GitHub DMCA被takedown,查看DMCA下架详情。
🚀 One-click installation for all clients!
No config, no manual JSON editing. Just one command installs MCP-for-Stata forevery supported agent(Claude Code, Codex, OpenClaw, Cursor, Gemini CLI, and more):
If you don't haveuv,see the uv installation guideto install it. Or, use our beta install script (auto-installsuvif missing):
curl -fsSL https://raw.githubusercontent.com/SepineTam/mcp-for-stata/master/scripts/install.sh | bash
irm https://raw.githubusercontent.com/SepineTam/mcp-for-stata/master/scripts/install.ps1 | iex
If you don't know how to use them,download the installation scriptsand double-click it in your device.install.batfor Windows users, andinstall.commandfor macOS users.
As we find Claude Code is the best agent for MCP-for-Stata as its prefect agentic ability, we recommend using it, and there are lots of advanced usage following:
Before using it, please make sure you have ever installClaude Code, if you don't know how to install it, visit onGitHub
Generally, you can install MCP-for-Stata globally for one time, you can run:
claude mcp add stata-mcp --scope user -- uvx stata-mcp
Then, you do not need to watch it again.
If you want to install it locally only for the certain workspace, you cancdto your working directory, and run:
claude mcp add stata-mcp --env STATA_MCP__CWD=$(pwd) --scope local -- uvx --directory $(pwd) stata-mcp
It would nothing happen, you can typeclaudeand type/mcpto find the status.
Also, collaboration is an essential part of research. You can share your MCP config with your co-authors using:
claude mcp add stata-mcp --scope project -- uvx stata-mcp
In your working directory, you can find a file named.mcp.json, your mcp config will be placed here.
Then, you can use MCP-for-Stata in Claude Code. Here are some scenarios for using it:
- Paper Replication: Replicate empirical studies from economics papers
- Quick Hypothesis Testing: Validate economic hypotheses through regression analysis
- Stata Learning Assistant: Learn econometrics with step-by-step Stata explanations
- Code Organization: Review and optimize existing Stata do-files
- Result Interpretation: Understand complex statistical outputs and regression results
If you use Claude Code inside IDEs (either the integrated terminal or the Claude Code Extension), installing our plugin includingMCP-for-StataandStata LSPmaintained by @euglevi.
# Add the MCP-for-Stata marketplace claude plugin marketplace add SepineTam/mcp-for-stata # Install the plugin to local, project or user scope claude plugin install stata-toolbox -s project
The language server gives AI-generated Stata code better syntax awareness and completion, which improves output quality. We package the LSP in compliance with its license and give full attribution to the original author.
We find that many researchers are using Codex as their agent, therefore we also provide instructions for Codex users.
I figure that researchers are not using Codex CLI but Codex Desktop, so we can say it is easier to config MCP-for-Stata than other agents.
You just need to sayInstall MCP-for-Stata for yourself globally from https://www.statamcp.com or visit https://github.com/SepineTam/mcp-for-statathen restart your Codex Desktop after it say ready.
Also, if you want to install it manually, here are two ways:
- Open your Codex Desktop APP
- ClickSettingsin the bottom-left corner
- FindMCP serverson the left side
- ClickAdd server
- Fill with the following:
Name: stata-mcp Command to launch: uvx Arguments: stata-mcp
For CLI mode, just run the following command in your terminal
codex mcp add stata-mcp -- uvx stata-mcp
Claude Science runs MCP servers inside a strict sandbox that blocks access to the home directory (~) by default. If you try to launch MCP-for-Stata the standard way, you may see:
Couldn't load tools: MCP error -32000: Connection closed FileNotFoundError: [Errno 2] No such file or directory
…
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





