Documentation
¶
Index ¶
- Constants
- func GetHandle(ctx context.Context) string
- func GetRemoteAddr(ctx context.Context) string
- func GetRequestID(ctx context.Context) string
- func GetRole(ctx context.Context) string
- func GetSessionID(ctx context.Context) string
- func GetTraceID(ctx context.Context) string
- func GetTransport(ctx context.Context) string
- func GetUserID(ctx context.Context) string
- func RegisterMCPTool(srv *mcp.Server, tool *mcp.Tool, endpoint Endpoint, ...)
- func WithHandle(ctx context.Context, h string) context.Context
- func WithRemoteAddr(ctx context.Context, addr string) context.Context
- func WithRequestID(ctx context.Context, id string) context.Context
- func WithRole(ctx context.Context, role string) context.Context
- func WithSessionID(ctx context.Context, id string) context.Context
- func WithTraceID(ctx context.Context, id string) context.Context
- func WithTransport(ctx context.Context, t string) context.Context
- func WithUserID(ctx context.Context, id string) context.Context
- type Endpoint
- type MCPDecodeResult
- type Middleware
Constants ¶
const ( UserIDKey contextKey = "kit_user_id" HandleKey contextKey = "kit_handle" TransportKey contextKey = "kit_transport" // "http", "mcp_quic" RequestIDKey contextKey = "kit_request_id" TraceIDKey contextKey = "kit_trace_id" SessionIDKey contextKey = "kit_session_id" RemoteAddrKey contextKey = "kit_remote_addr" RoleKey contextKey = "kit_role" )
Variables ¶
This section is empty.
Functions ¶
func GetRemoteAddr ¶
func GetRequestID ¶
func GetSessionID ¶
func GetTraceID ¶
func GetTransport ¶
func RegisterMCPTool ¶
func RegisterMCPTool(srv *mcp.Server, tool *mcp.Tool, endpoint Endpoint, decode func(*mcp.CallToolRequest) (*MCPDecodeResult, error))
RegisterMCPTool registers an Endpoint as an MCP tool on the given server. The decode function extracts the typed request from MCP arguments.
Migration note (feb 2026): signature changed from mcp-go to official SDK. - srv: *server.MCPServer → *mcp.Server - tool: mcp.Tool (value) → *mcp.Tool (pointer) - decode param: mcp.CallToolRequest (value) → *mcp.CallToolRequest (pointer) - Arguments are now in req.Params.Arguments as json.RawMessage, not map[string]any. Callers must update their decode functions accordingly.
Types ¶
type Endpoint ¶
Endpoint is a transport-agnostic action function. Each action (create node, vote, search) is an Endpoint. HTTP handlers and MCP tools both dispatch to the same Endpoints.
type MCPDecodeResult ¶
MCPDecodeResult holds the decoded request and an optional context enrichment.
type Middleware ¶
Middleware wraps an Endpoint with cross-cutting concerns (audit, auth, tracing).
func Chain ¶
func Chain(outer Middleware, others ...Middleware) Middleware
Chain composes middlewares so the first is outermost. Chain(a, b, c)(endpoint) == a(b(c(endpoint)))