mcpserver

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(ctx context.Context, cfgs map[string]config.Server, graphCfg *config.SkillGraphConfig) (*Manager, error)

NewManager creates a Manager by connecting to all servers in the config. Downstream connections happen in parallel so total startup is O(slowest server) instead of O(sum of servers) — important to stay under MCP client initialize timeouts (Claude Code's is 30s).

func NewManagerFromMCPServers added in v1.1.0

func NewManagerFromMCPServers(ctx context.Context, servers map[string]*mcp.Server) (*Manager, error)

NewManagerFromMCPServers creates a Manager from raw *mcp.Server instances by wiring each through an in-memory transport. Useful for unit tests.

func NewManagerFromServers

func NewManagerFromServers(servers map[string]*Server) (*Manager, error)

NewManagerFromServers creates a Manager from pre-built Servers (useful for testing).

func (*Manager) AddServer

func (m *Manager) AddServer(ctx context.Context, name string, cfg config.Server) error

AddServer connects to a new downstream MCP server and hot-registers it into the manager without a restart. The graph is rebuilt atomically after the connection succeeds. Returns an error if the name is already registered.

func (*Manager) AllTools

func (m *Manager) AllTools() []Tool

func (*Manager) Close

func (m *Manager) Close()

func (*Manager) GetGraph

func (m *Manager) GetGraph() *graph.Graph

func (*Manager) GetServer

func (m *Manager) GetServer(name string) (*Server, error)

func (*Manager) ListServerNames

func (m *Manager) ListServerNames() []string

func (*Manager) RebuildGraph

func (m *Manager) RebuildGraph(graphCfg *config.SkillGraphConfig)

RebuildGraph rebuilds the capability graph from scratch using the updated config and switches it atomically. This is thread-safe.

func (*Manager) ServerTools

func (m *Manager) ServerTools(name string) []Tool

func (*Manager) SetOnRebuild added in v1.1.0

func (m *Manager) SetOnRebuild(fn func())

type ParamInfo

type ParamInfo struct {
	Name     string
	Schema   any // raw JSON Schema for this property
	Required bool
}

ParamInfo describes a parameter extracted from a tool's JSON Schema.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server wraps a connected MCP client session to a downstream server.

func NewServer

func NewServer(ctx context.Context, srv config.Server) (*Server, error)

NewServer connects to a downstream MCP server and applies config options (description override, tool/resource allowlists).

func NewServerFromSession

func NewServerFromSession(ctx context.Context, session *mcp.ClientSession, opts ...config.ServerOptions) (*Server, error)

NewServerFromSession creates a Server from a pre-built session and applies optional configuration (description override, tool/resource allowlists).

func (*Server) CallTool

func (s *Server) CallTool(ctx context.Context, params *mcp.CallToolParams) (*mcp.CallToolResult, error)

func (*Server) Close

func (s *Server) Close() error

func (*Server) Instructions

func (s *Server) Instructions() string

func (*Server) ReadResource

func (s *Server) ReadResource(ctx context.Context, params *mcp.ReadResourceParams) (*mcp.ReadResourceResult, error)

func (*Server) Resources

func (s *Server) Resources() []*mcp.Resource

func (*Server) Tools

func (s *Server) Tools() []*mcp.Tool

type Tool

type Tool struct {
	ResolvedName string
	OriginalName string
	ServerName   string
	Description  string
	Params       []ParamInfo
	OutputSchema any // raw JSON Schema for output, nil = unstructured (str)
}

Tool represents a downstream tool with its resolved (potentially prefixed) name.

func (*Tool) Signature

func (t *Tool) Signature() string

Signature returns a Python-style function signature.

Jump to

Keyboard shortcuts

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