client

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package client provides utilities for managing client configurations and interacting with MCP servers.

Index

Constants

View Source
const (
	YAMLExt = ".yaml"
	YMLExt  = ".yml"
)

YAML file extensions

Variables

This section is empty.

Functions

func GenerateMCPServerURL

func GenerateMCPServerURL(host string, port int, containerName string) string

GenerateMCPServerURL generates the URL for an MCP server

func IsYAML

func IsYAML(ext string) bool

IsYAML checks if a file extension is a YAML extension

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL