Documentation
¶
Index ¶
- func CreateConsoleCore(level zapcore.Level) zapcore.Core
- func CreateNewLoggerFromCore(core zapcore.Core) *zap.Logger
- func InitLogger(config TelemetryConfig) error
- func InitTracer(ctx context.Context, config TelemetryConfig) (func(context.Context) error, error)
- func RunServer(ctx context.Context, cfg *Config) error
- type Config
- type ServerInfo
- type TelemetryConfig
- type ToolRegistryConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateConsoleCore ¶
CreateConsoleCore returns a zapcore.Core that writes logs at or above level to stdout and error logs to stderr using a console encoder.
func CreateNewLoggerFromCore ¶
CreateNewLoggerFromCore creates a named zap.Logger from the given core with caller information enabled.
func InitLogger ¶
func InitLogger(config TelemetryConfig) error
InitLogger sets up the global logger to use the OTel bridge, allowing logs to be exported to OTel. Logs below config.LogLevel are written neither to the console nor to OTel.
func InitTracer ¶
InitTracer initializes the OpenTelemetry tracer and returns a shutdown function
Types ¶
type Config ¶
type Config struct {
// SocketPath is the Unix domain socket path the gRPC server listens on.
SocketPath string
// ToolRegistryConfig configures how tools are loaded from OpenAPI specs.
ToolRegistryConfig *ToolRegistryConfig
// ServerInfo configures the identity and instructions for the MCP server.
ServerInfo ServerInfo
// AllowedHosts is the list of hostnames accepted in the Host/:authority and
// Origin headers of incoming requests (DNS rebinding protection). Matching
// is case-insensitive and ignores ports. Each entry is one of:
// - "*" — match any host (disables rebinding protection; opt-in only);
// - "*.example.org" — match any subdomain at any depth (foo.example.org,
// a.b.example.org) but NOT the apex example.org;
// - "host.example.org" — exact match.
// Empty means the default policy: localhost, 127.0.0.1 and ::1. A non-empty
// list REPLACES the default — include "localhost" explicitly if it should
// remain allowed.
AllowedHosts []string
}
Config holds the configuration for the ext_proc gRPC server.
type ServerInfo ¶
type ServerInfo struct {
// Name is the server name reported to MCP clients.
Name string
// Version is the server version reported to MCP clients.
Version string
// Instructions is human-readable text returned to MCP clients.
Instructions string
}
ServerInfo holds the identity and instructions returned in the MCP initialize response.
type TelemetryConfig ¶
type TelemetryConfig struct {
// OtelEndpoint is the gRPC address of the OpenTelemetry Collector (e.g. "localhost:4317").
OtelEndpoint string
// ServiceName identifies this service in traces and logs.
ServiceName string
// ServiceVersion is the version string reported in telemetry resource attributes.
ServiceVersion string
// LogLevel is the minimum severity written to the console and exported to
// OTel, one of "debug", "info", "warn" or "error". Empty means "info".
LogLevel string
}
TelemetryConfig holds the configuration for OpenTelemetry tracing and logging exporters.
type ToolRegistryConfig ¶
type ToolRegistryConfig struct {
// OpenAPISpecPattern is a glob pattern to match OpenAPI spec files for loading tools.
// For example, "specs/*.yaml" would load all YAML files in the specs directory.
OpenAPISpecPattern string
// ToolAllowlist is an optional list of tool names to allow. If empty, all tools loaded from the OpenAPI specs will be allowed.
ToolAllowlist []string
// StructuredOutput indicates whether to enable structured output for tools,
// which allows using outputSchema for response validation and structured content in tool responses.
StructuredOutput bool
}
ToolRegistryConfig defines the configuration for creating a toolRegistry from OpenAPI specs.