{"id":35127390,"url":"https://github.com/tmonk/stata-workbench","last_synced_at":"2026-02-27T18:30:27.124Z","repository":{"id":328666178,"uuid":"1115778458","full_name":"tmonk/stata-workbench","owner":"tmonk","description":"A VS Code compatible extension (Cursor, Windsurf, Antigravity etc.) that allows Stata code to be run directly from the editor. Enables AI agents to directly interact with Stata. Powered by mcp-stata, https://github.com/tmonk/mcp-stata.","archived":false,"fork":false,"pushed_at":"2026-02-09T10:51:44.000Z","size":11717,"stargazers_count":6,"open_issues_count":6,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-09T15:44:29.090Z","etag":null,"topics":["econometrics","economics","mcp","mcp-client","stata"],"latest_commit_sha":null,"homepage":"https://tdmonk.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tmonk.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-13T14:35:10.000Z","updated_at":"2026-02-08T03:19:23.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/tmonk/stata-workbench","commit_stats":null,"previous_names":["tmonk/stata-workbench"],"tags_count":90,"template":false,"template_full_name":null,"purl":"pkg:github/tmonk/stata-workbench","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmonk%2Fstata-workbench","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmonk%2Fstata-workbench/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmonk%2Fstata-workbench/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmonk%2Fstata-workbench/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tmonk","download_url":"https://codeload.github.com/tmonk/stata-workbench/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmonk%2Fstata-workbench/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29901168,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T14:46:13.553Z","status":"ssl_error","status_checked_at":"2026-02-27T14:46:10.522Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["econometrics","economics","mcp","mcp-client","stata"],"created_at":"2025-12-28T03:32:53.820Z","updated_at":"2026-02-27T18:30:27.112Z","avatar_url":"https://github.com/tmonk.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stata Workbench\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/tmonk/stata-workbench/refs/heads/main/img/icon.png\" width=\"200\"\u003e\n\u003c/p\u003e\n\nA VS Code compatible extension (Cursor, Windsurf, Antigravity etc.) that allows Stata code to be run directly from the editor. Enables AI agents to directly interact with Stata. Powered by [mcp-stata](https://github.com/tmonk/mcp-stata).\n\nBuilt by [Thomas Monk](https://tdmonk.com), London School of Economics.\n\n[![Open VSX Downloads](https://img.shields.io/open-vsx/dt/tmonk/stata-workbench?style=flat-square\u0026logo=cursor\u0026label=extension%20downloads\u0026color=black\u0026link=https%3A%2F%2Fopen-vsx.org%2Fextension%2Ftmonk%2Fstata-workbench)](https://open-vsx.org/extension/tmonk/stata-workbench)\n\n## Why use this?\n\n**Run Stata without leaving your editor.** Execute code, see output, and view graphs - all within VS Code. No switching windows, no copying and pasting between your do-file editor and an AI chat.\n\n**For solo work**: A modern IDE for Stata—autocomplete, syntax highlighting, multiple cursors, and an AI assistant that can run commands, inspect your variables, and debug errors directly.\n\n**For collaboration**: Co-authors work in the same environment they use for other code. Shared editor settings, consistent formatting, and AI assistants that understand your project structure.\n\n**For teaching**: Students learn Stata with the same tools they'll use for everything else - inline errors, an integrated terminal, and an AI that can explain what went wrong.\n\n## Installation\n\nInstall directly from the marketplace listings by searching for **Stata Workbench** in the Extensions view.\n\n[![Add to VSCode](https://img.shields.io/badge/VS%20Code-2C2C2C?style=flat\u0026logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+VmlzdWFsIFN0dWRpbyBDb2RlPC90aXRsZT48cGF0aCBmaWxsPSJ3aGl0ZSIgZD0iTTIzLjE1IDIuNTg3TDE4LjIxLjIxYTEuNDk0IDEuNDk0IDAgMCAwLTEuNzA1LjI5bC05LjQ2IDguNjMtNC4xMi0zLjEyOGEuOTk5Ljk5OSAwIDAgMC0xLjI3Ni4wNTdMLjMyNyA3LjI2MUExIDEgMCAwIDAgLjMyNiA4Ljc0TDMuODk5IDEyIC4zMjYgMTUuMjZhMSAxIDAgMCAwIC4wMDEgMS40NzlMMS42NSAxNy45NGEuOTk5Ljk5OSAwIDAgMCAxLjI3Ni4wNTdsNC4xMi0zLjEyOCA5LjQ2IDguNjNhMS40OTIgMS40OTIgMCAwIDAgMS43MDQuMjlsNC45NDItMi4zNzdBMS41IDEuNSAwIDAgMCAyNCAyMC4wNlYzLjkzOWExLjUgMS41IDAgMCAwLS44NS0xLjM1MnptLTUuMTQ2IDE0Ljg2MUwxMC44MjYgMTJsNy4xNzgtNS40NDh2MTAuODk2eiIvPjwvc3ZnPg==\u0026logoColor=white)](https://marketplace.visualstudio.com/items?itemName=tmonk.stata-workbench)\n[![Add to Cursor](https://img.shields.io/badge/Cursor-2C2C2C?style=flat\u0026logo=cursor\u0026logoColor=white)](https://open-vsx.org/extension/tmonk/stata-workbench)\n[![Add to Antigravity](https://img.shields.io/badge/Antigravity-2C2C2C?style=flat\u0026logo=google\u0026logoColor=white)](https://open-vsx.org/extension/tmonk/stata-workbench)\n[![Add to Windsurf](https://img.shields.io/badge/Windsurf-2C2C2C?style=flat\u0026logo=windsurf\u0026logoColor=white)](https://open-vsx.org/extension/tmonk/stata-workbench)\n\n- VS Code Marketplace: [tmonk.stata-workbench](https://marketplace.visualstudio.com/items?itemName=tmonk.stata-workbench)\n- Open VSX: [tmonk/stata-workbench](https://open-vsx.org/extension/tmonk/stata-workbench)\n\nOffline fallback:\n1. Download the latest extension .vsix from the [releases page](https://github.com/tmonk/stata-workbench/releases/latest).\n2. In your VS Code/Cursor/Antigravity/Windsurf IDE, open the command palette (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and select `Extensions: Install from VSIX...`.\n3. Select the downloaded .vsix file and install.\n\n## Quickstart\n\n1. Install the **Stata Workbench** extension.\n2. Open a `.do` file in VS Code (or a compatible editor).\n3. Run **Stata: Run Selection/Line** (press the play button on the top right). The **Stata Terminal** panel opens automatically the first time you run a command. You can interact with this as you would a standard Stata terminal.\n4. Run:\n\n   ```stata\n   sysuse auto, clear\n   summarize\n   ```\n\n   Output appears as output cards in the panel.\n5. Run:\n\n   ```stata\n   scatter price mpg\n   ```\n\n   A **Graph** artifact card appears - click it to open the generated graph.\n\n6. Open the **Data Browser** panel to view your data live.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"img/screenshot.png\" width=\"70%\" alt=\"Stata Terminal panel showing Stata output cards and a graph artifact\" /\u003e\n  \u003cbr /\u003e\n  \u003cem\u003eStata Terminal panel showing output cards and a graph artifact.\u003c/em\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"img/screenshot-data.png\" width=\"70%\" alt=\"Stata Data Browser panel showing data output.\" /\u003e\n  \u003cbr /\u003e\n  \u003cem\u003eData Browser allows for a live view of your data, with filtering and sorting.\u003c/em\u003e\n\u003c/p\u003e\n\n\n\n## Requirements\n- Stata 17+ on macOS, Windows, or Linux.\n- **uv/uvx**: The extension includes bundled `uv` binaries for standard platforms. It will automatically use the system `uv` if available on your `PATH`, or fall back to the bundled version. No manual installation is required for most users.\n\n## Features \u0026 Commands\n- **Syntax highlighting** for Stata, Dyndoc Markdown, and Dyndoc LaTeX.\n- **Run Selection/Current Line** (`stata-workbench.runSelection`) → Executes the selected code or current line via MCP tool `run_command` with normalized output + graphs. Results appear in the terminal panel.\n- **Run Current File** (`stata-workbench.runFile`) → Runs the entire `.do` file via MCP tool `run_do_file`. Results appear in the terminal panel.\n- **Terminal panel**: Automatically opens when running code, displaying results with stdout/stderr, execution time, return codes, and graph artifacts. You can continue running additional Stata commands directly in the panel. Supports quick history navigation (PageUp/PageDown), Tab-based variable name completion, and clickable links to the full SMCL log. Matches Stata's behavior by providing a **Log tab** for viewing the full session history with efficient tail-loading for large files. Includes an **integrated search** within each card (click the search icon in the card header) with bidirectional highlights, match counts, and keyboard shortcuts (`Enter`/`Shift+Enter` for navigation, `Esc` to close).\n- **Data Browser** (`stata-workbench.viewData`): Live view of your data with filtering and sorting. Optimized for high performance (~20x faster with Apache Arrow support) and includes a custom variable selector for large datasets.\n- **Test MCP Server** (`stata-workbench.testMcpServer`) for quick smoke checks.\n- **Install MCP CLI helper** (`stata-workbench.installMcpCli`): Bootstraps uv locally when it is missing.\n- **Status bar + cancel** (`stata-workbench.cancelRequest`): Live request states with one-click cancellation routed through the MCP client.\n- **Auto-manage MCP configs**: Writes the user-level `mcp.json` in your editor's user data so AI agents reuse the same `uvx --refresh --refresh-package mcp-stata --from mcp-stata@latest mcp-stata` wiring.\n- **Durable logs**: All run results are logged to the `Stata Workbench` output channel for reference.\n\n## Settings\n- `stataMcp.requestTimeoutMs` (default `100000`): timeout for MCP requests.\n- `stataMcp.autoRevealOutput` (default `false`): automatically show the output channel after runs.\n- `stataMcp.autoConfigureMcp` (default `true`): automatically add/update the mcp-stata server entry in your host MCP config (`mcp.json`).\n- `stataMcp.configureClaudeCode` (default `false`): register mcp-stata via `claude mcp add-json` at user scope. Ensures both Claude Code CLI and VS Code extension see the server. Requires `claude` on PATH.\n- `stataMcp.configureCodex` (default `false`): also configure Codex CLI and VS Code extension MCP settings.\n- `stataMcp.codexConfigPath` (default `~/.codex/config.toml`): path to Codex MCP config. Supports `~` and `${workspaceFolder}`.\n- `stataMcp.runFileWorkingDirectory` (default empty): working directory when running .do files. Supports an absolute path, ~, ${workspaceFolder} or ${fileDir}; empty uses the .do file's folder.\n- `stataMcp.setupTimeoutSeconds` (default `60`): timeout (seconds) for Stata initialization.\n- `stataMcp.noReloadOnClear` (default `false`): disable reloading startup/profile do files after clear all/program drop.\n- `stataMcp.maxOutputLines` (default `0`): limit Stata output to N lines (0 = unlimited). Useful for reducing token usage with AI agents.\n- `stataMcp.runFileBehavior` (default `runDirtyFile`): choose whether 'Run File' should run the current editor content (including unsaved changes) or the version saved on disk.\n- `stataMcp.defaultVariableLimit` (default `100`): default number of variables to select when opening the Data Browser (0 = all). Useful for huge datasets.\n\n\n## AI Assistant Integration\n\n### Automatic Configuration\n\nMCP configuration is **synced on extension load and when you toggle the relevant settings**. When a setting is enabled, the extension adds or updates the mcp-stata entry in that config. When you turn the setting off, the extension **removes** the mcp_stata entry cleanly.\n\n| When | Behaviour |\n|------|-----------|\n| Extension loads | Adds/updates mcp-stata in each enabled config target |\n| Setting toggled ON | Adds/updates mcp-stata in that config |\n| Setting toggled OFF | Removes mcp_stata from that config |\n\nThe extension detects your editor and writes to the appropriate config file(s).\n- User-level `mcp.json` with Stata MCP server entry\n- Uses `uvx --refresh --refresh-package mcp-stata --from mcp-stata@latest mcp-stata` for auto-updates\n- Works for: VS Code, Cursor, Windsurf, Antigravity\n- Optional: Claude Code CLI and extension when `stataMcp.configureClaudeCode` is enabled\n- Optional: Codex CLI and extension when `stataMcp.configureCodex` is enabled\n\n**Config file locations:**\n\n| Editor | macOS | Windows | Linux |\n|--------|-------|---------|-------|\n| **VS Code** | `~/Library/Application Support/Code/User/mcp.json` | `%APPDATA%/Code/User/mcp.json` | `~/.config/Code/User/mcp.json` |\n| **VS Code Insiders** | `~/Library/Application Support/Code - Insiders/User/mcp.json` | `%APPDATA%/Code - Insiders/User/mcp.json` | `~/.config/Code - Insiders/User/mcp.json` |\n| **Cursor** | `~/.cursor/mcp.json` | `%USERPROFILE%/.cursor/mcp.json` | `~/.cursor/mcp.json` |\n| **Windsurf** | `~/.codeium/windsurf/mcp_config.json` | `%USERPROFILE%/.codeium/windsurf/mcp_config.json` | `~/.codeium/windsurf/mcp_config.json` |\n| **Windsurf Next** | `~/.codeium/windsurf-next/mcp_config.json` | `%USERPROFILE%/.codeium/windsurf-next/mcp_config.json` | `~/.codeium/windsurf-next/mcp_config.json` |\n| **Antigravity** | `~/Library/Application Support/Antigravity/User/mcp.json` | `%APPDATA%/Antigravity/User/mcp.json` | `~/.antigravity/mcp.json` |\n| **Claude Code CLI \u0026 extension** | Via `claude mcp add-json` (user scope) | same | same |\n| **Codex CLI \u0026 extension** | `stataMcp.codexConfigPath` (default `~/.codex/config.toml`) | same | same |\n\nIf you want to manage the file yourself, here is the content to add. User-level `mcp.json`:\n```json\n{\n  \"servers\": {\n    \"mcp_stata\": {\n      \"type\": \"stdio\",\n      \"command\": \"uvx\",\n      \"args\": [\"--refresh\", \"--refresh-package\", \"mcp-stata\", \"--from\", \"mcp-stata@latest\", \"mcp-stata\"]\n    }\n  }\n}\n```\n\n## Troubleshooting\n- **Claude Code extension doesn't see MCPs**: We use `claude mcp add-json` so both CLI and extension share the same config. Ensure `claude` is on PATH and `stataMcp.configureClaudeCode` is enabled. Restart the Claude Code panel after changes.\n- **Icons not visible in editor title bar**: If the play, run, and graph icons don't appear when you open a `.do` file, click the `...` menu in the editor title bar and enable the Stata Workbench icons to make them visible.\n- **Status bar says \"CLI missing\"**: This usually only occurs on unsupported platforms where a bundled binary is not provided. Install `uv` manually with `curl -LsSf https://astral.sh/uv/install.sh | sh` (macOS/Linux) or `powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command \"iwr https://astral.sh/uv/install.ps1 -useb | iex\"` (Windows).\n- **Requests time out**: raise `stataMcp.requestTimeoutMs`.\n- Unexpected MCP errors: open the output channel for a structured error message.\n- Cancel a stuck run: run `Stata: Cancel Current Request` from the command palette.\n\n## Uninstall cleanup (optional)\n**Automatic removal:** Turn off `stataMcp.autoConfigureMcp`, `stataMcp.configureClaudeCode`, or `stataMcp.configureCodex` in settings; the extension removes the mcp_stata entry immediately.\n\n**Manual removal:** Edit the config file and delete the relevant entry:\n- VS Code format → delete `servers.mcp_stata`\n- Cursor format → delete `mcpServers.mcp_stata`\n- Claude Code → run `claude mcp remove mcp_stata`, or turn off `stataMcp.configureClaudeCode` to auto-remove\n- Codex → delete `[mcp_servers.mcp_stata]` and `[mcp_servers.mcp_stata.env]` from `~/.codex/config.toml`\n\n## Telemetry\n\nThis extension uses Sentry to collect error and performance data to improve reliability. No personal data is collected. You can disable telemetry by setting `\"stata-workbench.telemetry.enabled\": false` in your VS Code settings.\n\n## Acknowledgments\nPortions of this file are derived from [stata-mcp](https://github.com/hanlulong/stata-mcp) (MIT License), [language-stata](https://github.com/kylebarron/language-stata) by Kyle Barron (MIT License), and [vscode-stata](https://github.com/kylebutts/vscode-stata) by Kyle Butts (MIT License). See license_extras for the full license texts. Do check their projects out!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmonk%2Fstata-workbench","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftmonk%2Fstata-workbench","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmonk%2Fstata-workbench/lists"}