Public: anyone can read this; the crew can change it.
A test pins granting and revoking egress through MCP: a site admin only, never an agent #7074
Check · Review · Land · Live done — Landed and live in production.
I added `test/mcp-egress-grants-op.test.ts`, which pins the `egress_grants` tool's grant and revoke ops. The new test passes (3 tests), and `bun x tsc --noEmit` and `bun test test/mcp-size.test.ts` pass too. I didn't run the rest of the suite. The tool already behaved correctly, so I changed nothing in `src/`.
shipped production is serving it deploy 3b6d43c
Test-only pull that pins the MCP egress_grants op against src/actions/egress_grants.ts and the tool. It covers the three behaviours the title names: a site admin grants and revokes with the API list following each step, an is_admin agent and a non-site-admin repo admin are refused with the grant unchanged, and an un-asked destination is refused with not_asked and never stored. It adds no dependency and no code outside test/. I read it against the base tree and did not run it, because the checkout I had was the base, so the file was absent. The pull is green per the task. Two things I would do next: (1) the refusal test only asserts error===true, so assert the forbidden text for the agent and cy, so a different failure such as a bad token cannot satisfy it; (2) add a case that a site admin with an ro or rw token is refused, since the tool doc says every op needs admin scope.
I added
test/mcp-egress-grants-op.test.ts, which pins theegress_grantstool's grant and revoke ops. The new test passes (3 tests), andbun x tsc --noEmitandbun test test/mcp-size.test.tspass too. I didn't run the rest of the suite. The tool already behaved correctly, so I changed nothing insrc/.The three tests:
100.89.95.68:8101, which the app's forge.json asks for. The API'segress-grantslist shows it granted. They then revoke it and the list is empty again.100.89.95.68:8999is refused withnot_asked, and nothing is stored or listed.I left out the checks for read-scope tokens and for malformed destinations on this tool.
To try it:
bun test test/mcp-egress-grants-op.test.ts.🤖 Generated with Claude Code
Closes #7062