Documentation
¶
Index ¶
Constants ¶
const ( TransportProtocolStreamableHttp = "streamablehttp" TransportProtocolStdio = "stdio" KindMCPServerConfig = "MCPServerConfig" )
const (
DefaultBasePath = "/mcp"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthConfig ¶
type AuthConfig struct {
// List of authorization server URLs for token validation.
AuthorizationServers []string `json:"authorizationServers,omitempty" jsonschema:"optional"`
// URI for the JSON Web Key Set (JWKS) used for token verification.
JWKSURI string `json:"jwksUri,omitempty" jsonschema:"optional"`
}
AuthConfig defines OAuth 2.0 authorization settings.
type MCPServerConfig ¶
type MCPServerConfig struct {
// Runtime configuration for the MCP server.
Runtime *ServerRuntime `json:"runtime,omitempty" jsonschema:"optional"`
}
MCPServerConfig defines the runtime configuration of an MCP server.
func (*MCPServerConfig) UnmarshalJSON ¶
func (s *MCPServerConfig) UnmarshalJSON(data []byte) error
func (*MCPServerConfig) Validate ¶
func (s *MCPServerConfig) Validate() error
type MCPServerConfigFile ¶
type MCPServerConfigFile struct {
// Kind identifies the type of GenMCP config file.
Kind string `json:"kind" jsonschema:"required"`
// Version of the GenMCP config file format.
SchemaVersion string `json:"schemaVersion" jsonschema:"required"`
// MCP server definition.
MCPServerConfig `json:",inline"`
}
MCPServerConfigFile is the root structure of a Server Config File (mcpserver.yaml).
func ParseMCPFile ¶
func ParseMCPFile(path string) (*MCPServerConfigFile, error)
ParseMCPFile parses a Server Config File (mcpserver.yaml)
func (*MCPServerConfigFile) UnmarshalJSON ¶
func (m *MCPServerConfigFile) UnmarshalJSON(data []byte) error
func (*MCPServerConfigFile) Validate ¶
func (m *MCPServerConfigFile) Validate() error
type RuntimeOverrider ¶
type RuntimeOverrider interface {
ApplyOverrides(runtime *ServerRuntime) error
}
func NewEnvRuntimeOverrider ¶
func NewEnvRuntimeOverrider() RuntimeOverrider
type ServerRuntime ¶
type ServerRuntime struct {
// Transport protocol to use (streamablehttp or stdio).
TransportProtocol string `json:"transportProtocol" jsonschema:"required"`
// Configuration for streamable HTTP transport protocol.
StreamableHTTPConfig *StreamableHTTPConfig `json:"streamableHttpConfig,omitempty" jsonschema:"optional"`
// Configuration for stdio transport protocol.
StdioConfig *StdioConfig `json:"stdioConfig,omitempty" jsonschema:"optional"`
// Configuration for the server logging
LoggingConfig *logging.LoggingConfig `json:"loggingConfig" jsonschema:"optional"`
// contains filtered or unexported fields
}
ServerRuntime defines transport protocol and associated configuration.
func (*ServerRuntime) GetBaseLogger ¶
func (sr *ServerRuntime) GetBaseLogger() *zap.Logger
GetBaseLogger returns the base logger for the server. If LoggingConfig is nil, it defaults to a console logger with info level to ensure startup messages are visible as documented in tutorials. If LoggingConfig is provided but fails to build, it falls back to a console logger. If the runtime is nil, it returns a no-op logger.
func (*ServerRuntime) Validate ¶
func (r *ServerRuntime) Validate() error
type StdioConfig ¶
type StdioConfig struct{}
StdioConfig defines configuration for stdio transport protocol.
type StreamableHTTPConfig ¶
type StreamableHTTPConfig struct {
// Port number to listen on.
Port int `json:"port" jsonschema:"required"`
// Base path for the MCP server (default: /mcp).
BasePath string `json:"basePath,omitempty" jsonschema:"optional"`
// Indicates whether the server is stateless (default: true when unset).
Stateless bool `json:"stateless,omitempty" jsonschema:"optional"`
// OAuth 2.0 configuration for protected resources.
Auth *AuthConfig `json:"auth,omitempty" jsonschema:"optional"`
// TLS configuration for HTTPS.
TLS *TLSConfig `json:"tls,omitempty" jsonschema:"optional"`
}
StreamableHTTPConfig defines configuration for the HTTP-based runtime.
func (*StreamableHTTPConfig) UnmarshalJSON ¶
func (s *StreamableHTTPConfig) UnmarshalJSON(data []byte) error
type TLSConfig ¶
type TLSConfig struct {
// Absolute path to the server's public certificate.
CertFile string `json:"certFile,omitempty" jsonschema:"optional"`
// Absolute path to the server's private key.
KeyFile string `json:"keyFile,omitempty" jsonschema:"optional"`
}
TLSConfig defines paths to TLS certificate and private key files.