Cursor CLI MCP Callback Port

,

Where does the bug appear (feature/product)?

Cursor CLI

Describe the Bug

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

Does this stop you from using Cursor

No - Cursor works, but with this issue

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 hey! Thanks for the reply :slight_smile: I’ll respond to you by points:

  • toolhive, server side; note tho that via Cursor IDE it works no problem
  • 5555, while agent expect 8787
  • screenshot below, I get an auth error by the IDP because obviously the redirect uri is malconfigured

Note also that with other tools, there is plenty of options to change the callback port, ad example with Claude:

“oauth”: {
“callbackPort”: 5555
}

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?

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.