Documentation
¶
Overview ¶
Package client provides utilities for managing client configurations and interacting with MCP servers.
Index ¶
Constants ¶
const ( YAMLExt = ".yaml" YMLExt = ".yml" )
YAML file extensions
Variables ¶
This section is empty.
Functions ¶
func GenerateMCPServerURL ¶
GenerateMCPServerURL generates the URL for an MCP server
Types ¶
type ConfigEditor ¶
type ConfigEditor interface {
AddServer(config *ConfigFile, serverName, url string) error
}
ConfigEditor defines the interface for types which can edit MCP client config files.
type ConfigFile ¶
type ConfigFile struct { Path string Contents map[string]interface{} Editor ConfigEditor }
ConfigFile represents a client configuration file
func FindClientConfigs ¶
func FindClientConfigs() ([]ConfigFile, error)
FindClientConfigs searches for client configuration files in standard locations
func (*ConfigFile) Save ¶
func (c *ConfigFile) Save() error
Save writes the updated configuration back to the file without locking This is unsafe for concurrent access and should only be used in tests
func (*ConfigFile) SaveWithLock ¶
func (c *ConfigFile) SaveWithLock(serverName, url string, editor ConfigEditor) error
SaveWithLock safely updates the MCP server configuration in the file It acquires a lock, reads the latest content, applies the change, and saves the file
func (*ConfigFile) UpdateMCPServerConfig ¶
func (c *ConfigFile) UpdateMCPServerConfig(serverName, url string) error
UpdateMCPServerConfig updates the MCP server configuration in memory This does not save the changes to the file
type MCPClient ¶
type MCPClient string
MCPClient is an enum of supported MCP clients.
const ( // RooCode represents the RooCode extension for VSCode. RooCode MCPClient = "roo-code" // Cursor represents the Cursor editor. Cursor MCPClient = "cursor" // VSCodeInsider represents the VSCode Insider editor. VSCodeInsider MCPClient = "vscode-insider" // VSCode represents the standard VSCode editor. VSCode MCPClient = "vscode" )
type MCPServerConfig ¶
type MCPServerConfig struct {
URL string `json:"url,omitempty"`
}
MCPServerConfig represents an MCP server configuration in a client config file
type StandardConfigEditor ¶
type StandardConfigEditor struct{}
StandardConfigEditor edits the MCP client config format used by most clients.
func (*StandardConfigEditor) AddServer ¶
func (*StandardConfigEditor) AddServer(config *ConfigFile, serverName, url string) error
AddServer inserts or updates a server in the MCP client config file.
type VSCodeConfigEditor ¶
type VSCodeConfigEditor struct{}
VSCodeConfigEditor edits the MCP client config format used by VSCode.
func (*VSCodeConfigEditor) AddServer ¶
func (*VSCodeConfigEditor) AddServer(config *ConfigFile, serverName, url string) error
AddServer inserts or updates a server in the MCP client config file.