Skip to content

feat(opencode): hand sessions lich's MCP server at spawn - #949

Merged
omartelo merged 1 commit into
mainfrom
feat/opencode-mcp-at-spawn
Oct 27, 2026
Merged

omartelo merged 1 commit into
mainfrom
feat/opencode-mcp-at-spawn

Conversation

@omartelo

Copy link
Copy Markdown
Collaborator

Summary

opencode sessions now get lich's MCP server at spawn, the way Claude Code and Codex do. opencode takes no server on its argv, but it merges OPENCODE_CONFIG_CONTENT over every config file it reads. lich puts mcp.lich ([<lich>, "mcp"]) there, per spawn and off the disk (internal/terminal, mcpEnv).

  • An OPENCODE_CONFIG_CONTENT the user already exports is extended rather than replaced. This composes with the paste-unfold switch, which uses the same variable.
  • If that inline config cannot be extended, lich skips the registration and logs a warning. The session still spawns, without the lich tools.
  • providers.AcceptsMCPServer now includes opencode, so HasTools no longer depends on the plugin version there.
  • opencode sessions list every lich tool, browser_* included. The ceiling "opencode does not list browser_*" is removed, and the README rows change in every locale.

The companion change in lichdotdev/lich-plugin stops opencode/lich.js from defining its own copies once this registration is present. An older lich keeps the JavaScript tools.

Tests

The contract changed for opencode: its tools come from the spawn now, not from the plugin.

  • TestHasToolsFollowsThePluginVersionElsewhere keeps the same pinned versions, with oh-my-pi as its subject instead of opencode.
  • TestHasToolsIgnoresTheBinaryForOpencode is removed. opencode is now covered by TestHasToolsIsAlwaysTrueForTheHarnessesToldAtSpawn.
  • New: internal/terminal/mcp_env_test.go.

Test plan

  • gofmt -l ., go vet ./... and go test ./... are clean.
  • With opencode 1.19.4 and OPENCODE_CONFIG_CONTENT='{"mcp":{"lich":{"type":"local","command":["/usr/bin/lich","mcp"]}}}', opencode mcp list shows both lich and the user's own server as connected.

opencode takes no MCP server on its argv but merges OPENCODE_CONFIG_CONTENT
over its config files, so lich registers its server there per spawn, as it
does for Claude Code and Codex, extending any inline config the user exports.
opencode sessions now list every lich tool, browser_* included, instead of
the subset lich-plugin redefines in JavaScript.

Tests: TestHasToolsFollowsThePluginVersionElsewhere moves its subject from
opencode to oh-my-pi and TestHasToolsIgnoresTheBinaryForOpencode is removed,
because the contract changed: opencode's tools no longer come from the plugin.
@omartelo
omartelo merged commit f28a1c0 into main Oct 27, 2026
7 checks passed
@omartelo
omartelo deleted the feat/opencode-mcp-at-spawn branch October 27, 2026 12:43
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