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 ¶
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 ¶
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 ¶
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.