Skip to content

fix(pi): docker image mcp env passthrough instead of literal expansion#67

Merged
ricardoraposo merged 1 commit into
mainfrom
ricardo-/-fix-pi-docker-mcp-env-passthrough
Jul 7, 2026
Merged

fix(pi): docker image mcp env passthrough instead of literal expansion#67
ricardoraposo merged 1 commit into
mainfrom
ricardo-/-fix-pi-docker-mcp-env-passthrough

Conversation

@ricardoraposo

@ricardoraposo ricardoraposo commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes docker-image MCP generation in the pi extension (buildPiMcpEntry, used by mcp-wiring.ts to write .pi/mcp.json).

The image branch always emitted every env var inline as -e KEY=value, so a reference like ${SIGNOZ_URL} was baked into the docker args literally. Docker never shell-expands its own args, so the container received the literal string ${SIGNOZ_URL} instead of the real value.

Change

New helper buildDockerEnvArgs splits env vars into two cases:

  • Pure variable references (${VAR}) → emitted as bare -e VAR (docker passthrough) and collected into an env block so pi resolves the value into the docker process, which docker then forwards to the container.
  • Literal values (e.g. LOG_LEVEL=info) → stay inline as -e KEY=value.

Only buildPiMcpEntry was touched. The Cursor / Kiro / Claude Code / OpenCode builders were intentionally left unchanged.

Before

{
  "command": "docker",
  "args": ["run","-i","--rm","-e","SIGNOZ_URL=${SIGNOZ_URL}","-e","SIGNOZ_API_KEY=${SIGNOZ_API_KEY}","-e","LOG_LEVEL=info","signoz/signoz-mcp-server:latest"]
}

After

{
  "command": "docker",
  "args": ["run","-i","--rm","-e","SIGNOZ_URL","-e","SIGNOZ_API_KEY","-e","LOG_LEVEL=info","signoz/signoz-mcp-server:latest"],
  "env": { "SIGNOZ_URL": "${SIGNOZ_URL}", "SIGNOZ_API_KEY": "${SIGNOZ_API_KEY}" }
}

Tested

  • pnpm build and pnpm lint pass in packages/core.
  • Verified generated output against the signoz MCP config matches the expected shape.

Bumps @arvoretech/hub-core to 0.26.1.

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of Docker-based environment settings so variable references are passed through more reliably.
    • Updated container launches to better preserve existing environment values when they are referenced indirectly.
  • Chores

    • Bumped the core package version to 0.26.1.

buildPiMcpEntry now emits pure ${VAR} env references as bare -e VAR
docker passthrough flags (with a resolved env block) instead of inline
-e KEY=${VAR}, which docker never expands and delivered the literal
string to the container. Literal values (e.g. LOG_LEVEL=info) stay inline.
@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
rhm-website Ready Ready Preview, Comment Jul 7, 2026 9:21pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 244d6126-fd08-4a30-85d2-049b043c7b9d

📥 Commits

Reviewing files that changed from the base of the PR and between bcbe29a and 7459d87.

📒 Files selected for processing (2)
  • packages/core/package.json
  • packages/core/src/prompt-builders.ts

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Walkthrough

Walkthrough

Adds an internal buildDockerEnvArgs helper in the core package's prompt builders that converts env maps into Docker -e CLI arguments, treating ${...}-style placeholder values specially by passing only the key and collecting the value into a passthroughEnv object. buildPiMcpEntry now uses this helper and conditionally attaches env. The core package version was bumped from 0.26.0 to 0.26.1.

Changes

Docker Env Passthrough

Layer / File(s) Summary
Docker env args helper and integration
packages/core/src/prompt-builders.ts
New buildDockerEnvArgs helper builds -e CLI arguments and detects ${word}-only placeholder values, routing them into a passthroughEnv map; buildPiMcpEntry's Docker branch now uses this helper and conditionally includes env in the returned config.
Package version bump
packages/core/package.json
Version bumped from 0.26.0 to 0.26.1.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant buildPiMcpEntry
  participant buildDockerEnvArgs
  participant DockerConfig

  buildPiMcpEntry->>buildDockerEnvArgs: pass env map
  buildDockerEnvArgs->>buildDockerEnvArgs: detect ${...} placeholder values
  buildDockerEnvArgs-->>buildPiMcpEntry: return args and passthroughEnv
  buildPiMcpEntry->>DockerConfig: attach args
  buildPiMcpEntry->>DockerConfig: attach env when passthroughEnv present
Loading
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ricardo-/-fix-pi-docker-mcp-env-passthrough

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ricardoraposo
ricardoraposo merged commit a782581 into main Jul 7, 2026
4 of 5 checks passed
@ricardoraposo
ricardoraposo deleted the ricardo-/-fix-pi-docker-mcp-env-passthrough branch July 7, 2026 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant