You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Local MCP servers inherit OPENCODE_SERVER_PASSWORD #52427
When opencode serve runs with OPENCODE_SERVER_PASSWORD (and optionally OPENCODE_SERVER_USERNAME) set, every local (type: "local") MCP server it starts receives both variables in its environment.
connectLocal in packages/opencode/src/mcp/index.ts (v1.18.32, 545f51d) builds the server's environment as:
So any MCP server, including a third-party one from npm, can read the Basic Auth credential and call the opencode HTTP API with full access: send prompts, answer permission requests, read sessions. The password exists to keep other local processes out of the server, and the MCP server is exactly such a process.
Steps to reproduce
Configure a local MCP server whose command prints its environment, for example ["sh", "-c", "env > /tmp/mcp-env; cat"].
Run OPENCODE_SERVER_PASSWORD=secret opencode serve.
The server's own credentials are not passed to child processes it starts for tools. Removing OPENCODE_SERVER_PASSWORD and OPENCODE_SERVER_USERNAME from the inherited environment before mcp.environment is applied would keep an explicit per-server setting possible. The same likely applies to other children started with ...process.env (LSP servers, formatters, shell tools); those may deserve the same treatment.
A fork already does this: Kilo Code strips KILO_SERVER_PASSWORD and KILO_SERVER_USERNAME in packages/*/src/kilocode/process/env.ts.
Neither of the issues above was fixed. #14567 was closed automatically after 60 days without activity, and #31778 was closed while a later comment confirmed it still reproduced. On 1.18.32, connectLocal in packages/opencode/src/mcp/index.ts still builds the local MCP server environment as { ...process.env, ...mcp.environment }, so this report stands.
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.
Activity
github-actions commentedon Oct 1, 2026
This issue might be a duplicate of existing issues. Please check:
phetzy commentedon Oct 1, 2026
Neither of the issues above was fixed. #14567 was closed automatically after 60 days without activity, and #31778 was closed while a later comment confirmed it still reproduced. On 1.18.32,
connectLocalinpackages/opencode/src/mcp/index.tsstill builds the local MCP server environment as{ ...process.env, ...mcp.environment }, so this report stands.thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊