Skip to main content

Let LLM help you achieve your regression analysis with Stata

Project description

logo

Stata-MCP

Let LLM help you achieve your regression analysis with Stata ✨

en cn fr sp PyPI version PyPI Downloads License: Apache 2.0 Issue Ask DeepWiki


News: Now you can use Stata-MCP with agent mode, more information here.

Finding our newest research? Click here or visit reports website.

Looking for others?

  • 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
  • NBER-MCP & AER-MCP 🔧 under construction
  • Econometrics-Agent
  • 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

Agent Mode

The details of agent mode find here.

git clone https://github.com/sepinetam/stata-mcp.git
cd stata-mcp

uv sync
uv pip install -e .

stata-mcp --version  # for test whether stata-mcp is installed successfully.
stata-mcp --agent  # now you have enjoy your stata-mcp agent mode.

or you can directly use it with uvx:

uvx stata-mcp --version  # for test whether it could be used on your computer.
uvx stata-mcp --agent

You can edit the task in agent_examples/openai/main.py for variable model_instructions and task_message, click me #L37 and #L68

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.

{
  "mcpServers": {
    "stata-mcp": {
      "command": "uvx",
      "args": [
        "stata-mcp"
      ]
    }
  }
}

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:

  1. If you are located in China, a short uv usage document you can find here.
  2. 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.

uvx stata-mcp --usable
uvx stata-mcp --version

If you want to use it locally, you can install it via pip or download the source code.

Download via pip

pip install stata-mcp

Download source code and compile

git clone https://github.com/sepinetam/stata-mcp.git
cd stata-mcp

uv build

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:

uvx /path/to/your/whl/stata_mcp-1.8.1-py3-non-any.whl  # here is the wheel file name, you can change it to your version

📝 Documentation

💡 Questions

🚀 Roadmap

  • macOS support
  • Windows support
  • Additional LLM integrations
  • Performance optimizations

⚠️ Disclaimer

This project is for research purposes only. I am not responsible for any damage caused by this project. Please ensure you have proper licensing to use Stata.

For more information, refer to the Statement.

🐛 Report Issues

If you encounter any bugs or have feature requests, please open an issue.

📄 License

Apache License 2.0

📚 Citation

If you use Stata-MCP in your research, please cite this repository using one of the following formats:

BibTeX

@software{sepinetam2025stata,
  author = {Song Tan},
  title = {Stata-MCP: Let LLM help you achieve your regression analysis with Stata},
  year = {2025},
  url = {https://github.com/sepinetam/stata-mcp},
  version = {1.8.1}
}

APA

Song Tan. (2025). Stata-MCP: Let LLM help you achieve your regression analysis with Stata (Version 1.8.1) [Computer software]. https://github.com/sepinetam/stata-mcp

Chicago

Song Tan. 2025. "Stata-MCP: Let LLM help you achieve your regression analysis with Stata." Version 1.8.1. https://github.com/sepinetam/stata-mcp.

📬 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.

✨ Star History

Star History Chart

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stata_mcp-1.8.1.tar.gz (2.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stata_mcp-1.8.1-py3-none-any.whl (67.3 kB view details)

Uploaded Python 3

File details

Details for the file stata_mcp-1.8.1.tar.gz.

File metadata

  • Download URL: stata_mcp-1.8.1.tar.gz
  • Upload date:
  • Size: 2.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.0

File hashes

Hashes for stata_mcp-1.8.1.tar.gz
Algorithm Hash digest
SHA256 e56ca63f28ba5c51b08e3a26178594706bf5a549f29fe4eb36a69c91b607c1f6
MD5 8acadd3612d8a156ac019a69e3b012c4
BLAKE2b-256 31a756b65c4ecd8b53ff089933a540c1269f058ed66a4b846457b31ef7a1a1cc

See more details on using hashes here.

File details

Details for the file stata_mcp-1.8.1-py3-none-any.whl.

File metadata

  • Download URL: stata_mcp-1.8.1-py3-none-any.whl
  • Upload date:
  • Size: 67.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.0

File hashes

Hashes for stata_mcp-1.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ceffe9196581aca65986ca6154b9f12ed35b0e81e88ccc2087b932cd06ed08b9
MD5 edc94f025530988759cff122c9037ab5
BLAKE2b-256 58db8f0f67938a9798d19f64cdbcccd5fa1664ca08e7860d34f212f21288d92d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page