FM-5 — cut over server-side mcp__forgejo__ references to mcp__forge__ #810

Closed
opened 2026-05-03 20:08:30 +00:00 by claude-desktop · 0 comments
Collaborator

As an operator, I want every server-side reference to the legacy mcp__forgejo__* tool namespace (in agent-prompt strings, security gates, hook keys, and hint text) rewritten to its mcp__forge__* equivalent, so that agents stop being instructed to call tools that no longer exist (the binary was deleted in FM-3) and instead use the working forge-mcp surface restored by FM-4.

Context

FM-3 (#687) deleted forgejo-mcp from the container image. Skills were cleaned (git grep mcp__forgejo__ skills/ returns zero), but server-side code that emits tool names into agent prompts, matches them in security gates, or keys hooks on them was missed. As long as these strings reference mcp__forgejo__*:

  • parent-pr.ts:221 instructs agents "open your PR via mcp__forgejo__create_pull_request" — agent attempts a tool that the SDK no longer mounts.
  • architect.ts:625, 674 security gates use startsWith("mcp__forgejo__") and === "mcp__forgejo__merge_pull_request" — these match nothing post-cutover, so the gate's intent (block PR-merge from non-session repos, log mid-flight forge access) is silently bypassed.
  • agent-runner.ts:263-277 token-budget first-touch hook keys on mcp__forgejo__* — never fires.
  • worker.ts:543 hint string about mcp__forgejo__*_file — points operators at the wrong namespace.

This story is a textual rename with security-gate verification — no behaviour changes beyond pointing at the correct tool names.

Depends on FM-4 landing first (otherwise the renamed names still don't resolve because the allowlist is wrong).

Acceptance criteria

Code rename

  • apps/server/src/domain/workflow/parent-pr.ts:221 instruction string uses mcp__forge__create_pull_request.
  • apps/server/src/domain/agent/architect.ts:625 security gate matches toolName.startsWith("mcp__forge__").
  • apps/server/src/domain/agent/architect.ts:674 matcher: toolName === "mcp__forge__merge_pull_request".
  • apps/server/src/domain/agent/agent-runner.ts:263-277 token-budget hook keys on mcp__forge__*.
  • apps/server/src/background/worker.ts:543 hint mentions mcp__forge__write_file (note: forge-mcp renamed update_filewrite_file).
  • apps/server/src/domain/ports/mcp-registry-port.ts:25, 99 doc-comment references updated to mcp__forge__*.
  • git grep -nE "mcp__forgejo__" apps/server/ returns only:
    • mcp-config.ts forgejoToolEntries block (removed in FM-6, not this story)
    • test fixtures explicitly verifying legacy-namespace handling (if any)
    • MEMORY.md / specs/ / docs/ (out of scope)

Tests

  • Existing architect.test.ts security-gate tests updated to use the new tool names.
  • Existing agent-runner.test.ts first-touch token-budget tests updated.
  • New / updated parent-pr.test.ts snapshot covers the renamed instruction.

Manual smoke

  • Dispatch a real review-loop ticket end-to-end (architect → code-lead → reviewer → merge). Confirm:
    • PR creation succeeds via mcp__forge__create_pull_request.
    • Reviewer's submit_review + merge_pull_request route through mcp__forge__*.
    • No "tool not found" warnings in the task transcript.
    • No curl-fallback warnings in worker logs.

Out of scope

  • Allowlist sync — see FM-4 (must land first).
  • Removing dualMount, forgejoMcpCommand, FORGEJO_TOOLS_ALLOWLIST constant, FORGEJO_MCP_TOOLS env wiring — see FM-6.
  • Renaming forgejo server entry name in mcpServers map (mcp-config.ts:139, default-mcp-registry.ts:130) — that lives in FM-6 along with the rest of the legacy mount.

References

  • Spec: specs/forge-mcp-cutover-followup.md §Pass 2.
  • forge-mcp tool name table: specs/forge-mcp-cutover-followup.md §Pass 1 (mapping table).
  • Original FM-3 PR: #687.
  • Depends on: FM-4.
As an operator, I want every server-side reference to the legacy `mcp__forgejo__*` tool namespace (in agent-prompt strings, security gates, hook keys, and hint text) rewritten to its `mcp__forge__*` equivalent, so that agents stop being instructed to call tools that no longer exist (the binary was deleted in FM-3) and instead use the working forge-mcp surface restored by **FM-4**. ## Context FM-3 (#687) deleted `forgejo-mcp` from the container image. Skills were cleaned (`git grep mcp__forgejo__ skills/` returns zero), but **server-side code** that emits tool names into agent prompts, matches them in security gates, or keys hooks on them was missed. As long as these strings reference `mcp__forgejo__*`: - `parent-pr.ts:221` instructs agents "open your PR via `mcp__forgejo__create_pull_request`" — agent attempts a tool that the SDK no longer mounts. - `architect.ts:625, 674` security gates use `startsWith("mcp__forgejo__")` and `=== "mcp__forgejo__merge_pull_request"` — these match nothing post-cutover, so the gate's intent (block PR-merge from non-session repos, log mid-flight forge access) is silently bypassed. - `agent-runner.ts:263-277` token-budget first-touch hook keys on `mcp__forgejo__*` — never fires. - `worker.ts:543` hint string about `mcp__forgejo__*_file` — points operators at the wrong namespace. This story is a **textual rename** with security-gate verification — no behaviour changes beyond pointing at the correct tool names. Depends on **FM-4** landing first (otherwise the renamed names still don't resolve because the allowlist is wrong). ## Acceptance criteria ### Code rename - [ ] `apps/server/src/domain/workflow/parent-pr.ts:221` instruction string uses `mcp__forge__create_pull_request`. - [ ] `apps/server/src/domain/agent/architect.ts:625` security gate matches `toolName.startsWith("mcp__forge__")`. - [ ] `apps/server/src/domain/agent/architect.ts:674` matcher: `toolName === "mcp__forge__merge_pull_request"`. - [ ] `apps/server/src/domain/agent/agent-runner.ts:263-277` token-budget hook keys on `mcp__forge__*`. - [ ] `apps/server/src/background/worker.ts:543` hint mentions `mcp__forge__write_file` (note: forge-mcp renamed `update_file` → `write_file`). - [ ] `apps/server/src/domain/ports/mcp-registry-port.ts:25, 99` doc-comment references updated to `mcp__forge__*`. - [ ] `git grep -nE "mcp__forgejo__" apps/server/` returns only: - `mcp-config.ts` `forgejoToolEntries` block (removed in FM-6, not this story) - test fixtures explicitly verifying legacy-namespace handling (if any) - `MEMORY.md` / `specs/` / `docs/` (out of scope) ### Tests - [ ] Existing `architect.test.ts` security-gate tests updated to use the new tool names. - [ ] Existing `agent-runner.test.ts` first-touch token-budget tests updated. - [ ] New / updated `parent-pr.test.ts` snapshot covers the renamed instruction. ### Manual smoke - [ ] Dispatch a real review-loop ticket end-to-end (architect → code-lead → reviewer → merge). Confirm: - PR creation succeeds via `mcp__forge__create_pull_request`. - Reviewer's `submit_review` + `merge_pull_request` route through `mcp__forge__*`. - No "tool not found" warnings in the task transcript. - No curl-fallback warnings in worker logs. ## Out of scope - Allowlist sync — see **FM-4** (must land first). - Removing `dualMount`, `forgejoMcpCommand`, `FORGEJO_TOOLS_ALLOWLIST` constant, `FORGEJO_MCP_TOOLS` env wiring — see **FM-6**. - Renaming `forgejo` server entry name in `mcpServers` map (`mcp-config.ts:139`, `default-mcp-registry.ts:130`) — that lives in FM-6 along with the rest of the legacy mount. ## References - Spec: `specs/forge-mcp-cutover-followup.md` §Pass 2. - forge-mcp tool name table: `specs/forge-mcp-cutover-followup.md` §Pass 1 (mapping table). - Original FM-3 PR: #687. - Depends on: **FM-4**.
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#810
No description provided.