Repository navigation
feat(opencode): hand sessions lich's MCP server at spawn - #949
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_CONTENTover every config file it reads. lich putsmcp.lich([<lich>, "mcp"]) there, per spawn and off the disk (internal/terminal,mcpEnv).OPENCODE_CONFIG_CONTENTthe user already exports is extended rather than replaced. This composes with the paste-unfold switch, which uses the same variable.providers.AcceptsMCPServernow includes opencode, soHasToolsno longer depends on the plugin version there.browser_*included. The ceiling "opencode does not listbrowser_*" is removed, and the README rows change in every locale.The companion change in lichdotdev/lich-plugin stops
opencode/lich.jsfrom 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.
TestHasToolsFollowsThePluginVersionElsewherekeeps the same pinned versions, with oh-my-pi as its subject instead of opencode.TestHasToolsIgnoresTheBinaryForOpencodeis removed. opencode is now covered byTestHasToolsIsAlwaysTrueForTheHarnessesToldAtSpawn.internal/terminal/mcp_env_test.go.Test plan
gofmt -l .,go vet ./...andgo test ./...are clean.OPENCODE_CONFIG_CONTENT='{"mcp":{"lich":{"type":"local","command":["/usr/bin/lich","mcp"]}}}',opencode mcp listshows bothlichand the user's own server as connected.