Skip to content

Add get_problematic_queries tool#518

Merged
luanfreitasdev merged 1 commit into4.xfrom
mcp-tools
Mar 4, 2026
Merged

Add get_problematic_queries tool#518
luanfreitasdev merged 1 commit into4.xfrom
mcp-tools

Conversation

@luanfreitasdev
Copy link
Copy Markdown
Member

This pull request introduces improvements to the MCP server's transport management for HTTP requests and adds new API endpoints and tooling for analyzing problematic SQL queries. The main focus is on making the server more robust by handling transport errors gracefully, and on providing richer diagnostics for SQL queries, including detection of duplicates and queries with EXPLAIN nodes.

Transport management improvements:

  • Refactored the MCP server's HTTP transport logic to instantiate and connect a new StreamableHTTPServerTransport only when needed (i.e., when the previous transport is invalid or missing), improving error recovery and stability for both SSE and POST endpoints. The transport is now reset on error, and the server is properly closed and reconnected as required. [1] [2] [3] [4]
  • Updated the server's stop method to asynchronously close the transport and reset its state, ensuring clean shutdowns.

SQL query diagnostics and API enhancements:

  • Added a new Express endpoint /api/mcp/problematic-queries that returns SQL queries considered problematic (either duplicates or those with EXPLAIN nodes), including detailed metadata and support for limiting the number of returned entries.
  • Added a new Express endpoint /api/mcp/queries-full for retrieving the full set of stored queries with optional limiting.
  • Registered a new tool get_problematic_queries in the MCP server, allowing clients to programmatically fetch problematic SQL queries via the new endpoint.

@luanfreitasdev luanfreitasdev merged commit 820d053 into 4.x Mar 4, 2026
3 checks passed
@luanfreitasdev luanfreitasdev deleted the mcp-tools branch March 4, 2026 11:38
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