Skip to content

fix(mcp): authenticated queries never worked — and the auth knob shouldn't exist#89

Merged
zzstoatzz merged 4 commits into
mainfrom
fix/authenticated-query-jwt
Jul 18, 2026
Merged

fix(mcp): authenticated queries never worked — and the auth knob shouldn't exist#89
zzstoatzz merged 4 commits into
mainfrom
fix/authenticated-query-jwt

Conversation

@zzstoatzz

@zzstoatzz zzstoatzz commented Jul 17, 2026

Copy link
Copy Markdown
Owner

two commits: query(authenticated=True) has failed 100% of the time since it shipped (JWT read from client.me, which has no access_jwt — every call raised AuthenticationRequired after a successful login, blaming missing credentials), and the fix exposed that the authenticated kwarg itself was a smell: the allowlist already fully determines which NSIDs need the session, so auth is now automatic and the flag is deprecated-and-ignored.

commit 1 — the bug (d5a7592)
  • phi's self-trace audit surfaced 22 identical failures on a ~4h schedule going back a month — a 100% failure rate, not an intermittent one
  • reproduced against the hosted server and against current main locally
  • a credentials spy showed handle/password present and login succeeding — the failure was getattr(client.me, "access_jwt", None) returning None; the JWT lives on client._session (a Session dataclass)
  • after the fix, a live local run returned real notifications through the authenticated path
  • the existing test never caught it because its fake client put the jwt on .me — the fake now matches the real SDK shape
commit 2 — the smell (8ea37aa)
  • the caller-supplied authenticated flag was a redundant degree of freedom: the server already fully determines auth need from the NSID (the allowlist), and both allowlisted endpoints are auth-only
  • for LLM callers the flag was a knob to guess at, with a misleading failure mode when guessed wrong
  • now: allowlisted NSIDs authenticate automatically; everything else is always public — no caller-supplied knob can widen the boundary (regression-tested: a non-allowlisted NSID never touches credentials even with authenticated=True passed)
  • the kwarg is kept and ignored so existing callers don't fail schema validation; drop it in a later major

🤖 Generated with Claude Code

zzstoatzz and others added 2 commits July 17, 2026 01:19
query(authenticated=True) has never worked: client.me is the profile
view (no access_jwt attribute), so every authenticated query raised
AuthenticationRequired *after* a successful login — masquerading as
'no credentials provided'. surfaced by phi's trace audit: 22 identical
failures on a ~4h schedule for a month, 100% failure rate.

the regression test had encoded the bug — its fake client put the jwt
on .me. the fake now matches the real SDK shape.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
the `authenticated` kwarg was a redundant degree of freedom: the
allowlist already fully determines which NSIDs need the caller's
session, and both entries are auth-only endpoints. the flag added a
knob for callers (LLMs) to guess at, with a misleading failure mode
when guessed wrong. now allowlisted NSIDs authenticate automatically
and everything else is always public — no caller-supplied knob can
widen the boundary. the kwarg is kept, ignored, so existing callers
don't fail validation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@zzstoatzz zzstoatzz changed the title fix(mcp): authenticated query never worked — JWT read from the wrong object fix(mcp): authenticated queries never worked — and the auth knob shouldn't exist Jul 17, 2026
zzstoatzz and others added 2 commits July 17, 2026 14:07
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@zzstoatzz
zzstoatzz merged commit a95ffb6 into main Jul 18, 2026
3 checks passed
@zzstoatzz
zzstoatzz deleted the fix/authenticated-query-jwt branch July 18, 2026 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant