feat(mcp): notify desktop UI to reload after connection add/remove

Add /reload-connections bridge route that emits mcp-reload-connections
event, triggering the frontend to re-read connections from SQLite.
This commit is contained in:
t8y2 committed 2026-05-08 12:44:16 +08:00
1 parent 30b6c472ea
commit 68d8776e8f
3 files changed
+15

No files matched your search

+3
View File
@@ -74,6 +74,9 @@ pub fn start(app_handle: AppHandle, state: Arc<AppState>) {
handle_open_table(&app, &st, body, &mut stream).await;
} else if first_line.starts_with("POST /execute-query") {
handle_execute_query(&app, &st, body, &mut stream).await;
} else if first_line.starts_with("POST /reload-connections") {
let _ = app.emit("mcp-reload-connections", ());
respond(&mut stream, "200 OK", "ok").await;
} else {
let _ = stream.write_all(b"HTTP/1.1 404 Not Found\r\nContent-Length: 0\r\n\r\n").await;
}