Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMCP ¶
func NewMCP(cfg MCPConfig, deps MCPDeps) (agentkit.ToolProvider, error)
NewMCP registers tool/mcp: Load mcpServers JSON and expose MCP tools as dynamic model-visible tools.
Best practices:
- Shared servers belong in global:mcp.json; per-project servers need enableLocal and local:mcp.json.
- Mount via tools/runtime deps.dynamicTools, not deps.tools, because definitions are discovered at runtime.
- Server configs and their tool lists are loaded once and cached; run the "mcp" command to reload mcp.json and rediscover tools after editing it or restarting a server.
- Pooled connections are closed after idleTimeoutSeconds (default 300) without use; the next call reconnects.
Types ¶
type MCPConfig ¶
type MCPConfig struct {
// Files are MCP config paths in precedence order; first file wins for duplicate server names.
// When omitted, defaults to global:mcp.json only; set EnableLocal to also load local:mcp.json.
Files []string `json:"files,omitempty"`
// EnableLocal allows per-tenant/project local:mcp.json and /mcp add writes. Off by default.
EnableLocal bool `json:"enableLocal,omitempty"`
// IdleTimeoutSeconds closes pooled MCP connections after this many seconds without
// use. Omitted defaults to 300; set to 0 to disable idle eviction.
IdleTimeoutSeconds *int `json:"idleTimeoutSeconds,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.