MCP client for `X` failed to start: handshaking with MCP server failed: connection closed: initialize response
What version of Codex is running?
codex-cli 0.53.0
What subscription do you have?
Pro
Which model were you using?
GPT-5
What platform is your computer?
Darwin 24.6.0 arm64 arm
What issue are you seeing?
All servers fail at once
MCP client for X failed to start: handshaking with MCP server failed: connection closed: initialize response
What steps can reproduce the bug?
Uploaded thread: 019a38db-7497-7b12-bbaa-75edef1f4150
What is the expected behavior?
MCP servers load
Additional information
model = "gpt-5" <br>model_reasoning_effort = "high"
\[features\] <br>rmcp_client=true <br>web_search_request=true
\[mcp_servers.svelte\] <br>command = "npx" <br>args = \["-y", "@sveltejs/mcp"\]
\[mcp_servers.sentry\] <br>command = "npx" <br>args = \["-y", "mcp-remote@latest", "[https://mcp.sentry.dev/mcp](<https://mcp.sentry.dev/mcp>)"\]
\[mcp_servers.posthog\] <br>command = "npx" <br>args = \[ "-y", "mcp-remote@latest", "[https://mcp.posthog.com/sse](<https://mcp.posthog.com/sse>)", "--header", "Authorization: Bearer {KEY}"\]
\[mcp_servers.context7\] <br>command = "npx" <br>args = \["-y", "@upstash/context7-mcp", "--api-key", "{KEY}"\]
\[mcp_servers.linear\] <br>command = "npx" <br>args = \["-y", "mcp-remote", "[https://mcp.linear.app/sse](<https://mcp.linear.app/sse>)"\]
\[mcp_servers.stripe\] <br>command = "npx" <br>args = \[ "mcp-remote", "[https://mcp.stripe.com/](<https://mcp.stripe.com/>)" \]
#\[mcp_servers.dataforseo\] <br>#command = "npx" <br>#args = \[ "-y", "dataforseo-mcp-server"\]
#\[mcp_servers.dataforseo.env\] <br>#DATAFORSEO_USERNAME = "{email}" <br>#DATAFORSEO_PASSWORD = "{KEY}"
\[mcp_servers.supabase\] <br>command = "npx" <br>args = \["-y", "@supabase/mcp-server-supabase@latest"\]
\[mcp_servers.supabase.env\] <br>SUPABASE_ACCESS_TOKEN = "{KEY}"
\[mcp_servers.vercel\] <br>command = "npx" <br>args = \[ "mcp-remote", "[https://mcp.vercel.com](<https://mcp.vercel.com>)" \]
\[mcp_servers.trigger\] <br>command = "npx" <br>args = \[ "trigger.dev@latest", "mcp", "--dev-only" \]
43 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Can you specify which of your MCP servers stopped working so I can try to repro?
I got this error with Linear:
I am also getting this error with Posthog:
I'm currently getting this for the Chakra UI MCP server as well:
MCP client forchakra-uifailed to start: handshaking with MCP server failed:connection closed: initialize response
https://chakra-ui.com/docs/get-started/ai/mcp-server
Codex only supports streamable http servers. SSE is deprecated and we may or may not backport support.
Linear's updated server is at
https://mcp.linear.app/mcpand posthog looks like MCP.@jozef-barton I just tried that MCP server and it worked fine
What is in your config.toml?
<img width="1944" height="368" alt="Image" src="https://github.com/user-attachments/assets/b60017eb-fb17-41ad-b3eb-f1817aac71c2" />
@kirso I think all of your MCP issues are either unsupported SSE servers or incorrect configuration. I just tried all of them and I think they're all working. Can you reply with a specific broken server and your config if you think there is still an issue?
Thank you for checking this for me. Here's my config.toml.
I am getting this when trying to add the Shadcn MCP:
[mcp_servers.shadcn]
command = "cmd"
args = ["/c", "npx", "-y", "@shadcn@latest", "mcp"]
startup_timeout_sec = 20.0
[mcp_servers.shadcn.env]
SystemRoot = "C:\\Windows"
■ MCP client for
shadcnfailed to start: handshaking with MCP server failed: connection closed: initialize responsesame error.
I tested my own local Nodejs file, still get the error:
■ MCP client for
ppt-agentfailed to start: handshaking with MCP serverfailed: connection closed: initialize response
@gpeal apologies for the late response, here is a list of servers that is still failing for me.
Svelte
<img width="852" height="324" alt="Image" src="https://github.com/user-attachments/assets/cc29102a-b1a0-452e-95ea-68dac3564e0d" />
Setup:
<img width="2280" height="784" alt="Image" src="https://github.com/user-attachments/assets/c1b3757d-2ca1-4ea1-99b9-aa3cacc03970" />
Official docs: https://svelte.dev/docs/mcp/remote-setup#Codex-CLI
Once I changed to:
For a remote implementation, it picked it up, so it seems indeed the error is SSE and in case you are not supporting it then its expected behavior
To add, did something change? They all used to work fine and broke a few weeks back.
Intersting, both the local and remote svelte MCP worked just fine when I tried it. What happens if you run that npx command in the same termianl outside of the terminal? Do you see it start successfully? If so, the command should appear as if it's running but not doing anything but no errors and it should not exit on its own.
<img width="1897" height="686" alt="Image" src="https://github.com/user-attachments/assets/f2e0e189-7742-4832-aa07-02c34e627231" />
@YikaJ can you run
tail -f ~/.codex/log/codex-tui.logif you're on macOS or check the logs from the equivalent CODEX_HOME path on Windows? When I run it, I see these logs because I haven't fully configured ppt-agent so maybe you have a similar issue:For anybody running into the same problem I did, I used some ChatGPT and tinkering and found the problem was that codex was pointed to Node 23 when the MCP server I'm using only supports Node 20/22. Changing that fixed the problem.
I get the same error following the instructions on the Zen MCP server page for codex.
``
[mcp_servers.zen]
command = "bash"
args = ["-c", "for p in $(which uvx 2>/dev/null) $HOME/.local/bin/uvx /opt/homebrew/bin/uvx /usr/local/bin/uvx uvx; do [ -x \\\"$p\\\" ] && exec \\\"$p\\\" --from git+https://github.com/BeehiveInnovations/zen-mcp-server.git zen-mcp-server; done; echo 'uvx not found' >&2; exit 1"]
tool_timeout_sec = 1200
[mcp_servers.zen.env]
PATH = "/usr/local/bin:/usr/bin:/bin:/opt/homebrew/bin:$HOME/.local/bin:$HOME/.cargo/bin:$HOME/bin:/opt/docker/zen-mcp-server"
GEMINI_API_KEY = "redacted"
OPENAI_API_KEY = "redacted"
OPENROUTER_API_KEY = "redacted"
CUSTOM_API_URL = "https://api.z.ai/api/paas/v4"
CUSTOM_API_KEY = "redacted"
CUSTOM_MODEL_NAME = "glm-4.6"
DEFAULT_MODEL = "auto"
DEFAULT_THINKING_MODE_THINKDEEP = "high"
CONVERSATION_TIMEOUT_HOURS = "24"
MAX_CONVERSATION_TURNS = "40"
LOG_LEVEL = "DEBUG"
DISABLED_TOOLS = "analyze,refactor,testgen,secaudit,docgen,tracer"
ZEN_MCP_FORCE_ENV_OVERRIDE = "false"
COMPOSE_PROJECT_NAME = "zen-mcp"
TZ = "UTC"
LOG_MAX_SIZE = "10MB
Hi all,
Can I have help using a stdio mcp running via an .exe file?
I keep having this error
MCP client for autodeskAECModel failed to start: handshaking with MCP server failed: connection closed: initializeresponse
@jozef-barton Could you elaborate a bit?
How did you change codex pointing node from 23 to 22?
Thanks! This fixed it for me! I switched back to Node 22 and it worked.
I've partially solved this for the majority of MCP servers by switching them to streaming http and just using
codex mcp logincommand.However one server is still throwing the same error that I can't bypass and I just can't figure out from the docs how to set it up.
The MCP requires an Auth Bearer token
It still fails with handshaking, it doesn't support oath and is pure SSE with the old implementation it never loads, but used to load fine like a month ago.
Am I missing something here?
I think what is frustrating that a lot of these are not backward compatible after changes, so its hard to find specific issues. They work one month, and then stop after internal changes but I might also have a skill issue...
I was trying to add decriptor/AvaloniaUI.MCP.
I got the following errors:
After a lot of Trial and error me and AI figured out the reason for it was that the logger in AvaloniaUI.MCP vomits logs to STDOUT.
So Codex receives garbage before the JSON handshake.
I fixed the code in AvaloniaUI.MCP by editing the following:
to
I imagine it is the same for a lot other MCPs failing.
I find the problem.
In the code, I was having some Write.Console for debugging! Interesting, Claude Code don't care; instead, Codex was literally causing the handshaking to fail.
I also had same issue I just installed latest npm package for playwright globally using npm i -g @playwright/mcp@latest and it worked.
@gpeal You need to make Codex handle logs being sent before the handshake. We've used at least 3 other clients (including Claude Code as well as open source ones) and none of them had issues with this. It's not debuggable either as all you're sending is
connection closed: initialize response. We've got a bunch of people running into this in this thread alone.The Codex team is absolutely terrible. I pay $200 a month for the subscription, and I encounter these kinds of minor problems every single day. Every other CLI works fine except for theirs, and the newline input issue hasn't been fixed for almost a year. They should really beg Claude Code to teach them something useful.
@AyinMostima but we did get Sora app 😂
Joke aside ... I have same issues with Supabase MCP ... and the only solution is to re-authenticate every day when I start Codex
I haven't seen this issue with any other model ... just codex.
Worked for me as well. However I had to clear my
.npmfolder (rm -rf Users/<username>/.npm) for it to work after changing the node version.I am on node 22, and this didn't help unfortunately. Its always an issue with specific MCP servers that require some special treatment like env.
This for instance triggers the same error :/
I also encountered this problem recently when using @playwright/mcp@latest. Then I tried to start it directly using npx in the terminal.
After deleting the npm/_npx/9833c18b2d85bc59 directory under the home directory, the mcp returned to normal.
I have same error with supabase mcp, i setup use
codex mcp add supabase --url http://localhost:54321/mcpaccording to https://supabase.com/docs/guides/getting-started/mcp , I also have added
I'm having this problem with the https://github.com/microsoft/azure-devops-mcp server
Getting the same issue with context 7 MCP
with the proper context 7 config
it's trying to force OAuth even when using the context 7 API url https://context7.com/api/v2 as well
What worked for me with Posthog (mcp-remote) was to follow the advice here for Cursor and Claude Desktop.
I used an AUTH_TOKEN and no spaces in the header, like this:
[mcp_servers.posthog]
command = "mcp-remote"
args = [
"https://mcp-eu.posthog.com/sse",
"--header",
"Authorization:${CUTS_POSTHOG_MCP_API_KEY}",
]
env = { CUTS_POSTHOG_MCP_API_KEY = "Bearer phx_**************************" }
Having the problem with https://github.com/laravel/boost
⚠ MCP client for
laravel-boostfailed to start: MCP startup failed:handshaking with MCP server failed: connection closed: initialize response
⚠ MCP startup incomplete (failed: laravel-boost)
[mcp_servers.laravel-boost]
command = "php"
args = ["artisan", "boost:mcp"]
I having the same problem with
XcodeBuildMCP(version2.0.7):And here's Codex' explanation of the problem:
<img width="762" height="500" alt="Image" src="https://github.com/user-attachments/assets/2dc34ebf-5f43-4202-892c-22dfea8df15e" />
Can you try with hosted platform installation?
Go to https://supabase.com/docs/guides/getting-started/mcp
For platform, select "Hosted"
For project, select the project you want.
And select "Codex" as the client.
It should give you a command that looks like this:
"codex mcp add supabase --url https://mcp.supabase.com/mcp..."
After doing that, don't forget to run "codex mcp login supabase"
This was the solution for me as well.
It would be a nice addition if Codex Desktop / CLI is telling you that there is an issue while running the npx command.
The Codex CLI gives you more information but no details about the failure:
Same here. Remote one works, just not the local one.
I had to add the env variable for the MCP in the config.toml.
NODIST_PREFIX = "C:\\Program Files (x86)\\Nodist"
I took a closer look at the current
codex doctorMCP check and I think there is a small support-friendly step that would help reports like the ones in this thread without trying to fully start every MCP server fromdoctor.A narrow MVP would be to keep the existing
mcp.configdetail strings, but also emit structuredissues[]entries incodex doctor --jsonfor the MCP cases that can already be detected locally:cwddoes not exist;env_varsare absent from the launching environment;env_varsusessource = "remote"for a local stdio server;That would make the uploaded doctor report easier to triage because support tooling could read
cause,measured,expected,remedy, and the config field path (mcp_servers.<name>...) instead of parsing free-form detail lines. It also complements #19023: docs can explainenvvsenv_vars, while doctor can show exactly which forwarded variable or command path is missing on the user’s machine.I prepared a local patch for this shape, including tests around missing
env_varsand remote-sourced env vars. I am not opening an unsolicited PR because the repo’s contribution policy says external code contributions are invitation-only, but if this direction is useful I can share the branch/patch or adapt the scope.Branch with the local implementation: https://github.com/SylvainWinning/codex/tree/codex/mcp-doctor-diagnostics
I had the same issue. It happens because network access is disabled for Codex, which blocks the automatic setup. You can fix it by manually installing context7. Just open your terminal and run this command:
npx ctx7 setupSadly I don't have any data/logs but this used to work around Jan/Feb 2026 when I had sentry MCP setup (it would just open a browser window like claude code) to get the right tokens.
Right now in wsl when I open codex I am getting the:
Following Sentry's docs: https://mcp.sentry.dev/?ide=codex-cli
I also encountered this issue when using UnityMCP
⚠ MCP client for
unityMCPfailed to start: MCP startup failed: handshaking with MCP server failed: connection closed:initialize response
⚠ MCP startup incomplete (failed: unityMCP)
It works fine with the HTTP server, but fails to connect when using Stdio.
I tried the official configuration and versions of Node.js 18-23, but neither worked. Installing CTX7 also didn't help.