Codex IDE extension fails GitHub MCP startup with "connection closed: initialize response" in PyCharm AI Chat
What version of the IDE extension are you using?
JetBrains AI Assistant / Codex integration bundled with PyCharm 2026.1 – v0.0.44
What subscription do you have?
ChatGPT subscription with Codex access
Which IDE are you using?
PyCharm 2026.1
What platform is your computer?
Darwin arm64 arm 25.4.0
What issue are you seeing?
n PyCharm AI Chat, Codex fails to start a custom GitHub MCP server configured via npx mcp-remote.
The startup error shown in chat is:
mcp__github__startup
[codex-acp forwarded startup error] MCP server github failed to start: MCP client for github failed to start: MCP startup failed: handshaking with MCP server failed: connection closed: initialize response
At the same time, /mcp still shows the server as configured:
Configured MCP servers:
• codex_apps: 90 tools, 0 resources, auth=bearerToken
• atlassian
• github
This happens in a new chat after restarting the IDE.
Important detail: the MCP backend itself appears to work. In github.log, the GitHub MCP process:
- receives
initialize - returns a valid
initializeresponse - receives
tools/list - returns a valid
tools/listresponse
Example of a valid initialize response from github.log:
{
"jsonrpc":"2.0",
"id":"09c567a3be744276a0716fba3ce4b48e",
"result":{
"capabilities":{"completions":{},"prompts":{},"resources":{},"tools":{}},
"protocolVersion":"2025-06-18",
"serverInfo":{
"name":"github-mcp-server",
"version":"github-mcp-server/remote-b3a6334d17cb745035c4ef75d2d5ae76a67f655d"
}
}
}
Example of a minimal valid tools/list response from github.log:
{
"jsonrpc":"2.0",
"id":"627bed4c48204a839d0ea4a95bb68ca0",
"result":{
"tools":[
{
"name":"get_file_contents",
"inputSchema":{
"type":"object",
"properties":{
"owner":{"type":"string"},
"path":{"type":"string","default":"/"},
"ref":{"type":"string"},
"repo":{"type":"string"},
"sha":{"type":"string"}
},
"required":["owner","repo"]
}
},
{
"name":"get_me",
"inputSchema":{
"type":"object",
"properties":{}
}
}
]
}
}
So the failure seems to happen in the ACP / IDE extension layer, not in the GitHub MCP server itself.
What steps can reproduce the bug?
- Open a project in PyCharm 2026.1.
- Configure a project-level MCP server in
.ai/mcp/mcp.jsonusingnpx mcp-remote, for example:
``json``
{
"mcpServers": {
"github": {
"command": "npx",
"args": [
"-y",
"mcp-remote@latest",
"https://api.githubcopilot.com/mcp/",
"--header",
"Authorization:Bearer ${CODEX_GITHUB_PERSONAL_ACCESS_TOKEN}",
"--header",
"X-MCP-Readonly:true",
"--header",
"X-MCP-Tools:get_me,get_file_contents",
"--transport",
"http-only"
]
}
}
}
- Ensure
CODEX_GITHUB_PERSONAL_ACCESS_TOKENis available in the IDE process environment. - Restart PyCharm.
- Open a new AI Chat with Codex.
- Run
/mcp. - Observe the
mcp__github__startupfailure. - Inspect:
idea.log~/Library/Logs/JetBrains/PyCharm2026.1/mcp/github.log
Outside the IDE extension, the same MCP setup works. For example, this succeeds locally:
npx -y -p mcp-remote@latest mcp-remote-client \
https://api.githubcopilot.com/mcp/ \
--header "Authorization:Bearer ${CODEX_GITHUB_PERSONAL_ACCESS_TOKEN}" \
--header "X-MCP-Readonly:true" \
--header "X-MCP-Tools:get_me,get_file_contents" \
--transport http-only
It connects and retrieves the tools list successfully.
What is the expected behavior?
The GitHub MCP server should start successfully in Codex AI Chat, and the configured GitHub tools should become available to the model.
If the MCP process returns valid initialize and tools/list responses, the IDE extension should not fail startup with connection closed: initialize response.
Additional information
Relevant observations from logs:
idea.logshows the server being exposed as:
``text``
Stdio(name=github, command=npx, args=[-y, mcp-remote@latest, https://api.githubcopilot.com/mcp/, --header, Authorization:Bearer ${CODEX_GITHUB_PERSONAL_ACCESS_TOKEN}, --header, X-MCP-Readonly:true, --header, X-MCP-Tools:get_me,get_file_contents, --transport, http-only], env=[])
- then the IDE extension reports:
``textgithub
MCP server failed to start: MCP client for github failed to start: MCP startup failed: handshaking with MCP server failed: connection closed: initialize response``
github.logshows that:initializesucceedstools/listsucceeds- the tool payload is already reduced to only
get_file_contentsandget_me
So this does not appear to be:
- a PAT/auth problem
- a GitHub MCP server problem
- a full toolset size problem
It appears to be an IDE extension / ACP integration bug when handling GitHub MCP startup over npx mcp-remote.
I created a bug report for JetBrains too: https://youtrack.jetbrains.com/issue/IJPL-244795/Codex-ACP-fails-GitHub-MCP-startup-with-connection-closed-initialize-response-although-initialize-tools-list-succeed-via-npx-mcp
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗