Module mcp

Module mcp 

Source
Expand description

Agent-operable administration via MCP (DW-112).

Expose the admin API as an MCP (Model Context Protocol) server with tools for route/service/policy CRUD, stats, and analytics queries. RBAC-scoped tool access – AI agents operate dwara.

§MCP tools

The MCP server exposes the following tools:

  • list_routes – list all routes in the current config
  • get_route – get a single route by name
  • create_route – create a new route
  • update_route – update an existing route
  • delete_route – delete a route
  • list_services – list all services
  • get_stats – get gateway stats
  • get_health – get gateway health
  • get_config – dump the current config

§RBAC

Tool access is RBAC-scoped: each tool requires a permission, and the MCP server checks the agent’s permissions before executing a tool. Out-of-scope operations are denied.

§JSON-first

All tool inputs and outputs are JSON. The CLI also has a --json flag for JSON-first output mode.

§Feature gate

The mcp cargo feature must be enabled.

Structs§

AgentIdentity
An agent’s identity and permissions.
McpServer
The MCP server: holds tool definitions and executes tool calls with RBAC checks.
MockToolHandler
A simple tool handler for testing: returns canned responses.
ToolCallRequest
An MCP tool call request.
ToolCallResponse
An MCP tool call response.
ToolDefinition
An MCP tool definition.

Enums§

McpTransport
AI-11 (#200): The transport type for the admin MCP server.
Permission
A permission required to use a tool.

Traits§

ToolHandler
A tool handler: the caller implements this to actually execute tools (calling the admin API, reading config, etc.).

Functions§

encode_sse_error
AI-11 (#200): Encode a JSON-RPC error as an SSE frame.
encode_sse_response
AI-11 (#200): Encode a JSON-RPC response as an SSE frame. Returns a string suitable for writing to an SSE response body (data: <payload>\n\n).