Repository navigation
Added MCP server - #546
Closed
mjavadalavi wants to merge 1 commit into
Closed
Added MCP server#546mjavadalavi wants to merge 1 commit into
mjavadalavi wants to merge 1 commit into
Conversation
- read-only MCP server over stdio for AI assistants - 31 tools: queries, query stats, explain, indexes, space, maintenance, connections, replication, sequences, settings, and more - no additional dependencies - pghero-mcp executable
Owner
|
Hi @mjavadalavi, thanks for the PR, but it's not something I'd like to maintain. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a built-in MCP server, so AI assistants like Claude can inspect database performance — running queries, query stats, explain plans, indexes, space usage, maintenance, connections, replication, sequences, settings, and more.
Design
explainnever uses ANALYZEPGHERO_DATABASE_URLorconfig/pghero.yml(PGHERO_CONFIG_PATH), works with or without Railspghero-mcpexecutable; guides/MCP.md documents setup for Claude Code, Claude Desktop, and CursorTools (31)
All tools accept an optional
databaseargument and default to the first configured database.overview,running_queries,long_running_queries,blocked_queries,explainquery_stats,query_stats_status,query_detailsindexes,invalid_indexes,duplicate_indexes,unused_indexes,index_usage,index_bloat,missing_indexes,suggested_indexes,best_indexspace,space_growth,relation_space_stats,table_stats,unused_tables,cachingmaintenance,settings,connections,replication,sequences,invalid_constraints,system_stats,databasesFeature availability matches the gem: query stats tools require the pg_stat_statements extension, suggested indexes require the pg_query gem, and system stats require AWS/GCP config — tools return a clear error message when a prerequisite is missing.
Testing
15 new tests covering the protocol (initialize/version negotiation, ping, notifications, error codes) and tool calls against a real database. Full suite: 203 runs, 0 failures.