Documentation
¶
Overview ¶
Code generated by apic; DO NOT EDIT.
Index ¶
- Variables
- func NewEngine(srv MCPServerInterface, opts ...mcpx.Option) (*mcpx.Engine, error)
- func NewTools(srv MCPServerInterface) map[string]mcpx.Tool
- func ToolDescriptors() []mcpx.ToolDescriptor
- type MCPServerInterface
- type UnimplementedMCPServer
- func (UnimplementedMCPServer) Admin_action(_ context.Context, _ *types.AdminActionReq) (*types.AdminActionResp, error)
- func (UnimplementedMCPServer) Create_post(_ context.Context, _ *types.PostCreateReq) (*types.PostCreateResp, error)
- func (UnimplementedMCPServer) Search_posts(_ context.Context, _ *types.PostSearchReq) (*types.PostSearchResp, error)
Constants ¶
This section is empty.
Variables ¶
var ErrNotImplemented = errors.New("not implemented")
ErrNotImplemented is returned by UnimplementedMCPServer methods.
Functions ¶
func NewEngine ¶ added in v0.19.2
NewEngine builds this server's MCP engine from the supplied business-logic implementation. Every knob -- tools, descriptors, server identity, per-tool rate buckets, body cap, role and ownership policy -- is owned by the returned *mcpx.Engine, so a process may host several MCP surfaces with different tenants, tool sets and policies without cross-talk (ENG-4634 / GitLab #364).
It replaces Register(srv), which pushed all of the above into process-wide mcpx state and then published three package-level handler variables (MCPHandler / MCPWSHandler / MCPSTDIOFunc) that the LAST Register call in the process won. Mount the returned engine with eng.HandleHTTP / eng.ServeWS, or run eng.ServeSTDIO(ctx) for the stdio transport.
Callers append their own mcpx.Option values -- notably mcpx.WithAuthVerifier, which the generated server supplies -- and later options win. Without a verifier the HTTP and WS transports fail closed with HTTP 401.
GEN-2026-05-29-06: the rate/burst arguments to mcpx.WithToolBuckets are derived from the operator's top-level "mcp" config block (mcp.rate / mcp.burst) -- the block is bound at the config root, not under "security". 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:
{"mcp": {"rate": 60, "burst": 60}}
func NewTools ¶
func NewTools(srv MCPServerInterface) map[string]mcpx.Tool
NewTools builds the MCP tool map backed by srv.
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). NewEngine passes these to mcpx.WithToolDescriptors so tools/list advertises a spec-compliant descriptor for each tool.
Types ¶
type MCPServerInterface ¶
type MCPServerInterface interface {
Admin_action(ctx context.Context, params *types.AdminActionReq) (*types.AdminActionResp, error)
Create_post(ctx context.Context, params *types.PostCreateReq) (*types.PostCreateResp, error)
Search_posts(ctx context.Context, params *types.PostSearchReq) (*types.PostSearchResp, 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) Admin_action ¶
func (UnimplementedMCPServer) Admin_action(_ context.Context, _ *types.AdminActionReq) (*types.AdminActionResp, error)
func (UnimplementedMCPServer) Create_post ¶
func (UnimplementedMCPServer) Create_post(_ context.Context, _ *types.PostCreateReq) (*types.PostCreateResp, error)
func (UnimplementedMCPServer) Search_posts ¶
func (UnimplementedMCPServer) Search_posts(_ context.Context, _ *types.PostSearchReq) (*types.PostSearchResp, error)