mcp_servers
Manage MCP server registry entries and bundle memberships: list, create, update, delete, reconcile ordered tool members, and probe external endpoints with SSRF-guarded discovery.
Instructions
CRUD + bundle-membership for the MCP-server registry (agent_mcp_servers / agent_mcp_tools / agent_profile_mcp_servers): both kinds of server, bundles and external endpoints.
A server row is either source="external" (a live MCP endpoint reached
over transport/endpoint, optionally filtered by the legacy server-level
tool_subset) or source="bundle" (a named group of agent_tools wired via
agent_mcp_tools membership; no endpoint/transport of its own). Built-in
bundles (is_builtin=True) are seeder-managed and read-only here —
update/delete/members all refuse them with the same message the portal
uses. The reserved `__builtin__:` name prefix can't be claimed via
create/update either.
action:
list — every server (both sources).
get (mcp_server_id) — the row + `members` (bundle membership, as
[{tool_id, python_name, position}]) + `attached_count` (profiles
wired to this server via agent_profile_mcp_servers).
create (source="bundle"|"external", name, ...) —
external needs endpoint (+ transport, default "http"; optional
auth_env_var/tool_subset/context_fields);
bundle needs name (+ optional usage_guidance/context_fields);
member_tool_ids seeds agent_mcp_tools membership in the given
order (validated against non-deprecated agent_tools first).
update (mcp_server_id + fields) — name/transport/endpoint/
auth_env_var/usage_guidance/tool_subset/context_fields/is_active.
Refused for is_builtin rows.
delete (mcp_server_id, confirm=true) — detaches the id from every
profile's legacy mcp_server_ids[], deletes its agent_mcp_tools and
agent_profile_mcp_servers rows, then the server itself. Refused
for is_builtin rows.
members (mcp_server_id, member_tool_ids) — reconciles a BUNDLE's
agent_mcp_tools membership: delete-all then re-insert in the given
order (position 0..N-1). Only valid for source="bundle"; refused
for is_builtin rows.
discover (endpoint, auth_env_var) — live tools/list probe of a
candidate external endpoint, SSRF-guarded (blocks loopback/
link-local/cloud-metadata hosts unless MCP_ALLOW_LOCAL_ENDPOINTS
is set truthy). Read-only — no DB write, no audit. Always returns
an {"ok": bool, "tools": [...], "error", "error_class"} envelope,
never raises.
Unknown action: list | get | create | update | delete | members |
discover.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"action": "<action>"
},
"name": "mcp_servers"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| env | No | Config branch: which `environment` rows of the AI config DB to read/write. staging = the editable working set (default); prod = what production serves. | staging |
| name | No | MCP server name (unique). | |
| action | Yes | Operation to run: list | get | create | update | delete | members | discover. The tool description lists what each action needs. | |
| source | No | bundle (group of agent_tools) | external (remote MCP endpoint). | |
| confirm | No | false (default) = dry run, nothing changes; true = execute. | |
| endpoint | No | External MCP endpoint URL. | |
| is_active | No | update: active flag. | |
| transport | No | MCP transport for an external server (e.g. http). | |
| tool_subset | No | Only these tool names from the MCP (omit = all). | |
| auth_env_var | No | Env var holding the MCP endpoint's token (name only). | |
| mcp_server_id | No | agent_mcp_servers UUID (mcp_servers action=list). | |
| context_fields | No | JSON object of server-side context/credential fields the resolver injects into tool calls. | |
| usage_guidance | No | Free-text guidance rendered to the model next to the tool(s) when bound. | |
| member_tool_ids | No | Bundle membership: agent_tools ids in order (REPLACES the bundle's members). | |
| timeout_seconds | No | Timeout in seconds. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |