claude-code - 💡(How to fix) Fix [Bug] API Error: Socket connection closed unexpectedly [1 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#55069Fetched 2026-05-01 05:47:02
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Participants
Timeline (top)
labeled ×3

Error Message

[{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server sfcc invalid: Missing environment variables: SFCC_HOSTNAME, SFCC_SITE_ID, SFCC_CLIENT_ID, SFCC_CLIENT_SECRET, SFCC_OCAPI_VERSION\n at o0H (/$bunfs/root/src/entrypoints/cli.js:2769:32776)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-30T16:54:55.930Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server sfcc invalid: Missing environment variables: SFCC_HOSTNAME, SFCC_SITE_ID, SFCC_CLIENT_ID, SFCC_CLIENT_SECRET, SFCC_OCAPI_VERSION\n at o0H (/$bunfs/root/src/entrypoints/cli.js:2769:32776)\n at async k (/$bunfs/root/src/entrypoints/cli.js:6355:11810)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-30T16:54:56.140Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server sfcc invalid: Missing environment variables: SFCC_HOSTNAME, SFCC_SITE_ID, SFCC_CLIENT_ID, SFCC_CLIENT_SECRET, SFCC_OCAPI_VERSION\n at o0H (/$bunfs/root/src/entrypoints/cli.js:2769:32776)\n at async N (/$bunfs/root/src/entrypoints/cli.js:6355:12696)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-30T16:54:56.140Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server sfcc invalid: Missing environment variables: SFCC_HOSTNAME, SFCC_SITE_ID, SFCC_CLIENT_ID, SFCC_CLIENT_SECRET, SFCC_OCAPI_VERSION\n at o0H (/$bunfs/root/src/entrypoints/cli.js:2769:32776)\n at async k (/$bunfs/root/src/entrypoints/cli.js:6355:11810)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-30T16:55:02.989Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server sfcc invalid: Missing environment variables: SFCC_HOSTNAME, SFCC_SITE_ID, SFCC_CLIENT_ID, SFCC_CLIENT_SECRET, SFCC_OCAPI_VERSION\n at o0H (/$bunfs/root/src/entrypoints/cli.js:2769:32776)\n at async N (/$bunfs/root/src/entrypoints/cli.js:6355:12696)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-30T16:55:02.989Z"}]

Code Example

[{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server sfcc invalid: Missing environment variables: SFCC_HOSTNAME, SFCC_SITE_ID, SFCC_CLIENT_ID, SFCC_CLIENT_SECRET, SFCC_OCAPI_VERSION\n    at o0H (/$bunfs/root/src/entrypoints/cli.js:2769:32776)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-30T16:54:55.930Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server sfcc invalid: Missing environment variables: SFCC_HOSTNAME, SFCC_SITE_ID, SFCC_CLIENT_ID, SFCC_CLIENT_SECRET, SFCC_OCAPI_VERSION\n    at o0H (/$bunfs/root/src/entrypoints/cli.js:2769:32776)\n    at async k (/$bunfs/root/src/entrypoints/cli.js:6355:11810)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-30T16:54:56.140Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server sfcc invalid: Missing environment variables: SFCC_HOSTNAME, SFCC_SITE_ID, SFCC_CLIENT_ID, SFCC_CLIENT_SECRET, SFCC_OCAPI_VERSION\n    at o0H (/$bunfs/root/src/entrypoints/cli.js:2769:32776)\n    at async N (/$bunfs/root/src/entrypoints/cli.js:6355:12696)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-30T16:54:56.140Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server sfcc invalid: Missing environment variables: SFCC_HOSTNAME, SFCC_SITE_ID, SFCC_CLIENT_ID, SFCC_CLIENT_SECRET, SFCC_OCAPI_VERSION\n    at o0H (/$bunfs/root/src/entrypoints/cli.js:2769:32776)\n    at async k (/$bunfs/root/src/entrypoints/cli.js:6355:11810)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-30T16:55:02.989Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server sfcc invalid: Missing environment variables: SFCC_HOSTNAME, SFCC_SITE_ID, SFCC_CLIENT_ID, SFCC_CLIENT_SECRET, SFCC_OCAPI_VERSION\n    at o0H (/$bunfs/root/src/entrypoints/cli.js:2769:32776)\n    at async N (/$bunfs/root/src/entrypoints/cli.js:6355:12696)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-30T16:55:02.989Z"}]
RAW_BUFFERClick to expand / collapse

Bug Description Continually receiving this error: ⎿  API Error: The socket connection was closed unexpectedly. For more information, pass verbose: true in the second argument to fetch()

Output will begin to stream to the terminal, then abruptly disappear with the error above taking its place.

Environment Info

  • Platform: darwin
  • Terminal: Apple_Terminal
  • Version: 2.1.123
  • Feedback ID: 5b551ee3-4306-4eb1-bc71-6d7569272055

Errors

[{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server sfcc invalid: Missing environment variables: SFCC_HOSTNAME, SFCC_SITE_ID, SFCC_CLIENT_ID, SFCC_CLIENT_SECRET, SFCC_OCAPI_VERSION\n    at o0H (/$bunfs/root/src/entrypoints/cli.js:2769:32776)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-30T16:54:55.930Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server sfcc invalid: Missing environment variables: SFCC_HOSTNAME, SFCC_SITE_ID, SFCC_CLIENT_ID, SFCC_CLIENT_SECRET, SFCC_OCAPI_VERSION\n    at o0H (/$bunfs/root/src/entrypoints/cli.js:2769:32776)\n    at async k (/$bunfs/root/src/entrypoints/cli.js:6355:11810)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-30T16:54:56.140Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server sfcc invalid: Missing environment variables: SFCC_HOSTNAME, SFCC_SITE_ID, SFCC_CLIENT_ID, SFCC_CLIENT_SECRET, SFCC_OCAPI_VERSION\n    at o0H (/$bunfs/root/src/entrypoints/cli.js:2769:32776)\n    at async N (/$bunfs/root/src/entrypoints/cli.js:6355:12696)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-30T16:54:56.140Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server sfcc invalid: Missing environment variables: SFCC_HOSTNAME, SFCC_SITE_ID, SFCC_CLIENT_ID, SFCC_CLIENT_SECRET, SFCC_OCAPI_VERSION\n    at o0H (/$bunfs/root/src/entrypoints/cli.js:2769:32776)\n    at async k (/$bunfs/root/src/entrypoints/cli.js:6355:11810)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-30T16:55:02.989Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server sfcc invalid: Missing environment variables: SFCC_HOSTNAME, SFCC_SITE_ID, SFCC_CLIENT_ID, SFCC_CLIENT_SECRET, SFCC_OCAPI_VERSION\n    at o0H (/$bunfs/root/src/entrypoints/cli.js:2769:32776)\n    at async N (/$bunfs/root/src/entrypoints/cli.js:6355:12696)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-30T16:55:02.989Z"}]

extent analysis

TL;DR

Set the required environment variables SFCC_HOSTNAME, SFCC_SITE_ID, SFCC_CLIENT_ID, SFCC_CLIENT_SECRET, and SFCC_OCAPI_VERSION to resolve the MCP server error.

Guidance

  • The error messages indicate that the MCP server is invalid due to missing environment variables, so setting these variables is the most likely solution.
  • Verify that the environment variables are set correctly by checking the output of the env command or the environment variable settings in your operating system.
  • To mitigate the issue, ensure that the environment variables are set before running the command that triggers the error.
  • If using a .env file, make sure it is in the correct location and formatted correctly.

Example

No code snippet is provided as the issue is related to environment variable configuration.

Notes

The solution assumes that the environment variables are required for the MCP server to function correctly. If the variables are set but the issue persists, further investigation into the MCP server configuration may be necessary.

Recommendation

Apply workaround: Set the required environment variables to resolve the MCP server error. This is the most straightforward solution based on the error messages provided.

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

claude-code - 💡(How to fix) Fix [Bug] API Error: Socket connection closed unexpectedly [1 participants]