OmniscioGuidesOAuth callback port is already in use
OAuth callback port is already in use: the MCP sign-in fix
Without a fixed port Claude Code takes any free one, so this message mostly comes from a port pinned for a server. The fix is either to free the port or to move yours.
Checked against Anthropic's documentation on November 25, 2026. By the Omniscio team. Updated .
What is the exact message?
OAuth callback port <port> is already in use — another process may be holding it. Run `lsof -ti:<port> -sTCP:LISTEN` to find it.On Windows the suggested command is different: netstat -ano | findstr :<port>.
A related message means the opposite problem, no port at all:
No available ports for OAuth redirectWhat does it mean?
Signing in to a remote MCP server with OAuth runs in two halves. Claude Code opens a small listener on your machine and the browser sends the sign-in result back to it. That listener needs one local port, and the message means something else already has it.
A random port is the default, so this mostly happens when a port is fixed, which you would do because the server registered a redirect URI in advance and only accepts that one address, of the form http://localhost:PORT/callback. If you never pinned a port, the port was free when Claude Code picked it and taken since; a fresh attempt picks again.
Where the fixed port comes from
--callback-portwhen you add the server:claude mcp add --transport http --callback-port 8080 my-server https://mcp.example.com/mcp.callbackPortin theoauthobject ofclaude mcp add-json, which is the route for a JSON entry.- The
MCP_OAUTH_CALLBACK_PORTenvironment variable, which sets the same port without a flag.
Before you change any configuration: a listener from an earlier attempt, or from another Claude Code window, may still hold the port. Quitting that session frees it with no configuration change.
How do I fix it?
- Find the program holding the port. Run the command from the message, with your port number in place of
<port>. On macOS and Linux,lsof -ti:8080 -sTCP:LISTENprints the process ID and nothing else; on Windows,netstat -ano | findstr :8080prints the owning PID in its last column. - Name it, then stop it or wait for it. On macOS and Linux,
ps -p <pid>names the process behind the ID, andkill <pid>stops it. On Windows,tasklist /FI "PID eq <pid>"names it andtaskkill /PID <pid> /Fends it; without/FWindows only asks the process to close, which a background holder will refuse. If it is a listener from your own earlier sign-in attempt, quitting that session is enough. - Or move your port. If another program needs that port permanently, pick a different one and register the matching redirect URI,
http://localhost:<newport>/callback, with the server. Then set it withMCP_OAUTH_CALLBACK_PORT, or re-add the server with--callback-port. - Start the sign-in again. In the session, run
/mcp, select the server and choose the sign-in option. From a terminal,claude mcp login <name>runs the same flow. It already detects a machine with no local browser and prints the URL instead of opening one;--no-browserforces that URL prompt even when a browser is present. Open the URL wherever you have a browser, then paste the full redirect URL from the address bar back at the prompt — that step needs an interactive terminal, so connect withssh -t.
When the message is No available ports for OAuth redirect
Nothing holds a port here; Claude Code cannot bind one at all. Something on the machine is blocking local listeners on 127.0.0.1, and Anthropic names security software and a sandbox policy as the examples. Allow Claude Code to listen on a local port, then start the sign-in again from /mcp.
Before v2.1.268 Claude Code had no fallback to an operating-system-assigned port, so the same message appeared when only the ports it picks for itself were unavailable, which can happen on Windows hosts where Hyper-V reserves ranges that cover them. On an older build, updating is the first thing to try.
How do I know it is fixed?
- The browser opens the server's sign-in page instead of the flow stopping in the terminal.
- After you approve, the server shows as connected in
/mcp, andclaude mcp listin a shell shows it connected. - The callback port is no longer reported as in use on a second attempt, which tells you the listener was released.
Where these answers come from
- Anthropic's error reference, OAuth callback port is already in use, read November 25, 2026: the exact message, the Windows command, the three fixes and the retry through
/mcp. - The same page, No available ports for OAuth redirect, read the same day: the cause, the security-software note and the v2.1.268 change.
- MCP, Use a fixed OAuth callback port, read the same day: the random default,
--callback-portand thehttp://localhost:PORT/callbackform. The same page's pre-configured OAuth credentials section carriescallbackPortinadd-json, and its command-line authentication section carries--no-browser. - Environment variables, read the same day: the
MCP_OAUTH_CALLBACK_PORTrow.
Common questions
What does OAuth callback port is already in use mean?
You were signing in to a remote MCP server and Claude Code needed to listen on one local port to catch the browser's callback, but another program holds that port. Without a fixed port Claude Code picks any free one, so the message mostly appears when MCP_OAUTH_CALLBACK_PORT or --callback-port names a specific port.
How do I find the program holding the port?
Run the command the message gives you: lsof -ti:<port> -sTCP:LISTEN on macOS and Linux, or netstat -ano | findstr :<port> on Windows. Stop that program or wait for it to finish, then start the sign-in again from /mcp.
Can I make Claude Code use a different port?
Yes. Set MCP_OAUTH_CALLBACK_PORT, pass --callback-port when you add the server, or set callbackPort in the oauth object for claude mcp add-json. If the server registered a redirect URI in advance, register the new one first, because the port in the URI and the port Claude Code listens on have to match.
What does No available ports for OAuth redirect mean?
Claude Code could not bind any local port for the sign-in callback. Something on the machine is stopping it from listening on 127.0.0.1, such as security software or a sandbox policy. Before v2.1.268 the message also appeared when only the ports Claude Code picks for itself could not be bound.
How do I retry the MCP sign-in after freeing the port?
Run /mcp in the session, select the server and choose the sign-in option again. From a terminal, claude mcp login <name> starts the same flow, and --no-browser forces the URL prompt even when a local browser is present.