This server enables interaction with Stata for data analysis and management through five key capabilities:
Read Log Files: Retrieve and return the content of specified log files
Get Data Information: Obtain descriptive statistics for data files, with optional encoding and variable list specifications
Write Dofiles: Create new Stata dofiles with provided content
Append Dofiles: Add Stata code to existing dofiles or create new ones if they don't exist
Execute Stata Code: Run Stata commands by executing specified dofiles through Stata
Supports running Stata statistical analysis on macOS systems, with Windows support planned for future releases.
News:
Use Stata-MCP in Claude Code, look here
Try to use agent mode as tool? Now it is supported more easily here.
Want to evaluate your LLM? Look here.
Update
StataFinder, but it is not stable, please config yourSTATA_CLIinto your environment.
Finding our newest research? Click here or visit reports website.
Looking for others?
STOP: StataMCP-Team Opendata Project ๐, we have open-sourced a comprehensive dataset collection for social science research, aiming to enable the future of AI-driven and data-powered research paradigms.
Trace DID: If you want to fetch the newest information about DID (Difference-in-Difference), click here. Now there is a Chinese translation by Sepine Tam and StataMCP-Team ๐
Jupyter Lab Usage (Important: Stata 17+) here
TexIV: A machine learning-driven framework that transforms text data into usable variables for empirical research using advanced NLP and ML techniques
A VScode or Cursor integrated here. Confused it? ๐ก Difference
๐ก Quick Start
Use Stata-MCP in Claude Code
We can use Stata-MCP in Claude Code as its prefect agentic ability.
Before using it, please make sure you have ever install Claude Code, if you don't know how to install it, visit on GitHub
You can open your terminal and cd to your working directory, and run:
I am not sure whether it works on Windows, as I do not have a Windows device for test it.
Then, you can use Stata-MCP 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
Agent Mode
The details of agent mode find here.
or you can directly use it with uvx:
You can edit the task in agent_examples/openai/main.py for variable model_instructions and task_message, click me #L37 and #L68
Agent as Tool
If you want to use a Stata-Agent in another agent, here is a simple example:
AI Chat-Bot Client Mode
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.
For more detailed usage information, visit the Usage guide.
And some advanced usage, visit the Advanced guide
Prerequisites
uv - Package installer and virtual environment manager
Claude, Cline, ChatWise, or other LLM service
Stata License
Your API-KEY from LLM
Notes:
If you are located in China, a short uv usage document you can find here.
Claude is the best choice for Stata-MCP, 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 report How to use StataMCP improve your social science research.
Installation
For the new version, you don't need to install the stata-mcp package again, you can just use the following command to check whether your computer can use stata-mcp.
If you want to use it locally, you can install it via pip or download the source code.
Download via pip
Download source code and compile
Then you can find the compiled stata-mcp binary in the dist directory. You can use it directly or add it to your PATH.
For example:
Related MCP server: MCP-MultilspyLSP
๐ Documentation
For more detailed usage information, visit the Usage guide.
Advanced Usage, visit the Advanced
Some questions, visit the Questions
Difference with Stata-MCP@hanlulong, visit the Difference
๐ก Questions
๐ Roadmap
macOS support
Windows support
Additional LLM integrations (With a new webUI)
Performance optimizations (Via prompt and context engineering)
For more information, refer to the Statement.
๐ Report Issues
If you encounter any bugs or have feature requests, please open an issue.
๐ License
๐ Citation
If you use Stata-MCP in your research, please cite this repository using one of the following formats:
BibTeX
APA
Chicago
๐ฌ Contact
Email: sepinetam@gmail.com
Or contribute directly by submitting a Pull Request! We welcome contributions of all kinds, from bug fixes to new features.
โค๏ธ Acknowledgements
The author sincerely thanks the Stata official team for their support and the Stata License for authorizing the test development.
๐ Statement
The Stata referred to in this project is the commercial software Stata developed by StataCorp LLC. This project is not affiliated with, endorsed by, or sponsored by StataCorp LLC. This project does not include the Stata software or any installation packages; users must obtain and install a validly licensed copy of Stata from StataCorp. This project is licensed under Apache-2.0. The project maintainers accept no liability for any loss or damage arising from the use of this project or from actions related to Stata.
More information: refer to the Chinese version at [source/docs/README/cn/README.md]; in case of any conflict, the Chinese version shall prevail.