Documentation
¶
Index ¶
- Constants
- func AddServer(name string, config McpServerConfig, scope ConfigScope) error
- func ParseMcpConfigFromFile(filePath string) (McpJsonConfig, []ValidationError)
- func ReconnectServer(ctx context.Context, manager *Manager, serverName string, cwd string) error
- func RemoveServer(name string, scope ConfigScope) error
- func SetServerEnabled(name string, enabled bool, cwd string) error
- type Client
- type ConfigScope
- type ConnectServerConfig
- type IntegrationOptions
- type IntegrationResult
- type Manager
- type McpJsonConfig
- type McpServerConfig
- type McpServerType
- type ScopedMcpServerConfig
- type ServerConfig
- type TransportType
- type ValidationError
Constants ¶
const ( ScopeProject = internalmcp.ScopeProject ScopeUser = internalmcp.ScopeUser ScopeLocal = internalmcp.ScopeLocal ScopeEnterprise = internalmcp.ScopeEnterprise ServerTypeStdio = internalmcp.ServerTypeStdio ServerTypeHTTP = internalmcp.ServerTypeHTTP ServerTypeSSE = internalmcp.ServerTypeSSE ServerTypeWebSocket = internalmcp.ServerTypeWebSocket ServerTypeSDK = internalmcp.ServerTypeSDK // TransportType* values are for ServerConfig.Transport specifically // (the low-level Client's transport selector) - a separate type from // ServerType* above (McpServerType, used by the higher-level DB-facing // McpServerConfig), even though the string values overlap. TransportTypeStdio = internalmcp.TransportTypeStdio TransportTypeHTTP = internalmcp.TransportTypeHTTP TransportTypeSSE = internalmcp.TransportTypeSSE TransportTypeWebSocket = internalmcp.TransportTypeWebSocket )
Variables ¶
This section is empty.
Functions ¶
func AddServer ¶
func AddServer(name string, config McpServerConfig, scope ConfigScope) error
AddServer registers an MCP server under name in the configuration file of the given scope. The name may only contain letters, digits, hyphens and underscores, "claude-in-chrome" is reserved, and the transport type is inferred from config when it is not set.
func ParseMcpConfigFromFile ¶
func ParseMcpConfigFromFile(filePath string) (McpJsonConfig, []ValidationError)
ParseMcpConfigFromFile reads an MCP configuration file. A missing file gives an empty configuration and no error; a file that cannot be read or parsed gives an empty configuration and validation errors of severity "fatal".
func ReconnectServer ¶
ReconnectServer disconnects the named server from manager and connects it again with the configuration found for cwd. It returns an error when no server of that name is configured.
func RemoveServer ¶
func RemoveServer(name string, scope ConfigScope) error
RemoveServer deletes the named server's entry from the configuration file of the given scope. It errors if no server of that name is configured in that scope.
Types ¶
type Client ¶
type Client = internalmcp.Client
Client is a single MCP server connection, for callers that need a direct, deterministic tool call (e.g. connector.ActionConnector.Act) rather than registering a server's tools into an agent's tool registry for the LLM to decide when to call. Sequence: NewClient, Start, Initialize, then CallTool/ListTools/etc.; Close when done - see MCPClientManager.Connect (internal/tools/system/mcp/tool_manager.go) for the same sequence used internally.
func NewClient ¶
func NewClient(config ServerConfig) (*Client, error)
NewClient creates a new MCP client for the given server config. It does not connect - call Start then Initialize on the result before use.
type ConfigScope ¶
type ConfigScope = internalmcp.ConfigScope
ConfigScope says where an MCP server is defined: in the project, in the user's configuration, locally, or by the enterprise.
type ConnectServerConfig ¶
type ConnectServerConfig = internalmcp.ConnectServerConfig
ConnectServerConfig is the config for connecting to an MCP server
type IntegrationOptions ¶
type IntegrationOptions = internalmcp.IntegrationOptions
IntegrationOptions controls how MCP servers are wrapped into the tool registry.
type IntegrationResult ¶
type IntegrationResult = internalmcp.IntegrationResult
IntegrationResult represents the result of MCP integration
type Manager ¶
type Manager = internalmcp.MCPClientManager
Manager manages MCP server connections
func GlobalManager ¶
func GlobalManager() *Manager
GlobalManager returns the global MCP client manager
type McpJsonConfig ¶
type McpJsonConfig = internalmcp.McpJsonConfig
McpJsonConfig is the content of an MCP configuration file: the servers under the "mcpServers" key, by name.
type McpServerConfig ¶
type McpServerConfig = internalmcp.McpServerConfig
McpServerConfig describes one MCP server: its transport Type, the Command, Args and Env that start it (stdio) or the URL and Headers that reach it (http, sse, ws), a Timeout and the Scope it was defined in.
type McpServerType ¶
type McpServerType = internalmcp.McpServerType
McpServerType is the transport of an MCP server: stdio, http, sse, ws or sdk.
type ScopedMcpServerConfig ¶
type ScopedMcpServerConfig = internalmcp.ScopedMcpServerConfig
ScopedMcpServerConfig is a server configuration with the scope it was found in.
type ServerConfig ¶
type ServerConfig = internalmcp.ServerConfig
ServerConfig represents configuration for an MCP server
type TransportType ¶
type TransportType = internalmcp.TransportType
TransportType represents the type of MCP transport
type ValidationError ¶
type ValidationError = internalmcp.ValidationError
ValidationError is a problem found in an MCP configuration: where (File, Path), what (Message), how to fix it (Suggestion) and how serious it is (Severity).