[BUG] User-scope plugin MCP server cannot access project directory — no cwd or env var pointing to project root

Resolved 💬 2 comments Opened Apr 2, 2026 by aplaxas Closed May 8, 2026

@

Description

When a plugin is installed with --scope user, its MCP server process has no way to know the current project directory. The server's process.cwd() points to the plugin cache path (~/.claude/plugins/cache/...), not the project root.

This means any MCP server that needs a project-level config file (e.g. .db-fetcher.json in project root) will fail on startup or at tool invocation time.

Steps to Reproduce

  1. Create a plugin with an MCP server that reads a config file from process.cwd()
  2. Install the plugin: claude plugin install my-plugin@my-marketplace --scope user
  3. Place the config file in the project root (e.g. C:\Projects\my-app\.my-config.json)
  4. Open Claude Code in that project
  5. The MCP server fails — process.cwd() is the plugin cache directory, not the project root

Expected Behavior

The MCP server should be able to discover the current project root, either via:

  • process.cwd() set to the project root (like project-scope plugins)
  • An environment variable like CLAUDE_PROJECT_DIR

Actual Behavior

  • process.cwd() = ~/.claude/plugins/cache/{marketplace}/{plugin}/{version}/
  • No environment variable provides the project path
  • Only CLAUDE_PLUGIN_ROOT and CLAUDE_PLUGIN_DATA are available

Workaround

Install with --scope project instead. This works because projectPath in installed_plugins.json tells Claude Code where to set the cwd.

Environment

  • Claude Code: VS Code Extension
  • OS: Windows 11
  • Plugin system version: latest

Related Issues

  • #33815 — CLAUDE_PROJECT_DIR is empty/unset
  • #26429 — Feature request to expose project root

@

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗