server

package
v3.20.77 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package server adapts GraphJin's stable internal MCP registration surface to the official modelcontextprotocol/go-sdk server and transports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ServeStdio

func ServeStdio(ctx context.Context, server *MCPServer) error

func ToolFromSDK

func ToolFromSDK(tool *sdk.Tool) compat.Tool

ToolFromSDK converts an official SDK tool into GraphJin's stable internal representation. It is exported for contract tests that exercise the wire catalog through an official client.

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) AddTool

func (s *MCPServer) AddTool(tool compat.Tool, handler ToolHandler)

func (*MCPServer) ListTools

func (s *MCPServer) ListTools() map[string]*ServerTool

func (*MCPServer) ResourceUpdated

func (s *MCPServer) ResourceUpdated(ctx context.Context, uri string) error

func (*MCPServer) SDK

func (s *MCPServer) SDK() *sdk.Server

func (*MCPServer) SendNotificationToClient

func (s *MCPServer) SendNotificationToClient(ctx context.Context, method string, params map[string]any) 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)

func (*StreamableHTTPServer) Shutdown

type SubscribeHandler

type SubscribeHandler func(context.Context, string) error

type ToolFilter

type ToolFilter func(context.Context, []compat.Tool) []compat.Tool

Jump to

Keyboard shortcuts

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