manager

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package manager provides configuration management for MCP servers across platforms.

This package contains shared functionality for managing MCP server configurations for Claude Desktop and VSCode. It provides generic configuration management, loading and saving JSON config files, and common utilities.

This is an internal package and should not be imported by users of the cobrax library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeriveServerName

func DeriveServerName(executablePath string) string

DeriveServerName extracts the server name from an executable path.

func GetCmdPath

func GetCmdPath(cmd *cobra.Command, commandName string) ([]string, error)

GetCmdPath builds the command path to the cobrax command. It returns the slice of command names from after the root command up to and including the command identified by commandName.

Example: for command path "myapp agent claude enable" with commandName "agent", returns ["agent"].

The returned slice can be used as arguments when invoking the executable. Returns an error if commandName is not found in the command path.

Types

type Config

type Config[S Server] interface {
	HasServer(name string) bool
	AddServer(name string, server S)
	RemoveServer(name string)
	Print()
}

Config represents MCP server configuration that can be managed.

type Manager

type Manager[S Server, C Config[S]] struct {
	// contains filtered or unexported fields
}

Manager provides generic configuration management for MCP servers. It handles loading, saving, and modifying MCP server configurations. It is not thread-safe.

func NewClaudeManager

func NewClaudeManager(configPath string) (*Manager[claude.Server, *claude.Config], error)

NewClaudeManager creates a new Manager configured for Claude Desktop MCP servers.

func NewCursorManager

func NewCursorManager(configPath string, workspace bool) (*Manager[cursor.Server, *cursor.Config], error)

NewCursorManager creates a new Manager configured for Cursor MCP servers. If workspace is true, uses workspace configuration (.cursor/mcp.json), otherwise uses user-level configuration.

func NewVSCodeManager

func NewVSCodeManager(configPath string, workspace bool) (*Manager[vscode.Server, *vscode.Config], error)

NewVSCodeManager creates a new Manager configured for VSCode MCP servers. If workspace is true, uses workspace configuration (.vscode/mcp.json), otherwise uses user-level configuration.

func (*Manager[S, C]) DisableServer

func (m *Manager[S, C]) DisableServer(name string) error

DisableServer removes an MCP server from the configuration.

func (*Manager[S, C]) EnableServer

func (m *Manager[S, C]) EnableServer(name string, server S) error

EnableServer adds or updates an MCP server in the configuration.

func (*Manager[S, C]) Print

func (m *Manager[S, C]) Print()

Print calls Print on the underlying config

type Server

type Server interface {
	Print()
}

Server represents an individual MCP server entry.

Directories

Path Synopsis
Package claude provides configuration management for Claude Desktop MCP servers.
Package claude provides configuration management for Claude Desktop MCP servers.
Package cursor provides configuration management for Cursor MCP servers.
Package cursor provides configuration management for Cursor MCP servers.
Package vscode provides configuration management for VSCode MCP servers.
Package vscode provides configuration management for VSCode MCP servers.

Jump to

Keyboard shortcuts

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