Documentation
¶
Overview ¶
Package mcp provides CLI-based MCP tool discovery and registration.
Index ¶
- func AvailableCLIs() map[string][]string
- func BackupConfig(path string) (string, error)
- func KnownCLINames() []string
- func RemoveCopilotMCPConfig(path, serverName string) error
- func RemoveMCPConfig(path, serverName string) error
- func RestoreConfig(path, backupPath string) error
- func WriteCopilotMCPConfig(path, serverName string, entry MCPServerEntry) error
- func WriteMCPConfig(path, serverName string, entry MCPServerEntry) error
- type BBMCPServer
- type CLISpec
- type ClaudeCodeMCPConfig
- type CopilotMCPConfig
- type Discoverer
- type DiscoveryResult
- type MCPServerEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AvailableCLIs ¶
AvailableCLIs returns the subset of known CLIs that are present in PATH. It performs an exec.LookPath check for each CLI and returns a map of CLI name → tool names for those that are installed.
func BackupConfig ¶
BackupConfig copies the file at path to path.ratchet-bak and returns the backup path. Returns ("", nil) if the file does not exist.
func KnownCLINames ¶
func KnownCLINames() []string
KnownCLINames returns the names of all CLIs that can be discovered.
func RemoveCopilotMCPConfig ¶
RemoveCopilotMCPConfig removes a server entry from a Copilot-format MCP config.
func RemoveMCPConfig ¶
RemoveMCPConfig removes a server entry from a Claude Code-format MCP config.
func RestoreConfig ¶
RestoreConfig restores the backup to the original path and removes the backup.
func WriteCopilotMCPConfig ¶
func WriteCopilotMCPConfig(path, serverName string, entry MCPServerEntry) error
WriteCopilotMCPConfig merges a server entry into a Copilot-format MCP config file.
func WriteMCPConfig ¶
func WriteMCPConfig(path, serverName string, entry MCPServerEntry) error
WriteMCPConfig merges a server entry into a Claude Code-format MCP config file. Creates the file and parent directories if they don't exist.
Types ¶
type BBMCPServer ¶
type BBMCPServer struct {
// contains filtered or unexported fields
}
BBMCPServer exposes Blackboard operations as MCP tools over stdio.
func NewBBMCPServer ¶
func NewBBMCPServer(bb *mesh.Blackboard) *BBMCPServer
NewBBMCPServer creates an MCP server backed by the given Blackboard.
type CLISpec ¶
type CLISpec struct {
Name string
Tools []cliTool
}
CLISpec describes a CLI tool and the MCP tools derived from it.
type ClaudeCodeMCPConfig ¶
type ClaudeCodeMCPConfig struct {
MCPServers map[string]MCPServerEntry `json:"mcpServers"`
}
ClaudeCodeMCPConfig is the structure of .claude/mcp.json.
type CopilotMCPConfig ¶
type CopilotMCPConfig struct {
Servers map[string]MCPServerEntry `json:"servers"`
}
CopilotMCPConfig is the structure of ~/.copilot/mcp-config.json.
type Discoverer ¶
type Discoverer struct {
// contains filtered or unexported fields
}
Discoverer wraps CLI discovery and caches results.
func NewDiscoverer ¶
func NewDiscoverer(registry *ratchetplugin.ToolRegistry) *Discoverer
NewDiscoverer creates a Discoverer backed by the given ToolRegistry.
func (*Discoverer) Disable ¶
func (d *Discoverer) Disable(cliName string)
Disable removes tools for the given CLI from the registry.
func (*Discoverer) Discover ¶
func (d *Discoverer) Discover() *DiscoveryResult
Discover detects available CLIs and registers their tools. Results are cached; subsequent calls return the cached result immediately.
func (*Discoverer) Enable ¶
func (d *Discoverer) Enable(cliName string) error
Enable re-runs discovery (cache cleared first) and returns the result.
func (*Discoverer) InvalidateCache ¶
func (d *Discoverer) InvalidateCache()
InvalidateCache forces the next Discover() call to re-detect CLIs.
type DiscoveryResult ¶
type DiscoveryResult struct {
// Registered maps CLI name to the tool names registered.
Registered map[string][]string
}
DiscoveryResult is the result of a CLI discovery run.