mcp

package
v0.15.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Code generated by apic; DO NOT EDIT.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotImplemented = errors.New("not implemented")

ErrNotImplemented is returned by UnimplementedMCPServer methods.

View Source
var MCPHandler http.Handler

MCPHandler is an http.Handler for MCP JSON-RPC. Set by Register.

View Source
var MCPSTDIOFunc func() error

MCPSTDIOFunc starts the MCP stdio JSON-RPC loop. Set by Register.

View Source
var MCPWSHandler http.Handler

MCPWSHandler is an http.Handler for MCP over WebSocket. Set by Register.

Functions

func HandleMCPHTTP

func HandleMCPHTTP(w http.ResponseWriter, r *http.Request)

HandleMCPHTTP is an http.Handler for MCP JSON-RPC. Call Register first.

func HandleMCPWS

func HandleMCPWS(w http.ResponseWriter, r *http.Request)

HandleMCPWS is an http.Handler for MCP over WebSocket. Call Register first.

func NewTools

func NewTools(srv MCPServerInterface) map[string]mcpx.Tool

NewTools builds the MCP tool map backed by srv.

func Register

func Register(srv MCPServerInterface)

Register configures the MCP tools with the given server implementation. Call this during application startup before serving.

GEN-2026-05-29-06: the rate/burst arguments to mcpx.SetToolBuckets are derived from the operator's MCP config block (security.MCP.Rate / MCP.Burst). When the config leaves them unset the generator emits the historic defaults (100 rps / 20 burst) so existing consumers keep working unchanged; operators who need a tighter ceiling for a sensitive MCP surface can now configure it at codegen time.

func ServeSTDIO

func ServeSTDIO() error

ServeSTDIO starts the MCP stdio JSON-RPC loop. Call Register first.

func ToolDescriptors

func ToolDescriptors() []mcpx.ToolDescriptor

ToolDescriptors returns the MCP tools/list metadata for every generated tool: name, optional title/description, and the inputSchema (a JSON Schema object that is the union of the tool's body, path, and query parameters). Register passes these to mcpx.SetToolDescriptors so tools/list advertises a spec-compliant descriptor for each tool.

Types

type MCPServerInterface

type MCPServerInterface interface {
	Create_item(ctx context.Context, params *types.ItemCreateReq) (*types.ItemCreateResp, error)
	List_items(ctx context.Context, params *types.ItemListReq) (*types.ItemListResp, error)
}

MCPServerInterface defines the business logic contract for generated MCP tools. Embed UnimplementedMCPServer and override only the tools you implement. The ctx is the request-scoped context threaded from the MCP transport (HTTP/WS carry the auth-verifier-enriched context; STDIO passes context.Background()).

type UnimplementedMCPServer

type UnimplementedMCPServer struct{}

UnimplementedMCPServer returns ErrNotImplemented for every MCP tool.

func (UnimplementedMCPServer) Create_item

func (UnimplementedMCPServer) List_items

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL