Documentation
¶
Index ¶
- type AudioHandler
- type BaseHandler
- type ImageHandler
- type ResponseHandler
- type Server
- func (s *Server) EnableMetrics(cfg config.MetricsConfig)
- func (s *Server) EnableTracing(serviceName string)
- func (s *Server) RegisterRoutes(ctx context.Context) error
- func (s *Server) ReloadConfigs(ctx context.Context)
- func (s *Server) Shutdown(_ context.Context) error
- func (s *Server) Start()
- func (s *Server) UpdateConfig(ctx context.Context, cfg *config.MCPConfig)
- type ServerOption
- type TextHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AudioHandler ¶
type AudioHandler struct {
BaseHandler
}
AudioHandler is a handler for audio responses
func (*AudioHandler) Handle ¶
func (h *AudioHandler) Handle(resp *http.Response, tool *config.ToolConfig, tmplCtx *template.Context) (*mcp.CallToolResult, error)
type BaseHandler ¶
type BaseHandler struct {
// contains filtered or unexported fields
}
BaseHandler is a base implementation of the ResponseHandler interface
func (*BaseHandler) HandleNext ¶
func (h *BaseHandler) HandleNext(resp *http.Response, tool *config.ToolConfig, tmplCtx *template.Context) (*mcp.CallToolResult, error)
func (*BaseHandler) SetNext ¶
func (h *BaseHandler) SetNext(handler ResponseHandler)
type ImageHandler ¶
type ImageHandler struct {
BaseHandler
}
ImageHandler is a handler for image responses
func (*ImageHandler) Handle ¶
func (h *ImageHandler) Handle(resp *http.Response, tool *config.ToolConfig, tmplCtx *template.Context) (*mcp.CallToolResult, error)
type ResponseHandler ¶
type ResponseHandler interface {
// CanHandle checks if the handler can process the given response
CanHandle(resp *http.Response) bool
// Handle processes the response and returns the result
Handle(resp *http.Response, tool *config.ToolConfig, tmplCtx *template.Context) (*mcp.CallToolResult, error)
// SetNext sets the next handler in the chain
SetNext(handler ResponseHandler)
}
ResponseHandler is an interface for handling HTTP responses
func CreateResponseHandlerChain ¶
func CreateResponseHandlerChain() ResponseHandler
CreateResponseHandlerChain create a chain of response handlers The first handler is ImageHandler, which handles image responses. The second handler is TextHandler, which handles text responses. default handler is a base handler that can handle any other type of response. If the response is neither, it will return an error.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents the MCP server
func NewServer ¶
func NewServer(logger *zap.Logger, port int, store storage.Store, sessionStore session.Store, a auth.Auth, opts ...ServerOption) (*Server, error)
NewServer creates a new MCP server. Required params are explicit; optional features are configured via ServerOption (e.g., tracing, forward config).
func (*Server) EnableMetrics ¶ added in v0.9.1
func (s *Server) EnableMetrics(cfg config.MetricsConfig)
func (*Server) EnableTracing ¶ added in v0.9.0
EnableTracing attaches OpenTelemetry gin middleware using the given service name.
func (*Server) RegisterRoutes ¶
RegisterRoutes registers routes with the given router for MCP servers
func (*Server) ReloadConfigs ¶
type ServerOption ¶ added in v0.9.0
type ServerOption func(*Server)
ServerOption allows configuring optional server features without breaking callers.
func WithForwardConfig ¶ added in v0.9.0
func WithForwardConfig(cfg config.ForwardConfig) ServerOption
WithForwardConfig sets the forward proxy configuration.
func WithToolAccessConfig ¶ added in v0.9.1
func WithToolAccessConfig(cfg config.ToolAccessConfig) ServerOption
WithToolAccessConfig sets the tool access policy configuration.
func WithTraceCapture ¶ added in v0.9.0
func WithTraceCapture(c apptrace.CaptureConfig) ServerOption
WithTraceCapture sets the trace capture configuration.
func WithTracing ¶ added in v0.9.1
func WithTracing(serviceName string) ServerOption
WithTracing sets the tracing service name for OpenTelemetry.
type TextHandler ¶
type TextHandler struct {
BaseHandler
}
TextHandler is a handler for text responses
func (*TextHandler) Handle ¶
func (h *TextHandler) Handle(resp *http.Response, tool *config.ToolConfig, tmplCtx *template.Context) (*mcp.CallToolResult, error)