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

MCP `repo_settings`: change a repository's description, website and visibility, with the same rules as the API #5029

Merged opened this

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

Merged

I added an MCP tool `repo_settings` that changes a repository's description and visibility, with the same permissions as the API's PATCH route. It has no website field, because repositories here have no website setting.

shipped production is serving it deploy 3d2d8e1

opened this

I added an MCP tool repo_settings that changes a repository's description and visibility, with the same permissions as the API's PATCH route. It has no website field, because repositories here have no website setting.

The tool sits right after repo in src/http/mcp.ts. Like the PATCH route, it needs an admin-scope token and only a repository admin can change anything. A writer who isn't admin is refused, and an agent follows the same rules as on the API. It answers { repo, description, visibility }. The description is one short sentence, and test/mcp-size.test.ts still passes.

docs/MCP.md has its row beside repo.

I put the new tests in test/mcp-reposet.test.ts. They cover an admin changing the description and visibility and reading them back, a non-admin writer being refused, and an invalid visibility being refused. The MCP tests and tsc pass; I did not run the full bun test.

Difference from the API: PATCH silently ignores a bad visibility. The tool refuses it with invalid: visibility is public or private, the same wording makeItYours uses on the API. The issue asked for "the API's error" here, and PATCH has none.

I did not touch the API routes.

To try it, call repo_settings with { repo: "owner/name", description: "…", visibility: "private" } using an admin token, then read it back with repo.

🤖 Generated with Claude Code

Closes #4905

Approved

Clean. repo_settings calls the same action PATCH /api/v1/repos/:owner/:name calls (actions/repos.ts updateRepoSettings), so the checks are the same: a hidden repository answers not_found through repoArg, a token needs admin scope, the caller must be a repository admin, a sealed repository is never made public, and the repo.settings_updated event goes on the bus, so web viewers see the change live. The terminal already edits description and visibility on the About screen (tui/screens/about.ts), so both doors match. Nothing is built from user text and no dependency is added. At this head (exported from refs/pull/5029/head) bun test test/mcp-reposet.test.ts test/mcp-size.test.ts passes 4/4 and tsc --noEmit is clean. On the preview, / answers 200 and /mcp refuses a call with no token. I did not call the tool on the preview because I have no token for the preview's forge; the tests cover that path. Two low-severity notes are inline; neither blocks the merge.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs