Skip to content

Conversation

bhosmer-ant
Copy link
Contributor

@bhosmer-ant bhosmer-ant commented Oct 6, 2025

Simplify to single OAuth pattern with separate auth server

This PR simplifies the MCP example server by removing the integrated OAuth mode (previously "AUTH_MODE=integrated"), leaving only the separate auth server pattern. This creates a cleaner, more maintainable codebase that better demonstrates production-ready OAuth delegation.

Summary of Changes

  • Removed integrated OAuth mode - The codebase no longer supports embedded OAuth within the MCP server
  • Split into two distinct servers - Clear separation between auth-server and mcp-server (previously conditional)
  • Improved documentation - Added practical examples and clearer explanations
  • Fixed security issues - Addressed CodeQL alerts for information exposure and missing rate limiting

Why This Simplification?

The separate auth server pattern better represents real-world deployments where authentication is delegated to specialized providers (Auth0, Okta, Google OAuth, etc). The integrated mode added complexity without providing significant educational value.

Test Status

✅ All 79 tests pass
✅ Build and lint successful
✅ Security vulnerabilities fixed

The workspace names were changed during refactoring but package-lock.json wasn't updated, causing CI failures with npm ci
Simplified the repository to have a single OAuth pattern with separate auth and MCP servers at the top level. Preserved embedded OAuth documentation as an alternative pattern.
- Fix information exposure: return generic error instead of stack traces in sse.ts
- Add missing rate limiting to root route in index.ts
- Rename oauth-patterns.md to oauth-architecture-patterns.md for clarity
- Fix session-ownership.md test commands to run from mcp-server directory
- Update redisTransport.ts path reference to include mcp-server prefix
Server starts immediately and retries auth connection in background.
Splash page and health endpoint remain accessible in degraded mode.
Fix PKCE implementation, SSE parsing, error handling, and usage clarity.
Add --help flag and improve output messaging for both examples.
- Add /health endpoint to docs/endpoints.md for MCP server
- Document degraded mode behavior in Common Issues section
- Update OAuth metadata endpoint to mention 503 responses
Consolidate three redundant 'Production Replacement' sections into
a single canonical location in docs/oauth-architecture-patterns.md.
Both server READMEs now point to this guide.
- Create docs/customization-guide.md with guidance on replacing demo functionality
- Add customization section to main README
- Fix all references to renamed oauth-architecture-patterns.md
- Update repository structure comments to clarify what to replace vs keep
- Remove unused mcpAuthMetadataRouter import
- Fix authMetadata type (use Record<string, unknown> instead of any)
- Add rate limiting to all MCP endpoints (/mcp, /sse, /message)
Add documentation explaining that SSE transport requires /sse endpoint
and Streamable HTTP requires /mcp endpoint. This is a common mistake
when using MCP Inspector.
@bhosmer-ant bhosmer-ant merged commit afb8d6a into main Oct 7, 2025
4 checks passed
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