Skip to content

feat(oauth): add OAuth authentication for MCP HTTP mode#153

Open
jwerle wants to merge 1 commit intomainfrom
jwerle/oauth-integration
Open

feat(oauth): add OAuth authentication for MCP HTTP mode#153
jwerle wants to merge 1 commit intomainfrom
jwerle/oauth-integration

Conversation

@jwerle
Copy link
Member

@jwerle jwerle commented Mar 9, 2026

  • discover oauth server metadata, expose protected resource metadata, and introspect bearer tokens for incoming requests
  • pass auth'd access tokens through to Socket API calls returning 401/403 when auth fails

@jwerle jwerle requested review from Copilot and kapravel March 9, 2026 23:44
@jwerle jwerle self-assigned this Mar 9, 2026
@jwerle jwerle added the enhancement New feature or request label Mar 9, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds OAuth 2.0 authentication support for the MCP server when running in HTTP mode. It implements the full OAuth resource-server flow: discovery of the upstream authorization server's metadata, exposure of a protected resource metadata endpoint (RFC 9728), per-request Bearer token introspection, scope checking, and forwarding the validated token to Socket API calls. Non-OAuth HTTP mode and stdio mode continue to work with a static API key.

Changes:

  • Added OAuth metadata discovery, token introspection (verifyAccessToken), and request authentication (authenticateRequest) functions with all associated helpers
  • Exposed /.well-known/oauth-authorization-server and /.well-known/oauth-protected-resource endpoints when OAuth is enabled
  • Threaded extra.authInfo.token through to Socket API calls so authenticated tokens are forwarded, with explicit 401/403 error handling

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- discover oauth server metadata, expose protected resource metadata, and introspect bearer tokens for incoming requests
- pass auth'd access tokens through to Socket API calls returning 401/403 when auth fails
@jwerle jwerle force-pushed the jwerle/oauth-integration branch from 3ea63ac to 35797fc Compare March 10, 2026 03:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants