Documentation
¶
Overview ¶
Package bridge borrows a client's MCP connections for the runner.
A bridge holds no credential and reads no configuration. It asks the client, over the client's own control channel, what tools it has and asks it to call one. How each client is reached, what it names things and how it spells an annotation is code in this package; what the user has connected is always discovered live.
Every bridge is a stand-in. It is deleted when its client can run a primitive itself.
Index ¶
- func ClaudeExecutable() (string, error)
- func GeminiRules(files ...string) func(bind.Tool) (denied bool)
- func Tested(name, version string) bool
- type Asker
- type Bridge
- type Claude
- func (c *Claude) Asks(t bind.Tool) (bool, error)
- func (c *Claude) Call(t bind.Tool, args map[string]any) (string, error)
- func (c *Claude) Client() (string, string)
- func (c *Claude) Close()
- func (c *Claude) Denied(t bind.Tool) (bool, error)
- func (c *Claude) HasSchemas() bool
- func (c *Claude) Inventory() ([]bind.Tool, error)
- type Codex
- func (c *Codex) Asks(t bind.Tool) (bool, error)
- func (c *Codex) Call(t bind.Tool, args map[string]any) (string, error)
- func (c *Codex) Client() (string, string)
- func (c *Codex) Close()
- func (c *Codex) Denied(t bind.Tool) (bool, error)
- func (c *Codex) HasSchemas() bool
- func (c *Codex) Inventory() ([]bind.Tool, error)
- type Goose
- type Kilo
- func (k *Kilo) Call(t bind.Tool, args map[string]any) (string, error)
- func (k *Kilo) Client() (string, string)
- func (k *Kilo) Close()
- func (k *Kilo) Denied(t bind.Tool) (bool, error)
- func (k *Kilo) HasSchemas() bool
- func (k *Kilo) Inventory() ([]bind.Tool, error)
- func (k *Kilo) UsePins(tools []bind.Tool)
- type MCP
- type PinnedOnly
- type VSCode
- func (v *VSCode) Asks(t bind.Tool) (bool, error)
- func (v *VSCode) Call(t bind.Tool, args map[string]any) (string, error)
- func (v *VSCode) Client() (string, string)
- func (v *VSCode) Close()
- func (v *VSCode) Denied(bind.Tool) (bool, error)
- func (v *VSCode) HasSchemas() bool
- func (v *VSCode) Inventory() ([]bind.Tool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClaudeExecutable ¶
ClaudeExecutable returns the Claude Code executable TAP should use. It prefers the native per-user install and falls back to PATH, matching the bridge's control-channel launcher.
func GeminiRules ¶
GeminiRules reads the tool rules of Gemini CLI from the user's settings and from the project's, the project's adding to the user's.
Types ¶
type Asker ¶
Asker is implemented by a bridge that can read the person's own "ask me first" rule for a tool. The runner then puts a call to that tool in front of them even when the primitive declares it a read.
type Bridge ¶
type Bridge interface {
// Client names the client and its version, as the client reports them.
Client() (name, version string)
// Inventory lists every tool the client can dispatch.
Inventory() ([]bind.Tool, error)
// Denied reports whether the user has forbidden their client to use a
// tool. The runner refuses such a tool.
Denied(t bind.Tool) (bool, error)
// Call dispatches one tool through the client's own session and returns
// its result as text.
Call(t bind.Tool, args map[string]any) (string, error)
// HasSchemas reports whether the client gives tool input schemas, so the
// receipt can say whether a contract could have been checked.
HasSchemas() bool
Close()
}
Bridge is the whole of what the runner needs from a client.
type Claude ¶
type Claude struct {
// contains filtered or unexported fields
}
Claude reaches Claude Code through the control channel of its stream-json input. Control requests start no model turn. The channel is undocumented.
func NewClaude ¶
NewClaude starts a second copy of Claude Code. extra is passed to it and exists for tests.
func (*Claude) Asks ¶
Asks reports whether the user has an "ask" rule for the tool: Claude Code would stop and ask them before using it.
func (*Claude) HasSchemas ¶
type Codex ¶
type Codex struct {
// contains filtered or unexported fields
}
Codex reaches Codex through its app-server protocol, the interface its own desktop app uses. Codex marks it experimental.
func (*Codex) Denied ¶
Denied reports whether the user's Codex configuration switches the tool off: its server is disabled, it is not in the server's enabled_tools, or it is in disabled_tools.
func (*Codex) HasSchemas ¶
type Goose ¶
type Goose struct {
// contains filtered or unexported fields
}
Goose reaches Goose through ACP (`goose acp`), with Goose's own custom requests: _goose/unstable/tools/list lists a session's extension tools and _goose/unstable/tools/call runs one through Goose's extension manager, with no model turn. Goose marks both unstable.
Goose runs an app tool call only in auto mode, so the bridge's session is put in auto mode and Goose shows no approval of its own: the runner's effect gate is the only approval. A tool the user set to never_allow is denied.
func (*Goose) Call ¶
Call runs one extension tool through Goose. A result Goose marks isError is returned as an error, so a failure is never read back as output.
func (*Goose) Close ¶
func (g *Goose) Close()
Close deletes the bridge's session, so it does not show in Goose's history, and stops Goose.
func (*Goose) HasSchemas ¶
type Kilo ¶
type Kilo struct {
// contains filtered or unexported fields
}
Kilo reaches the Kilo CLI through its own server, `kilo serve`, started for this run. POST /experimental/mcp/call-tool runs one tool of a connected MCP server through Kilo's live client, with no model turn Kilo exposes the route only with its experimental flag on, which the bridge sets on the server it starts and nowhere else.
The route skips Kilo's own permission prompt, so, as for Goose, the runner's effect gate is the only approval. A tool the person's Kilo configuration switches off (tools: {name: false}) or denies (permission: {name: "deny"}) is denied.
Kilo lists no MCP server's tools, so a primitive that runs through Kilo pins each tool it uses ({server, tool}), as for Gemini CLI. The pinned tools of servers Kilo reports connected are the inventory.
func (*Kilo) Call ¶
Call runs one MCP tool through Kilo. A result Kilo marks isError is an error, so a failure is never read back as output.
func (*Kilo) Close ¶
func (k *Kilo) Close()
Close stops the server the bridge started, and everything it started: kilo is a launcher, and the server is its child.
func (*Kilo) Denied ¶
Denied reports a tool the person's Kilo configuration switches off (tools: {"<server>_<tool>": false}) or denies (permission: {"<server>_<tool>": "deny"}). Keys may use * as a wildcard; the most specific matching key decides.
func (*Kilo) HasSchemas ¶
type MCP ¶
type MCP struct {
// contains filtered or unexported fields
}
MCP reaches one MCP server directly, over streamable HTTP. It is the bridge for a runner with no client to borrow from: a service that runs primitives itself hands the runner the MCP endpoint it would call and the header that authenticates it. The server decides, per call, what the caller may do; this bridge adds no policy of its own.
func NewMCPWithName ¶
NewMCPWithName opens an MCP server over streamable HTTP. connectionName, when nonempty, is the local connection alias used as bind.Tool.Server; the endpoint's advertised tool names and all wire calls remain unchanged. An empty name preserves NewMCP's serverInfo.name behavior.
func (*MCP) Call ¶
Call dispatches one tool. A result the server marks isError is returned as an error, so a refusal is never read back as the tool's output.
func (*MCP) Client ¶
Client names the protocol rather than a product: what is on the other end is whatever MCP server the caller pointed at.
func (*MCP) Close ¶
func (m *MCP) Close()
Close ends the session. A server that does not support ending sessions answers 405, which is not an error.
func (*MCP) Denied ¶
Denied always reports false. There is no user between the runner and the server to have forbidden anything; the server refuses what it will not do.
func (*MCP) HasSchemas ¶
type PinnedOnly ¶
PinnedOnly is a bridge whose client cannot list its tools: the runner gives it the tools a primitive pins, and only those can bind.
type VSCode ¶
type VSCode struct {
// contains filtered or unexported fields
}
VSCode reaches Visual Studio Code, and so GitHub Copilot's tools, through the TAP extension (vscode/ in this repository). The extension starts this runner as an MCP server and gives it a private local socket; over it the runner lists the editor's language model tools, the MCP servers the user connected included, and calls them with vscode.lm.invokeTool. The editor makes each call with its own connection, and shows its own confirmation where the tool asks for one.
func (*VSCode) Asks ¶
Asks reports whether the user's chat.tools.eligibleForAutoApproval setting lists the tool as false, which makes VS Code ask them before every use.
func (*VSCode) Denied ¶
Denied reports false: VS Code gives an extension no way to read which tools the user has switched off in the chat tools picker.