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" model_reasoning_effort = "high"
[features] rmcp_client=true web_search_request=true
[mcp_servers.svelte] command = "npx" args = ["-y", "@sveltejs/mcp"]
[mcp_servers.sentry] command = "npx" args = ["-y", "mcp-remote@latest", "https://mcp.sentry.dev/mcp"]
[mcp_servers.posthog] command = "npx" args = [ "-y", "mcp-remote@latest", "https://mcp.posthog.com/sse", "--header", "Authorization: Bearer {KEY}"]
[mcp_servers.context7] command = "npx" args = ["-y", "@upstash/context7-mcp", "--api-key", "{KEY}"]
[mcp_servers.linear] command = "npx" args = ["-y", "mcp-remote", "https://mcp.linear.app/sse"]
[mcp_servers.stripe] command = "npx" args = [ "mcp-remote", "https://mcp.stripe.com/" ]
#[mcp_servers.dataforseo] #command = "npx" #args = [ "-y", "dataforseo-mcp-server"]
#[mcp_servers.dataforseo.env] #DATAFORSEO_USERNAME = "{email}" #DATAFORSEO_PASSWORD = "{KEY}"
[mcp_servers.supabase] command = "npx" args = ["-y", "@supabase/mcp-server-supabase@latest"]
[mcp_servers.supabase.env] SUPABASE_ACCESS_TOKEN = "{KEY}"
[mcp_servers.vercel] command = "npx" args = [ "mcp-remote", "https://mcp.vercel.com" ]
[mcp_servers.trigger] command = "npx" args = [ "trigger.dev@latest", "mcp", "--dev-only" ]
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
- #5805
- #5855
- #5619
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:
■ MCP client for
linearfailed to start: handshaking with MCP server failed: Send message error Transport [rmcp::transport::worker::WorkerTransport<rmcp::transport::streamable_http_client::StreamableHttpClientWorker<rmcp::transport::auth::AuthClientreqwest::async_impl::client::Client> >] error: Client error: HTTP status client error (404 Not Found) for url (https://mcp.linear.app/sse), when send initialize request
I am also getting this error with Posthog:
■ MCP client for
posthogfailed to start: handshaking with MCP server failed: Send message error Transport [rmcp::transport::worker::WorkerTransport<rmcp::transport::streamable_http_client::StreamableHttpClientWorkerreqwest::async_impl::client::Client>] error: Client error: HTTP status client error (404 Not Found) for url (https://mcp.posthog.com/sse), when send initialize request
I'm currently getting this for the Chakra UI MCP server as well:
MCP client for chakra-ui failed to start: handshaking with MCP server failed: connection closed: initialize response
https://chakra-ui.com/docs/get-started/ai/mcp-server
I got this error with Linear:
■ MCP client for
linearfailed to start: handshaking with MCP server failed: Send message error Transport [rmcp::transport::worker::WorkerTransport<rmcp::transport::streamable_http_client::StreamableHttpClientWorkerrmcp::transport::auth::AuthClientreqwest::async_impl::client::Client] error: Client error: HTTP status client error (404 Not Found) for url (mcp.linear.app/sse), when send initialize request
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/mcp and posthog looks like MCP.
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
@jozef-barton I just tried that MCP server and it worked fine
[mcp_servers.chakra]
command = "npx"
args = ["-y", "@chakra-ui/react-mcp"]
What is in your config.toml?
@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.
model = "gpt-5-codex"
model_reasoning_effort = "medium"
experimental_use_rmcp_client = true
[projects."/Users/<user>/dev/<repo>"]
trust_level = "trusted"
[projects."/Users/<user>/dev/<repo>"]
trust_level = "trusted"
[projects."/Users/<user>/dev/<repo>"]
trust_level = "trusted"
[mcp_servers.chakra-ui]
command = "npx"
args = ["-y", "@chakra-ui/react-mcp"]
transport = "stdio"
startup_timeout_sec = 30
[mcp_servers.supabase]
url = "https://mcp.supabase.com/mcp?project_ref=<project_ref>&read_only=true&features=docs"
[mcp_servers.chakra-ui.env]
CHAKRA_PRO_API_KEY = "<api_key>"
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 shadcn failed to start: handshaking with MCP server failed: connection closed: initialize response
same error.
I tested my own local Nodejs file, still get the error:
■ MCP client for ppt-agent failed to start: handshaking with MCP server
failed: connection closed: initialize response
@gpeal apologies for the late response, here is a list of servers that is still failing for me.
Svelte
Setup:
[mcp_servers.svelte]
command = "npx"
args = ["-y", "@sveltejs/mcp"]
Official docs: https://svelte.dev/docs/mcp/remote-setup#Codex-CLI
Once I changed to:
[mcp_servers.svelte]
url = "https://mcp.svelte.dev/mcp"
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.
@gpeal apologies for the late response, here is a list of servers that is still failing for me.
Svelte
Setup:
[mcp_servers.svelte] command = "npx" args = ["-y", "@sveltejs/mcp"]
Official docs: svelte.dev/docs/mcp/remote-setup#Codex-CLI
Once I changed to:
[mcp_servers.svelte] url = "https://mcp.svelte.dev/mcp" 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.
ppt-agent
@YikaJ can you run tail -f ~/.codex/log/codex-tui.log if 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:
2025-11-05T16:16:41.417426Z INFO MCP server stderr (uv): 2025-11-05 08:16:41,417 - ERROR - mcp_server.py:71 - Unable to connect to the model, please set the PPTAGENT_MODEL, PPTAGENT_API_BASE, and PPTAGENT_API_KEY environment variables correctly
2025-11-05T16:16:41.417462Z INFO MCP server stderr (uv): ERROR:pptagent.mcp_server:Unable to connect to the model, please set the PPTAGENT_MODEL, PPTAGENT_API_BASE, and PPTAGENT_API_KEY environment variables correctly
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?
[mcp_servers.autodeskAECModel]
type = "stdio"
command = "C:\\Users\\xxx\\Documents\\aps-graphql\\src\\apsMcp.StdioServer\\bin\\Release\\net9.0\\win-x64\\publish\\apsMcp.StdioServer.exe"]
env = { "APS_CLIENT_ID" = "id", "APS_CLIENT_SECRET" = "secret", "APS_CALLBACK_URL" = "callback" }
I keep having this error
MCP client for autodeskAECModel failed to start: handshaking with MCP server failed: connection closed: initialize response
@jozef-barton Could you elaborate a bit? How did you change codex pointing node from 23 to 22?
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.
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 login command.
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
[mcp_servers.posthog]
command = "npx"
args = ["-y", "mcp-server", "https://mcp.posthog.com/sse", "--header", "Authorization: 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:
⚠ MCP client for avalonia failed to start: MCP startup failed: handshaking with MCP server failed: connection closed: initialize response
⚠ MCP startup incomplete (failed: avalonia)
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:
builder.Logging.AddConsole();
to
builder.Logging.AddConsole(o =>
{
o.LogToStandardErrorThreshold = LogLevel.Trace;
});
I imagine it is the same for a lot other MCPs failing.
Hi all, Can I have help using a stdio mcp running via an .exe file?
[mcp_servers.autodeskAECModel] type = "stdio" command = "C:\\Users\\xxx\\Documents\\aps-graphql\\src\\apsMcp.StdioServer\\bin\\Release\\net9.0\\win-x64\\publish\\apsMcp.StdioServer.exe"] env = { "APS_CLIENT_ID" = "id", "APS_CLIENT_SECRET" = "secret", "APS_CALLBACK_URL" = "callback" }I keep having this error
MCP client for autodeskAECModel failed to start: handshaking with MCP server failed: connection closed: initialize response
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.
@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.
Setup:
Official docs: