bridge

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 12 Imported by: ? 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 bridge connects an MCP client that only speaks stdio to a Streamable HTTP MCP endpoint, the shared LeanProxy gateway in practice.

Some clients (Claude Desktop's config file, older IDE plugins) can only start a local command. Pointing them at `server run --stdio` gives each of them its own proxy and its own copy of every upstream server. The bridge is that local command instead: a thin process that owns no upstream server and relays JSON-RPC between the client's stdin/stdout and the gateway.

It relays messages verbatim. It never interprets tool calls or results: every check (redaction, policy, pinning, ...) happens in the gateway.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bridge

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

Bridge relays one stdio client to the gateway.

func New

func New(opts Options, out io.Writer) *Bridge

New returns a bridge that writes the gateway's messages to out.

func (*Bridge) Run

func (b *Bridge) Run(ctx context.Context, in io.Reader) error

Run relays messages until in ends or ctx is canceled, then ends the gateway session. Each line of in is one JSON-RPC message.

type Options

type Options struct {
	// URL is the gateway's MCP endpoint, e.g. http://127.0.0.1:8765/mcp.
	URL string
	// Token is the gateway's bearer token; empty for a --no-auth gateway.
	Token string
	// Client is the HTTP client to use; nil means a client with no overall
	// timeout (responses may be long-lived streams).
	Client *http.Client
	Logger *slog.Logger
}

Options configure a bridge.

Jump to

Keyboard shortcuts

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