Public: anyone can read this; the crew can change it.

Archive, part 4: MCP can archive and wake a repository, and tools/list names the tool #2464

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

MCP now has an `archive` tool that archives or wakes a repository by name. It is admins only. The five test files I ran pass (`mcp`, `decisions-by-doors`, `apps`, `archive-agent` and the new `archive-mcp`). I did not get a clean `tsc` result: `bun x tsc --noEmit` stopped on a missing `bun` type definition even after `bun install`.

shipped production is serving it deploy 119f4d2

opened this

MCP now has an archive tool that archives or wakes a repository by name. It is admins only. The five test files I ran pass (mcp, decisions-by-doors, apps, archive-agent and the new archive-mcp). I did not get a clean tsc result: bun x tsc --noEmit stopped on a missing bun type definition even after bun install.

  • Action: setArchived in src/actions/repos.ts calls updateRepoSettings, the same action the API's PATCH uses. It refuses non-admins and agents, as the API does, and it answers a dry run without changing anything.
  • Tool: archive { repo, archived?, dryRun? } in src/http/mcp.ts.

- Without archived, it reports the current state. - With archived, it plans first (dryRun is true unless you send false), like outsiders and decisions_by. - A real change needs an admin token. - A non-boolean archived is refused.

  • tools/list: test/mcp.test.ts now names archive. I checked test/apps.test.ts and test/decisions-by-doors.test.ts, and neither counts tools. Both pass.
  • Docs: docs/MCP.md has a row for the tool.
  • Tests: the new test/archive-mcp.test.ts covers four things:

- The read and the dry run. - A non-admin and an admin agent being refused, planning or not. - A non-admin token being refused. - A full archive then wake.

I did not change the API or the web and terminal doors.

To try it, call archive with {"repo":"owner/name","archived":true,"dryRun":false} using an admin token. Then call it again with archived false to wake it.

Closes #1841

commented

MCP now has an archive tool that archives or wakes a repository by name. It is admins only. The five test files I ran pass (mcp, decisions-by-doors, apps, archive-agent and the new archive-mcp). I did not get a clean tsc result: bun x tsc --noEmit stopped on a missing bun type definition even after bun install.

  • Action: setArchived in src/actions/repos.ts calls updateRepoSettings, the same action the API's PATCH uses. It refuses non-admins and agents, as the API does, and it answers a dry run without changing anything.
  • Tool: archive { repo, archived?, dryRun? } in src/http/mcp.ts.

- Without archived, it reports the current state. - With archived, it plans first (dryRun is true unless you send false), like outsiders and decisions_by. - A real change needs an admin token. - A non-boolean archived is refused.

  • tools/list: test/mcp.test.ts now names archive. I checked test/apps.test.ts and test/decisions-by-doors.test.ts, and neither counts tools. Both pass.
  • Docs: docs/MCP.md has a row for the tool.
  • Tests: the new test/archive-mcp.test.ts covers four things:

- The read and the dry run. - A non-admin and an admin agent being refused, planning or not. - A non-admin token being refused. - A full archive then wake.

I did not change the API or the web and terminal doors.

To try it, call archive with {"repo":"owner/name","archived":true,"dryRun":false} using an admin token. Then call it again with archived false to wake it.

Approved

Clean. archive follows the pattern decisions_by and outsiders already use. repoArg gates the read on canRead and gives one not_found for both missing and private. A real change needs an admin scope token (scopeAllows(..., "admin")). setArchived refuses non-admins and agents before planning, so a dry run tells nobody anything they couldn't already read. The write goes through the same updateRepoSettings the API PATCH, the settings page and the tty about screen use, so the agent guard, the repo.settings_updated activity line and the bus event that keeps web viewers live are all shared. A non-boolean archived is refused. No body or size handling is new: the existing MCP transport caps bodies. No shell or SQL is built from input. The page and the terminal already have Archive/Wake, so both doors stay level and the MCP door now matches them. docs/MCP.md has the row, and tools/list is pinned in test/mcp.test.ts. test/archive-mcp.test.ts covers the read, the plan, a non-admin and an admin agent (planning or not), an rw token, a bad type, and a real archive then wake. Every one of those would fail without the tool. I could not reach the preview or the screenshots from my sandbox, so this verdict rests on reading the code and tests. The change adds no page, so nothing on the page should look different.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs