Documentation
¶
Overview ¶
Package server adapts GraphJin's stable internal MCP registration surface to the official modelcontextprotocol/go-sdk server and transports.
Index ¶
- func ServeStdio(ctx context.Context, server *MCPServer) error
- func ToolFromSDK(tool *sdk.Tool) compat.Tool
- type MCPServer
- func (s *MCPServer) AddPrompt(prompt *sdk.Prompt, handler PromptHandler)
- func (s *MCPServer) AddResource(resource compat.Resource, handler ResourceHandler)
- func (s *MCPServer) AddResourceTemplate(resource compat.ResourceTemplate, handler ResourceHandler)
- func (s *MCPServer) AddTool(tool compat.Tool, handler ToolHandler)
- func (s *MCPServer) ListTools() map[string]*ServerTool
- func (s *MCPServer) ResourceUpdated(ctx context.Context, uri string) error
- func (s *MCPServer) SDK() *sdk.Server
- func (s *MCPServer) SendNotificationToClient(ctx context.Context, method string, params map[string]any) error
- type PromptHandler
- type ResourceHandler
- type ServerOption
- type ServerTool
- type StreamableHTTPServer
- type SubscribeHandler
- type ToolFilter
- type ToolHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MCPServer ¶
type MCPServer struct {
// contains filtered or unexported fields
}
func NewMCPServer ¶
func NewMCPServer(name, version string, opts ...ServerOption) *MCPServer
func (*MCPServer) AddPrompt ¶
func (s *MCPServer) AddPrompt(prompt *sdk.Prompt, handler PromptHandler)
func (*MCPServer) AddResource ¶
func (s *MCPServer) AddResource(resource compat.Resource, handler ResourceHandler)
func (*MCPServer) AddResourceTemplate ¶
func (s *MCPServer) AddResourceTemplate(resource compat.ResourceTemplate, handler ResourceHandler)
func (*MCPServer) ListTools ¶
func (s *MCPServer) ListTools() map[string]*ServerTool
func (*MCPServer) ResourceUpdated ¶
type PromptHandler ¶
type PromptHandler func(context.Context, compat.GetPromptRequest) (*compat.GetPromptResult, error)
type ResourceHandler ¶
type ResourceHandler func(context.Context, compat.ReadResourceRequest) ([]compat.ResourceContents, error)
type ServerOption ¶
type ServerOption func(*serverOptions)
func WithInstructions ¶
func WithInstructions(value string) ServerOption
func WithPromptCapabilities ¶
func WithPromptCapabilities(bool) ServerOption
These compatibility options are retained for GraphJin's focused registration tests. The official SDK infers the capabilities from registered features.
func WithResourceCapabilities ¶
func WithResourceCapabilities(bool, bool) ServerOption
func WithSubscribeHandler ¶
func WithSubscribeHandler(subscribe, unsubscribe SubscribeHandler) ServerOption
func WithToolFilter ¶
func WithToolFilter(filter ToolFilter) ServerOption
type ServerTool ¶
type ServerTool struct {
Tool compat.Tool
Handler ToolHandler
}
type StreamableHTTPServer ¶
type StreamableHTTPServer struct {
// contains filtered or unexported fields
}
func NewDualStreamableHTTPServer ¶
func NewDualStreamableHTTPServer(server *MCPServer) *StreamableHTTPServer
func (*StreamableHTTPServer) ServeHTTP ¶
func (s *StreamableHTTPServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ToolHandler ¶
type ToolHandler func(context.Context, compat.CallToolRequest) (*compat.CallToolResult, error)
Click to show internal directories.
Click to hide internal directories.