Skip to content

CTX7-884: OAuth Support for MCP#1176

Merged
enesgules merged 20 commits into
masterfrom
CTX7-884
Jan 8, 2026
Merged

CTX7-884: OAuth Support for MCP#1176
enesgules merged 20 commits into
masterfrom
CTX7-884

Conversation

@fahreddinozcan

@fahreddinozcan fahreddinozcan commented Dec 5, 2025

Copy link
Copy Markdown
Contributor

This PR adds OAuth 2.0 authentication support to the MCP server, enabling secure access control for MCP clients.

Changes

New OAuth-protected endpoint (/mcp/oauth) - Requires authentication via JWT tokens
JWT validation - Validates tokens against the authorization server's JWKS endpoint with caching (1 hour TTL)
OAuth Protected Resource Metadata - Implements RFC 9728 discovery endpoint at /.well-known/oauth-protected-resource
WWW-Authenticate header - Returns resource metadata URL to help clients discover the authorization server
Backward compatibility - The existing /mcp endpoint remains available for anonymous access

New Files

packages/mcp/src/lib/jwt.ts - JWT validation utilities using jose library

Configuration

AUTH_SERVER_URL - Authorization server URL (default: https://context7.com)
RESOURCE_URL - Resource server URL for metadata

@linear

linear Bot commented Dec 5, 2025

Copy link
Copy Markdown

CTX7-884 oauth for mcp

@fahreddinozcan fahreddinozcan changed the title Ctx7 884 CTX7-884: OAuth Support for MCP Dec 8, 2025
Comment thread packages/mcp/src/lib/api.ts Outdated
Comment thread packages/mcp/src/lib/jwt.ts Outdated
Comment thread packages/mcp/src/index.ts Outdated
Comment thread packages/mcp/src/index.ts Outdated
Comment thread packages/mcp/src/lib/jwt.ts Outdated
Comment thread packages/mcp/src/lib/jwt.ts Outdated
Comment thread packages/mcp/src/lib/jwt.ts Outdated
@enesgules
enesgules merged commit ef82f30 into master Jan 8, 2026
4 checks passed
@enesgules
enesgules deleted the CTX7-884 branch January 8, 2026 17:17
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.

2 participants