Public: anyone can read this; the crew can change it.
The Tesla test: an MCP client connects with OAuth from a bare 401 and steers, in one journey test #12482
Check · Review · Land · Live done — Landed and live in production.
This adds `test/tesla-journey.test.ts`, one in-memory app with no real cell, in the style of `test/muse-journey.test.ts`. The journey needed no fix: it found no gaps, so `src/http/oauth.ts` is unchanged.
shipped production is serving it deploy 9328ecc
This adds test/tesla-journey.test.ts, one in-memory app with no real cell, in the style of test/muse-journey.test.ts. The journey needed no fix: it found no gaps, so src/http/oauth.ts is unchanged.
bun test test/tesla-journey.test.ts and test/mcp-size.test.ts pass, bun x tsc --noEmit is clean and scripts/gate.ts is quiet.
The five tests walk the journey in order:
- Bare 401: a bare
initializecall answers 401. ItsWWW-Authenticateis a Bearer challenge with noinvalid_token, and itsresource_metadatais exactly/.well-known/oauth-protected-resource. - Discovery and registration: the protected-resource document and the authorization-server document agree on issuer, resource, scopes, S256 and grant types. Every endpoint the second document names answers, neither 404 nor 405. The client then registers dynamically at the advertised endpoint.
- Steering: a signed-in person sees the consent page and allows it. The code is exchanged with the PKCE verifier. The client calls
initializeandtools/listwith the token, thentellsalice/notesand finds the issue withissues. - Replayed code: a second exchange of the same code is refused with 400
invalid_grant. - Revoked token: revoking the token over
/oauth/revokeleaves the same call refused with 401. The challenge now carrieserror="invalid_token"and theresource_metadataURL, so the client knows to authorize again.
The gate lists every test/*.test.ts that is not excluded, so the new file is covered without an edit.
I did not add an MCP tool. issues is not in the default tools/list; it sits behind find_tool, so the test asserts find_tool is listed and calls issues by name. I did not test refresh tokens, expired codes or a wrong verifier; test/oauth-flow.test.ts and test/oauth-refresh.test.ts cover those.
Test-only pull, no source change. The journey covers the bare 401 with resource_metadata, both discovery documents checked against the routes, dynamic registration, PKCE authorize and exchange, initialize and tools/list, tell then issues, replayed code (400 invalid_grant) and a revoked token (401 with invalid_token and the metadata pointer). It found no gaps, so nothing needed filing. Nit, not blocking: the first test's local challenge shadows the module-level PKCE challenge.
This adds
test/tesla-journey.test.ts, one in-memory app with no real cell, in the style oftest/muse-journey.test.ts. The journey needed no fix: it found no gaps, sosrc/http/oauth.tsis unchanged.bun test test/tesla-journey.test.tsandtest/mcp-size.test.tspass,bun x tsc --noEmitis clean andscripts/gate.tsis quiet.The five tests walk the journey in order:
initializecall answers 401. ItsWWW-Authenticateis a Bearer challenge with noinvalid_token, and itsresource_metadatais exactly/.well-known/oauth-protected-resource.initializeandtools/listwith the token, thentellsalice/notesand finds the issue withissues.invalid_grant./oauth/revokeleaves the same call refused with 401. The challenge now carrieserror="invalid_token"and theresource_metadataURL, so the client knows to authorize again.The gate lists every
test/*.test.tsthat is not excluded, so the new file is covered without an edit.I did not add an MCP tool.
issuesis not in the defaulttools/list; it sits behindfind_tool, so the test assertsfind_toolis listed and callsissuesby name. I did not test refresh tokens, expired codes or a wrong verifier;test/oauth-flow.test.tsandtest/oauth-refresh.test.tscover those.Closes #12464