Agent Registration
External MCP servers are registered per-agent via the Octopus Agent API. At startup, the agent calls GET /tools on each registered server and merges the discovered tools into its capability set alongside built-in plugin tools.
Registration via the Agent API
Use the Octopus Management API to add an external MCP server to an agent. The mcpServers array on the agent record holds one entry per external server.
// POST /api/agents
{
"name": "Zendesk Support Agent",
"description": "Handles customer support tickets via Zendesk.",
"systemPrompt": "You are a support specialist. Use the Zendesk tools to " +
"create, update, and search support tickets on behalf of users.",
"llmModel": "gpt-4o",
"mcpServers": [
{
"name": "zendesk",
"baseUrl": "https://mcp-zendesk.internal",
"credentialId": 55,
"timeoutMs": 30000,
"enabled": true
}
]
}
mcpServers Registration Fields
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Logical name for the server — used in logs and the UI |
baseUrl | string (uri) | Yes | HTTPS base URL of the MCP server (no trailing slash) |
credentialId | integer | Yes | ID of the credential containing the Bearer token |
timeoutMs | integer | No | Per-tool-call timeout in milliseconds (default: 30000) |
enabled | boolean | No | Set to false to disable without removing (default: true) |
toolFilter | string[] | No | Allowlist of tool names to expose — omit to expose all |
Tool Discovery Lifecycle
- Agent starts up (or is refreshed via the API)
- Octopus calls
GET {baseUrl}/toolswith the resolved Bearer token - Discovered tools are merged into the agent's tool registry alongside built-in plugin tools
- If
toolFilteris set, only the listed tool names are registered - On each agent conversation turn, the merged tool list is sent to the LLM as function definitions
- When the LLM calls an external tool, Octopus routes the call to
POST {baseUrl}/tool/{name}/call
Filtering Tools from a Server
If your MCP server exposes 20 tools but a particular agent only needs 3, use toolFilter to limit what the LLM sees. This reduces prompt token usage and prevents agents from calling tools outside their intended scope.
{
"mcpServers": [
{
"name": "zendesk",
"baseUrl": "https://mcp-zendesk.internal",
"credentialId": 55,
"toolFilter": [
"zendesk_create_ticket",
"zendesk_search_tickets"
]
}
]
}
Registering Multiple External Servers
An agent can connect to multiple MCP servers simultaneously. Tool names must be unique across all registered servers — Octopus rejects registrations that produce naming conflicts.
{
"mcpServers": [
{
"name": "zendesk",
"baseUrl": "https://mcp-zendesk.internal",
"credentialId": 55
},
{
"name": "jira",
"baseUrl": "https://mcp-jira.internal",
"credentialId": 56
},
{
"name": "slack",
"baseUrl": "https://mcp-slack.internal",
"credentialId": 57
}
]
}
Updating Server Registration
To update a server's URL, credential, or timeout — PATCH the agent with the updated mcpServers array. Octopus will re-discover tools from the updated configuration on the next agent turn.
// PATCH /api/agents/{agentId}
{
"mcpServers": [
{
"name": "zendesk",
"baseUrl": "https://mcp-zendesk-v2.internal", // updated URL
"credentialId": 58, // new credential
"timeoutMs": 45000
}
]
}
Tool Discovery Errors
| Error Condition | Agent Behavior | Resolution |
|---|---|---|
| MCP server unreachable at startup | Agent starts; external tools unavailable; warning logged | Fix server URL or network; refresh agent config |
GET /tools returns 401 | Agent starts; external tools unavailable; error logged | Update credential ID with a valid token |
| Tool name collision with built-in tool | Registration rejected; error returned from PATCH | Rename the conflicting tool on your MCP server |
| Invalid JSON Schema in tool definition | Tool skipped; warning logged per affected tool | Fix the inputSchema on your server and restart it |
POST /tool/{name}/call times out | Agent receives timeout error result; LLM notifies user | Increase timeoutMs or optimize the handler |
toolFilter to keep each agent's tool set focused.