Documentation
¶
Overview ¶
Package mcp speaks the Model Context Protocol, letting Antares borrow tools from external servers over stdio or streamable HTTP.
Index ¶
- type CallResult
- type Client
- func (c *Client) Call(ctx context.Context, tool string, args map[string]any) (*CallResult, error)
- func (c *Client) Close() error
- func (c *Client) ListResources(ctx context.Context) ([]ResourceDef, error)
- func (c *Client) Name() string
- func (c *Client) ReadResource(ctx context.Context, uri string) (string, error)
- func (c *Client) Tools() []ToolDef
- type Manager
- func (m *Manager) Close()
- func (m *Manager) Connect(ctx context.Context, cfg *config.Config)
- func (m *Manager) ListResources(ctx context.Context) []ResourceView
- func (m *Manager) ReadResource(ctx context.Context, uri string) (string, error)
- func (m *Manager) Register(reg *tools.Registry) []string
- func (m *Manager) Status(cfg *config.Config) []ServerStatus
- type ResourceDef
- type ResourceView
- type ServerConfig
- type ServerStatus
- type ToolDef
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallResult ¶
CallResult is the outcome of calling an MCP tool.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a connection to one MCP server.
func (*Client) ListResources ¶
func (c *Client) ListResources(ctx context.Context) ([]ResourceDef, error)
ListResources returns the resources a server offers. A server that does not implement resources answers with an error, which is reported as none.
func (*Client) ReadResource ¶
ReadResource fetches one resource's contents by URI and flattens them to text.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager owns the configured MCP servers and exposes their tools to the agent.
func (*Manager) Connect ¶
Connect brings up every enabled server, recording rather than propagating individual failures so one bad server cannot block startup.
func (*Manager) ListResources ¶
func (m *Manager) ListResources(ctx context.Context) []ResourceView
ListResources aggregates resources from every connected server, prefixing each with its server so the same-named resource on two servers stays distinct.
func (*Manager) ReadResource ¶
ReadResource reads a resource by URI from whichever server exposes it.
type ResourceDef ¶
type ResourceDef struct {
URI string `json:"uri"`
Name string `json:"name"`
Description string `json:"description"`
MimeType string `json:"mimeType"`
}
ResourceDef describes an MCP resource a server exposes.
type ResourceView ¶
type ResourceView struct {
Server string
URI string
Name string
Description string
MimeType string
}
ResourceView is one resource with the server that hosts it.
type ServerConfig ¶
type ServerConfig struct {
Transport string
Command string
Args []string
Env map[string]string
URL string
Headers map[string]string
}
ServerConfig describes how to reach one MCP server.