mcp

package
v0.3.13 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CredentialScope added in v0.3.12

func CredentialScope(serverName string) string

CredentialScope returns the scopedStore scope for an mcpServers entry name.

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