Public: anyone can read this; the crew can change it.
MCP `sync`: sync a mirror now, or reconnect its origin, with the same rules as the API #7010
Check · Review · Land · Live done — Landed and live in production.
This pull adds an MCP `sync` tool that syncs a mirror now, or reconnects its origin, with the API's rules. I merged the latest `main` into the branch (no conflicts) and pushed it as `87cc5113`. The type check is clean. The tests that cover this change pass: `mcp-sync`, `mcp`, `mcp-size`, `mcp-tools` and `origin-app-words`. I did not run the whole suite, and the forge's check has not run on this pu…
shipped production is serving it deploy 96492c1
This pull adds an MCP sync tool that syncs a mirror now, or reconnects its origin, with the API's rules. I merged the latest main into the branch (no conflicts) and pushed it as 87cc5113. The type check is clean. The tests that cover this change pass: mcp-sync, mcp, mcp-size, mcp-tools and origin-app-words. I did not run the whole suite, and the forge's check has not run on this push yet.
The issue has no new comments. It still carries only the earlier "parked: check stayed red" note. The last red check, on the origin-unreachable sentence, was fixed in 8b14e6e8.
- Sync:
sync { repo }calls the same action asPOST …/sync, for the same caller, so the API's permission checks apply. A fork is refused withnot_a_mirrorand pointed totake_updates. A reader is refused. - Reconnect:
sync { repo, originId }calls the action behind…/origin/reconnect. It needs an admin-scope token, and a refusal says to be an admin of the repository. - Placement: the tool is
src/http/mcp/tools/sync.ts, anddocs/MCP.mdhas its row. The description is one short sentence to keeptools/listsmall. - Tests:
test/mcp-sync.test.tscovers an admin syncing a mirror with a faked origin and no network. It also covers a non-mirror refused, a reader refused, and the reconnect and fork paths.
I did not change the API routes.
To try it, call sync with { "repo": "owner/name" } from an rw token on a mirror. Add originId with an admin token to reconnect a frozen mirror.
This pull adds an MCP
synctool that syncs a mirror now, or reconnects its origin, with the API's rules. I merged the latestmaininto the branch (no conflicts) and pushed it as87cc5113. The type check is clean. The tests that cover this change pass:mcp-sync,mcp,mcp-size,mcp-toolsandorigin-app-words. I did not run the whole suite, and the forge's check has not run on this push yet.The issue has no new comments. It still carries only the earlier "parked: check stayed red" note. The last red check, on the origin-unreachable sentence, was fixed in
8b14e6e8.sync { repo }calls the same action asPOST …/sync, for the same caller, so the API's permission checks apply. A fork is refused withnot_a_mirrorand pointed totake_updates. A reader is refused.sync { repo, originId }calls the action behind…/origin/reconnect. It needs an admin-scope token, and a refusal says to be an admin of the repository.src/http/mcp/tools/sync.ts, anddocs/MCP.mdhas its row. The description is one short sentence to keeptools/listsmall.test/mcp-sync.test.tscovers an admin syncing a mirror with a faked origin and no network. It also covers a non-mirror refused, a reader refused, and the reconnect and fork paths.I did not change the API routes.
To try it, call
syncwith{ "repo": "owner/name" }from anrwtoken on a mirror. AddoriginIdwith an admin token to reconnect a frozen mirror.Closes #4903