Skip to content

A native macOS / windows / Linux database IDE built with Swift and AppKit. Connect to PostgreSQL, MySQL, SQLite, and Redis from a single app with a fast, keyboard-driven interface.

C++

fix(mcp): stub unimplemented capability handlers & auto-connect on stdio startup

nguyen trand9a972ad62b8
diff --git a/macos/App/Lifecycle/main.swift b/macos/App/Lifecycle/main.swift
index 34a0c08..3d7da3c 100644
--- a/macos/App/Lifecycle/main.swift
+++ b/macos/App/Lifecycle/main.swift
@@ -50,6 +50,7 @@ func runMCPServerAsync(modelContainer: ModelContainer) async {
// Create services
let connectionManager = ConnectionManager()
let connectionRepository = SwiftDataConnectionRepository(modelContainer: modelContainer)
+ let keychain = KeychainService()
// Create MCP server with stdio transport for CLI mode
let mcpServer = MCPServer(
@@ -59,11 +60,28 @@ func runMCPServerAsync(modelContainer: ModelContainer) async {
transportMode: .stdio
)
- // Load connections and their MCP modes
+ // Load connections, register their MCP modes, and pre-open DB connections so
+ // tools that require an active adapter (list_tables, query, …) work without
+ // requiring the GUI app to be open. The stdio entrypoint runs in a separate
+ // process from the main GUI, so it cannot share live adapters with it.
do {
let configs = try await connectionRepository.fetchAll()
for config in configs where config.mcpMode != .locked {
await mcpServer.setConnectionMode(config.mcpMode, for: config.id)
+
+ let password = (try? keychain.loadPassword(connectionId: config.id)) ?? nil
+ let sshPassword = config.sshConfig != nil
+ ? ((try? keychain.loadSSHPassword(connectionId: config.id)) ?? nil)
+ : nil
+ do {
+ _ = try await connectionManager.connect(
+ config: config,
+ password: password,
+ sshPassword: sshPassword
+ )
+ } catch {
+ fputs("Warning: Failed to open connection '\(config.name)': \(error)\n", stderr)
+ }
}
} catch {
fputs("Warning: Failed to load connections: \(error)\n", stderr)
diff --git a/macos/Services/MCP/MCPServer.swift b/macos/Services/MCP/MCPServer.swift
index ca6c694..3e42e75 100644
--- a/macos/Services/MCP/MCPServer.swift
+++ b/macos/Services/MCP/MCPServer.swift
@@ -93,7 +93,7 @@ actor MCPServer: StdioTransportDelegate {
case "initialize":
response = await handleInitialize(request)
- case "initialized":
+ case "initialized", "notifications/initialized":
// Client acknowledges initialization, no response needed
return
@@ -103,6 +103,15 @@ actor MCPServer: StdioTransportDelegate {
case "tools/call":
response = await handleToolCall(request)
+ case "prompts/list":
+ response = JSONRPCResponse(id: request.id, result: .object(["prompts": .array([])]))
+
+ case "resources/list":
+ response = JSONRPCResponse(id: request.id, result: .object(["resources": .array([])]))
+
+ case "resources/templates/list":
+ response = JSONRPCResponse(id: request.id, result: .object(["resourceTemplates": .array([])]))
+
case "ping":
response = JSONRPCResponse(id: request.id, result: .object(["pong": .bool(true)]))