mcp

package
v0.0.38 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package mcp provides types for MCP (Model Context Protocol) server configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MCPServerConfig

type MCPServerConfig struct {
	// Type specifies the connection protocol.
	// Values: "stdio", "sse", "http".
	Type TransportType `json:"type,omitempty" yaml:"type,omitempty"`

	// Command is the executable to run (e.g. "npx", "docker").
	// Required for "stdio" type.
	Command string `json:"command,omitempty" yaml:"command,omitempty"`

	// Args is an array of arguments for the command.
	Args []string `json:"args,omitempty" yaml:"args,omitempty"`

	// Env defines environment variables for the server process.
	Env map[string]string `json:"env,omitempty" yaml:"env,omitempty"`

	// URL is the endpoint for "http" or "sse" types.
	// Required for remote connections.
	URL string `json:"url,omitempty" yaml:"url,omitempty"`

	// Headers contains custom HTTP headers (e.g. {"Authorization": "Bearer ..."}).
	// Used for "http" and "sse" types.
	Headers map[string]string `json:"headers,omitempty" yaml:"headers,omitempty"`

	// Content holds arbitrary additional fields from YAML/JSON that aren't in the struct
	Content map[string]any `json:"-" yaml:",inline"`
}

MCPServerConfig defines the common configuration fields supported by both platforms. It also supports arbitrary additional fields via the Content map.

func (*MCPServerConfig) UnmarshalJSON

func (m *MCPServerConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON custom unmarshaler that populates both typed fields and Content map.

type MCPServerConfigs

type MCPServerConfigs map[string]MCPServerConfig

MCPServerConfigs maps server names to their configurations.

type TransportType

type TransportType string

TransportType defines the communication protocol used by the server. Supported by both Claude and Cursor.

const (
	// TransportTypeStdio is for local processes (executables).
	TransportTypeStdio TransportType = "stdio"

	// TransportTypeSSE is for Server-Sent Events (Remote).
	// Note: Claude Code prefers HTTP over SSE, but supports it.
	TransportTypeSSE TransportType = "sse"

	// TransportTypeHTTP is for standard HTTP/POST interactions.
	TransportTypeHTTP TransportType = "http"
)

Jump to

Keyboard shortcuts

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