Documentation
¶
Overview ¶
Package vscode provides an adapter for VS Code / GitHub Copilot MCP configuration.
VS Code uses a different format than Claude:
- Root key is "servers" (not "mcpServers")
- Has "inputs" section for secret management
- Requires explicit "type" field
- Supports "envFile" for loading env files
File locations:
- Workspace: .vscode/mcp.json
- User: depends on OS and profile
Index ¶
- Constants
- func ReadWorkspaceConfig() (*core.Config, error)
- func WorkspaceConfigPath() string
- func WriteWorkspaceConfig(cfg *core.Config) error
- type Adapter
- func (a *Adapter) DefaultPaths() []string
- func (a *Adapter) FromCore(cfg *core.Config) *Config
- func (a *Adapter) Marshal(cfg *core.Config) ([]byte, error)
- func (a *Adapter) Name() string
- func (a *Adapter) Parse(data []byte) (*core.Config, error)
- func (a *Adapter) ReadFile(path string) (*core.Config, error)
- func (a *Adapter) ToCore(vscodeCfg *Config) *core.Config
- func (a *Adapter) WriteFile(cfg *core.Config, path string) error
- type Config
- type InputVariable
- type ServerConfig
Constants ¶
View Source
const ( // AdapterName is the identifier for this adapter. AdapterName = "vscode" // WorkspaceConfigDir is the workspace config directory. WorkspaceConfigDir = ".vscode" // ConfigFileName is the config file name. ConfigFileName = "mcp.json" )
Variables ¶
This section is empty.
Functions ¶
func ReadWorkspaceConfig ¶
ReadWorkspaceConfig reads the workspace .vscode/mcp.json file.
func WorkspaceConfigPath ¶
func WorkspaceConfigPath() string
WorkspaceConfigPath returns the workspace config path.
func WriteWorkspaceConfig ¶
WriteWorkspaceConfig writes to the workspace .vscode/mcp.json file.
Types ¶
type Adapter ¶
type Adapter struct{}
Adapter implements core.Adapter for VS Code.
func (*Adapter) DefaultPaths ¶
DefaultPaths returns the default config file paths for VS Code.
type Config ¶
type Config struct {
// Inputs defines input variables for sensitive data.
Inputs []InputVariable `json:"inputs,omitempty"`
// Servers maps server names to their configurations.
Servers map[string]ServerConfig `json:"servers"`
}
Config represents the VS Code MCP configuration. Note: VS Code uses "servers" not "mcpServers".
type InputVariable ¶
type InputVariable struct {
// Type is the input type, typically "promptString".
Type string `json:"type"`
// ID is the unique identifier referenced as ${input:id}.
ID string `json:"id"`
// Description is the user-friendly prompt text.
Description string `json:"description"`
// Password hides input when true.
Password bool `json:"password,omitempty"`
}
InputVariable represents a placeholder for sensitive values.
type ServerConfig ¶
type ServerConfig struct {
// Type is required: "stdio", "http", or "sse".
Type string `json:"type"`
// --- STDIO Server Fields ---
Command string `json:"command,omitempty"`
Args []string `json:"args,omitempty"`
Env map[string]string `json:"env,omitempty"`
EnvFile string `json:"envFile,omitempty"`
// --- HTTP/SSE Server Fields ---
URL string `json:"url,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
}
ServerConfig represents a VS Code MCP server configuration.
Click to show internal directories.
Click to hide internal directories.