mcp

package
v0.0.0-...-0cceabf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2026 License: Apache-2.0 Imports: 22 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.

Functions

func New

func New(o Options) (*mcp.Server, error)

New builds the MCP server with Local Engineer's tools registered.

Types

type Options

type Options struct {
	// DataDir is the storage root, as `--data` gives the CLI.
	DataDir string
	// WorkDir is the directory a tool call resolves against when it is given
	// no path of its own. It is the repository the client has open.
	WorkDir string
}

Options configures the server.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server holds what the tools need. It deliberately holds no workspace handle: see the package comment.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL