You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Allow custom OAuth redirect URI configuration for MCP servers #7377
This feature request is focused on adding support for custom OAuth redirect URI configuration for MCP servers.
Problem
OpenCode currently hardcodes the OAuth callback URL as http://127.0.0.1:19876/mcp/oauth/callback. Many OAuth servers (Azure AD, Okta, Keycloak, GitHub OAuth apps, etc.) require exact matching of pre-registered redirect URIs, which prevents users from:
Using OpenCode with enterprise OAuth providers that use different domains
Configuring OAuth for deployment scenarios with custom hostnames
Using Claude Code with different callback port configurations
Design Philosophy
OpenCode already allows overriding the clientId to impersonate different OAuth clients. Since OAuth servers validate both the client ID and the redirect URI as part of the security model, it follows logically that users should also be able to override the redirect URI.
Without this capability, there's an asymmetry where users can point to any OAuth server and any client, but are still constrained by OpenCode's hardcoded callback URL. This defeats the purpose of flexible client configuration.
Therefore, supporting custom redirectUri is essential for feature completeness when users have the ability to override clientId.
Solution
Add a new optional redirectUri configuration parameter to MCP OAuth settings, allowing users to specify custom callback URLs:
If opencode is started in WSL, 127.0.0.1 does not work because it doesn't allow to connect to a port in WSL. But using localhost instead does work.
@rekram1-node Should we rename 127.0.0.1 to localhost as the default? It would fix WSL compatibility and is more standard. Or would you prefer keeping 127.0.0.1 with the redirectUri override option? Or should I create a separate issue to start a discussion?
@rekram1-node Can you reopen this issue? PR #7379 was reverted in commit 33290c5 due to a regression. I've submitted a new fix in PR #9034 that addresses the original feature request while avoiding the regression.
Activity
github-actions commentedon Jan 8, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
christso commentedon Jan 8, 2026
PR Created: #7379 - feat: add OAuth redirect URI configuration for MCP servers
This PR implements the feature requested in this issue. Ready for review!
YPares commentedon Jan 12, 2026
If opencode is started in WSL,
127.0.0.1does not work because it doesn't allow to connect to a port in WSL. But usinglocalhostinstead does work.christso commentedon Jan 16, 2026
@rekram1-node Should we rename 127.0.0.1 to localhost as the default? It would fix WSL compatibility and is more standard. Or would you prefer keeping 127.0.0.1 with the redirectUri override option? Or should I create a separate issue to start a discussion?
christso commentedon Jan 17, 2026
@rekram1-node Can you reopen this issue? PR #7379 was reverted in commit 33290c5 due to a regression. I've submitted a new fix in PR #9034 that addresses the original feature request while avoiding the regression.
0x7ffc commentedon Jan 28, 2026
+1 for this
nieomylnieja commentedon Feb 19, 2026
+1 for this, our MCP server cannot be configured with OAuth due to this
renanwilliam commentedon Mar 3, 2026
I have the same situation, but regarding a https scheme issue. My endpoint requires https :/
leoseo-1113 commentedon Mar 23, 2026
I was having a same issue, when putting slack MCP to Opencode. This helped me.
https://github.com/korotovsky/slack-mcp-server
rekram1-node commentedon Apr 9, 2026
been a while sorry yall, @egze pr looks p good, need to verify it. Will test and prolly release it tmr