mcpbridge

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package mcpbridge serves a stdio MCP server's tools to an ACP agent over loopback streamable HTTP. Some agents (GitHub Copilot CLI) accept only remote MCP servers in session/new, so a per-session stdio server such as the hosted Compozy tool proxy is relayed through a loopback listener guarded by a per-bridge bearer token.

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 MCP server's tools over a loopback HTTP endpoint. Close releases the listener and the child; it is safe to call more than once.

func Start

func Start(ctx context.Context, spec Spec, logger *slog.Logger) (_ *Bridge, err error)

Start launches spec as a stdio MCP client, mirrors its tools onto an HTTP MCP server, and listens on an ephemeral loopback port. The returned bridge owns the child process and listener until Close.

func (*Bridge) AuthorizationHeader

func (b *Bridge) AuthorizationHeader() string

AuthorizationHeader is the header value the agent must send. It is a secret: never log it or persist it outside the session request.

func (*Bridge) Close

func (b *Bridge) Close() error

Close stops the listener, then the child. It returns the first teardown errors and is idempotent.

func (*Bridge) Name

func (b *Bridge) Name() string

Name is the MCP server name the agent sees.

func (*Bridge) URL

func (b *Bridge) URL() string

URL is the loopback streamable HTTP endpoint.

type Spec

type Spec struct {
	Name    string
	Command string
	Args    []string
	// Env is the complete child environment, already filtered by the caller.
	Env []string
	Dir string
}

Spec describes the stdio MCP server one bridge launches and relays.

Jump to

Keyboard shortcuts

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