ADR-0036: Agent-managed skills and MCP servers
- **Status:** Accepted - **Date:** 2026-10-03 - **Related:** ADR-0006 (MCP architecture), ADR-0023 (slash commands / skill promotion), `docs/77-skill-execution-engine.md`
3 min read
This is a migrated reference document from the original Anvio source repo. Content is preserved as-is; canonical documentation lives in the sections above in the sidebar.
Original path: docs/adr/0036-agent-managed-skills-and-mcp-servers.md
- Status: Accepted
- Date: 2026-10-03
- Related: ADR-0006 (MCP architecture), ADR-0023 (slash commands / skill promotion),
docs/77-skill-execution-engine.md
Context
Users asked an agent (over Telegram) to "add a skill" or "install an MCP server" and it could not. Inspection showed why:
- Skills. The agent-facing surface was
skills_list,skill_view,skill_call(read/invoke) andskill_manage, which was disabled by default and only offeredlist_draftsandpromote. The only way a new skill came into being was the learning loop at session end. - MCP.
IntegrationRegistrywas read-only (load/list/get), andplatformbuilt the MCP tool catalog once at boot (loadMcpToolCatalog) and froze it intoMcpToolPort, which was only constructed when the catalog was non-empty. No tool exposed the registry to the agent, so even a hand-editedservers.yamlneeded a restart.
Decision
Evolve the existing pieces, don't add a subsystem.
skill_managegainscreate.createwrites a draft through the learning engine's existingSkillEvolutionWriter(LearningEngine.createDraft), so it lands inworkspace/skills/_drafts. Going live is stillpromote, the same step every learning-loop draft passes through. The agent cannot write straight intoworkspace/skills/.- New
mcp_managebuilt-in tool (list | add | remove), wired inplatform:IntegrationRegistry.upsert/removepersistmcp/servers.yaml. They edit the raw YAML document: the parsed config has$\{ENV\}placeholders expanded, and writing it back would put every other server's secrets on disk in plain text. The result is validated withparseMcpConfigbefore it is written.McpToolPort.setCatalog()swaps the catalog in place. Platform now always wraps the tool port withMcpToolPort(a pass-through when empty), so a server added at runtime has somewhere to land. New tools appear on the agent's next turn.McpBridge.invalidate(id)drops a cached stdio client after add/remove.
- Guard rails
- Both tools stay
enabled: falseby default in the tool gateway. An operator opts in per workspace. addonly accepts a barecommandwhose name is in the newMcpConfig.spec.agentAllowedCommands(defaultnpx, uvx, node, python3, docker). Paths are rejected. Humans editingservers.yamldirectly are not constrained.- The existing MCP first-call approval gate still applies to every new tool, so a newly registered server cannot act until a human approves each tool once per session.
- Ids and slugs are validated (lowercase, short) because they become file names and tool-name segments.
- Both tools stay
Consequences
- An agent can now extend itself without a restart, behind two opt-ins (tool enabled, command allow-listed) and the per-tool approval gate.
addspawns the server process to list its tools. That is code execution chosen by the model. The allow-list limits which launcher runs, not which package:npx -y <anything>is still arbitrary code. That is why the tool is off by default. Operators who enable it in a channel exposed to untrusted users should narrowagentAllowedCommandsor leavemcp_manageoff.envpassed by the agent is written in plain text. The tool description and ADR say to keep secrets in$\{VAR\}placeholders.- Removing a server whose tools were already approved leaves stale approval keys in session metadata. They are harmless because the tool no longer exists.
Alternatives considered
- Route add/remove through
anvio_channel__request_approval. Rejected for now: the approval flow pauses the run with a checkpoint, and resuming a built-in tool call after approval is not wired for built-ins. The first-call gate already gives a human checkpoint before any new tool runs. Revisit if built-in approval resume lands. - Let
createwrite directly toworkspace/skills/. Rejected: it would bypass the soul-gated review that ADR-0023 established for drafts.
Last updated on
ADR 0035: gbrain Episodic Timeline and Learning-Loop Consolidation
Proposed — builds on the `gbrain` memory provider from PR #88 (`feat/gbrain-memory-provider`).
ADR-0037: Remote MCP servers over HTTP
- **Status:** Accepted - **Date:** 2026-10-03 - **Related:** ADR-0006 (MCP architecture), ADR-0036 (agent-managed MCP servers)