{"version":"2.1.302","anchor":"new-env-var-claude-code-mcp-serve-workspace-root","canonical_anchor":"mcp-serve-gains-a-one-shot-workspace-root-env-var-that-can-r","heading":"MCP serve gains a workspace-root setting for registering a subfolder","tier":"use","area":"MCP","scope":"individual","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.302\/e\/new-env-var-claude-code-mcp-serve-workspace-root","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.302","markdown":"### MCP serve gains a workspace-root setting for registering a subfolder\n\n`CLAUDE_CODE_MCP_SERVE_WORKSPACE_ROOT` lets a host running `claude mcp serve` limit folder registration to a folder below the server's own\n\n**Unclear.** What `CLAUDE_CODE_MCP_SERVE_WORKSPACE_ROOT` controls, and what value it expects, is not settled.\n\n**What**\n\n`claude mcp serve` runs Claude Code as an MCP server, a program another application (the host) connects to and drives. A new environment variable, `CLAUDE_CODE_MCP_SERVE_WORKSPACE_ROOT`, lets the host name a workspace root for it. An environment variable is a setting passed to a program when it starts.\n\n- It is listed alongside the other `CLAUDE_CODE_MCP_SERVE_*` variables, such as `CLAUDE_CODE_MCP_SERVE_AUTH_TOKEN` and `CLAUDE_CODE_MCP_SERVE_SETTINGS`, and next to `CLAUDE_CODE_REMOTE_TOOLS_FORWARD`. One of these lists appears to hold sensitive variables and the other variables passed on to child processes.\n\n- `mcp serve` in HTTP mode reads the value once and then removes it from its environment.\n\n- The value must be a valid absolute path, must not be the current folder, and must not overlap a private folder (that refusal is reported as `private_folder`).\n\n- A valid root is added as an extra working folder for the tool that registers folders. Registering a folder that is not below that root fails with `outside_scope`.\n\n- An invalid value is ignored, with a warning that only a folder below the server's own can be registered.\n\n**Why**\n\nA host that launches `claude mcp serve` can now keep a session to one subfolder. Ordinary users who never set the variable see no difference.\n\n- Area: MCP\n- Names: `CLAUDE_CODE_REMOTE_TOOLS_FORWARD`\n- Tier: Use it now\n- Useful: 5\/5\n- Signal: 3\/5\n- Scope: individual\n- Heads-up: no"}