Skip to main content

MCP Admin API

The @agentium/transport package provides admin REST endpoints for managing MCP servers and the toolkit catalog at runtime. This enables UI-driven configuration — users can add MCP servers, connect them, and have their tools automatically available to agents.

Setup

Option 1: Via createAgentRouter

Enable admin routes with a single flag:

Option 2: Standalone admin router

For more control, use createAdminRouter directly with a shared MCPManager:

Option 3: Shared MCPManager with agent

Share the MCPManager between admin routes and your agent so tools stay in sync:

MCP Server Endpoints

List servers

Add a server

string
required
Server name. Also used as the default id.
'stdio' | 'http' | 'sse'
required
Transport protocol.
string
Server URL (required for http and sse transports).
string
Command to spawn (required for stdio transport).
string[]
Command arguments (stdio only).
Record<string, string>
Custom HTTP headers for authentication.
string
Custom server ID. Defaults to name.
boolean
default:"true"
Automatically connect after adding. Set false to add without connecting.
Returns the server summary with status and tool count.

Get server details

Connect a server

Connects to the MCP server and discovers its tools. Returns the updated summary.

Disconnect a server

Disconnects the server. Tools from this server are no longer available.

Remove a server

Disconnects (if connected) and removes the server entirely.

Get tools from a server

Get all tools (all connected servers)

Returns a merged list of tools from every connected MCP server.

Toolkit Catalog Endpoints

The admin router also exposes the toolkit catalog, allowing UIs to list available toolkit types and instantiate them with configuration.

List toolkits

Get toolkit details

Instantiate a toolkit

The body should match the configFields schema for the toolkit. Returns the instantiated toolkit’s name and tools.

Server Status Values


Full Example: Chat UI with MCP Management

See examples/toolkits/mcp-chat-ui.ts for a complete working example that combines:
  • Dynamic MCP server management from the browser
  • Streaming chat with SSE
  • MongoDB-backed conversation memory
  • Per-session cost tracking