Documentation
¶
Overview ¶
Package mcp implements the Model Context Protocol (MCP) over JSON-RPC 2.0.
The package is transport-agnostic: HTTP, Server-Sent Events (SSE), and stdio transports are all provided, but the protocol Handler does not depend on any specific transport. The HTTP-server integration lives in the root hyperserve package; built-in tools and resources that need a *hyperserve.Server live in mcp/builtin.
Index ¶
- Constants
- Variables
- func NewStdioTransport(logger *slog.Logger) *stdioTransport
- func NewStdioTransportWithIO(r io.Reader, w io.Writer, logger *slog.Logger) *stdioTransport
- func ToolError(message string) error
- func ToolErrorf(format string, args ...any) error
- type CacheableResource
- type Capabilities
- type ClientInfo
- type DiscoveryConfig
- type DiscoveryInfo
- type DiscoveryPolicy
- type Extension
- type ExtensionBuilder
- func (b *ExtensionBuilder) Build() Extension
- func (b *ExtensionBuilder) WithDescription(desc string) *ExtensionBuilder
- func (b *ExtensionBuilder) WithResource(resource Resource) *ExtensionBuilder
- func (b *ExtensionBuilder) WithResourceTemplate(template ResourceTemplate) *ExtensionBuilder
- func (b *ExtensionBuilder) WithTool(tool Tool) *ExtensionBuilder
- type Handler
- func (h *Handler) BuildDiscoveryInfo(r *http.Request, cfg DiscoveryConfig) DiscoveryInfo
- func (h *Handler) Capabilities() Capabilities
- func (h *Handler) HasNamespace(name string) bool
- func (h *Handler) HasResource(uri string) bool
- func (h *Handler) HasResourceTemplate(uriTemplate string) bool
- func (h *Handler) HasTool(name string) bool
- func (h *Handler) Logger() *slog.Logger
- func (h *Handler) ProcessRequest(requestData []byte) []byte
- func (h *Handler) ProcessRequestWithTransport(transport Transport) error
- func (h *Handler) ProtocolVersion() string
- func (h *Handler) RPCEngine() *jsonrpc.Engine
- func (h *Handler) RegisterExtension(ext Extension) error
- func (h *Handler) RegisterNamespace(name string, configs ...NamespaceConfig) error
- func (h *Handler) RegisterResource(resource Resource)
- func (h *Handler) RegisterResourceInNamespace(resource Resource, namespace string)
- func (h *Handler) RegisterResourceTemplate(template ResourceTemplate)
- func (h *Handler) RegisterResourceTemplateInNamespace(template ResourceTemplate, namespace string)
- func (h *Handler) RegisterTool(tool Tool)
- func (h *Handler) RegisterToolInNamespace(tool Tool, namespace string)
- func (h *Handler) RegisteredResourceTemplates() []string
- func (h *Handler) RegisteredResources() []string
- func (h *Handler) RegisteredTools() []string
- func (h *Handler) ResourceCount() int
- func (h *Handler) ResourceTemplateCount() int
- func (h *Handler) RunStdioLoop() error
- func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ServerInfo() ServerInfo
- func (h *Handler) SetLegacyRoutedSSEEnabled(enabled bool)deprecated
- func (h *Handler) SetLogger(l *slog.Logger)
- func (h *Handler) SetOriginValidator(validator func(*http.Request) bool)
- func (h *Handler) SetProtocolVersion(version string)
- func (h *Handler) SetToolCallTimeout(d time.Duration)
- func (h *Handler) Shutdown(ctx context.Context) error
- func (h *Handler) Tool(name string) (Tool, bool)
- func (h *Handler) ToolCount() int
- type InitializeParams
- type InitializeResult
- type Namespace
- type NamespaceConfig
- type Resource
- type ResourceContent
- type ResourceEmitter
- type ResourceInfo
- type ResourceReadParams
- type ResourceTemplate
- type ResourceTemplateExtension
- type ResourceTemplateInfo
- type ResourcesCapability
- type SSECapability
- type ServerInfo
- type SubscribableResourceTemplate
- type Tool
- type ToolBuilder
- type ToolCallParams
- type ToolInfo
- type ToolResult
- type ToolWithContext
- type ToolWithOutputSchema
- type ToolsCapability
- type Transport
- type TransportConfig
- type TransportInfo
- type TransportOptions
- type TransportType
- type TypedToolFunc
Constants ¶
const ( // DefaultProtocolVersion is the initialize-era MCP protocol version // advertised by default. It remains the default for compatibility with // existing 2025 clients while Streamable HTTP negotiates the current // revision independently on each request. DefaultProtocolVersion = "2025-11-25" // StreamableHTTPProtocolVersion is the current stateless Streamable HTTP // protocol revision supported by Handler.ServeHTTP. StreamableHTTPProtocolVersion = "2026-07-28" )
const ProtocolVersion = DefaultProtocolVersion
ProtocolVersion is kept as a compatibility alias for callers that used the old package constant. New code should prefer DefaultProtocolVersion or a Handler's configured ProtocolVersion.
Variables ¶
var ( ErrMethodNotAllowed = errors.New("method not allowed") ErrUnsupportedContentType = errors.New("unsupported content type") )
ErrMethodNotAllowed and ErrUnsupportedContentType are sentinel errors used by the HTTP transport so ServeHTTP can categorise failures with errors.Is rather than substring-matching free-form messages. Adding a wrap site is a public contract — keep the sentinel set narrow and stable.
Functions ¶
func NewStdioTransport ¶
NewStdioTransport creates a new stdio transport using os.Stdin / os.Stdout.
func NewStdioTransportWithIO ¶
NewStdioTransportWithIO creates a new stdio transport with custom IO.
func ToolError ¶
ToolError returns an error that tools can use for domain-level failures. The MCP handler converts it into a successful tools/call response with isError=true instead of a JSON-RPC protocol error.
func ToolErrorf ¶
ToolErrorf formats a domain-level tool failure.
Types ¶
type CacheableResource ¶
CacheableResource is an optional extension for resources whose read result is safe to reuse for a bounded time. Resources are uncached by default so live observability views (health, metrics, logs, route lists) never return stale data unless they explicitly opt in.
type Capabilities ¶
type Capabilities struct {
Resources *ResourcesCapability `json:"resources,omitempty"`
Tools *ToolsCapability `json:"tools,omitempty"`
SSE *SSECapability `json:"sse,omitempty"`
}
Capabilities represents the server's advertised MCP capabilities. Add fields here only when the corresponding capability is actually wired in Handler.Capabilities() and exercised on the wire; advertising an unsupported capability is worse than omitting it.
type ClientInfo ¶
ClientInfo identifies an MCP client.
type DiscoveryConfig ¶
type DiscoveryConfig struct {
// MCPEndpoint is the URL path the MCP handler is mounted on (e.g. "/mcp").
MCPEndpoint string
// DefaultAddr is used to derive the base URL when the request has no Host header.
DefaultAddr string
// Transport identifies the transport in use (HTTP / Stdio).
Transport TransportType
// Policy controls discovery list visibility.
Policy DiscoveryPolicy
// Filter, if non-nil, makes the final decision per tool. It overrides the
// default rules entirely.
Filter func(toolName string, r *http.Request) bool
}
DiscoveryConfig groups the inputs needed to build a DiscoveryInfo response.
type DiscoveryInfo ¶
type DiscoveryInfo struct {
Version string `json:"version"`
Versions []string `json:"versions,omitempty"`
Transports []TransportInfo `json:"transports"`
Endpoints map[string]string `json:"endpoints"`
Capabilities map[string]any `json:"capabilities,omitempty"`
}
DiscoveryInfo describes the MCP endpoints surfaced by the discovery API.
type DiscoveryPolicy ¶
type DiscoveryPolicy int
DiscoveryPolicy controls how MCP tools and resources are exposed via the discovery endpoints (/.well-known/mcp.json and /mcp/discover).
const ( // DiscoveryPublic shows all discoverable tools/resources (default). DiscoveryPublic DiscoveryPolicy = iota // DiscoveryCount only exposes counts, not names. DiscoveryCount // DiscoveryAuthenticated returns the full list only when the request // carries an Authorization header. DiscoveryAuthenticated // DiscoveryNone hides all tool/resource information. DiscoveryNone )
type Extension ¶
type Extension interface {
// Name returns the extension name (e.g., "e-commerce", "blog").
Name() string
// Description returns a human-readable description.
Description() string
// Tools returns the tools provided by this extension.
Tools() []Tool
// Resources returns the resources provided by this extension.
Resources() []Resource
// Configure runs before registration with the supplied handler. Use it to
// wire the extension up to the handler (e.g. capture a reference, register
// extra namespaces).
Configure(h *Handler) error
}
Extension represents a collection of MCP tools and resources that can be registered as a group. It's the lightweight way to package related functionality together.
type ExtensionBuilder ¶
type ExtensionBuilder struct {
// contains filtered or unexported fields
}
ExtensionBuilder provides a fluent API for building Extensions.
func NewExtension ¶
func NewExtension(name string) *ExtensionBuilder
NewExtension creates a new extension builder.
func (*ExtensionBuilder) Build ¶
func (b *ExtensionBuilder) Build() Extension
func (*ExtensionBuilder) WithDescription ¶
func (b *ExtensionBuilder) WithDescription(desc string) *ExtensionBuilder
func (*ExtensionBuilder) WithResource ¶
func (b *ExtensionBuilder) WithResource(resource Resource) *ExtensionBuilder
func (*ExtensionBuilder) WithResourceTemplate ¶
func (b *ExtensionBuilder) WithResourceTemplate(template ResourceTemplate) *ExtensionBuilder
func (*ExtensionBuilder) WithTool ¶
func (b *ExtensionBuilder) WithTool(tool Tool) *ExtensionBuilder
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler manages MCP protocol communication with multiple namespace support. The SSE state machine (client registry + per-client request channels) lives entirely in sseManager — Handler stays focused on JSON-RPC dispatch.
func NewHandler ¶
func NewHandler(serverInfo ServerInfo) *Handler
NewHandler creates a new MCP handler instance.
func (*Handler) BuildDiscoveryInfo ¶
func (h *Handler) BuildDiscoveryInfo(r *http.Request, cfg DiscoveryConfig) DiscoveryInfo
BuildDiscoveryInfo constructs the discovery payload based on the supplied configuration and request. The caller is responsible for marshalling and writing the response.
func (*Handler) Capabilities ¶
func (h *Handler) Capabilities() Capabilities
Capabilities returns the server's MCP capabilities.
func (*Handler) HasNamespace ¶
HasNamespace reports whether a namespace with the given name has been registered via RegisterNamespace.
func (*Handler) HasResource ¶
HasResource reports whether a resource with the given URI is registered.
func (*Handler) HasResourceTemplate ¶
HasResourceTemplate reports whether a resource template is registered.
func (*Handler) HasTool ¶
HasTool reports whether a tool with the given (possibly prefixed) name is registered.
func (*Handler) ProcessRequest ¶
ProcessRequest processes a single MCP request (raw JSON).
func (*Handler) ProcessRequestWithTransport ¶
ProcessRequestWithTransport processes an MCP request using the provided transport.
func (*Handler) ProtocolVersion ¶
ProtocolVersion returns the MCP protocol version this handler advertises.
func (*Handler) RPCEngine ¶
RPCEngine returns the underlying JSON-RPC engine. Exposed so tests and transports can dispatch a parsed request without re-marshalling.
func (*Handler) RegisterExtension ¶
RegisterExtension wires all of an Extension's tools and resources into the handler. It calls Configure(h) first so the extension can hook in.
func (*Handler) RegisterNamespace ¶
func (h *Handler) RegisterNamespace(name string, configs ...NamespaceConfig) error
RegisterNamespace registers an entire namespace with its tools and resources.
func (*Handler) RegisterResource ¶
RegisterResource registers an MCP resource without namespace prefixing.
func (*Handler) RegisterResourceInNamespace ¶
RegisterResourceInNamespace registers an MCP resource in the specified namespace.
func (*Handler) RegisterResourceTemplate ¶
func (h *Handler) RegisterResourceTemplate(template ResourceTemplate)
RegisterResourceTemplate registers an MCP resource template without namespace prefixing.
func (*Handler) RegisterResourceTemplateInNamespace ¶
func (h *Handler) RegisterResourceTemplateInNamespace(template ResourceTemplate, namespace string)
RegisterResourceTemplateInNamespace registers an MCP resource template in the specified namespace.
func (*Handler) RegisterTool ¶
RegisterTool registers an MCP tool without namespace prefixing.
func (*Handler) RegisterToolInNamespace ¶
RegisterToolInNamespace registers an MCP tool in the specified namespace.
func (*Handler) RegisteredResourceTemplates ¶
RegisteredResourceTemplates returns all registered resource template URI templates in registration order.
func (*Handler) RegisteredResources ¶
RegisteredResources returns all registered resource URIs. Returns a non-nil slice even when no resources are registered.
func (*Handler) RegisteredTools ¶
RegisteredTools returns all registered tool names. Returns a non-nil slice even when no tools are registered.
func (*Handler) ResourceCount ¶
ResourceCount returns the number of registered resources.
func (*Handler) ResourceTemplateCount ¶
ResourceTemplateCount returns the number of registered resource templates.
func (*Handler) RunStdioLoop ¶
RunStdioLoop runs until EOF or a terminal input/output error. Malformed complete JSON records receive a parse error and do not end the session.
func (*Handler) ServeHTTP ¶
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler for the MCP endpoint.
func (*Handler) ServerInfo ¶
func (h *Handler) ServerInfo() ServerInfo
ServerInfo returns the server info associated with this handler.
func (*Handler) SetLegacyRoutedSSEEnabled
deprecated
SetLegacyRoutedSSEEnabled enables HyperServe's proprietary X-SSE-* routed stream. It is disabled by default and exists only for migration of existing HyperServe-specific clients.
Deprecated: use MCP 2026-07-28 Streamable HTTP and subscriptions/listen.
func (*Handler) SetLogger ¶
SetLogger overrides the handler's logger. Useful for tests that want to silence output.
func (*Handler) SetOriginValidator ¶
SetOriginValidator overrides the default MCP Origin policy. The default accepts requests without Origin (normal for non-browser clients) and requires browser origins to match the request Host. Passing nil restores that default. Applications allowing cross-origin browser clients should authenticate them and validate an explicit origin allowlist here.
func (*Handler) SetProtocolVersion ¶
SetProtocolVersion overrides the initialize-era compatibility version advertised in legacy responses and discovery. Empty values reset to the default. StreamableHTTPProtocolVersion is selected independently through per-request metadata and cannot be configured as the legacy version.
func (*Handler) SetToolCallTimeout ¶
SetToolCallTimeout overrides the per-call timeout used when dispatching tools/call. Zero or negative values reset to defaultToolCallTimeout.
func (*Handler) Shutdown ¶
Shutdown gracefully completes active subscriptions/listen streams and closes legacy routed SSE connections. It is safe to call more than once.
type InitializeParams ¶
type InitializeParams struct {
ProtocolVersion string `json:"protocolVersion"`
Capabilities any `json:"capabilities"`
ClientInfo ClientInfo `json:"clientInfo"`
}
InitializeParams is the parameter struct for the "initialize" method.
type InitializeResult ¶
type InitializeResult struct {
ProtocolVersion string `json:"protocolVersion"`
Capabilities Capabilities `json:"capabilities"`
ServerInfo ServerInfo `json:"serverInfo"`
}
InitializeResult is the result returned by the "initialize" method.
type Namespace ¶
type Namespace struct {
Name string
Tools []Tool
Resources []Resource
ResourceTemplates []ResourceTemplate
}
Namespace represents a named collection of MCP tools and resources.
type NamespaceConfig ¶
type NamespaceConfig func(*Namespace)
NamespaceConfig configures a Namespace.
func WithNamespaceResourceTemplates ¶
func WithNamespaceResourceTemplates(templates ...ResourceTemplate) NamespaceConfig
WithNamespaceResourceTemplates adds resource templates to a namespace.
func WithNamespaceResources ¶
func WithNamespaceResources(resources ...Resource) NamespaceConfig
WithNamespaceResources adds resources to a namespace.
func WithNamespaceTools ¶
func WithNamespaceTools(tools ...Tool) NamespaceConfig
WithNamespaceTools adds tools to a namespace.
type Resource ¶
type Resource interface {
URI() string
Name() string
Description() string
MimeType() string
Read() (any, error)
List() ([]string, error)
}
Resource defines the interface for Model Context Protocol resources.
type ResourceContent ¶
type ResourceContent struct {
URI string `json:"uri"`
MimeType string `json:"mimeType"`
Text any `json:"text"`
}
ResourceContent represents the content body of a resource.
type ResourceEmitter ¶
ResourceEmitter emits resource update notifications for an active subscription. MCP update notifications are invalidation signals: clients should call resources/read to fetch the latest content.
type ResourceInfo ¶
type ResourceInfo struct {
URI string `json:"uri"`
Name string `json:"name"`
Description string `json:"description"`
MimeType string `json:"mimeType"`
}
ResourceInfo describes a resource in resources/list responses.
type ResourceReadParams ¶
type ResourceReadParams struct {
URI string `json:"uri"`
}
ResourceReadParams is the parameter struct for "resources/read".
type ResourceTemplate ¶
type ResourceTemplate interface {
URITemplate() string
Name() string
Description() string
MimeType() string
Match(uri string) (params map[string]string, ok bool)
Read(ctx context.Context, uri string, params map[string]string) (any, error)
}
ResourceTemplate defines a parameterized family of MCP resources.
type ResourceTemplateExtension ¶
type ResourceTemplateExtension interface {
ResourceTemplates() []ResourceTemplate
}
ResourceTemplateExtension is implemented by extensions that also provide parameterized resource templates. It is optional so existing Extension implementations remain source-compatible.
type ResourceTemplateInfo ¶
type ResourceTemplateInfo struct {
URITemplate string `json:"uriTemplate"`
Name string `json:"name"`
Description string `json:"description"`
MimeType string `json:"mimeType,omitempty"`
}
ResourceTemplateInfo describes a resource template in resources/templates/list responses.
type ResourcesCapability ¶
type ResourcesCapability struct {
Subscribe bool `json:"subscribe,omitempty"`
ListChanged bool `json:"listChanged,omitempty"`
}
ResourcesCapability represents the server's resource management capabilities.
type SSECapability ¶
type SSECapability struct {
Enabled bool `json:"enabled"`
Endpoint string `json:"endpoint"`
HeaderRouting bool `json:"headerRouting"`
}
SSECapability represents the server's Server-Sent Events capability.
type ServerInfo ¶
ServerInfo identifies an MCP server.
type SubscribableResourceTemplate ¶
type SubscribableResourceTemplate interface {
ResourceTemplate
Subscribe(ctx context.Context, uri string, params map[string]string, emit ResourceEmitter) error
}
SubscribableResourceTemplate extends ResourceTemplate with live update subscriptions. Subscribe should block until ctx is canceled or the subscription ends.
type Tool ¶
type Tool interface {
Name() string
Description() string
Schema() map[string]any
Execute(params map[string]any) (any, error)
}
Tool defines the interface for Model Context Protocol tools.
func NewTypedTool ¶
func NewTypedTool[In, Out any](name, description string, fn TypedToolFunc[In, Out]) Tool
NewTypedTool returns a Tool whose input schema is derived from In (which must be a struct or pointer to a struct). When Out is also a struct (or slice/array of struct), an output schema is derived too and emitted as `outputSchema` in tools/list. The returned Tool implements ToolWithContext, so the per-call timeout enforced by Handler.handleToolsCall is propagated to fn.
type CreatePostArgs struct {
Title string `json:"title" validate:"required,max=200"`
Author string `json:"author" validate:"required"`
Tags []string `json:"tags,omitempty" validate:"max=10"`
}
type Post struct {
ID, Title, Author string
Tags []string
CreatedAt time.Time
}
tool := mcp.NewTypedTool("create_post", "Create a new blog post.",
func(ctx context.Context, args CreatePostArgs) (Post, error) {
return blog.create(args)
})
srv.RegisterMCPTool(tool)
Type inference at the call site picks both In and Out off the function value, so callers don't write the type parameters explicitly.
Schema generation covers strings, numbers, booleans, arrays, and nested structs. It derives enums and bounds from oneof, min, max, and len validation rules, and descriptions from mcp:"desc=..." tags. Nested structs are inlined; $ref, $defs, cross-field rules, and custom validators are not emitted.
Prefer NewTypedTool for new tools because the typed shape keeps the handler and its schema together. The NewTool builder remains available for callers that need to assemble a schema dynamically.
Panics at registration if In is not a struct type, fn is nil, or a numeric oneof value cannot be represented by its field type.
type ToolBuilder ¶
type ToolBuilder struct {
// contains filtered or unexported fields
}
ToolBuilder provides a fluent API for building Tools with a hand-tuned schema. Prefer NewTypedTool[In, Out] when the input shape is a struct; reach for this builder when you need a schema the type system can't describe (oneOf, polymorphic shapes, schema-from-JSON-file, etc.).
func (*ToolBuilder) Build ¶
func (b *ToolBuilder) Build() Tool
Build snapshots the tool's metadata, parameter schema, and execution function. Later changes to the builder do not alter the returned tool.
func (*ToolBuilder) WithDescription ¶
func (b *ToolBuilder) WithDescription(desc string) *ToolBuilder
func (*ToolBuilder) WithExecute ¶
func (b *ToolBuilder) WithExecute(fn func(map[string]any) (any, error)) *ToolBuilder
func (*ToolBuilder) WithParameter ¶
func (b *ToolBuilder) WithParameter(name, paramType, description string, required bool) *ToolBuilder
type ToolCallParams ¶
type ToolCallParams struct {
Name string `json:"name"`
Arguments map[string]any `json:"arguments"`
}
ToolCallParams is the parameter struct for "tools/call".
type ToolInfo ¶
type ToolInfo struct {
Name string `json:"name"`
Description string `json:"description"`
InputSchema map[string]any `json:"inputSchema"`
OutputSchema map[string]any `json:"outputSchema,omitempty"`
}
ToolInfo describes a tool in tools/list responses. OutputSchema is the `outputSchema` field added in the MCP spec revision 2025-06-18; tools that implement ToolWithOutputSchema populate it via the handler's tools/list path, others omit it.
type ToolResult ¶
type ToolResult struct {
Content []map[string]any `json:"content"`
StructuredContent any `json:"structuredContent,omitempty"` // JSON object matching outputSchema, when advertised.
IsError bool `json:"isError,omitempty"`
}
ToolResult represents the result of a tool execution.
type ToolWithContext ¶
type ToolWithContext interface {
Tool
ExecuteWithContext(ctx context.Context, params map[string]any) (any, error)
}
ToolWithContext is an enhanced Tool that supports context for cancellation and timeouts during ExecuteWithContext.
type ToolWithOutputSchema ¶
ToolWithOutputSchema is implemented by tools that can describe their return shape. The handler's tools/list path checks this interface via type assertion and surfaces the result as the `outputSchema` field on ToolInfo (MCP spec revision 2025-06-18). Returning nil omits the field. Non-object schemas are wrapped in an object with a required "result" property on the wire, along with the corresponding structured result.
type ToolsCapability ¶
type ToolsCapability struct {
ListChanged bool `json:"listChanged,omitempty"`
}
ToolsCapability represents the server's tool execution capabilities.
type Transport ¶
type Transport interface {
Send(response *jsonrpc.Response) error
Receive() (*jsonrpc.Request, error)
Close() error
}
Transport defines the interface for MCP communication transports.
type TransportConfig ¶
type TransportConfig func(*TransportOptions)
TransportConfig configures MCP transport options.
func OverStdio ¶
func OverStdio() TransportConfig
OverStdio configures MCP to use stdio transport.
The HTTP/SSE counterparts that used to live here were unused (no caller outside this file); HTTP is the default when no Over* config is supplied, and SSE shares the HTTP endpoint via Accept-header routing. Configure the endpoint path with hyperserve.WithMCPEndpoint instead.
func WithDeveloperMode ¶
func WithDeveloperMode() TransportConfig
WithDeveloperMode marks the transport options as opting into the developer preset.
func WithObservabilityMode ¶
func WithObservabilityMode() TransportConfig
WithObservabilityMode marks the transport options as opting into the observability preset. The preset itself is implemented by callers (e.g. mcp/builtin) which read this flag.
type TransportInfo ¶
type TransportInfo struct {
Type string `json:"type"`
Endpoint string `json:"endpoint"`
Description string `json:"description"`
Headers map[string]string `json:"headers,omitempty"`
}
TransportInfo describes one available transport mechanism.
type TransportOptions ¶
type TransportOptions struct {
Transport TransportType
Endpoint string
ObservabilityMode bool
DeveloperMode bool
}
TransportOptions holds transport configuration. It is exported so callers (most notably the root hyperserve package) can inspect the resolved transport selection after applying a series of TransportConfig functions.
type TransportType ¶
type TransportType int
TransportType identifies the kind of transport used for MCP communication.
const ( // HTTPTransport selects HTTP-based MCP communication. HTTPTransport TransportType = iota // StdioTransport selects stdin/stdout MCP communication. StdioTransport )
type TypedToolFunc ¶
TypedToolFunc is the signature an MCP tool implements when registered via NewTypedTool. The In value is decoded and validated before the function runs; Out is JSON-marshaled by the framework. Use `struct{}` for either side when the tool takes no arguments or returns no payload.