Documentation
¶
Index ¶
- Constants
- func TextContent(text string) []map[string]any
- type CompletionsCapability
- type HandlerFunc
- type InitializeResult
- type LoggingCapability
- type PromptListChangedEmitterProvider
- type PromptProvider
- type PromptsCapability
- type RepoProvider
- type ResourceCapability
- type ResourceListChangedEmitterProvider
- type ResourceProvider
- type ResourceUpdatedEmitterProvider
- type RuntimeProvider
- func (p *RuntimeProvider) AttachEventBus(bus *events.Bus)
- func (p *RuntimeProvider) Handler(name string) (HandlerFunc, bool)
- func (p *RuntimeProvider) ListResourceTemplates(_ context.Context) ([]map[string]any, error)
- func (p *RuntimeProvider) ListResources(ctx context.Context) ([]map[string]any, error)
- func (p *RuntimeProvider) ReadResource(ctx context.Context, uri string) ([]map[string]any, error)
- func (p *RuntimeProvider) SetResourceListChangedEmitter(cb func())
- func (p *RuntimeProvider) SetResourceUpdatedEmitter(cb func(uri string))
- func (p *RuntimeProvider) Tools() []Tool
- type SSESource
- type Server
- type ServerCapabilities
- type SymbolFindResult
- type SymbolFinder
- type SymbolHit
- type SymbolQuery
- type TasksCapability
- type Tool
- type ToolCapability
- type ToolProvider
- type ToolResult
Constants ¶
const ( RPCParseError = -32700 RPCInvalidRequest = -32600 RPCMethodNotFound = -32601 RPCInvalidParams = -32602 RPCInternalError = -32603 ProtocolVersion = "2025-11-25" DefaultRequestTimeout = 30 * time.Second // DefaultReplayLimit bounds in-memory SSE notification replay history per // process. Replay state is intentionally ephemeral and not shared across // restarts. // TODO(mcp): make replay retention configurable (and optionally durable) // once runtime auth and multi-process reconnect expectations are finalized. DefaultReplayLimit = 256 )
Variables ¶
This section is empty.
Functions ¶
func TextContent ¶
TextContent creates a standard MCP text content block for tools/call results.
Types ¶
type CompletionsCapability ¶
type CompletionsCapability struct {
}
CompletionsCapability describes the server's completions support.
type HandlerFunc ¶
type InitializeResult ¶
type InitializeResult struct {
ProtocolVersion string `json:"protocolVersion"`
Capabilities ServerCapabilities `json:"capabilities"`
ServerInfo map[string]string `json:"serverInfo"`
Instructions string `json:"instructions,omitempty"`
}
InitializeResult represents the server's response to initialize.
type LoggingCapability ¶
type LoggingCapability struct {
}
LoggingCapability describes the server's logging support.
type PromptListChangedEmitterProvider ¶
type PromptListChangedEmitterProvider interface {
SetPromptListChangedEmitter(cb func())
}
PromptListChangedEmitterProvider allows providers to request outbound notifications/prompts/list_changed emissions when prompt inventories change outside MCP prompts/list requests.
type PromptProvider ¶
type PromptProvider interface {
ListPrompts(ctx context.Context) ([]map[string]any, error)
GetPrompt(ctx context.Context, name string) ([]map[string]any, bool, error)
}
PromptProvider allows a provider to back MCP prompts/* methods.
type PromptsCapability ¶
type PromptsCapability struct {
ListChanged bool `json:"listChanged,omitempty"`
}
PromptsCapability describes the server's prompts support.
type RepoProvider ¶
type RepoProvider struct {
// contains filtered or unexported fields
}
func NewRepoProvider ¶
func NewRepoProvider(workspaceRoot string) *RepoProvider
func (*RepoProvider) Handler ¶
func (p *RepoProvider) Handler(name string) (HandlerFunc, bool)
func (*RepoProvider) Tools ¶
func (p *RepoProvider) Tools() []Tool
type ResourceCapability ¶
type ResourceCapability struct {
Subscribe bool `json:"subscribe,omitempty"`
ListChanged bool `json:"listChanged,omitempty"`
}
ResourceCapability describes the server's resources support.
type ResourceListChangedEmitterProvider ¶
type ResourceListChangedEmitterProvider interface {
SetResourceListChangedEmitter(cb func())
}
ResourceListChangedEmitterProvider allows providers to request outbound notifications/resources/list_changed emissions when they detect mutations that occur outside MCP tools/call execution.
type ResourceProvider ¶
type ResourceProvider interface {
ListResources(ctx context.Context) ([]map[string]any, error)
ReadResource(ctx context.Context, uri string) ([]map[string]any, error)
ListResourceTemplates(ctx context.Context) ([]map[string]any, error)
}
ResourceProvider allows a provider to back MCP resources/* methods. When absent, the server keeps returning empty baseline responses.
type ResourceUpdatedEmitterProvider ¶
type ResourceUpdatedEmitterProvider interface {
SetResourceUpdatedEmitter(cb func(uri string))
}
ResourceUpdatedEmitterProvider allows providers to request outbound notifications/resources/updated emissions for concrete resource URIs.
type RuntimeProvider ¶
type RuntimeProvider struct {
// contains filtered or unexported fields
}
RuntimeProvider exposes live-instance tools and resources to MCP clients connecting directly to a running Overcast instance at /_mcp.
The runtime MCP is currently local-only (protected by Origin validation in the shared server) and does not require authentication. This posture is temporary and must be revisited before any remote/production exposure.
func NewRuntimeProvider ¶
func NewRuntimeProvider(cfg *config.Config, store state.Store) *RuntimeProvider
NewRuntimeProvider creates a RuntimeProvider backed by the given config and state store. Both may be nil (in which case affected tools return empty data).
func (*RuntimeProvider) AttachEventBus ¶
func (p *RuntimeProvider) AttachEventBus(bus *events.Bus)
AttachEventBus subscribes the runtime provider to the shared event bus so runtime_get_recent_events can return a bounded in-memory history.
func (*RuntimeProvider) Handler ¶
func (p *RuntimeProvider) Handler(name string) (HandlerFunc, bool)
func (*RuntimeProvider) ListResourceTemplates ¶
func (*RuntimeProvider) ListResources ¶
func (*RuntimeProvider) ReadResource ¶
func (*RuntimeProvider) SetResourceListChangedEmitter ¶
func (p *RuntimeProvider) SetResourceListChangedEmitter(cb func())
SetResourceListChangedEmitter configures a callback used to emit notifications/resources/list_changed when runtime service events indicate resource inventory changes that happened outside MCP tool calls.
func (*RuntimeProvider) SetResourceUpdatedEmitter ¶
func (p *RuntimeProvider) SetResourceUpdatedEmitter(cb func(uri string))
SetResourceUpdatedEmitter configures a callback used to emit notifications/resources/updated for concrete resource URIs when runtime service events provide enough identity information.
func (*RuntimeProvider) Tools ¶
func (p *RuntimeProvider) Tools() []Tool
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(sseSource SSESource, logger *slog.Logger, providers ...ToolProvider) *Server
func (*Server) RootHandler ¶
RootHandler serves MCP routes at handler root ("/") without path rewriting. Callers that mount under a prefix should wrap it with http.StripPrefix.
func (*Server) ServeStdio ¶
ServeStdio runs the MCP server over a newline-delimited JSON stdio transport. This is compatible with the stdio transport defined in MCP spec §1.3.1. It exits cleanly when the input stream closes (EOF) or ctx is cancelled. Notifications (id-less messages) are processed synchronously so that lifecycle state (e.g. notifications/initialized → ready) is visible to subsequent requests. Requests are dispatched concurrently to allow parallel tool calls.
func (*Server) SetBearerAuthToken ¶
SetBearerAuthToken enables bearer-token HTTP auth checks when token is non-empty. Empty token disables auth checks.
func (*Server) SetNotificationReplayLimit ¶
SetNotificationReplayLimit sets the in-memory notification replay history size. A value of 0 disables replay retention entirely.
type ServerCapabilities ¶
type ServerCapabilities struct {
Tools *ToolCapability `json:"tools,omitempty"`
Resources *ResourceCapability `json:"resources,omitempty"`
Prompts *PromptsCapability `json:"prompts,omitempty"`
Completions *CompletionsCapability `json:"completions,omitempty"`
Logging *LoggingCapability `json:"logging,omitempty"`
Tasks *TasksCapability `json:"tasks,omitempty"`
}
ServerCapabilities represents what the server supports.
type SymbolFindResult ¶
type SymbolFinder ¶
type SymbolFinder interface {
FindSymbol(ctx context.Context, query SymbolQuery) (SymbolFindResult, error)
}
type SymbolQuery ¶
type TasksCapability ¶
type TasksCapability struct {
List bool `json:"list,omitempty"`
Cancel bool `json:"cancel,omitempty"`
Requests map[string]interface{} `json:"requests,omitempty"`
}
TasksCapability describes the server's tasks support.
type Tool ¶
type Tool struct {
Name string `json:"name"`
Title string `json:"title,omitempty"`
Description string `json:"description"`
Annotations map[string]any `json:"annotations,omitempty"`
Execution map[string]any `json:"execution,omitempty"`
InputSchema json.RawMessage `json:"inputSchema"`
OutputSchema json.RawMessage `json:"outputSchema,omitempty"`
Icons []map[string]any `json:"icons,omitempty"`
}
type ToolCapability ¶
type ToolCapability struct {
ListChanged bool `json:"listChanged,omitempty"`
}
ToolCapability describes the server's tools support.
type ToolProvider ¶
type ToolProvider interface {
Tools() []Tool
Handler(name string) (HandlerFunc, bool)
}
type ToolResult ¶
type ToolResult struct {
Content []map[string]any `json:"content,omitempty"`
StructuredContent any `json:"structuredContent,omitempty"`
IsError bool `json:"isError,omitempty"`
}
ToolResult is a first-class tools/call result envelope. Providers can return this directly when they need explicit control over the human-readable content alongside machine-readable structuredContent.