Documentation
¶
Overview ¶
Package mcp: Client connects to an MCP server, lists tools, converts schemas, and can register them with an LLMServiceWithTools.
Package mcp provides an MCP (Model Context Protocol) client for integrating external tools with LLMs (Voxray MCP service).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
ServerParams StdioServerParams
ToolsFilter []string // if non-nil, only these tool names are registered
ToolsOutputFilters map[string]func(any) any // optional per-tool output transform
// contains filtered or unexported fields
}
Client is an MCP client that discovers tools from an MCP server and can register them with an LLM (Option A: LLMServiceWithTools).
func NewClient ¶
func NewClient(params StdioServerParams, toolsFilter []string, outputFilters map[string]func(any) any) *Client
NewClient returns an MCP client for the given stdio server params.
func (*Client) GetToolsSchema ¶
GetToolsSchema connects to the MCP server, lists tools, and returns their schema in Voxray/MCP tool schema format.
func (*Client) RegisterTools ¶
func (c *Client) RegisterTools(ctx context.Context, llm llmapi.LLMServiceWithTools) (*schemas.ToolsSchema, error)
RegisterTools gets the tools schema from the MCP server and registers each tool with the LLM. llm must implement llmapi.LLMServiceWithTools.
type StdioServerParams ¶
type StdioServerParams struct {
Command string // executable name or path
Args []string // arguments (e.g. []string{"run", "server.go"})
}
StdioServerParams configures an MCP server that is launched as a subprocess and communicates over stdin/stdout (newline-delimited JSON).
func (*StdioServerParams) ExecCmd ¶
func (p *StdioServerParams) ExecCmd() *exec.Cmd
ExecCmd returns an exec.Cmd that runs the MCP server. The command is not started.