feat(agents): McpRegistryPort + DefaultMcpRegistry adapter #516

Closed
opened 2026-04-28 09:24:30 +00:00 by claude-desktop · 0 comments
Collaborator

User story

As DefaultAgentDispatch, I want a port that resolves the MCP server set for a given agent + repo binding, so that the dual forgejo-mcp / forge-mcp transition (MF-5) and any future MCP additions are encapsulated behind one interface.

Acceptance criteria

Port

  • apps/server/src/domain/ports/mcp-registry-port.ts exports:
    • serversFor(agent: AgentInstance, binding: RepoBinding): McpServerSpec[]
    • allowedTools(agent: AgentInstance, binding: RepoBinding): string[]
  • Port returns plain McpServerSpec from domain/agent/types.ts; no transport-level details

Adapter

  • apps/server/src/infrastructure/agents/default-mcp-registry.ts
    • Replaces mcp-config.ts callsites
    • Honours MF-5 dual-mount flag (forgejo-mcp + forge-mcp) until cutover
    • Per-forge token injection moved to serversFor() (single source of truth)

Tests

  • Unit: dev agent on Forgejo repo → forge-mcp present, GitHub tools absent
  • Unit: same agent on GitHub repo → GitHub tools present, GitLab absent
  • Unit: MF-5 dual-mount flag toggles forgejo-mcp visibility

Out of scope

  • Wiring into DefaultAgentDispatch — separate issue
  • Killing MF-5 dual-mount — tracked in MF milestone

References

  • apps/server/src/infrastructure/agents/mcp-config.ts
  • MF-5 transition notes in docs/multi-forge.md
## User story As `DefaultAgentDispatch`, I want a port that resolves the MCP server set for a given agent + repo binding, so that the dual forgejo-mcp / forge-mcp transition (MF-5) and any future MCP additions are encapsulated behind one interface. ## Acceptance criteria ### Port - [ ] `apps/server/src/domain/ports/mcp-registry-port.ts` exports: - [ ] `serversFor(agent: AgentInstance, binding: RepoBinding): McpServerSpec[]` - [ ] `allowedTools(agent: AgentInstance, binding: RepoBinding): string[]` - [ ] Port returns plain `McpServerSpec` from `domain/agent/types.ts`; no transport-level details ### Adapter - [ ] `apps/server/src/infrastructure/agents/default-mcp-registry.ts` - [ ] Replaces `mcp-config.ts` callsites - [ ] Honours MF-5 dual-mount flag (forgejo-mcp + forge-mcp) until cutover - [ ] Per-forge token injection moved to `serversFor()` (single source of truth) ### Tests - [ ] Unit: dev agent on Forgejo repo → forge-mcp present, GitHub tools absent - [ ] Unit: same agent on GitHub repo → GitHub tools present, GitLab absent - [ ] Unit: MF-5 dual-mount flag toggles forgejo-mcp visibility ## Out of scope - Wiring into `DefaultAgentDispatch` — separate issue - Killing MF-5 dual-mount — tracked in MF milestone ## References - `apps/server/src/infrastructure/agents/mcp-config.ts` - MF-5 transition notes in `docs/multi-forge.md`
Sign in to join this conversation.
No project
No assignees
1 participant
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#516
No description provided.