[BUG] --callback-port not respected — OAuth listener not started when using /mcp authentication flow.
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
I am trying to connect Salesforce's hosted MCP Servers to Claude code. I have created an External Client App in Salesforce with the appropriate settings and a callback URL of http://localhost:8080/callback. The MCP config in Claude was created with claude mcp add --transport http sfdc-sobject-reads --client-id XXXXXXXXX --callback-port 8080 https://api.salesforce.com/platform/mcp/v1/platform/sobject-reads where XXXXXXX is the client id from Salesforce.
When I try and authenticate, the browser opens the Salesforce auth URL, I login, Chrome gets redirected to localhost:8080/callback?code=... but gets "connection refused" because Claude Code isn't listening.
I have spent over an hour with Claude code itself trying to sort it out and it finally said it was a bug and gave me this text to submit...
What Should Happen?
The Claude MCP authentication should listen on the port defined.
Error Messages/Logs
Nothing as such, the browser just says localhost refused to connect.
Steps to Reproduce
- Sign up for a Salesforce dev org. https://www.salesforce.com/products/free-trial/developer/
- Follow the instructions in this documentation. https://developer.salesforce.com/docs/platform/hosted-mcp-servers/guide/setup-overview.html, except use
http://localhost:8080/callbackfor the Callback URL. - Activate sobject-reads in the Setup area as per the documentation
- Use the command in the bug text to create an MCP server connection
- Inside Claude Code, use
/mcpand you will see the Salesforce MCP server needs authentication, try and authenticate, the screen pops on your browser (make sure you are still logged into Salesforce for automatic authentication). - Boom...
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.161 (Claude Code)
Platform
Anthropic API
Operating System
Other Linux
Terminal/Shell
Other
Additional Information
I am using Linux Mint and the standard terminal package. It is fully updated.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗