Documentation
¶
Overview ¶
Package mcp implements orb's bundled, settings-driven MCP extension. It is dormant when no enabled servers are configured and exposes remote tools only through the native extension API.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager owns all MCP client sessions for one coding-agent session.
func NewManager ¶
func NewManager(cwd string, configs []ServerConfig) *Manager
func (*Manager) Extension ¶
func (manager *Manager) Extension() extensions.Factory
Extension returns the compiled extension factory for this manager. A manager with no configured servers registers nothing and performs no MCP connection work.
func (*Manager) Reconnect ¶
Reconnect closes and recreates one server session. An empty name reconnects all configured servers in deterministic order.
func (*Manager) Start ¶
Start connects every configured server concurrently, each bounded by its own timeoutMs, and registers the tools available from the successful sessions. Per-server failures remain visible in Status and do not prevent other servers or the coding agent from starting. Calling Start again re-registers the tools of already-connected servers against the currently bound API, so a factory re-run against a fresh registry keeps every MCP tool exposed.
func (*Manager) Status ¶
func (manager *Manager) Status() []ServerStatus
type ServerConfig ¶
type ServerConfig struct {
Name string
Command string
Args []string
Env map[string]string
CWD string
URL string
Headers map[string]string
TimeoutMS int
MaxRetries *int
}
ServerConfig describes one settings-declared MCP server. Exactly one of Command and URL is set after ParseSettings succeeds.
func ParseSettings ¶
func ParseSettings(settings map[string]any) ([]ServerConfig, error)
ParseSettings reads the documented top-level mcpServers object. Unknown settings and unknown per-server fields are retained by the settings manager but ignored here so newer configurations remain forward-compatible. Invalid entries are skipped so one bad entry cannot disable every other server; use ParseSettingsWithWarnings to report them.
func ParseSettingsWithWarnings ¶
func ParseSettingsWithWarnings(settings map[string]any) ([]ServerConfig, []string, error)
ParseSettingsWithWarnings is ParseSettings with per-entry isolation made visible: every invalid entry contributes one warning and is skipped while the remaining entries still parse. The error is reserved for total failures such as an mcpServers value that is not an object.
type ServerState ¶
type ServerState string
const ( ServerConnecting ServerState = "connecting" ServerConnected ServerState = "connected" ServerError ServerState = "error" ServerStopped ServerState = "stopped" )
type ServerStatus ¶
type ServerStatus struct {
Name string
Transport string
State ServerState
Tools []string
Error string
}