claude-code - 💡(How to fix) Fix Cowork desktop: Custom MCP connector URL field doesn't expand environment variables [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#54523Fetched 2026-04-30 06:43:17
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Author
Timeline (top)
labeled ×4commented ×1

The "Agregar conector personalizado" (Add custom connector) UI in Cowork desktop does not expand environment variable references like ${VAR} or ${VAR:-default} in the URL field. The string is sent literally to the MCP server, causing DNS/connection failures.

Error Message

Error: "Couldn't reach the MCP server. You can check the server URL and verify the server is running."

Root Cause

Plugins distributed via marketplace declare MCP servers in .mcp.json using the documented ${VAR} syntax (supported by Claude Code CLI). When the same plugin is consumed via Cowork desktop, the connector pre-fills with the literal placeholder and breaks. This forces users to manually edit and paste expanded URLs/tokens at install time, which defeats the portability of distributing plugins with env-var defaults.

In our case the plugin lives at marketplace admin431/PoWi-Mobile, version [email protected], and declares an HTTP MCP server with Bearer auth — both fields use `${VAR}` placeholders that work fine via CLI but fail in Cowork.

Fix Action

Workaround

Replace the placeholder with the literal expanded URL/token in the connector form. Loses portability across staging/prod environments.

RAW_BUFFERClick to expand / collapse

Summary

The "Agregar conector personalizado" (Add custom connector) UI in Cowork desktop does not expand environment variable references like ${VAR} or ${VAR:-default} in the URL field. The string is sent literally to the MCP server, causing DNS/connection failures.

Reproduction

  1. Open Cowork desktop → Customize → Conectores → Agregar conector personalizado
  2. In the URL field, paste: ${POWI_MCP_URL:-https://us-central1-powi-staging-488705.cloudfunctions.net/powiMcpServer}
  3. (Optional) Configuración avanzada → set Authorization header: Bearer ${POWI_MCP_TOKEN}
  4. Save → click "Conectar"

Expected

Cowork resolves ${POWI_MCP_URL} from the environment (or applies the :- default value) and connects to the MCP server.

Actual

Error: "Couldn't reach the MCP server. You can check the server URL and verify the server is running." Reference ID: ofid_667d0f69e01971cc

The literal string ${POWI_MCP_URL:-...} is sent as the URL, which is not a valid HTTP target.

Why this matters

Plugins distributed via marketplace declare MCP servers in .mcp.json using the documented ${VAR} syntax (supported by Claude Code CLI). When the same plugin is consumed via Cowork desktop, the connector pre-fills with the literal placeholder and breaks. This forces users to manually edit and paste expanded URLs/tokens at install time, which defeats the portability of distributing plugins with env-var defaults.

In our case the plugin lives at marketplace admin431/PoWi-Mobile, version [email protected], and declares an HTTP MCP server with Bearer auth — both fields use `${VAR}` placeholders that work fine via CLI but fail in Cowork.

Workaround

Replace the placeholder with the literal expanded URL/token in the connector form. Loses portability across staging/prod environments.

Environment

  • Cowork desktop (Windows 11)
  • Plugin: `[email protected]` from marketplace `admin431/PoWi-Mobile`
  • MCP server type: `http`, Bearer auth header

extent analysis

TL;DR

The issue can be mitigated by modifying the Cowork desktop code to expand environment variable references like ${VAR} or ${VAR:-default} in the URL field before sending the request to the MCP server.

Guidance

  • Verify that the environment variables POWI_MCP_URL and POWI_MCP_TOKEN are set correctly in the system.
  • Check if there are any existing functions or methods in the Cowork desktop code that can be used to expand environment variable references.
  • Consider adding a pre-processing step to the connector form submission to replace the placeholders with the actual environment variable values.
  • Review the plugin's .mcp.json file to ensure that it is correctly declaring the MCP server with the ${VAR} syntax.

Example

No code snippet is provided as it would require more information about the Cowork desktop codebase.

Notes

The provided workaround of replacing the placeholder with the literal expanded URL/token in the connector form is not ideal as it loses portability across staging/prod environments. A more robust solution would be to modify the Cowork desktop code to handle environment variable references correctly.

Recommendation

Apply a workaround by modifying the Cowork desktop code to expand environment variable references, as upgrading to a fixed version is not mentioned in the issue. This will allow the plugin to work correctly with the MCP server without requiring manual editing of the connector form.

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 Cowork desktop: Custom MCP connector URL field doesn't expand environment variables [1 comments, 2 participants]