Skip to content

Connect self-hosted MCP clients with optional OAuth - #203

Merged
officialsuyogdixit merged 2 commits into
mainfrom
codex/mcp-oauth-self-hosted
Oct 2, 2026
Merged

officialsuyogdixit merged 2 commits into
mainfrom
codex/mcp-oauth-self-hosted

Conversation

@officialsuyogdixit

Copy link
Copy Markdown
Member

Self-hosted installations currently require a manually issued key for HTTP MCP. This adds optional OAuth at the installation's own /mcp: a signed-in member chooses projects, approves read access and optionally replies, then returns to the client. Local stdio plugins and manual keys keep working; MCP_OAUTH_ENABLED defaults to false.

The flow uses public-client registration, S256 PKCE, exact callbacks, issuer identification, resource-bound one-hour access tokens and rotating refresh credentials. Replayed codes/refresh credentials revoke their grant. Account revocation and password replacement invalidate connections. Existing server operation authorization still enforces current project permissions; OAuth cannot delegate owner administration, resolution, uploads or external GitHub writes. Migration 29 is additive and must be preserved during rollback.

Setup documentation includes discovery checks, Compose commands, client connection commands and a consent illustration. The consent screen shows the client-provided name and registered callback, with explicit callback recovery after an answer.

Validation: Node 24 full suite (520 passed, 39 environment-dependent skips, zero failures); four native PostgreSQL checks including concurrent code exchange and refresh replay; formatting, types, harness/docs, all builds, isolated application smoke and release checks. Actual Codex CLI OAuth login succeeded against a disposable loopback installation; the real MCP SDK read permitted feedback and denied extra project/write/admin access. Desktop/mobile consent inspected. HTTPS deployment and directory acceptance are separate, unverified gates; required CI remains the integration gate.

Closes #201.

@officialsuyogdixit
officialsuyogdixit enabled auto-merge (squash) October 2, 2026 02:19
@officialsuyogdixit
officialsuyogdixit merged commit 21ff3d2 into main Oct 2, 2026
9 of 12 checks passed
@officialsuyogdixit
officialsuyogdixit deleted the codex/mcp-oauth-self-hosted branch October 2, 2026 02:32
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.

Add optional OAuth connections for self-hosted MCP clients

1 participant