Documentation
¶
Overview ¶
Package server provides the MCP server implementation for Speedgrapher.
Index ¶
- func NewServer(cfg Config) (*mcp.Server, error)
- func NewStreamableHandler(s *mcp.Server, opts *mcp.StreamableHTTPOptions) http.Handler
- func RunStdio(ctx context.Context, s *mcp.Server) error
- func RunStreamableHTTP(ctx context.Context, s *mcp.Server, addr string) error
- type Config
- type Option
- func WithAllowedOrigins(origins ...string) Option
- func WithIdleTimeout(d time.Duration) Option
- func WithInstructions(instructions string) Option
- func WithReadTimeout(d time.Duration) Option
- func WithServerConfig(cfg config.ServerConfig) Option
- func WithShutdownTimeout(d time.Duration) Option
- func WithWorkspaceDir(dir string) Option
- func WithWriteTimeout(d time.Duration) Option
- type Server
- func (s *Server) Connect(ctx context.Context, transport mcp.Transport, ...) (*mcp.ServerSession, error)
- func (s *Server) HTTPHandler() http.Handler
- func (s *Server) MCPServer() *mcp.Server
- func (s *Server) RegisterHandlers() error
- func (s *Server) Run(ctx context.Context) error
- func (s *Server) ServeHTTP(ctx context.Context, addr string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewServer ¶
NewServer creates the server and registers fog, slop, seo, and vale tools. Deprecated: Use New(version, opts...) instead.
func NewStreamableHandler ¶
NewStreamableHandler creates streamable HTTP handler using mcp.NewStreamableHTTPHandler. Deprecated: Use Server.HTTPHandler or Server.ServeHTTP instead.
Types ¶
type Config ¶
Config holds legacy configuration parameters for initializing the Speedgrapher MCP server.
type Option ¶ added in v0.10.0
type Option func(*Server)
Option defines a functional option for configuring a Server.
func WithAllowedOrigins ¶ added in v0.10.0
WithAllowedOrigins sets the allowed CORS origins.
func WithIdleTimeout ¶ added in v0.10.0
WithIdleTimeout sets the HTTP server IdleTimeout.
func WithInstructions ¶ added in v0.10.0
WithInstructions sets custom MCP server instructions.
func WithReadTimeout ¶ added in v0.10.0
WithReadTimeout sets the HTTP server ReadTimeout.
func WithServerConfig ¶ added in v0.10.0
func WithServerConfig(cfg config.ServerConfig) Option
WithServerConfig configures allowed origins and timeouts from config.ServerConfig.
func WithShutdownTimeout ¶ added in v0.10.0
WithShutdownTimeout sets the HTTP server ShutdownTimeout.
func WithWorkspaceDir ¶ added in v0.10.0
WithWorkspaceDir sets the workspace directory for the server and registered tools.
func WithWriteTimeout ¶ added in v0.10.0
WithWriteTimeout sets the HTTP server WriteTimeout.
type Server ¶ added in v0.10.0
type Server struct {
// contains filtered or unexported fields
}
Server encapsulates the MCP server and its lifecycle configuration.
func (*Server) Connect ¶ added in v0.10.0
func (s *Server) Connect(ctx context.Context, transport mcp.Transport, initOpts *mcp.ServerSessionOptions) (*mcp.ServerSession, error)
Connect connects the server to a transport for in-memory or custom testing sessions.
func (*Server) HTTPHandler ¶ added in v0.10.0
HTTPHandler returns the HTTP handler wrapping the streamable MCP handler.
func (*Server) RegisterHandlers ¶ added in v0.10.0
RegisterHandlers wires all tools idempotently using sync.Once.