Skip to content

Commit f14bb4b

Browse files
committed
Implement /api/v1 REST API + SSE Event Stream (P4)
- Add chi router with comprehensive REST API endpoints - Implement /api/v1/servers for server management - Add /api/v1/servers/{id}/{action} for server control (enable/disable/restart/login) - Create /api/v1/servers/{id}/tools for listing server tools - Implement /api/v1/servers/{id}/logs for server log access (placeholder) - Add /api/v1/index/search for tool search with BM25 scoring - Create /events SSE endpoint for real-time status updates - Maintain backward compatibility with existing /api endpoints Features: - CORS support for browser access - Consistent JSON response format with success/error handling - Real-time status streaming via Server-Sent Events - Tool search with input schema parsing - Server state management (enable/disable/quarantine) - Comprehensive server statistics and connection status This provides a modern REST API foundation for web UI and improved tray integration.
1 parent 07cda89 commit f14bb4b

5 files changed

Lines changed: 714 additions & 1 deletion

File tree

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ require (
4242
github.com/blevesearch/zapx/v16 v16.2.4 // indirect
4343
github.com/buger/jsonparser v1.1.1 // indirect
4444
github.com/davecgh/go-spew v1.1.1 // indirect
45+
github.com/go-chi/chi/v5 v5.2.3 // indirect
4546
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
4647
github.com/godbus/dbus/v5 v5.1.0 // indirect
4748
github.com/golang/protobuf v1.3.2 // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk
5353
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
5454
github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M=
5555
github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
56+
github.com/go-chi/chi/v5 v5.2.3 h1:WQIt9uxdsAbgIYgid+BpYc+liqQZGMHRaUwp0JUcvdE=
57+
github.com/go-chi/chi/v5 v5.2.3/go.mod h1:L2yAIGWB3H+phAw1NxKwWM+7eUH/lU8pOMm5hHcoops=
5658
github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss=
5759
github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
5860
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=

0 commit comments

Comments
 (0)