codexmcp
codexmcp copied to clipboard
[建议] 改进错误处理:当存在部分 MCP 链接失败时,不应影响其使用
我给codex配置了一些MCP,其中有些可能不是随时可用(比如 IDEA、 WebStorm 或 DeepWiki 之类的),当我尝试用 claude code 调用 codex 时,会直接得到错误:
{
"result": {
"success": false,
"error": "codex error: MCP client for `JetBrains-WebStorm` failed to start: handshaking with MCP server failed: connection closed: initialize response"
}
}
但是实际上部分 MCP 的连接错误不应会影响 codex 的正常使用
感谢您的建议,我们在最新版本中推送了对mcp连接错误的容忍机制!
到家里试了一下,似乎仍然存在相关问题:
{
"result": {
"success": false,
"error": "Failed to get `agent_messages` from the codex session. \n\n You can try to set `return_all_messages` to `True` to get the full reasoning information.
\n\n Failed to get `SESSION_ID` from the codex session. \n\n2025-11-20T11:07:56.764544Z ERROR codex_core::codex: MCP client for `fetch` failed to start: request
timed out"
}
}
cc 的调用:
● codex - codex (MCP)(PROMPT: "你好,你是谁", cd: "G:\\code\\forliy-agent-flow", return_all_messages: true)
那么大概率该MCP不支持codex命令行模式,可以在命令行中输入 codex exec "hi"看一下是否有正常返回
那么大概率该MCP不支持codex命令行模式,可以在命令行中输入 codex exec "hi"看一下是否有正常返回
经过尝试,使用 codex exec "hi" 是存在正常返回的:
OpenAI Codex v0.58.0 (research preview)
--------
workdir: xxx
model: gpt-5.1-codex
provider: xxx
approval: never
sandbox: workspace-write [workdir, /tmp, $TMPDIR]
reasoning effort: high
reasoning summaries: auto
session id: xxx
--------
user
hi
ERROR: MCP client for `JetBrains-WebStorm` failed to start: handshaking with MCP server failed: connection closed: initialize response
thinking
**Preparing a polite Chinese greeting**
codex
你好。需要我在这个项目里帮你什么?
tokens used
9,916
你好。需要我在这个项目里帮你什么?
而此时 claude code 中的返回值是:
{
"result": {
"success": false,
"error": "codex error: MCP client for `JetBrains-WebStorm` failed to start: handshaking with MCP server failed: connection closed: initialize response"
}
}