Skip to content

SSO sends PKCE; no agent is exposed over MCP unless named - #364

Merged
antiv merged 1 commit into
mainfrom
sso-pkce-mcp-exposed-default
Nov 15, 2026
Merged

antiv merged 1 commit into
mainfrom
sso-pkce-mcp-exposed-default

Conversation

@antiv

@antiv antiv commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Two findings from the #206 re-check.

SSO: PKCE (S256) for Google and GitHub

server/oauth_routes.py passes code_challenge_method="S256" to both providers. Authlib 1.8 then sends a code challenge with the login redirect, keeps the verifier in the session next to the state, and sends it with the code on the callback. A code taken from the redirect is of no use without the verifier.

  • Checked on a running server: /auth/login/google and /auth/login/github now redirect with code_challenge and code_challenge_method=S256.
  • Not checked: a full sign-in against the real providers. Both document PKCE support for web apps with a client secret. Please sign in once with each before release.

MCP_EXPOSED_AGENTS exposes no agent when unset

It defaulted to chess_mate_root, so any installation with an agent of that name served it at /agents/chess_mate_root/mcp without anyone choosing to. Now an unset or empty value exposes none, and .env.example shows the variable commented out.

Upgrade note for the 2.0 release notes: an installation that relied on the default has to set MCP_EXPOSED_AGENTS=chess_mate_root.

Tests

  • shared/test/test_oauth_pkce.py checks:
    • both clients use S256;
    • the full GitHub flow through the real routes and session: the verifier sent with the token request hashes to the challenge in the redirect.
  • test_mcp_auth.py (TestExposedAgents) checks unset, empty and named values.
  • Mutation checks: removing S256 from either provider, or restoring the old default, fails the tests.
  • Full suite: 2044 tests, 1 skipped. test_client_contract.py is unchanged and passes.

Docs

  • sso-setup.md, auth-and-access.md, mcp-servers.md and openai-api-and-mcp.md are updated. auth-and-access.md also called the session cookie encrypted; it is signed.
  • docs/reference/configuration.md is regenerated.
  • drift reports no guides.

- Google and GitHub sign-in use PKCE (S256): the login redirect carries a
  code challenge, Authlib keeps the verifier in the session with the state,
  and the callback sends it with the code.
- MCP_EXPOSED_AGENTS defaulted to chess_mate_root, so any installation with
  an agent of that name served it at /agents/chess_mate_root/mcp. Unset now
  exposes none; .env.example no longer sets it.
- Docs: sso-setup, auth-and-access (the session cookie is signed, not
  encrypted), mcp-servers, openai-api-and-mcp; reference regenerated.
@antiv
antiv merged commit 5553096 into main Nov 15, 2026
2 checks passed
@antiv
antiv deleted the sso-pkce-mcp-exposed-default branch November 22, 2026 07:26
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