Skip to content

Add MCP server for AI-assisted plan analysis#6

Merged
erikdarlingdata merged 1 commit intodevfrom
feature/mcp-server
Mar 5, 2026
Merged

Add MCP server for AI-assisted plan analysis#6
erikdarlingdata merged 1 commit intodevfrom
feature/mcp-server

Conversation

@erikdarlingdata
Copy link
Copy Markdown
Owner

Summary

  • Opt-in MCP server (Streamable HTTP on localhost, disabled by default) exposing 13 read-only tools
  • Plan analysis tools work on plans already loaded in the app (file, paste, query execution, Query Store)
  • Query Store tools use the app's built-in read-only DMV query only — no arbitrary SQL execution
  • PlanSessionManager bridges UI thread plan state to MCP tool layer (thread-safe via ConcurrentDictionary)
  • Enable via ~/.planview/settings.json: {"mcp_enabled": true, "mcp_port": 5152}

Test plan

  • Build succeeds with 0 errors (verified)
  • All 37 tests pass (verified)
  • App launches normally with MCP disabled (default)
  • Enable MCP, verify server responds on configured port
  • Open a .sqlplan, verify list_plans returns it
  • Call analyze_plan, get_plan_warnings, get_missing_indexes — verify results
  • Close the plan tab, verify list_plans no longer shows it
  • Test Query Store tools with a connected server
  • Verify Help menu shows MCP status

🤖 Generated with Claude Code

Opt-in MCP server (disabled by default) that exposes loaded execution plans
and Query Store data to AI assistants via read-only tools over Streamable HTTP.

13 tools total:
- Discovery: list_plans, get_connections
- Plan analysis: analyze_plan, get_plan_summary, get_plan_warnings,
  get_missing_indexes, get_plan_parameters, get_expensive_operators,
  get_plan_xml, compare_plans, get_repro_script
- Query Store: check_query_store, get_query_store_top (uses built-in
  read-only DMV query only, no arbitrary SQL)

Enable via ~/.planview/settings.json: {"mcp_enabled": true, "mcp_port": 5152}

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant