Unable to specify callback-port for MCP with Oauth, therefore authentication link is computed with wrong callback uri + callback handler listen to wrong port.
Steps to Reproduce
Run MCP with no-default (8787) callback port
connect
unable to auth
Operating System
MacOS
Version Information
About Cursor CLI │
│ │
│ CLI Version 2026.02.27-e7d2ef6 │
│ Model Claude 4.6 Opus (Thinking) │
│ OS darwin (arm64) │
│ Terminal iterm2 │
│ Shell zsh
Hey, thanks for the report. To help track this down, could you share a bit more detail?
Which MCP server are you connecting to, and how is the non-default callback port configured? For example, is it set on the server side, or are you specifying it somewhere in your mcp.json?
What port does the auth link end up using vs. what port should it use?
If you can, a screenshot or log output of the auth flow would help.
The team is aware of OAuth-related issues with MCP in the CLI. The more specifics we have, the easier it is to narrow this down.
Hey, thanks for the details and the screenshot, that really helps.
I can see the issue. The CLI is currently hardcoded to use port 8787 for the OAuth callback and it doesn’t respect the custom port configured on the server side. The fact that it works in the IDE but not in the CLI confirms this is a CLI-side bug.
I’ve passed this along to the team with the details from your message.
As a temporary workaround, can you switch toolhive to port 8787 so you can unblock yourself?