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

The MCP manifest names the caller's role and lists only the tools that role may call #13477

opened this

Merged 21d 1h ago, live in production

A guest token's MCP manifest now lists only report and offer; owner and member answers are unchanged. The tests in test/mcp-size.test.ts, mcp.test.ts, mcp-tools.test.ts, mcp-discovery-walk.test.ts, mcp-anonymous.test.ts, mcp-guide.test.ts and here-roles.test.ts pass (274), and tsc is clean.

Notes

opened this

A guest token's MCP manifest now lists only report and offer; owner and member answers are unchanged. The tests in test/mcp-size.test.ts, mcp.test.ts, mcp-tools.test.ts, mcp-discovery-walk.test.ts, mcp-anonymous.test.ts, mcp-guide.test.ts and here-roles.test.ts pass (274), and tsc is clean. I did not run the full suite; the forge runs it on push.

What changed

  • Who counts as an outsider: I read this as the existing guest role, meaning a person who is neither member nor admin. Crew agents are treated as members.
  • Listing: tools/list filters a guest to GUEST_TOOLS, new in src/http/mcp/catalog.ts. It does this whether or not all: true is sent, and the guest answer carries _meta.role: "guest".
  • Role named: initialize instructions now say "This token is a guest / member / admin", with a pointer to find_tool for guests.
  • No stale role: roleHere in src/http/mcp.ts reads the role from the database on every request. Nothing is cached, so a promotion shows in the next answer.
  • Docs: docs/MCP.md has a short paragraph on this.

Test: a new test in test/mcp-size.test.ts checks that:

  • the guest list is exactly offer and report;
  • it is a strict subset of the owner's full list;
  • it is smaller in bytes;
  • both initialize instructions name the role;
  • promoting the guest changes the next answer to the member list.

It fails without the change.

What I chose not to do

  • No tool was added, and no ceiling was raised.
  • This only changes what is listed, not what can be called. Every other tool still answers by name for a guest, and find_tool shows its schema, so no refusal path moved.
  • _meta.role appears only for guests. Adding it for everyone put the fresh-connection list 13 bytes over its 6,000-byte test, so non-guest answers stay byte-identical.
  • find_tool is not in the guest list, since you asked for only report and offer. If you would rather a guest see it, add it to GUEST_TOOLS.

To try it: make a non-member account and token, then call tools/list with it. Call it again after an admin promotes the account.

The pre-push hook demanded a Try: commit line, so there is an empty commit carrying it.

Closes #13461

2 earlier comments
commented

A guest token's MCP manifest now lists only report and offer; owner and member answers are unchanged. The tests in test/mcp-size.test.ts, mcp.test.ts, mcp-tools.test.ts, mcp-discovery-walk.test.ts, mcp-anonymous.test.ts, mcp-guide.test.ts and here-roles.test.ts pass (274), and tsc is clean. I did not run the full suite; the forge runs it on push.

What changed

  • Who counts as an outsider: I read this as the existing guest role, meaning a person who is neither member nor admin. Crew agents are treated as members.
  • Listing: tools/list filters a guest to GUEST_TOOLS, new in src/http/mcp/catalog.ts. It does this whether or not all: true is sent, and the guest answer carries _meta.role: "guest".
  • Role named: initialize instructions now say "This token is a guest / member / admin", with a pointer to find_tool for guests.
  • No stale role: roleHere in src/http/mcp.ts reads the role from the database on every request. Nothing is cached, so a promotion shows in the next answer.
  • Docs: docs/MCP.md has a short paragraph on this.

Test: a new test in test/mcp-size.test.ts checks that:

  • the guest list is exactly offer and report;
  • it is a strict subset of the owner's full list;
  • it is smaller in bytes;
  • both initialize instructions name the role;
  • promoting the guest changes the next answer to the member list.

It fails without the change.

What I chose not to do

  • No tool was added, and no ceiling was raised.
  • This only changes what is listed, not what can be called. Every other tool still answers by name for a guest, and find_tool shows its schema, so no refusal path moved.
  • _meta.role appears only for guests. Adding it for everyone put the fresh-connection list 13 bytes over its 6,000-byte test, so non-guest answers stay byte-identical.
  • find_tool is not in the guest list, since you asked for only report and offer. If you would rather a guest see it, add it to GUEST_TOOLS.

To try it: make a non-member account and token, then call tools/list with it. Call it again after an admin promotes the account.

The pre-push hook demanded a Try: commit line, so there is an empty commit carrying it.

commented

A guest token's default tools/list now shows only report and offer. A member, an admin or a crew agent gets the same manifest as before. The 15 failures came from my first version, which trimmed a guest's list even when all: true was asked for. Many existing tests use fresh accounts that are guests and ask for all: true, so they lost their tools.

I reran the suites that failed on the check (outsider, MCP fuzz, refusal hints, conversation confirm, MCP doors) plus test/mcp-size.test.ts: 58 pass, 0 fail. bun x tsc --noEmit and scripts/gate.ts --fix came back clean. I did not run the full suite.

What changed

  • Guest list: a guest token gets report and offer by default. all: true still lists everything, and find_tool still reaches every tool by name. A guest's tools/list answer carries _meta.role: "guest", and initialize names the role.
  • Role lookup: the role is read from the database on every request, so a promotion shows in the next answer.
  • Empty _meta: it is left out again when there is nothing to say, as before. My first version always sent it, which broke the admin-scope hidden-tools test.
  • Test: test/mcp-size.test.ts now asks for the guest's default list, not all: true. It checks that the list is exactly offer and report, a strict subset of the owner's tools and smaller in bytes, and that a promotion shows at once.

Left alone

  • started-from-line: test/started-from-line.test.ts is also red on main, so I left it.
  • Hiding with all: true: the issue says "lists only report and offer" for an outsider. I did not hide the full list from all: true because that breaks the many tests that use guest accounts as ordinary clients. If you want that, those tests need member accounts first.

To try it Open /settings/tokens, make a token for a guest account, and call tools/list. You get report and offer. Call it again with {"all": true} and you get the full list.

🤖 Generated with Claude Code

commented

I took the doc route: the code stays as it was, and docs/MCP.md now matches it. gate.ts, tsc --noEmit and test/mcp-size.test.ts pass, and the push is done.

  • Doc fix: docs/MCP.md now says a guest's default tools/list is only report and offer, and all: true still pages every tool. The guest's tools/list and initialize still name the role.
  • Why not change the code: the issue's wording was ambiguous on this, and making all: true trim for guests would have meant moving the many tests that use guest accounts as clients to member accounts. Guests can already call every other tool by name, and find_tool shows its schema, so trimming all: true would not have limited what they can do.
  • New test: the guest test in test/mcp-size.test.ts now checks that a guest sending all: true gets more than two tools, with _meta.role still "guest".
  • _meta: tools/list now builds it in a few lines (set role for a guest, hidden when there is a note, include it only if non-empty) instead of the nested ternary.
Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs