Documentation
¶
Overview ¶
Package mcpgw is Keystone's MCP gateway: clients reach registered MCP servers through /mcp with a KTMS key, and the gateway holds the servers' credentials, enforces each key's allowed_mcp and tool_rpm, and accounts for every tool call.
Index ¶
Constants ¶
const A2AVersion = "0.3.0"
A2AVersion is the A2A protocol version the bridge speaks.
const CodeForbidden = -32003
CodeForbidden is the JSON-RPC error of a tool or server the key may not use.
const Separator = "__"
Separator joins a server and a tool name in the /mcp aggregate.
const UserHeader = "X-KTMS-User"
UserHeader names the end user a call is made for, as user_id does on /v1.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builtin ¶ added in v1.6.0
type Builtin interface {
Tools() []*mcp.Tool
Call(ctx context.Context, id *apikeys.Identity, tool string, args json.RawMessage) (*mcp.CallToolResult, error)
}
Builtin is a server KTMS answers itself (agents.Service), named agents.Server.
type Gateway ¶
type Gateway struct {
// contains filtered or unexported fields
}
Gateway serves /mcp and /mcp/{server}.
func New ¶
func New(snaps Snapshots, verifier Verifier, limiter ToolLimiter, recorder Recorder, version string) *Gateway
New builds a gateway; limiter and recorder may be nil.
func (*Gateway) ListTools ¶
ListTools is the server's tools for an operator (Admin API ListMCPTools).
type Recorder ¶
type Recorder interface {
RecordToolCall(usagereport.ToolCall) error
}
Recorder accounts for tool calls (usagereport.UsageCollectorClient).