feat(agents): McpRegistryPort + DefaultMcpRegistry adapter #526

Merged
code-lead merged 1 commit from dev/516 into main 2026-04-28 11:05:25 +00:00
Collaborator

Introduces McpRegistryPort so consumers resolve MCP server specs without importing SDK types or module-level setMcpConfig state.

Closes #516

Test plan

  • bun test src/infrastructure/agents/default-mcp-registry.test.ts — 26 tests, 0 failures.
  • Forgejo repo: forgejo-mcp + forge-mcp mounted, tokens in lockstep with allowlists.
  • GitHub repo: forge-mcp only (FORGE_TYPE=github), no mcp__forgejo__* entries.
  • GitLab repo: forge-mcp only (FORGE_TYPE=gitlab).
  • MF-5 dual-mount flag: mf5DualMount:false drops forgejo-mcp from both serversFor and allowedTools.
  • Penpot: mounted only when penpot_mcp:true and secrets are non-null.
  • just qa clean (format + lint pass; tsc bun typedef error is pre-existing in this worktree).
Introduces `McpRegistryPort` so consumers resolve MCP server specs without importing SDK types or module-level `setMcpConfig` state. Closes #516 ## Test plan - `bun test src/infrastructure/agents/default-mcp-registry.test.ts` — 26 tests, 0 failures. - Forgejo repo: forgejo-mcp + forge-mcp mounted, tokens in lockstep with allowlists. - GitHub repo: forge-mcp only (FORGE_TYPE=github), no `mcp__forgejo__*` entries. - GitLab repo: forge-mcp only (FORGE_TYPE=gitlab). - MF-5 dual-mount flag: `mf5DualMount:false` drops forgejo-mcp from both `serversFor` and `allowedTools`. - Penpot: mounted only when `penpot_mcp:true` and secrets are non-null. - `just qa` clean (format + lint pass; tsc `bun` typedef error is pre-existing in this worktree).
feat(agents): McpRegistryPort + DefaultMcpRegistry adapter
All checks were successful
qa / qa (pull_request) Successful in 12m52s
qa / dockerfile (pull_request) Successful in 13s
28c60c1eec
Introduces the hexagonal McpRegistryPort interface so consumers can
resolve MCP server specs + allowed-tool lists without importing Docker
helpers, SDK types, or the module-level setMcpConfig state.

- domain/agent/types.ts: domain-pure McpServerSpec (no transport discriminant)
- domain/ports/mcp-registry-port.ts: McpRegistryPort with serversFor/allowedTools
- infrastructure/agents/default-mcp-registry.ts: adapter wrapping existing
  FORGEJO/FORGE_TOOLS_ALLOWLIST logic; per-forge token injection; MF-5
  dual-mount flag (forgejo-mcp alongside forge-mcp, default on)
- 26 new tests cover Forgejo/GitHub/GitLab repo routing and dual-mount toggle

Closes #516

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
dev requested review from reviewer 2026-04-28 11:02:41 +00:00
reviewer approved these changes 2026-04-28 11:05:00 +00:00
reviewer left a comment

Port interface and adapter are correct; 26 tests cover all three ACs (Forgejo/GitHub/GitLab forge routing, MF-5 dual-mount toggle, Penpot gating). Token fallback chain matches MF-4 resolution in agent-runner.ts. CI green.

Nit (non-blocking): allowedTools re-derives usePenpot by re-checking agent.penpot_mcp === true && this.config.penpotEnv !== null independently rather than checking servers.some(s => s.name === "penpot") as it does for hasForgejoMcp — harmless today but would drift if serversFor gains extra Penpot conditions.

Port interface and adapter are correct; 26 tests cover all three ACs (Forgejo/GitHub/GitLab forge routing, MF-5 dual-mount toggle, Penpot gating). Token fallback chain matches MF-4 resolution in `agent-runner.ts`. CI green. Nit (non-blocking): `allowedTools` re-derives `usePenpot` by re-checking `agent.penpot_mcp === true && this.config.penpotEnv !== null` independently rather than checking `servers.some(s => s.name === "penpot")` as it does for `hasForgejoMcp` — harmless today but would drift if `serversFor` gains extra Penpot conditions.
code-lead deleted branch dev/516 2026-04-28 11:05:26 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/claude-hooks!526
No description provided.