fix(mcp): dispatch plugin drivers via the registry + harden the --mcp subprocess#256
Merged
Merged
Conversation
…ocess The MCP server hardcoded mysql/postgres/sqlite dispatch, so every plugin driver (e.g. hackernews) failed with "Unsupported driver". Route schema, list/describe table, query and EXPLAIN through the shared driver registry, and register the built-in + installed plugin drivers when the --mcp subprocess starts (it has no Tauri AppHandle). Hardening surfaced by reaching plugins from MCP: - Bound plugin RPC calls with a timeout (120s call, 15s initialize) so a wedged plugin can't block the single-threaded request loop forever, and cancel the pending entry on timeout so it doesn't leak. - kill_on_drop the plugin child so it isn't orphaned when the subprocess exits on stdin EOF. - Refuse plugins that claim a built-in driver id (mysql/postgres/sqlite). - Resolve resources/read through the keychain/SSH-aware path. - Initialize the logger in --mcp mode (stderr only) so plugin-load errors are visible. - Stop cleanly instead of panicking when a stdout write fails (BrokenPipe). - Run describe_table's column/FK/index fetches concurrently.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (5 files)
Reviewed by kimi-k2.6 · 435,773 tokens |
Collaborator
|
Good catch! I will check it ASAP |
2 tasks
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.
Summary
MCP could only reach built-in mysql/postgres/sqlite connections — every plugin-driven connection (Hacker News, Redis, …) failed with
Unsupported driver. This routes all MCP driver operations through the shared driver registry (the same path the GUI uses) and registers the built-in + installed plugin drivers when the standalone--mcpsubprocess starts.Closes #255.
What changed
list_tables,describe_table,run_query, and pre-flightEXPLAINnow resolve the driver viaregistry::get_driverinstead of a hardcodedmatch.--mcpmode registers the three built-ins + installed plugins (load_plugins_with_configs), honoringactive_external_drivers.Hardening surfaced by reaching plugins from MCP
initialize) so a wedged plugin can't block the single-threaded request loop forever, and cancel the pending entry on timeout so it doesn't leak.kill_on_dropthe plugin child so it isn't orphaned when the subprocess exits on stdin EOF.mysql/postgres/sqlite).resources/readthrough the keychain/SSH-aware path.--mcpmode (stderr only) so plugin-load errors are visible.describe_table's column/FK/index fetches concurrently.Test plan
cargo buildclean (no warnings) on latestmaincargo test --lib pluginspasses--mcpbinary:list_tables→["stories"],run_query→ real rows,resources/read→ schema (previously allUnsupported driver)--mcpsubprocess exits