client

package
v0.0.36 Latest Latest
Warning

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

Go to latest
Published: May 23, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

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 Upsert added in v0.0.32

func Upsert(cf ConfigFile, name string, url string) error

Upsert updates/inserts an MCP server in a client configuration file It is a wrapper around the ConfigUpdater.Upsert method. Because the ConfigUpdater is different for each client type, we need to handle the different types of McpServer objects. For example, VSCode and ClaudeCode allows for a `type` field, but Cursor and others do not. This allows us to build up more complex MCP server configurations for different clients without leaking them into the CMD layer.

Types

type ConfigFile

type ConfigFile struct {
	Path          string
	ClientType    MCPClient
	ConfigUpdater ConfigUpdater
	Extension     Extension
}

ConfigFile represents a client configuration file

func FindClientConfigs

func FindClientConfigs() ([]ConfigFile, error)

FindClientConfigs searches for client configuration files in standard locations

type ConfigUpdater added in v0.0.32

type ConfigUpdater interface {
	Upsert(serverName string, data MCPServer) error
	Remove(serverName string) error
}

ConfigUpdater defines the interface for types which can edit MCP client config files.

type Extension added in v0.0.32

type Extension string

Extension is extension of the client config file.

const (
	// JSON represents a JSON extension.
	JSON Extension = "json"
)

type JSONConfigUpdater added in v0.0.32

type JSONConfigUpdater struct {
	Path                 string
	MCPServersPathPrefix string
}

JSONConfigUpdater is a ConfigUpdater that is responsible for updating JSON config files.

func (*JSONConfigUpdater) Remove added in v0.0.32

func (jcu *JSONConfigUpdater) Remove(serverName string) error

Remove removes an MCP server from the MCP client config file

func (*JSONConfigUpdater) Upsert added in v0.0.32

func (jcu *JSONConfigUpdater) Upsert(serverName string, data MCPServer) error

Upsert inserts or updates an MCP server in the MCP client config file

type MCPClient

type MCPClient string

MCPClient is an enum of supported MCP clients.

const (
	// RooCode represents the Roo Code extension for VS Code.
	RooCode MCPClient = "roo-code"
	// Cursor represents the Cursor editor.
	Cursor MCPClient = "cursor"
	// VSCodeInsider represents the VS Code Insiders editor.
	VSCodeInsider MCPClient = "vscode-insider"
	// VSCode represents the standard VS Code editor.
	VSCode MCPClient = "vscode"
	// ClaudeCode represents the Claude Code CLI.
	ClaudeCode MCPClient = "claude-code"
)

type MCPServer added in v0.0.32

type MCPServer struct {
	Url  string `json:"url,omitempty"`
	Type string `json:"type,omitempty"`
}

MCPServer represents an MCP server in a MCP client config file

type MCPServerConfig

type MCPServerConfig struct {
	URL string `json:"url,omitempty"`
}

MCPServerConfig represents an MCP server configuration in a client config file

Jump to

Keyboard shortcuts

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