Documentation
¶
Index ¶
- Variables
- type Builder
- func (b *Builder) AllowTools(names ...string) *Builder
- func (b *Builder) AutoRefresh(enabled bool) *Builder
- func (b *Builder) ClientOptions(opts sdkmcp.ClientOptions) *Builder
- func (b *Builder) Command(path string, args ...string) *Builder
- func (b *Builder) CommandExec(cmd *exec.Cmd) *Builder
- func (b *Builder) Connect(ctx context.Context) (*Server, error)
- func (b *Builder) DenyTools(names ...string) *Builder
- func (b *Builder) Dir(dir string) *Builder
- func (b *Builder) Env(key, value string) *Builder
- func (b *Builder) Filter(filter ToolFilter) *Builder
- func (b *Builder) HTTPClient(client *http.Client) *Builder
- func (b *Builder) Header(key, value string) *Builder
- func (b *Builder) Headers(headers http.Header) *Builder
- func (b *Builder) IO(reader io.ReadCloser, writer io.WriteCloser) *Builder
- func (b *Builder) Implementation(name, version string) *Builder
- func (b *Builder) KeepAlive(interval time.Duration) *Builder
- func (b *Builder) Prefix(prefix string) *Builder
- func (b *Builder) Register(ctx context.Context) (*Server, error)
- func (b *Builder) RegisterTo(reg *tool.Registry) *Builder
- func (b *Builder) SSE(endpoint string) *Builder
- func (b *Builder) SessionOptions(opts *sdkmcp.ClientSessionOptions) *Builder
- func (b *Builder) Streamable(endpoint string) *Builder
- func (b *Builder) StreamableRetries(max int) *Builder
- func (b *Builder) TerminateAfter(duration time.Duration) *Builder
- func (b *Builder) ToolID(fn ToolIDFunc) *Builder
- func (b *Builder) Transport(t sdkmcp.Transport) *Builder
- type ProxyTool
- type Registry
- type Server
- func (s *Server) CallTool(ctx context.Context, name string, args json.RawMessage) (*sdkmcp.CallToolResult, error)
- func (s *Server) Client() *sdkmcp.Client
- func (s *Server) Close() error
- func (s *Server) Connect(ctx context.Context) error
- func (s *Server) Name() string
- func (s *Server) Prefix() string
- func (s *Server) Refresh(ctx context.Context) error
- func (s *Server) RegisterTools(reg *tool.Registry)
- func (s *Server) Session() *sdkmcp.ClientSession
- func (s *Server) ToolID(toolName string) string
- func (s *Server) ToolIDs() []string
- func (s *Server) Tools() []*ProxyTool
- type ToolFilter
- type ToolIDFunc
- type Toolkit
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotConnected indicates the MCP server has no active session. ErrNotConnected = errors.New("mcp server not connected") // ErrTransportRequired indicates no transport was configured. ErrTransportRequired = errors.New("mcp transport required") )
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder provides a fluent API for connecting to MCP servers.
func NewBuilder ¶
NewBuilder creates an MCP builder for the given server name.
func (*Builder) AllowTools ¶
AllowTools limits exposure to the provided tool names.
func (*Builder) AutoRefresh ¶
AutoRefresh toggles tool refresh on tool list changed notifications.
func (*Builder) ClientOptions ¶
func (b *Builder) ClientOptions(opts sdkmcp.ClientOptions) *Builder
ClientOptions overrides MCP client options.
func (*Builder) CommandExec ¶
CommandExec uses a preconfigured exec.Cmd for the command transport.
func (*Builder) Filter ¶
func (b *Builder) Filter(filter ToolFilter) *Builder
Filter applies a custom tool filter.
func (*Builder) HTTPClient ¶
HTTPClient sets the HTTP client used by HTTP-based transports.
func (*Builder) IO ¶
func (b *Builder) IO(reader io.ReadCloser, writer io.WriteCloser) *Builder
IO configures an IO transport using explicit reader/writer streams.
func (*Builder) Implementation ¶
Implementation sets the MCP client implementation name and version.
func (*Builder) Register ¶
Register connects to the server, loads tools, and registers them with the tool registry.
func (*Builder) RegisterTo ¶
RegisterTo sets the tool registry to register remote tools into.
func (*Builder) SessionOptions ¶
func (b *Builder) SessionOptions(opts *sdkmcp.ClientSessionOptions) *Builder
SessionOptions sets MCP session options.
func (*Builder) Streamable ¶
Streamable configures a streamable HTTP transport.
func (*Builder) StreamableRetries ¶
StreamableRetries sets the max retries for streamable HTTP transports.
func (*Builder) TerminateAfter ¶
TerminateAfter controls how long to wait before SIGTERM when closing a command transport.
func (*Builder) ToolID ¶
func (b *Builder) ToolID(fn ToolIDFunc) *Builder
ToolID maps MCP tool names to local tool IDs.
type ProxyTool ¶
type ProxyTool struct {
// contains filtered or unexported fields
}
ProxyTool exposes a remote MCP tool as a local tool.Tool.
func (*ProxyTool) Description ¶
Description returns a human-readable tool description when available.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry stores MCP server connections by name.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents a connected MCP server and its exposed tools.
func (*Server) CallTool ¶
func (s *Server) CallTool(ctx context.Context, name string, args json.RawMessage) (*sdkmcp.CallToolResult, error)
CallTool calls a remote tool by name.
func (*Server) RegisterTools ¶
RegisterTools registers the MCP tools into the provided registry and stores it for refresh.
func (*Server) Session ¶
func (s *Server) Session() *sdkmcp.ClientSession
Session returns the underlying MCP client session.
type ToolFilter ¶
ToolFilter decides whether a tool should be exposed.
type ToolIDFunc ¶
ToolIDFunc maps an MCP tool name to a local tool ID.
type Toolkit ¶
type Toolkit struct {
// contains filtered or unexported fields
}
Toolkit wraps an MCP server as a toolkit.
func NewToolkit ¶
NewToolkit creates a toolkit for an MCP server.
func (*Toolkit) BindRegistry ¶
BindRegistry binds the toolkit to a registry for refresh updates.
func (*Toolkit) DefaultToolIDs ¶
DefaultToolIDs returns MCP tool IDs.