handlers

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package handlers provides API endpoints and HTTP request handlers.

Package handlers provides HTTP request handlers.

Package handlers provides HTTP request handlers for the web interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIHandlers

type APIHandlers struct {
	// contains filtered or unexported fields
}

APIHandlers holds dependencies for API endpoints.

func NewAPIHandlers

func NewAPIHandlers(bs backend.Service, logger log.Logger) *APIHandlers

NewAPIHandlers creates a new instance of APIHandlers.

func (*APIHandlers) AddMCPServer

func (h *APIHandlers) AddMCPServer(w http.ResponseWriter, r *http.Request)

AddMCPServer handles POST /api/mcp/servers

func (*APIHandlers) GetMCPServer

func (h *APIHandlers) GetMCPServer(w http.ResponseWriter, r *http.Request)

GetMCPServer handles GET /api/mcp/servers/:id

func (*APIHandlers) HealthCheck

func (h *APIHandlers) HealthCheck(w http.ResponseWriter, _ *http.Request)

HealthCheck handles GET /api/health

func (*APIHandlers) ListAllTools

func (h *APIHandlers) ListAllTools(w http.ResponseWriter, r *http.Request)

ListAllTools handles GET /api/mcp/tools

func (*APIHandlers) ListMCPServers

func (h *APIHandlers) ListMCPServers(w http.ResponseWriter, _ *http.Request)

ListMCPServers handles GET /api/mcp/servers - Returns full JSON

func (*APIHandlers) ListMCPServersFragment

func (h *APIHandlers) ListMCPServersFragment(w http.ResponseWriter, r *http.Request)

ListMCPServersFragment handles GET /api/mcp/servers/list-fragment - Returns HTML fragment

func (*APIHandlers) ListServerTools

func (h *APIHandlers) ListServerTools(w http.ResponseWriter, r *http.Request, serverID int64)

ListServerTools handles GET /api/mcp/servers/:id/tools

func (*APIHandlers) RediscoverAllTools

func (h *APIHandlers) RediscoverAllTools(w http.ResponseWriter, r *http.Request)

RediscoverAllTools handles POST /api/mcp/rediscover-tools

func (*APIHandlers) RediscoverServerTools

func (h *APIHandlers) RediscoverServerTools(w http.ResponseWriter, r *http.Request, serverID int64)

RediscoverServerTools handles POST /api/mcp/servers/:id/rediscover-tools

func (*APIHandlers) RegisterRoutes

func (h *APIHandlers) RegisterRoutes(mux *http.ServeMux)

RegisterRoutes sets up the API routes on the given router. The actual router type might differ (e.g., chi, http.ServeMux). This function might live in an fx module instead.

func (*APIHandlers) RemoveMCPServer

func (h *APIHandlers) RemoveMCPServer(w http.ResponseWriter, r *http.Request, serverID int64)

RemoveMCPServer handles DELETE /api/mcp/servers/:id

func (*APIHandlers) ServeOpenAPISpec

func (h *APIHandlers) ServeOpenAPISpec(w http.ResponseWriter, r *http.Request)

ServeOpenAPISpec serves the OpenAPI specification file

func (*APIHandlers) ServeSwaggerUI

func (h *APIHandlers) ServeSwaggerUI(w http.ResponseWriter, r *http.Request)

ServeSwaggerUI serves the Swagger UI HTML

func (*APIHandlers) UpdateMCPServer

func (h *APIHandlers) UpdateMCPServer(w http.ResponseWriter, r *http.Request, serverID int64)

UpdateMCPServer handles PUT /api/mcp/servers/:id It updates the name and URL of the specified server.

func (*APIHandlers) UpdateMCPServerStatus

func (h *APIHandlers) UpdateMCPServerStatus(w http.ResponseWriter, r *http.Request, serverID int64)

UpdateMCPServerStatus handles PUT /api/mcp/servers/:id/status

func (*APIHandlers) UpdateServerTools

func (h *APIHandlers) UpdateServerTools(w http.ResponseWriter, r *http.Request, serverID int64)

UpdateServerTools handles POST /api/mcp/servers/:id/tools

type SSEHandler

type SSEHandler struct {
	// contains filtered or unexported fields
}

SSEHandler manages Server-Sent Events connections and broadcasts events.

func NewSSEHandler

func NewSSEHandler(ctx context.Context, logger log.Logger, bus events.Bus, bs backend.Service) *SSEHandler

NewSSEHandler creates and starts a new SSEHandler.

func (*SSEHandler) ServeHTTP

func (h *SSEHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP handles incoming HTTP requests for SSE connections.

func (*SSEHandler) Stop

func (h *SSEHandler) Stop()

Stop gracefully shuts down the SSEHandler.

type UIHandler

type UIHandler struct {
	// contains filtered or unexported fields
}

UIHandler holds dependencies for UI handlers.

func NewUIHandler

func NewUIHandler(bs backend.Service, logger log.Logger) *UIHandler

NewUIHandler creates a UIHandler with the necessary dependencies.

func (*UIHandler) ServeIndex

func (h *UIHandler) ServeIndex(w http.ResponseWriter, r *http.Request)

ServeIndex handles requests for the main UI page.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL