Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bridge ¶
Bridge connects an mcp.Server to a FullBackend. It registers proxy handlers that forward MCP requests to the SDK process.
func New ¶
func New(backend FullBackend, logger *slog.Logger, version string) *Bridge
New creates a Bridge with an mcp.Server that proxies to the given backend.
func (*Bridge) SetToolListMutationHandler ¶
func (b *Bridge) SetToolListMutationHandler(fn ToolListMutationHandler)
SetToolListMutationHandler registers a callback for enable_tools/disable_tools in tool call responses.
func (*Bridge) SyncAll ¶ added in v0.3.0
func (b *Bridge) SyncAll()
SyncAll atomically syncs tools, resources, and prompts under a single lock.
func (*Bridge) SyncPrompts ¶
func (b *Bridge) SyncPrompts()
SyncPrompts reads prompt definitions from the backend and registers them with the mcp.Server.
func (*Bridge) SyncResources ¶
func (b *Bridge) SyncResources()
SyncResources reads resource and resource template definitions from the backend and registers them with the mcp.Server.
type CompletionBackend ¶
type CompletionBackend interface {
Complete(ctx context.Context, refType, refName, argName, argValue string) (*pb.CompletionResponse, error)
}
CompletionBackend is the interface for completion operations.
type FullBackend ¶
type FullBackend interface {
ProcessBackend
ResourceBackend
PromptBackend
CompletionBackend
SamplingBackend
}
FullBackend combines all backend interfaces.
type ProcessBackend ¶
type ProcessBackend interface {
ActiveTools() []*pb.ToolDefinition
CallTool(ctx context.Context, name, argsJSON string) (*pb.CallToolResponse, error)
}
ProcessBackend is the interface for communicating with an SDK tool process. Implemented by process.Manager.
type PromptBackend ¶
type PromptBackend interface {
ListPrompts(ctx context.Context) ([]*pb.PromptDefinition, error)
GetPrompt(ctx context.Context, name, argsJSON string) (*pb.GetPromptResponse, error)
}
PromptBackend is the interface for prompt operations.
type ResourceBackend ¶
type ResourceBackend interface {
ListResources(ctx context.Context) ([]*pb.ResourceDefinition, error)
ListResourceTemplates(ctx context.Context) ([]*pb.ResourceTemplateDefinition, error)
ReadResource(ctx context.Context, uri string) (*pb.ReadResourceResponse, error)
}
ResourceBackend is the interface for resource operations.
type SamplingBackend ¶
type SamplingBackend interface {
SendSamplingResponse(reqID string, resp *pb.SamplingResponse) error
OnSampling(fn func(*pb.SamplingRequest, string))
SendListRootsResponse(reqID string, resp *pb.ListRootsResponse) error
OnListRoots(fn func(string))
}
SamplingBackend lets the bridge send sampling responses back to the SDK process.
type ToolListMutationHandler ¶
type ToolListMutationHandler func(enable, disable []string)
ToolListMutationHandler is called when a tool call response contains enable_tools or disable_tools.