Documentation
¶
Overview ¶
Package mcp exposes Local Engineer to an MCP client such as OpenCode.
It is an adapter, not a second implementation. Every tool here resolves a workspace through internal/session and then calls the same packages the CLI calls — internal/graph, internal/retrieval, internal/doctor. Nothing in this package shells out to `le`: a tool that built a command line out of model-supplied arguments would put an injection boundary between the model and a shell, which is the failure this whole system is arranged to avoid.
Why MCP rather than a plugin ¶
OpenCode's officially supported extension points are MCP servers, plugins and custom commands. Plugins are JavaScript or TypeScript and register tools and hooks; they cannot render a panel, and this project is Go. An MCP server is language-agnostic, is registered in one block of opencode.jsonc, and its tools become available to the agent alongside the built-in ones.
Isolation ¶
Unlike a CLI process, this server is long-lived and will be asked about more than one repository. Every call rebinds through session.Open, which performs §2.2's switch and clears the previous workspace's saved inference slots. No handle is cached between calls, because a cached handle is how project B ends up reading project A's index.
Trust ¶
A tool result carries repository content, and a result is read by a model. It is therefore returned as data with its origin named, on the same reasoning as internal/trust: content that arrives labelled cannot be mistaken for an instruction the supervisor issued.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.