{"version":"2.1.281","anchor":"headless-set-cwd-now-re-dials-stdio-mcp-servers-that-were-sp","canonical_anchor":"headless-set-cwd-now-re-dials-stdio-mcp-servers-that-were-sp","heading":"Headless set_cwd now re-dials stdio MCP servers that were spawned in the launch directory","tier":null,"area":null,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.281\/e\/headless-set-cwd-now-re-dials-stdio-mcp-servers-that-were-sp","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.281","markdown":"### Headless set_cwd now re-dials stdio MCP servers that were spawned in the launch directory\n\nIn headless mode, changing directory with set_cwd now restarts MCP servers started in the old folder so they run in the new project\n\n**What**\n\nThis applies to headless mode, where Claude Code is run by another program through the SDK (a developer toolkit) instead of in a terminal window. That program can send `set_cwd` to change the folder Claude Code works in. When `set_cwd` actually changes the folder, Claude Code now:\n\n- Removes stale connections to MCP servers (outside programs that give Claude extra tools) and clears their cached data.\n\n- Removes project MCP configurations that no longer match the new folder.\n\n- Refreshes plugin state.\n\n- Restarts local MCP servers that were started in the original launch folder, when the response marks a fresh session, and waits for them to reconnect.\n\nThe restarted servers are ones that talk to Claude Code over stdio, meaning through a directly started local process. They come back up with the new project folder as their base.\n\n**Why**\n\nPreviously an MCP server started in the launch folder could keep working against that folder after the directory change. Now the servers of a fresh session follow the new project, so their tools see the right files."}