MCP Client
Agentium includes a built-in MCP client that lets your agents connect to any Model Context Protocol server and use its tools natively — no glue code required.MCP is an open protocol that standardizes how LLM applications integrate with external tools, resources, and prompts. Agentium acts as an MCP client, consuming tools from external MCP servers.
Installation
The MCP SDK is an optional peer dependency:Quick Start
Transports
stdio
Spawns the MCP server as a child process and communicates via stdin/stdout. Best for local MCP servers.string
required
The command to spawn (e.g.
"npx", "node", "python").string[]
Arguments for the command.
Record<string, string>
Environment variables passed to the spawned process.
HTTP (Streamable HTTP)
Connects to a remote MCP server over HTTP. Falls back to SSE transport if Streamable HTTP is not available.string
required
The MCP server URL.
Record<string, string>
Custom HTTP headers (e.g. for authentication).
SSE (Server-Sent Events)
For MCP servers that use separate/sse and /messages endpoints. The client opens a persistent SSE stream for receiving responses and sends JSON-RPC requests via POST. Use this when your server implements the async SSE pattern.
string
required
The SSE endpoint URL. The client reads this stream and discovers the POST endpoint for messages automatically.
Record<string, string>
Custom HTTP headers sent on both the SSE connection and POST requests.
Mixing MCP and Local Tools
MCP tools are returned as standardToolDef[] and can be combined with local tools:
Multiple MCP Servers
Connect to multiple servers simultaneously. Tool names are namespaced as{serverName}__{toolName} to avoid collisions:
Handling Large Tool Results
MCP servers often return bulk data (e.g. all outstanding invoices, full record sets). A single tool result can be 200KB+, which translates to 50K+ prompt tokens on the next LLM roundtrip. UsetoolResultLimit to automatically truncate or summarize oversized results before they reach the main model:
toolResultLimit with toolRouter — the router selects which tools to call, and the result limit controls how much data comes back. Together they can reduce prompt tokens by 95%+.
See Tool Result Limits for full configuration details.
Dynamic Tools with setTools()
When MCP servers are connected or disconnected at runtime, use agent.setTools() to hot-swap the tool set without recreating the agent:
MCPManager (Multi-Server Lifecycle)
For managing multiple MCP servers at runtime — adding, connecting, disconnecting, and collecting tools — useMCPManager from @agentium/transport:
For managing MCP servers via REST API (from a UI), see MCP Admin.
API Reference
MCPToolProvider
string
required
A unique name for this MCP server connection. Used to namespace tool names.
'stdio' | 'http' | 'sse'
required
The transport protocol to use.
Popular MCP Servers
Browse all available servers at mcp.so.