Skip to content

[BUG] ENABLE_EXPERIMENTAL_MCP_CLI=true mode results in intermittent use of stale session ID #14009

@TyceHerrman

Description

@TyceHerrman

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

When running ENABLE_EXPERIMENTAL_MCP_CLI=true env var and using mcp-cli, exiting a session and resuming the session later causes mcp-cli to use a stale session ID, causing the mcp tool calls to fail.

What Should Happen?

mcp-cli should work after closing a session and re-launching it through /resume.

Error Messages/Logs

Error: Exit code 1
     Warning: MCP endpoint file not found at /tmp/claude/claude-code-mcp-cli/1544c6ea-e68d-4cc2-b7b4-285e9d3d8123.endpoint (session:
     1544c6ea-e68d-4cc2-b7b4-285e9d3d8123). Falling back to state file.
     Error: MCP state file not found at /tmp/claude/claude-code-mcp-cli/1544c6ea-e68d-4cc2-b7b4-285e9d3d8123.json (session:
     1544c6ea-e68d-4cc2-b7b4-285e9d3d8123). Is Claude Code running?

Steps to Reproduce

  1. Start a session with ENABLE_EXPERIMENTAL_MCP_CLI=true env var
  2. Do some work that invokes mcp-cli in bash tool
  3. End the session with ctrl+c twice
  4. reopen CC with same ENABLE_EXPERIMENTAL_MCP_CLI=true env var
  5. Use /resume and reopen session
  6. try and do more work that invokes mcp-cli
  7. mcp-cli will fail

Claude Model

None

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.0.69

Platform

Other

Operating System

macOS

Terminal/Shell

Other

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:mcpbugSomething isn't workinghas reproHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOSstaleIssue is inactive

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions