mcp

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 19 Imported by: 0

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"`
}

type MCPDeps

type MCPDeps struct {
	Workspace   workspace.Service `json:"workspace"`
	Credentials credentials.Store `json:"credentials,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL