Add external MCP server support (stdio JSON-RPC)
Lets the AI connect to any external stdio MCP server (e.g. safaridriver --mcp) configured in Settings, with tools auto-discovered and prefixed by server slug. Includes crash detection with backoff restart (5s/15s/30s) and a Settings UI to add/enable/disable/remove servers. Fixes the temp-dir allowlist in MCPService.isPathAllowed to also match /tmp and /private/tmp (not just NSTemporaryDirectory(), which resolves to a different per-user Darwin temp dir) so the MCP file tools can actually read files external servers and image generation write there. Also switches the Add Server sheet's argument parsing to a quote-aware tokenizer so args containing spaces survive intact. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+4
-1
@@ -37,6 +37,9 @@ struct oAIApp: App {
|
||||
// Start email handler on app launch
|
||||
EmailHandlerService.shared.start()
|
||||
|
||||
// Start external MCP servers
|
||||
Task { @MainActor in ExternalMCPManager.shared.startAll() }
|
||||
|
||||
// Sync Git changes on app launch (pull + import)
|
||||
Task {
|
||||
await GitSyncService.shared.syncOnStartup()
|
||||
@@ -56,7 +59,7 @@ struct oAIApp: App {
|
||||
}
|
||||
#if os(macOS)
|
||||
.onReceive(NotificationCenter.default.publisher(for: NSApplication.willTerminateNotification)) { _ in
|
||||
// Trigger auto-save on app quit
|
||||
Task { @MainActor in ExternalMCPManager.shared.stopAll() }
|
||||
Task {
|
||||
await chatViewModel.onAppWillTerminate()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user