stata_run_selectionLABSCO SUMMARY
The editor extension and the MCP endpoint are the same install — you do not wire up a server separately.
Because the server is already running once the status bar says Stata, connecting an assistant is just pointing it at localhost:4000. The practical payoff is the loop: the model writes a do-file, runs it, reads the actual Stata output, and corrects itself — which is the part that is tedious when you are pasting between windows.
What it is
An extension for VS Code, Cursor and Antigravity that adds Stata execution, syntax highlighting and a local MCP endpoint any AI client can connect to.
What you get
- stata_run_selection — run the selected code and get the results back
- stata_run_file — run an entire .do file
- Real-time output in an editor panel, plus a data viewer for the loaded dataset
- Syntax highlighting for .do, .ado, .mata and .doh files
- Multiple Stata sessions running in parallel, and a restart that clears in-memory data, globals and programs
- Keyboard shortcuts for run selection, run file and stop, plus an interactive browser mode for graphs
Requirements
Stata 17 or higher installed locally, and the uv package manager, which the extension installs for you if it is missing. Install the extension from the marketplace; it starts the server itself and listens on http://localhost:4000/mcp-streamable, with an SSE fallback at /mcp. First install sets up dependencies and can take a couple of minutes.
Setup effort
One command — code --install-extension DeepEcon.stata-mcp
USE CASES
Running the block you just wrote
Select the code and execute it, with results in the output panel rather than another application.
Letting an assistant debug your do-file
It runs the file, reads the error Stata actually returned, and edits from that instead of guessing.
Starting from a clean session
Restart to clear in-memory data, globals and programs — the equivalent of closing and reopening Stata.
Working on two analyses at once
Run parallel Stata sessions so a long regression does not block the next thing you want to try.
2 tools
Listed in project docs. Your client may show a different list.
stata_run_fileBEFORE YOU INSTALL
What to know first
Tools you get
2 tools named in the project's documentation.
Where it runs
All 5 documented clients run the server on your machine.
INSTALLATION
Connect your client
Server setup
code --install-extension DeepEcon.stata-mcpMCP Clients
VS Code
{
"servers": {
"stata-mcp": {
"type": "http",
"url": "http://localhost:4000/mcp-streamable"
}
}
}Claude Code
claude mcp add --transport http stata-mcp http://localhost:4000/mcp-streamable --scope userClaude Desktop
{
"mcpServers": {
"stata-mcp": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"http://localhost:4000/mcp-streamable"
]
}
}
}Cline
{
"mcpServers": {
"stata-mcp": {
"type": "streamableHttp",
"url": "http://localhost:4000/mcp-streamable"
}
}
}Cursor
{
"mcpServers": {
"stata-mcp": {
"url": "http://localhost:4000/mcp-streamable"
}
}
}