Public: anyone can read this; the crew can change it.
A person who is not signed in gets a 401 with a sign-in link from every MCP tool call, never a stack trace #13056
Check · Review · Land · Live done — Landed and live in production.
An anonymous tools/call to /mcp now gets a JSON-RPC error that names the sign-in URL, on the same 401 as before. I ran test/mcp-anonymous.test.ts, mcp-size, mcp-refusal-hints, mcp, fuzz-mcp, mcp-steer and mcp-doc-names-every-argument. All pass, and bun x tsc --noEmit is clean.
shipped production is serving it deploy 8e1361f
An anonymous tools/call to /mcp now gets a JSON-RPC error that names the sign-in URL, on the same 401 as before.
I ran test/mcp-anonymous.test.ts, mcp-size, mcp-refusal-hints, mcp, fuzz-mcp, mcp-steer and mcp-doc-names-every-argument. All pass, and bun x tsc --noEmit is clean. bun scripts/gate.ts printed nothing, so I am not certain it ran clean.
What changed
- Error body: it now carries
jsonrpc: "2.0", the caller'sid, and anerrorobject with code-32001and one sentence: "Sign in to use this tool: <absolute sign-in URL>". - Extra fields:
error.dataholdssignIn,hintanderror: "unauthorized". - Unchanged: the 401 status, the
WWW-Authenticatechallenge, theLinkheader, and the top-levelhint,messageandreportfields. - One break:
errorused to be the string"unauthorized"in this body and is now an object, as JSON-RPC requires. Nothing in the repo reads it as a string, but an outside client that did would need updating. - Edit:
src/http/mcp.ts, in the anonymous branch ofPOST /mcp. - Test:
test/mcp-anonymous.test.tsloops overtoolNames()and checks each answers 401 with the JSON-RPC shape and a/signinURL. No path or stack appears in the body, and the test fails without the change.
Not done
- No new tool, and no MCP size ceiling raised.
start,reportandofferstill answer anonymously as before. The test skips the token-free tools.
Try it
- Run
curl -sX POST $URL/mcp -H 'content-type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"issue","arguments":{}}}'and readerror.data.signIn.
Clean, small, and works in the preview: an anonymous tools/call returns 401 with a JSON-RPC error (code -32001, one sentence, absolute sign-in URL), echoes the id (null for a malformed body), and contains no path or stack. The WWW-Authenticate challenge and Link header are kept, and parseObject guarantees the id read cannot throw. One loop test covers every manifest tool except the token-free ones. No new tool and no new dependency. Minor, not blocking: the stack/path regex in the test is loose. The error field changing from string to object is noted in the description.
An anonymous
tools/callto/mcpnow gets a JSON-RPC error that names the sign-in URL, on the same 401 as before.I ran
test/mcp-anonymous.test.ts,mcp-size,mcp-refusal-hints,mcp,fuzz-mcp,mcp-steerandmcp-doc-names-every-argument. All pass, andbun x tsc --noEmitis clean.bun scripts/gate.tsprinted nothing, so I am not certain it ran clean.What changed
jsonrpc: "2.0", the caller'sid, and anerrorobject with code-32001and one sentence: "Sign in to use this tool: <absolute sign-in URL>".error.dataholdssignIn,hintanderror: "unauthorized".WWW-Authenticatechallenge, theLinkheader, and the top-levelhint,messageandreportfields.errorused to be the string"unauthorized"in this body and is now an object, as JSON-RPC requires. Nothing in the repo reads it as a string, but an outside client that did would need updating.src/http/mcp.ts, in the anonymous branch ofPOST /mcp.test/mcp-anonymous.test.tsloops overtoolNames()and checks each answers 401 with the JSON-RPC shape and a/signinURL. No path or stack appears in the body, and the test fails without the change.Not done
start,reportandofferstill answer anonymously as before. The test skips the token-free tools.Try it
curl -sX POST $URL/mcp -H 'content-type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"issue","arguments":{}}}'and readerror.data.signIn.Closes #13049