mcp

package
v1.45.2 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: GPL-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package mcp provides an independently composed, bounded SDK adapter.

Index

Constants

View Source
const MaxFrame = 64 * 1024

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, owned io.ReadWriteCloser, o Options) error

Run owns the supplied I/O. Close must unblock both Read and Write. Caller cancellation (including a signal-derived context), EOF and framing failure cancel all request contexts, join SDK handlers, then close composition resources. Ports must return on cancellation; Go cannot forcibly stop an arbitrary port.

Types

type Backend

Backend is constructed once by composition and must honor cancellation.

type Options

type Options struct {
	Backend Backend
	Status  StatusPort
	Clock   agentnotify.Clock
	// AdapterKind is operator configured: codex or claude. Never model supplied.
	AdapterKind string
	// CloseResources is called once after every SDK handler has joined.
	CloseResources func() error
}

type Status

type Status struct {
	Enabled       bool   `json:"enabled"`
	Configuration string `json:"configuration"`
	Capability    string `json:"capability"`
	ContextReason string `json:"context_reason"`
	// DedupScope and RateScope describe identity buckets, not caller trust.
	// The runtime-wide rate cap also applies to every bucket.
	DedupScope string `json:"dedup_scope"`
	RateScope  string `json:"rate_scope"`
}

Status contains only bounded configuration and capability diagnostics, no history.

type StatusPort

type StatusPort interface {
	Status(context.Context) (Status, error)
}

StatusPort must only read configuration; no migration, probes or maintenance.

Jump to

Keyboard shortcuts

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