mcp

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 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 mcp adapts ChannelTerm Tools to the Model Context Protocol.

This package is a protocol boundary. It depends only on the protocol-neutral Tool Registry and never owns, creates, or accesses a terminal Transport.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNilRegistry is returned when an MCP Server has no Tool Registry to adapt.
	ErrNilRegistry = errors.New("tool registry must not be nil")
	// ErrRequiredCursor is returned when an MCP wait tool has no cursor.
	ErrRequiredCursor = errors.New("cursor is required for wait tools")
)

Functions

func NewServer

func NewServer(registry *tool.Registry, version string) (*protocol.Server, error)

NewServer creates an MCP Server backed by registry and reports version in protocol implementation metadata. An empty version is reported as devel.

The returned Server has no ownership of registry or of the Sessions reached through it. In particular, disconnecting an MCP client only closes the MCP connection; the embedding application decides when shared Sessions close.

func NewStreamableHTTPHandler

func NewStreamableHTTPHandler(registry *tool.Registry, version string) (http.Handler, error)

NewStreamableHTTPHandler creates a stateless Streamable HTTP handler backed by registry and reporting version in MCP implementation metadata.

The handler returns the same MCP Server for every request, so HTTP and stdio expose the identical Tool Registry. Stateless mode is required for current MCP HTTP clients and makes an interrupted request release only its temporary protocol session; it never closes Registry-owned terminal Sessions.

func Run

func Run(ctx context.Context, registry *tool.Registry, version string, transport protocol.Transport) error

Run serves one MCP client over transport until it disconnects or ctx ends. version is exposed through MCP implementation metadata.

A normal client disconnect and context cancellation are successful shutdowns. Run deliberately does not close registry or its Sessions, because both can be shared with CLI or future GUI callers outside this protocol adapter.

Types

This section is empty.

Directories

Path Synopsis
Package terminal exposes Session operations as protocol-neutral Tools.
Package terminal exposes Session operations as protocol-neutral Tools.

Jump to

Keyboard shortcuts

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