MCP connection is not re-established after a local server restart

Resolved 💬 2 comments Opened Aug 21, 2026 by andriy-viyatyk Closed Aug 21, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

Summary

Codex loses its MCP connection when a local MCP server restarts, even when the server comes back on the same endpoint. The Codex session remains open but the MCP tools stay unavailable until the Codex client/session is restarted.

This is particularly disruptive for local development servers such as Persephone: editing source code causes Vite and the application (including its MCP server) to restart.

Reproduction

  1. Configure a local MCP server in Codex.
  2. Start Codex and verify that the server's tools are available.
  3. Restart the local application/server while keeping the Codex session open.
  4. Wait for the MCP server to come back at the same endpoint.
  5. Try to use one of its tools.

Expected behavior

Codex should automatically re-establish the MCP session when the configured server becomes available again, or provide an explicit reconnect action such as:

/mcp reconnect <server-name>

Actual behavior

The original MCP connection remains dead. The server is running again, but the tools are not available in the existing Codex session. Restarting Codex is required.

Environment

  • OS: Windows
  • Codex CLI: 0.148.0
  • MCP server: local Persephone development server
  • Transport: local MCP transport (please classify as stdio or Streamable HTTP if required)
  • Server lifecycle: Vite/application restart stops and starts the MCP server again

Additional context

The documented /mcp command can inspect active MCP servers, but there does not appear to be a reconnect command. A reconnect or automatic retry would make local MCP-based development workflows much more reliable.

View original on GitHub ↗

2 Comments

andriy-viyatyk · 6 days ago

For comparison, I have tested Claude Code with the same style of local MCP development workflow. Claude Code now reconnects to the MCP server after the application/server restarts, or otherwise keeps the MCP integration usable without restarting the chat. Codex should provide equivalent automatic recovery or an explicit reconnect command, since persistent MCP-based development is a core developer workflow.

github-actions[bot] contributor · 6 days ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #39149

Powered by Codex Action