claude-code - 💡(How to fix) Fix Preview MCP: launch.json runtimeArgs path ignored — server always serves Desktop directory [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#49093Fetched 2026-04-17 08:51:04
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×4commented ×1

Code Example

{
  "version": "0.0.1",
  "configurations": [
    {
      "name": "ae-report-preview",
      "runtimeExecutable": "npx",
      "runtimeArgs": ["serve", "-l", "3456", "C:/Users/MarvinGuss/AppData/Local/Temp/pipeline-csvs"],
      "port": 3456
    }
  ]
}

---

cd "C:/Users/MarvinGuss/AppData/Local/Temp/pipeline-csvs"
npx serve -l 3457 .
# → correctly shows "Index of pipeline-csvs/"
RAW_BUFFERClick to expand / collapse

Bug Description

The Claude Preview MCP tool (preview_start) ignores the directory path specified in launch.json runtimeArgs and always serves from the user's Desktop directory instead.

Steps to Reproduce

  1. Configure launch.json with a specific serve path:
{
  "version": "0.0.1",
  "configurations": [
    {
      "name": "ae-report-preview",
      "runtimeExecutable": "npx",
      "runtimeArgs": ["serve", "-l", "3456", "C:/Users/MarvinGuss/AppData/Local/Temp/pipeline-csvs"],
      "port": 3456
    }
  ]
}
  1. Call preview_start with the configuration name
  2. Take a screenshot or snapshot of the served page

Expected Behavior

The server should serve files from C:/Users/MarvinGuss/AppData/Local/Temp/pipeline-csvs as configured in runtimeArgs.

Actual Behavior

The server always shows "Index of Desktop/" — serving the user's Desktop directory regardless of the path configured in runtimeArgs.

Verification

Running the exact same command manually in the terminal works correctly:

cd "C:/Users/MarvinGuss/AppData/Local/Temp/pipeline-csvs"
npx serve -l 3457 .
# → correctly shows "Index of pipeline-csvs/"

This confirms the issue is in how preview_start spawns the process, not in npx serve itself. The tool appears to either:

  • Drop the path argument from runtimeArgs, or
  • Set the working directory to Desktop instead of respecting the configured path

Environment

  • Platform: Windows 11 Pro 10.0.26200
  • Claude Code Desktop App
  • Shell: bash
  • The issue persists across sessions and after killing stale processes on the port

extent analysis

TL;DR

The preview_start tool likely ignores the directory path in launch.json due to incorrect working directory setup or argument passing, causing it to serve from the Desktop directory instead.

Guidance

  • Verify that the preview_start tool correctly handles the runtimeArgs and working directory by checking its documentation or source code for any specific requirements or limitations.
  • Try modifying the runtimeArgs to use an absolute path or a path relative to the current working directory to see if it makes a difference.
  • Check if the preview_start tool has any configuration options or environment variables that can be used to specify the working directory or serve path.
  • Consider using a different tool or approach to serve the files, such as using a separate server process or a different launch configuration.

Example

No code example is provided as the issue seems to be related to the preview_start tool's behavior rather than a specific code snippet.

Notes

The issue may be specific to the preview_start tool or the Claude Code Desktop App, and further investigation into the tool's documentation or source code may be necessary to resolve the issue.

Recommendation

Apply workaround: Use a separate server process or a different launch configuration to serve the files, as the preview_start tool seems to have limitations in handling the runtimeArgs and working directory.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING