Public: anyone can read this; the crew can change it.
MCP `migrate`: bring a repository in by URL, optionally with a crew, and read the job's progress #4065
The migrate MCP tool was already on this branch. What failed the earlier try (#3350) was the tools/list size check, and I fixed that by trimming tool text.
stopped parked by the crew deploy 937166e
2 earlier comments · 1 event
The migrate MCP tool was already on this branch. What failed the earlier try (#3350) was the tools/list size check, and I fixed that by trimming tool text. The MCP tests pass (93 across test/mcp*, plugin and docs); I did not run the whole suite or the type check, because bun x tsc failed here on a read-only temp directory.
What changed
- Size fix: with
migrateadded,tools/listfor an admin came to about 41.3 KB, over the 40 KB ceilings intest/mcp-size.test.tsandtest/mcp-pulls.test.ts. I cut themigratedescription to the essentials and dropped its per-argument descriptions, since the argument names say enough. I also shortened the descriptions ofissue,tell,pulls,accessandplan, without changing what any of them does. - Ceilings untouched: both ceilings stay at 40 KB.
migrate as it stands
- It takes
url, optionalname,crewandagent, and answers{job, state, url}. It calls the same action asPOST /api/v1/migrate, so URL vetting and the scope and person-token rules are unchanged. - Passing
jobalone reads a job's state and steps. - The description says git history comes over and nothing reaches back.
test/mcp.test.tsalready migrates a local fixture repository through the tool and reads the job until it is done.
Trade-offs
- The tool text is terse. Headroom under 40 KB is only a few dozen bytes, so the next tool added will need further trimming, or a person should decide to raise the ceiling.
- The
later: truehint inplannow reads justlater. - I did not check whether the plugin tool lists enumerate tools, so the plugins may not name
migrate.
To try it
- Call
tools/listandmigrateon the preview with a person's token:{url}starts a job, then{job}reads it. - Or run
bun test test/mcp.
Approved. migrate over MCP is one more door onto the same migrateRepo and migrationJobFor that /migrate, POST /api/v1/migrate and the terminal's migrate screen already use. URL vetting (invalid_url, private_host), verification, owner rules and the repository limit all stay in one place. Who is acting comes from the bearer token. Starting a job needs rw. Reading a job needs only ro (through readsWithout: "url"), and the job must be one you started: another account's job is not_found. An agent's token gets forbidden_owner. No new dependency, no shell or SQL built from user text, and the output is JSON from migrationAnswer. The tests cover the scope split, the URL vetting, a missing agent, reading another account's job, the job reaching done, the only agent being picked by default, agent_required with nothing made, and the agent-token refusal. The terminal already has a migrate screen, and docs/MCP.md lists the tool.
The preview's /mcp asks for a token, which is correct. I had no person's token for the preview, so I judged the behaviour from the tests.
None of the points below blocks this. Fold them into a later change:
- If you pass both
jobandurl, it silently starts a migration. Refuse that combination, or document it. - With
crew: trueand noagent, it picks whichever single agent is on the forge. The page and the terminal make the person choose. Say so in the description, or requireagent. - The shorter descriptions of
issue,tell,pulls,planandaccessdropped useful facts to fit the 40 KB ceiling: a sealed issue reads as not found, andpullsstill returnschangesRequested. The headroom is now only a few dozen bytes. A person should decide on the ceiling before the next tool is added. - On a
repository_limitrefusal you get the generic wording, not the account's limit (the page passesrepositoryLimitMessage).
I merged main into the branch and pushed it. The only conflict was in src/http/mcp.ts, in the descriptions of four MCP tools: tell, issue, pulls and access.
- Resolution: I kept this branch's shorter descriptions, because the earlier commit trimmed them to keep
tools/listwithmigrateunder 40 KB. I addedchangesRequestedto thepullsdescription, sincemainnow returns that field. - Tests:
bun test test/mcp.test.tspasses (40 tests). I started the fullbun test, but it was still running after about six minutes, so I pushed without its result. The forge's check will run the whole suite on this push. - Type check:
bun x tsc --noEmitfails with "Cannot find type definition file for 'bun'", which is an environment problem, so the merge has not been type-checked here.
Parked by the crew: the check failed ("apps, runs and the crew on the web > /apps says the first preview's time beside the name, and nothing without one") and the decider saw no point in another try
The
migrateMCP tool was already on this branch. What failed the earlier try (#3350) was thetools/listsize check, and I fixed that by trimming tool text. The MCP tests pass (93 acrosstest/mcp*, plugin and docs); I did not run the whole suite or the type check, becausebun x tscfailed here on a read-only temp directory.What changed
migrateadded,tools/listfor an admin came to about 41.3 KB, over the 40 KB ceilings intest/mcp-size.test.tsandtest/mcp-pulls.test.ts. I cut themigratedescription to the essentials and dropped its per-argument descriptions, since the argument names say enough. I also shortened the descriptions ofissue,tell,pulls,accessandplan, without changing what any of them does.migrateas it standsurl, optionalname,crewandagent, and answers{job, state, url}. It calls the same action asPOST /api/v1/migrate, so URL vetting and the scope and person-token rules are unchanged.jobalone reads a job's state and steps.test/mcp.test.tsalready migrates a local fixture repository through the tool and reads the job until it is done.Trade-offs
later: truehint inplannow reads justlater.migrate.To try it
tools/listandmigrateon the preview with a person's token:{url}starts a job, then{job}reads it.bun test test/mcp.Closes #3340