Stata
A lightweight Model Context Protocol (MCP) server for Stata. Execute commands, inspect data, retrieve stored results (r()/e()), and view graphs in your chat interface. Built for economists who want to integrate LLM assistance into their Stata workflo
What is Stata?
Stata is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to lightweight model context protocol (mcp) server for stata. execute commands, inspect data, retrieve stored results (r()/e()), and view graphs in your chat interface. built for economists who want to i...
A lightweight Model Context Protocol (MCP) server for Stata. Execute commands, inspect data, retrieve stored results (r()/e()), and view graphs in your chat interface. Built for economists who want to integrate LLM assistance into their Stata workflo
This server falls under the Data Science & ML category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- A lightweight Model Context Protocol (MCP) server for Stata.
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx mcp-stataConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Stata
MCP-Stata is a lightweight MCP server that embeds a live Stata session inside your AI chat interface, enabling economists and researchers to execute Stata commands and do-files, inspect datasets, retrieve stored estimation results (r(), e(), s()), manage graphs, and run complete econometric workflows — all through natural language conversation. Built by Thomas Monk at LSE, it supports Stata 17+ (MP, SE, and BE editions) on macOS, Linux, and Windows, with pre-built skills for causal inference, data auditing, publication-quality tables, power analysis, and replication. Researchers who want LLM assistance with econometric analysis without leaving their Stata workflow use this server to bridge the two environments.
Prerequisites
- Stata 17 or later (MP, SE, or BE edition) licensed and installed on your system
- Python 3.11 or later
- uv package manager (strongly recommended for installation)
- An MCP-compatible client such as Claude Desktop, Claude Code, Cursor, Windsurf, or VS Code
- Optional: STATA_PATH environment variable if Stata is not on your system PATH
Install MCP-Stata using the one-line installer
Use the platform-specific installer script for the fastest setup. This installs the server and all Python dependencies automatically.
# macOS/Linux:
curl -LsSf https://mcp-stata-install.tdmonk.com/install.sh | bash
# Windows PowerShell:
irm https://mcp-stata-install.tdmonk.com/install.ps1 | iexOr install via uvx
Alternatively, use uvx to run the latest published version directly without a separate install step.
uvx --refresh --refresh-package mcp-stata --from mcp-stata@latest mcp-stataConfigure Claude Desktop
Add MCP-Stata to your Claude Desktop configuration file. On macOS, edit ~/Library/Application Support/Claude/claude_desktop_config.json.
{
"mcpServers": {
"stata": {
"command": "uvx",
"args": ["--refresh", "--refresh-package", "mcp-stata", "--from", "mcp-stata@latest", "mcp-stata"]
}
}
}Set optional environment variables
If Stata is not on your PATH, set STATA_PATH to the executable location. Other optional variables control temp directory, startup do-files, and logging.
{
"mcpServers": {
"stata": {
"command": "uvx",
"args": ["--refresh", "--refresh-package", "mcp-stata", "--from", "mcp-stata@latest", "mcp-stata"],
"env": {
"STATA_PATH": "/usr/local/stata17/stata-mp",
"MCP_STATA_LOGLEVEL": "INFO"
}
}
}
}Verify connection and start working
Once configured, ask your AI assistant to load the built-in auto dataset and run a simple regression to verify the Stata session is active and the tools are accessible.
Stata Examples
Client configuration
Claude Desktop config for MCP-Stata using uvx with optional STATA_PATH override.
{
"mcpServers": {
"stata": {
"command": "uvx",
"args": [
"--refresh",
"--refresh-package", "mcp-stata",
"--from", "mcp-stata@latest",
"mcp-stata"
],
"env": {
"STATA_PATH": "/usr/local/stata17/stata-mp"
}
}
}
}Prompts to try
Example Stata analysis requests once the server is connected.
- "Load the auto dataset and run a regression of price on mpg and weight, then show me the results"
- "Import the CSV at ~/data/wages.csv and give me a codebook summary of all variables"
- "Run a difference-in-differences regression and export the results table as publication-ready LaTeX"
- "Retrieve the stored e() results from my last regression and format them as a coefficient table"
- "Generate a scatter plot of mpg vs price with a fitted line and export it as PNG"
- "Check my do-file analysis.do for deprecated syntax and modernize it"Troubleshooting Stata
Stata executable not found or 'STATA_PATH is not configured' error
Set the STATA_PATH environment variable in your MCP client config to the absolute path of your Stata executable, e.g. '/usr/local/stata17/stata-mp' on Linux or 'C:\Program Files\Stata17\StataSE-64.exe' on Windows.
Graphs are not returned or export fails
Use the stata_manage_graphs() tool explicitly to list and export graphs after running graph commands. Specify the format as SVG or PNG. On Windows, temporary file permission issues can be resolved by setting MCP_STATA_TEMP to a user-writable directory.
Python version mismatch or uvx fails to resolve mcp-stata
MCP-Stata requires Python 3.11+. Run 'python --version' to check your version. If using uvx, ensure uv itself is up to date: 'pip install --upgrade uv'. You can also add '--python 3.11' to the uvx args to pin the Python version explicitly.
Frequently Asked Questions about Stata
What is Stata?
Stata is a Model Context Protocol (MCP) server that lightweight model context protocol (mcp) server for stata. execute commands, inspect data, retrieve stored results (r()/e()), and view graphs in your chat interface. built for economists who want to integrate llm assistance into their stata workflo It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Stata?
Follow the installation instructions on the Stata GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with Stata?
Stata works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Stata free to use?
Yes, Stata is open source and available under the AGPL-3.0 license. You can use it freely in both personal and commercial projects.
Stata Alternatives — Similar Data Science & ML Servers
Looking for alternatives to Stata? Here are other popular data science & ml servers you can use with Claude, Cursor, and VS Code.
Ultrarag
★ 5.6kA Low-Code MCP Framework for Building Complex and Innovative RAG Pipelines
RocketRide
★ 3.1k📇 🏠 - MCP server that exposes RocketRide AI pipelines as t
Aix Db
★ 2.1kAix-DB 基于 LangChain/LangGraph 框架,结合 MCP Skills 多智能体协作架构,实现自然语言到数据洞察的端到端转换。
NeMo Data Designer
★ 1.9k🎨 NeMo Data Designer: Generate high-quality synthetic data from scratch or from seed data.
PaperBanana
★ 1.7kOpen source implementation and extension of Google Research’s PaperBanana for automated academic figures, diagrams, and research visuals, expanded to new domains like slide generation.
MiniMax
★ 1.5kBridges MiniMax AI capabilities to the Model Context Protocol, enabling AI agents to perform image understanding, text-to-image generation, and speech synthesis. It provides a standardized interface for accessing MiniMax's core tools via JSON-RPC.
Browse More Data Science & ML MCP Servers
Explore all data science & ml servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up Stata in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use Stata?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.