codex - 💡(How to fix) Fix Codex IDE extension fails GitHub MCP startup with "connection closed: initialize response" in PyCharm AI Chat [1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#22461Fetched 2026-05-14 03:35:39
View on GitHub
Comments
1
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
commented ×1labeled ×1

Error Message

The startup error shown in chat is: [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

Code Example

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

---

Configured MCP servers:
• codex_apps: 90 tools, 0 resources, auth=bearerToken
• atlassian
• github

---

{
  "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"
    }
  }
}

---

{
  "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":{}
        }
      }
    ]
  }
}

---

{
     "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"
         ]
       }
     }
   }

---

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

---

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=[])

---

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
RAW_BUFFERClick to expand / collapse

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 initialize response
  • receives tools/list
  • returns a valid tools/list response

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?

  1. Open a project in PyCharm 2026.1.

  2. Configure a project-level MCP server in .ai/mcp/mcp.json using npx mcp-remote, for example:

    {
      "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"
          ]
        }
      }
    }
  3. Ensure CODEX_GITHUB_PERSONAL_ACCESS_TOKEN is available in the IDE process environment.

  4. Restart PyCharm.

  5. Open a new AI Chat with Codex.

  6. Run /mcp.

  7. Observe the mcp__github__startup failure.

  8. 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.log shows the server being exposed as:

    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:

    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
  • github.log shows that:

    • initialize succeeds
    • tools/list succeeds
    • the tool payload is already reduced to only get_file_contents and get_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

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Codex IDE extension fails GitHub MCP startup with "connection closed: initialize response" in PyCharm AI Chat [1 comments, 1 participants]