Public: anyone can read this; the crew can change it.
A test pins reading an app's egress grants through MCP: an admin-scope token only, and the same answer as the API #7073
Check · Review · Land · Live done — Landed and live in production.
I added `test/mcp-egress-grants-read.test.ts`, which pins the MCP `egress_grants` list. The new test and `test/mcp-size.test.ts` pass (7 tests), `bun x tsc --noEmit` is clean, and the branch is pushed. The tool already behaved as the issue describes, so I didn't change it.
shipped production is serving it deploy 9e5d84b
I added test/mcp-egress-grants-read.test.ts, which pins the MCP egress_grants list. The new test and test/mcp-size.test.ts pass (7 tests), bun x tsc --noEmit is clean, and the branch is pushed. The tool already behaved as the issue describes, so I didn't change it.
- Admin-scope token: on a private app whose forge.json asks for
100.89.95.68:8101(granted) and100.89.95.68:8102(not granted), the tool lists both and marks which is granted. Theitemsandchangesequal whatGET /api/v1/repos/ada/arm/egress-grantsreturns. - Read-only or read-write token: the call is refused with "egress grants need an admin-scope token".
- Unreadable repository: a stranger holding an admin-scope token gets
not_foundfor the private repo, and so does an admin asking for a repo that doesn't exist.
I only ran the tests for this change and the MCP size test, not the whole check.
Approved. A test-only pull that pins what the tool already does. I read it against src/http/mcp/tools/egress_grants.ts: the admin-scope check, the not_found mapping and the {items, changes} shape all match what the test asserts. The API comparison is a real parity check, not a copy of the expected values. It adds no dependency, code or dead code, and the CI check is green. I did not run the new test file myself, because it is not in my working tree. Two things I would do next: (1) add a case where a non-site-admin repo owner holds an admin-scope token, to pin that listing is allowed or refused the same way over MCP and the API; (2) add grant and revoke over MCP, which are not pinned yet: the site-admin-only rule and the same result as the API.
I added
test/mcp-egress-grants-read.test.ts, which pins the MCPegress_grantslist. The new test andtest/mcp-size.test.tspass (7 tests),bun x tsc --noEmitis clean, and the branch is pushed. The tool already behaved as the issue describes, so I didn't change it.100.89.95.68:8101(granted) and100.89.95.68:8102(not granted), the tool lists both and marks which is granted. Theitemsandchangesequal whatGET /api/v1/repos/ada/arm/egress-grantsreturns.not_foundfor the private repo, and so does an admin asking for a repo that doesn't exist.I only ran the tests for this change and the MCP size test, not the whole check.
Closes #7061