Skip to content

Conversation

@christso
Copy link
Contributor

@christso christso commented Jan 17, 2026

Summary

Re-implements the redirectUri option for MCP OAuth configuration, allowing users to specify a custom callback URL for OAuth flows.

  • Adds redirectUri config option to McpOAuth schema
  • Updates McpOAuthProvider to use custom redirect URI when provided
  • Updates McpOAuthCallback.ensureRunning() to support custom port/path
  • Adds parseRedirectUri() utility function

Key difference from original PR #7379: The OAuth callback server is now started lazily in startAuth() only when authentication is actually needed, rather than preemptively in create() for all remote servers. This fixes the regression where non-OAuth MCP servers would fail to connect.

Closes #7377

Test plan

  • Existing MCP tests pass (6 tests)
  • New parseRedirectUri tests pass (3 tests)
  • New ensureRunning with custom redirectUri test passes (1 test)
  • Manual test: Context7 remote MCP server connects without OAuth callback server
  • Manual test: Local filesystem MCP server connects normally

Manual test results

┌  MCP Servers
│
●  ✓ context7 connected
│      https://mcp.context7.com/mcp
│
●  ✓ filesystem connected
│      npx -y @modelcontextprotocol/server-filesystem /tmp
│
└  2 server(s)

Re-implements the redirectUri option for MCP OAuth configuration, allowing
users to specify a custom callback URL for OAuth flows.

Key difference from original PR anomalyco#7379: the OAuth callback server is now
started lazily in startAuth() only when authentication is actually needed,
rather than preemptively in create() for all remote servers. This fixes the
regression where non-OAuth MCP servers would fail to connect.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

christso and others added 2 commits January 17, 2026 18:43
Ensures the debug command uses the configured redirectUri when testing
OAuth flows, making it consistent with the main auth flow.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

[FEATURE]: Allow custom OAuth redirect URI configuration for MCP servers

1 participant