mirror of
https://github.com/bitechdev/ResolveSpec.git
synced 2026-04-05 15:36:15 +00:00
feat(resolvemcp): add SSE server and bunrouter setup functions
* Introduce SSEServer method for creating an SSE server bound to the handler. * Add SetupBunRouterRoutes function to mount MCP HTTP/SSE endpoints on bunrouter. * Update README with usage examples for new features.
This commit is contained in:
@@ -52,6 +52,19 @@ func (h *Handler) MCPServer() *server.MCPServer {
|
||||
return h.mcpServer
|
||||
}
|
||||
|
||||
// SSEServer creates an *server.SSEServer bound to this handler.
|
||||
// Use it to mount MCP on any HTTP framework that accepts http.Handler.
|
||||
//
|
||||
// sse := handler.SSEServer("http://localhost:8080", "/mcp")
|
||||
// ginEngine.Any("/mcp/*path", gin.WrapH(sse))
|
||||
func (h *Handler) SSEServer(baseURL, basePath string) *server.SSEServer {
|
||||
return server.NewSSEServer(
|
||||
h.mcpServer,
|
||||
server.WithBaseURL(baseURL),
|
||||
server.WithBasePath(basePath),
|
||||
)
|
||||
}
|
||||
|
||||
// RegisterModel registers a model and immediately exposes it as MCP tools and a resource.
|
||||
func (h *Handler) RegisterModel(schema, entity string, model interface{}) error {
|
||||
fullName := buildModelName(schema, entity)
|
||||
|
||||
Reference in New Issue
Block a user