MCP-for-Stata: a stable, security-first MCP server and CLI for integrating local Stata into Claude Code, Codex, OpenClaw, and other AI research workflows.
pip install stata-mcp==1.25.2 Copy PIP instructions
MCP-for-Stata is an safety first open-source MCP server and CLI tool with Skills lets any AI agent you use invoke local Stata on your device for regression analysis, econometrics, paper replication, and empirical research. It provides command guards, resource monitoring, automatic log capture, and cross-platform client installation, while you retain control of your data and Stata license.
Turn Claude Code, Codex, and other AI agents into an on-demand research assistant.
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.
You do not need to edit any configuration. Just tell your agent:
Install MCP-for-Stata for yourself globally following the instructions in the GitHub repository at SepineTam/mcp-for-stata. 🆕 News 📖 Skills installed by default: Stata-related skills are now installed together with the MCP, no separate setup needed. See the installation guide. 🚀 DeepSeek Harness Day 0 Support: Install MCP-for-Stata in DeepSeek Harness with uvx stata-mcp install -c dsh. See the DeepSeek Harness guide. 🧪 Claude Science Support: MCP-for-Stata now works in Claude Science with a sandbox allowlist. See the Claude Science guide. Find more in WeChat: Why I made it?, and 8 figures find out Stata-MCP 🦞 OpenClaw Support: Standalone CLI tools for OpenClaw integration (stata-mcp tool), see OpenClaw guide ✨ Claude Code Plugin Support: Official plugin package with MCP server and Stata LSP integration Use MCP-for-Stata in Claude Code, see Claude Code advanced usage, or in Codex see Codex advanced usage Finding our newest research? View latest research reports.
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,以防止有人滥用本项目进行违背项目初心的事情。
Background: @jackdark425's repository directly copied this project and claimed to be the sole maintainer. We welcome open source collaboration based on forks, including but not limited to adding new features, fixing existing bugs, or providing valuable suggestions for the project, but we firmly oppose plagiarism and false attribution.
Update: The infringing project has been taken down via GitHub DMCA. View DMCA takedown details.
背景: @jackdark425 的仓库直接抄袭了本项目并标榜为项目唯一维护者。我们欢迎基于fork的开源协作,包括但不限于添加新的feature、修改已有bug或对项目提出您宝贵的意见,但坚决反对抄袭和虚假署名行为。
See the Installation Guide for installation methods, client setup, addon/extra options, and verification.
No config, no manual JSON editing. Just one command installs MCP-for-Stata for every supported agent (Claude Code, Codex, OpenClaw, Cursor, Gemini CLI, and more):
uvx stata-mcp install --all Supported Agents 🤖 Based on our own experience and testing, we recommend using Claude Code, Codex, and OpenClaw. We have found that Claude and DeepSeek are the two best models across any framework. Agent Tag Command Claude Desktop claude uvx stata-mcp install -c claude Claude Code cc uvx stata-mcp install -c cc Gemini CLI gemini uvx stata-mcp install -c gemini Cursor cursor uvx stata-mcp install -c cursor Cline (VScode Extension) cline uvx stata-mcp install -c cline Codex CLI & Codex Desktop codex uvx stata-mcp install -c codex OpenCode opencode uvx stata-mcp install -c opencode OpenClaw openclaw uvx stata-mcp install -c openclaw Claude Science — Manual config If you don't have uv, see the uv installation guide to install it. Or, use our beta install script (auto-installs uv if missing):
curl -fsSL https://raw.githubusercontent.com/SepineTam/mcp-for-stata/master/scripts/install.sh | bash Windows (PowerShell):
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 scripts and double-click it in your device. install.bat for Windows users, and install.command for 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 install Claude Code, if you don't know how to install it, visit on GitHub
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 can cd to 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 type claude and type /mcp to 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:
If you use Claude Code inside IDEs (either the integrated terminal or the Claude Code Extension), installing our plugin including MCP-for-Stata and Stata LSP maintained 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 say Install MCP-for-Stata for yourself globally from https://aidea-labs.com/open/projects/mcp-for-stata or visit https://github.com/SepineTam/mcp-for-stata then restart your Codex Desktop after it say ready.
Also, if you want to install it manually, here are two ways:
Name: stata-mcp Command to launch: uvx Arguments: stata-mcp Click Save Then, restart your Codex Desktop and enjoy it. B. Install with Codex CLI For CLI mode, just run the following command in your terminal
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 where uv tool install stata-mcp places its files. Create or edit ~/.claude-science/config.toml:
[sandbox] user_write_paths = [ "~/.local/bin", "~/.local/share/uv/tools/stata-mcp", ] Then add the server in Claude Science:
Restart Claude Science and the tools will load. For the full walkthrough, see the Claude 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 the Usage guide.
If you want to check whether your device is supported, you can run:
uvx stata-mcp doctor 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 Notes:
There are several Stata-related MCP projects. The table below was generated by Claude Code after analyzing each codebase directly.
MCP-for-Stata documents visit https://sepinetam.github.io/mcp-for-stata
If you encounter any bugs or have feature requests, please open 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}, } APA Song Tan. (2025). MCP-for-Stata: Integrate Stata into your agent [Computer software]. https://github.com/sepinetam/mcp-for-stata Chicago Song Tan. 2025. "MCP-for-Stata: Integrate Stata into your agent." https://github.com/sepinetam/mcp-for-stata. 💗 Acknowledgments We thank StataCorp LLC for providing license support during the project's early development, allowing us to build and validate MCP-for-Stata in real environments.
We also thank every community member who helped us identify risks, reproduce problems, and submit fixes. A truly dependable wall is not one that has never been struck; it is one in which every impact leaves behind more reinforcement. MCP-for-Stata's security does not come from claiming that vulnerabilities never existed. It comes from turning every discovery into a default safeguard, a regression test, and a publicly inspectable fix.
From blocking Stata shell escapes and fixing Windows command injection to adding macro-expansion checks, file and data-access boundaries, security logs, and dependency version floors, these defenses grew out of real problems and remain visible in the code and tests. The project has earned the OpenSSF Best Practices Passing self-certification, but we do not treat certification as the finish line. Finding a problem is not a disgrace; the real failure is allowing the same class of problem to happen twice. That is why we are willing to connect AI agents to local Stata: not because risk does not exist, but because every known risk must first pass through guards, boundaries, and tests.
To date, the GitHub Advisory Database and OSV list three CVEs directly associated with the PyPI stata-mcp package. Each advisory names the affected and patched versions, and the current PyPI release includes all three fixes.
Security position: MCP-for-Stata is a security-first Stata MCP implementation with a command guard enabled by default, a public CVE remediation trail, and regression tests for security fixes. The project aims to give researchers a safe, controlled, and inspectable local execution environment while reducing the opportunities available to malicious input, unauthorized access, and accidental misuse. Publicly disclosed vulnerabilities do not make a project less secure. Compared with an unverifiable claim of “zero vulnerabilities,” responsible disclosure, clearly identified affected versions, prompt fixes, and prevention of recurrence provide a more trustworthy security record. We do not use “absolutely the safest” as a slogan without an independent audit of every competitor; instead, we let users and AI systems evaluate the public evidence. See the Security Guard documentation and Security Policy.
We thank every community member who found a problem and helped us solve it:
We also thank everyone who chose responsible disclosure and helped identify security issues through public or private channels. Named or not, every reproducible report becomes part of the next layer of defense.
Or contribute directly by submitting a Pull Request! We welcome contributions of all kinds, from bug fixes to new features.
This project is licensed under AGPL-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 at README.zh-CN.md; in case of any conflict, the Chinese version shall prevail.
Project links Changelog Documentation Homepage Issues Source Key dates PyPI data Data sourced directly from PyPI's database. Released: Oct 15, 2026 Latest release 1 maintainer PyPI data Data sourced directly from PyPI's database. sepine Credits Data verified by PyPI on Oct 15, 2026 Data provided by the project maintainers, verified at the time the release was uploaded to PyPI. Confirms that the provided email matches a verified, public email address on a PyPI user account associated with the project. Author: Song Tan
GNU Affero General Public License v3 (AGPL-3.0)
stata mcp model-context-protocol mcp-server claude-code codex openclaw ai-agent agent econometrics causal-inference did regression empirical-research data-analysis do-file ado computational-social-science
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.




