Documentation
¶
Index ¶
- type Meta
- type MetaOnChangeFunc
- type Remote
- func (r *Remote) Close()
- func (r *Remote) Init(localSession *mcp.ServerSession) error
- func (r *Remote) Meta() *Meta
- func (r *Remote) Run(ctx context.Context, checkInterval time.Duration) error
- func (r *Remote) Session() (*mcp.ClientSession, error)
- func (r *Remote) SetCallback(onChange MetaOnChangeFunc)
- func (r *Remote) ToolHandler(toolName string) ...
- type ToolInput
- type ToolOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MetaOnChangeFunc ¶
MetaOnChangeFunc is a callback function invoked when metadata changes.
type Remote ¶
type Remote struct {
// contains filtered or unexported fields
}
Remote manages a single connection to a remote MCP server over HTTP. It maintains one client session and handles health checking and reconnection.
func NewRemoteManager ¶
NewRemoteManager creates a new Remote instance for managing connections to the remote MCP server. The client is created lazily when capabilities are known.
func (*Remote) Close ¶
func (r *Remote) Close()
Close closes the current session and releases resources. It is safe to call Close even if no session exists.
func (*Remote) Meta ¶
Meta returns the cached metadata. Returns nil if metadata hasn't been loaded yet.
func (*Remote) Run ¶
Run periodically fetches and updates metadata from the remote server. It runs until the context is cancelled.
func (*Remote) Session ¶
func (r *Remote) Session() (*mcp.ClientSession, error)
Session returns the existing session or creates a new one if needed. When KeepAlive is enabled, it automatically handles health checks and closes the session if pings fail. This method will recreate the session if it was closed by KeepAlive or if no session exists.
func (*Remote) SetCallback ¶
func (r *Remote) SetCallback(onChange MetaOnChangeFunc)
func (*Remote) ToolHandler ¶
func (r *Remote) ToolHandler(toolName string) func(ctx context.Context, req *mcp.CallToolRequest, in ToolInput) (*mcp.CallToolResult, ToolOutput, error)
ToolHandler returns a handler function that proxies tool calls to the remote MCP server. The returned handler uses the Remote's managed session to forward tool invocations to the remote server and returns the structured output from the remote tool.
type ToolInput ¶
ToolInput is a generic input type for proxied tools that maps parameter names to their values.
type ToolOutput ¶
ToolOutput is a generic output type for proxied tools that maps output field names to their values.