mcp

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Overview

Package mcp provides the implementation of the `bridge` proxy service.

The proxy stands in between a local process and a remote MCP server, forwarding JSON-RPC requests and responses while transparently handling transport and authentication concerns. It is used by the `bridge` command found one directory up, but can also be embedded programmatically if more control is required.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(args []string) error

Types

type Elicitator added in v0.6.2

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

func NewElicitator added in v0.6.2

func NewElicitator(listenAddr string, openBrowser bool) *Elicitator

func (*Elicitator) OpenURL added in v0.6.2

func (e *Elicitator) OpenURL(u string)

func (*Elicitator) Start added in v0.6.2

func (e *Elicitator) Start(ctx context.Context, req *schema.ElicitRequest) (string, <-chan *schema.ElicitResult, error)

type Options

type Options struct {
	URL                      string `short:"u" long:"url" description:"mcp url" required:"true"`
	UseIdToken               bool   `short:"i" long:"id-token" description:"use id token"`
	BackendForFrontend       bool   `short:"b" long:"backend-for-frontend" description:"use backend for frontend"`
	BackendForFrontendHeader string `short:"h" long:"backend-for-frontend-header" description:"backend for frontend header"`
	OAuth2ConfigURL          string `short:"c" long:"config" description:"oauth2 config file"`
	EncryptionKey            string `short:"k" long:"key" description:"encryption key"`

	// Built-in web elicitator to handle elicitation when downstream client lacks support.
	ElicitatorEnabled     bool   `long:"elicit" description:"enable built-in web elicitator when client lacks elicitation"`
	ElicitatorListenAddr  string `long:"elicit-listen" description:"elicitator listen address" default:"127.0.0.1:0"`
	ElicitatorOpenBrowser bool   `long:"elicit-open" description:"attempt to open browser for elicitation"`
}

type Service

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

func New

func New(ctx context.Context, cfg *Options) (*Service, error)

New constructs a bridge Service. Provide either Config.Endpoint or Config.URL.

func (*Service) HTTP

func (s *Service) HTTP(ctx context.Context, addr string) (*http.Server, error)

HTTP starts an HTTP/SSE server on the given address that proxies MCP JSON-RPC calls to the client endpoint.

func (*Service) Stdio

func (s *Service) Stdio(ctx context.Context) (*stdiosrv.Server, error)

Stdio starts a JSON-RPC server over standard input/output that proxies MCP calls to the client endpoint.

Jump to

Keyboard shortcuts

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