Labsco
hanlulong logo

Stata MCP

β˜… 451

from hanlulong

Run Stata commands and execute .do files directly from VS Code and Cursor, with AI assistant integration.

πŸ”₯πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedFreeAdvanced setup

Stata MCP Extension for VS Code, Cursor, and Antigravity

en cn VS Code Marketplace VS Code Installs Open VSX Open VSX Downloads GitHub Downloads GitHub License

This extension provides Stata integration for Visual Studio Code, Cursor, and Antigravity IDE using the Model Context Protocol (MCP). It enables AI-powered Stata development with GitHub Copilot, Cursor, Antigravity, Cline, Claude Code, or Codex.

Features

  • Run Stata Commands: Execute selections or entire .do files directly from your editor
  • Real-time Output: See Stata results instantly in your editor
  • Syntax Highlighting: Full syntax support for Stata .do, .ado, .mata, and .doh files
  • AI Assistant Integration: Contextual help and code suggestions via MCP
  • Cross-platform: Works on Windows, macOS, and Linux
  • Multi-Session Parallel Execution: Run multiple Stata sessions simultaneously with AI coding tools

Demo

Watch how this extension enhances your Stata workflow with Cursor (or VS Code/Antigravity) and AI assistance:

Stata MCP Extension Demo

🎬 Full Video Version Β Β |Β Β  πŸ“„ View Generated PDF Report

<sub>Demo prompt: "Write and execute Stata do-files, ensuring that full absolute file paths are used in all cases. Load the auto dataset (webuse auto) and generate summary statistics for each variable. Identify and extract key features from the dataset, produce relevant plots, and save them in a folder named plots. Conduct a regression analysis to examine the main determinants of car prices. Export all outputs to a LaTeX file and compile it. Address any compilation errors automatically, and ensure that LaTeX compilation does not exceed 10 seconds. All code errors should be identified and resolved as part of the workflow."</sub>

⚑ Connect Your AI Assistant

Once the extension is running (status bar shows "Stata"), the local MCP server is listening on:

  • http://localhost:4000/mcp-streamable β€” Streamable HTTP (preferred for modern clients)
  • http://localhost:4000/mcp β€” SSE (legacy fallback)

Quick health check: curl -s http://localhost:4000/health should print {"status":"ok",...}.

πŸ“‹ One-prompt setup

Paste the block below into any MCP-aware assistant β€” Claude Code, OpenAI Codex, Cursor AI, Copilot Chat, etc. Hover the box on GitHub and click the copy icon in the top-right corner.

Set up the Stata MCP server for me. Endpoint: http://localhost:4000/mcp-streamable β€” setup guide: https://github.com/hanlulong/stata-mcp#detailed-configurations β€” if I already have a stata-mcp entry in my MCP config (e.g. using mcp-proxy), replace it rather than appending. When registration succeeds, tell me to restart the client so the stata_run_selection tool becomes available.

The assistant reads the guide, detects which client it is, writes the right config (or runs the right CLI command), and tells you to restart. The stata_run_selection tool becomes visible after the restart β€” MCP tool lists do not refresh mid-session.

Prefer manual setup? Expand Detailed Configurations below for per-client instructions.