Skip to content

Releases: hanlulong/stata-mcp

v0.5.3 - Windows locale port fix, streaming output fix, user log coexistence

Choose a tag to compare

@hanlulong hanlulong released this 05 Jul 20:35

What's Changed

Fixed

  • Python setup crash "Exit code: 9 - bad option: --js-flags" (#61): the dependency installer no longer inherits Electron-specific flags from the host IDE.
  • Empty output panel despite successful do-file execution (#62): streaming execution now writes to the exact log file the stream monitors, with a fallback that emits the final result directly if log tailing produced nothing.
  • User log using commands broken by output capture (#63): the server now captures output through its own named log (__mcp_log) and never touches user logs; log using/log close in your do-files work as in native Stata. If your code runs log close _all, MCP capture automatically resumes.
  • Port reclaim failed on non-English Windows (#64): all three port-cleanup paths are now locale-independent (netstat parsing without state-word matching in Python; PowerShell Get-NetTCPConnection in the extension and standalone launcher). IPv4+IPv6 covered.
  • workingDirectory setting now honored in multi-session mode (#36), including the none option.
  • Interactive window works behind path-prefixing proxies (#54) — relative URLs instead of root-relative.
  • Data Viewer no longer materializes the full filtered dataset before applying the row limit (related to #59).

Changed

  • Session log filenames use a sanitized session id + short hash (prevents invalid filenames/path traversal).
  • MCP stata_run_selection accepts timeout, working_dir, and session_id; timeouts enforced server-side in single-session mode.
  • Compact output mode strips Stata log header/footer noise from selection results.
  • start-server.js forwards --log-file-location / --custom-log-directory.
  • Temporary preprocessed do-files are cleaned up on all execution paths.

Full Changelog: v0.5.2...v0.5.3

v0.5.2 - Graph Viewer Rewrite + Preserve/Restore Fix

Choose a tag to compare

@hanlulong hanlulong released this 19 Apr 13:57

What's Changed

Graph Viewer Rewrite (Issue #60)

  • Stable webview shell with message-based (postMessage) hydration — no more full-document replacement on every update
  • External CSS/JS assets loaded with nonce-based Content Security Policy, matching Microsoft's recommended webview pattern
  • Execution-scoped graph artifacts — each batch lives under its own directory with a manifest, so graph1.png / graph2.png no longer overwrite each other across runs
  • Graph state centralized in a dedicated GraphStore on the extension side
  • Webview resource paths resolved through fs.realpathSync, so images load correctly on filesystems with symlinks or reparse points (macOS /private/var, Linux symlinked /tmp, Windows OneDrive, cloud-synced install locations)

Fixed

  • "Already preserved r(621)" error (Issue #58): Data Viewer filter no longer touches the user's preserve stack — replaced with isolated frame copy
  • Session restart recovery: users stuck in the r(621) state can recover via "Restart Stata Session"
  • Help endpoint if/else syntax error: fixed malformed Stata code in HTML help lookup
  • View Data toolbar button overflow: added explicit navigation@N ordering so the button stays visible
  • Graph viewer black-screen / missing content (Issue #60): resolved by the webview rewrite and path-resolution changes above; also added defensive onerror handling and server-side file-size validation for empty/corrupt PNG exports

Hardened

  • Session manager: explicit session_id requests no longer silently reroute; execution timeouts recover the session in place; dead default sessions are now recovered; non-execution timeouts no longer reset a session unnecessarily

Tests

  • New tests/test_graph_artifacts.py covering execution-scoped artifact layer
  • Rewrote tests/test_notifications.py and tests/test_streaming_http.py to make real assertions when a local integration server is available and skip cleanly otherwise
  • Expanded tests/test_session_manager.py for the session hardening changes

Full Changelog: v0.5.1...v0.5.2

v0.5.1 - Fix Streaming Output in Cursor/Trae

Choose a tag to compare

@hanlulong hanlulong released this 28 Mar 13:08

What's Changed

Fixed

  • Streaming output not displaying in Cursor/Trae (Issue #57): Force Node.js HTTP adapter for streaming requests to prevent axios from selecting the incompatible XHR adapter in VS Code forks

Full Changelog: v0.5.0...v0.5.1

v0.5.0 - Interactive Window Panel Mode & Remote Environment Fixes

Choose a tag to compare

@hanlulong hanlulong released this 15 Mar 02:28

What's Changed

Interactive Window as VS Code Panel (Issue #54)

  • New setting stata-vscode.interactiveDisplayMode: choose panel (default) to open the Interactive Window as a VS Code webview tab, or browser for external browser
  • Panel mode executes code and displays output/graphs inline with interactive command input

Fixed

  • Interactive Window URL broken in code-server: asExternalUri() was stripping the /interactive path in proxied environments. Fixed by resolving the base URL first, then re-appending path and query.
  • Graph viewer scrolling lockup: Added proper overflow CSS and capped graph history at 50 entries to prevent unbounded DOM growth.
  • Same asExternalUri fix applied to external browser graph display URLs.

Full Changelog: v0.4.9...v0.5.0

v0.4.9 - Help Command Support with Rich SMCL Rendering

Choose a tag to compare

@hanlulong hanlulong released this 25 Feb 07:08

What's Changed

Help Command Support (Issue #55)

  • Type help regress, man logit, h merge, etc. via Run Selection or the Interactive Window to display Stata help in a dedicated webview panel
  • Rich SMCL rendering — full formatting with bold, italic, command styling, proper fonts and colors (matches Stata's native Viewer)
  • Clickable links — click any help reference to navigate to that topic
  • Back/Forward navigation with history
  • Table of contents from {viewerjumpto} entries for quick section navigation
  • "Also see" section with clickable related topics
  • Synopt tables rendered as proper HTML tables
  • VS Code theme-aware — adapts to light and dark themes
  • Supports help, man, chelp, whelp commands (including abbreviations)
  • Handles multi-word topics, #-prefixed topics, and options
  • MCP tool calls (AI agents) are NOT affected

Note: The help interception works when a single help command line is selected and run. If help is embedded inside a longer do-file or multi-line selection, it goes through normal Stata execution.

Full Changelog: v0.4.8...v0.4.9

v0.4.8 - Fix Graphs in Remote Environments

Choose a tag to compare

@hanlulong hanlulong released this 25 Feb 03:11

What's Changed

Fixed

  • Graphs Fail in Remote Environments (Issue #54): Fixed graph display in code-server, Remote-SSH, and proxied environments
    • Replaced http://localhost image URLs with webview.asWebviewUri() for loading graphs from disk
    • Added proper localResourceRoots to webview panels
    • Updated Content Security Policy to use webview.cspSource
    • External browser display now uses vscode.env.asExternalUri() for correct URL resolution
  • Path traversal protection on /graphs/ HTTP endpoint
  • Graph output parsing fixed for lines with [CMD: ...] suffix
  • Null reference guard in interactive panel when closed during async operation
  • HTML escaping hardened for graph names, URLs, and file names

Full Changelog: v0.4.7...v0.4.8

v0.4.7 - Restart Session & Fix Globals Persistence

Choose a tag to compare

@hanlulong hanlulong released this 15 Feb 03:17

What's Changed

Added

  • Restart Stata Session command — reset the Stata session to a clean state from the editor toolbar, context menu, or Command Palette. Equivalent to closing and reopening Stata.

Fixed

  • Globals and macros lost between runs (Issue #51) — removed overly aggressive capture program drop _all and capture macro drop _all from the Run File wrapper. Sequential workflows now work correctly: run config.do to define globals, then analysis.do can access them.
  • Windows trailing backslash path issue (Issue #52) — fixed working directory path handling when path ends with \.

Full Changelog: v0.4.6...v0.4.7

v0.4.6 - Data Viewer Large Dataset Support

Choose a tag to compare

@hanlulong hanlulong released this 27 Jan 05:33

What's Changed

Added

  • Data Viewer Large Dataset Support: Efficient virtual scrolling for handling up to 500K rows
    • Only renders visible rows (~50-100 DOM elements) instead of all rows
    • Smooth scrolling experience even with large datasets
    • New setting stata-vscode.dataViewerMaxRows (default: 100K, max: 500K)
    • Warning: Setting above 500K may cause slow loading due to JSON transfer size

Fixed

  • Row Number Display After Filtering: Row numbers now correctly show original Stata observation numbers

    • Previously showed sequential numbers (1, 2, 3...) after filtering
    • Now displays actual observation numbers from original dataset (e.g., 10, 25, 50...)
  • Number Formatting in Data Viewer: Fixed regex escaping issue in template literals

    • Trailing zeros now correctly removed from decimal numbers
  • Data Loading with obs Parameter: Fixed pdataframe_from_data(obs=...) usage

    • Efficient row limiting without data copying

Full Changelog: v0.4.5...v0.4.6

v0.4.5 - Fix MCP Tool Name Length Issue

Choose a tag to compare

@hanlulong hanlulong released this 26 Jan 05:06

What's Changed

Fixed

  • MCP Tool Name Too Long: Fixed 400 error caused by auto-generated tool names exceeding API length limits (Issue #48)
    • Hidden streaming endpoints (/run_file/stream, /run_selection/stream) from MCP schema
    • Streaming endpoints remain functional for HTTP but are no longer exposed as MCP tools
    • Prevents invalid_request_error when using Claude Code or other MCP clients

Full Changelog: v0.4.4...v0.4.5

v0.4.4 - Bug Fixes for Windows & VS Code

Choose a tag to compare

@hanlulong hanlulong released this 19 Jan 02:50

What's Changed

Fixed

  • HTTP Protocol Error on Windows: Fixed h11 "MUST_CLOSE" error during streaming execution (Issue #45)

    • Restructured run_selection_stream to match run_file_stream approach
    • Moved temp file cleanup from generator's try-finally to worker thread
    • Prevents protocol violations when client disconnects mid-stream
  • Unwanted .cursor Directory Creation: Fixed extension creating .cursor/mcp.json in VS Code (Issue #45)

    • Added IDE detection using vscode.env.appName
    • MCP config auto-update now only runs when using Cursor IDE

Full Changelog: v0.4.3...v0.4.4