Expose data to the agent
Turn a Gateway plugin's HTTP routes into MCP tools the operator agent can call, with no separate MCP manifest
Overview
The operator agent calls fleet data and actions as MCP tools. A Gateway plugin's routes become those tools automatically when
mounted with autoGenerateMcp: true — no separate MCP manifest to author and keep in sync with the plugin's own routes.
Prerequisites
- The Gateway is running
- A Gateway plugin already mounted via
extraPluginDirs
Auto-generate tools from a plugin
Pass { dir, autoGenerateMcp: true } instead of a plain path to also expose a plugin's HTTP routes as MCP tools:
await startGateway({
kernel,
port: 3000,
extraPluginDirs: [
{ dir: path.join(__dirname, 'plugins/custom-metrics'), autoGenerateMcp: true }
],
mcp: { port: 3100 }
})Each route becomes a tool named after its id (dots and other non-alphanumeric characters become underscores), with the
description, safety hint, and input schema derived from the route's http block. Path, query, and header parameters and the
requestBody's top-level properties become the tool's input fields, and the same route handler and live mdkClient
connection serve both interfaces. The Gateway starts one in-process MCP server (Streamable HTTP, default port
opts.port + 100) covering every auto-generated tool across all mounted plugins.
Write tools by hand instead
A plugin that needs a different tool granularity, richer descriptions, or direct mdkClient calls can still author an
mcp-plugin.json by hand and run it with a standalone MCP server.
Next steps
- Build the plugin whose routes you want to expose
- Enable the operator agent to call the tools this produces
- Understand the agent as a stack component