Skip to content

Commit 04c3ca6

Browse files
committed
fix(site): docker run command was malformed when secret path enabled
The docker-deployment branch built a one-line `docker run` command but constructed the secret-path fragment with a trailing `\<newline>` (intended as a shell-line-continuation) and then `.trim()`-ed only the newline before splicing it back into the same line. The trailing backslash survived into the rendered command: ... -e MCP_SECRET_PATH=/private_xxx \ ghcr.io/... Bash parses `\<space>` as an escaped space, joining the leading whitespace onto the next token — so docker was invoked with an image argument of " ghcr.io/homeassistant-ai/ha-mcp:latest" (note the leading space), which fails with `invalid reference format`. Users who enabled the secret path on the Docker deployment got a broken copy-paste command. Drop the trailing `\\\n` from secretPathEnv (no continuation needed inline) and remove the matching .trim() at the splice site. The emitted command is now: docker run -d --name ha-mcp -p 8086:8086 -e ... -e ... -e MCP_SECRET_PATH=/private_xxx ghcr.io/... Pre-existing bug in master (predates homeassistant-ai#1106). Boy Scout fix bundled here since the surrounding deployment block is being heavily touched by this PR. Build verified clean (npm run build, 7 pages, 41s).
1 parent 7f1e007 commit 04c3ca6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

site/src/pages/setup.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,15 +1322,15 @@ ${secretPathEnv}uvx --from ha-mcp@latest ha-mcp-web</code></pre>
13221322
}
13231323
} else if (derivedDeployment === 'docker') {
13241324
const useSecretPath = isRemote && state.proxy !== 'webhook-proxy';
1325-
const secretPathEnv = useSecretPath ? ` -e MCP_SECRET_PATH=/private_{{RANDOM_STRING}} \\\n` : '';
1325+
const secretPathEnv = useSecretPath ? `-e MCP_SECRET_PATH=/private_{{RANDOM_STRING}}` : '';
13261326
const serverPath = useSecretPath ? '/private_{{RANDOM_STRING}}' : '/mcp';
13271327
const dockerPortNote = `<p class="text-xs text-slate-500 mt-2">Optional: Change <code>-p 8086:8086</code> to use a different port (e.g., <code>-p 9000:8086</code>).</p>`;
13281328
const composeSecretPathLine = useSecretPath
13291329
? `\n - MCP_SECRET_PATH=/private_{{RANDOM_STRING}}`
13301330
: '';
13311331
deployInstr = `<div class="instruction-block">
13321332
<h4 class="instruction-title">Start Docker Container</h4>
1333-
<pre class="code-block"><code>docker run -d --name ha-mcp -p 8086:8086 -e HOMEASSISTANT_URL={{HOMEASSISTANT_URL}} -e HOMEASSISTANT_TOKEN={{HOMEASSISTANT_TOKEN}}${secretPathEnv ? ' ' + secretPathEnv.trim() : ''} ghcr.io/homeassistant-ai/ha-mcp:latest ha-mcp-web</code></pre>
1333+
<pre class="code-block"><code>docker run -d --name ha-mcp -p 8086:8086 -e HOMEASSISTANT_URL={{HOMEASSISTANT_URL}} -e HOMEASSISTANT_TOKEN={{HOMEASSISTANT_TOKEN}}${secretPathEnv ? ' ' + secretPathEnv : ''} ghcr.io/homeassistant-ai/ha-mcp:latest ha-mcp-web</code></pre>
13341334
<p class="text-sm text-slate-400 mt-2">Server will be at: <code>http://YOUR_IP:8086${serverPath}</code></p>${dockerPortNote}${secretPathNote}
13351335
<details class="mt-3">
13361336
<summary class="cursor-pointer text-sm text-slate-300 font-medium hover:text-slate-100">Production hardening (docker compose)</summary>

0 commit comments

Comments
 (0)