mcp

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Copyright (c) Roman Atachiants and contributors. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for details. Package mcp implements the optional MCP endpoint for llmux. It exposes application-owned agents as MCP tools over stateless Streamable HTTP, reusing the shared agent execution and lifecycle machinery through the Host seam. MCP SDK types never cross back into the public agent contract.

Index

Constants

View Source
const ProtocolVersion = "2026-07-28"

ProtocolVersion is the MCP protocol revision served by Transport. Requests at older revisions are rejected; legacy initialize handshakes cannot proceed against this endpoint.

Variables

This section is empty.

Functions

This section is empty.

Types

type Host

type Host interface {
	// List returns the caller-visible unified catalog for this request.
	// Only entries with a nonempty Info.Tool become MCP tools. A nil or empty
	// result yields an empty tool catalog rather than a hidden failure.
	List(ctx context.Context) (map[string]chat.Info, error)
	// Run executes one canonical non-streaming request through the shared
	// lifecycle coordinator. Replays return without preparation or execution.
	// Accepted work that fails preparation is finalized exactly once.
	Run(ctx context.Context, idempotencyKey string, parsed *protocol.ParsedRequest) (chat.Response, error)
	// Limits returns the handler request and output limits.
	Limits() chat.Limits
	// LogError observes operational failures without exposing them.
	LogError(ctx context.Context, err error)
}

Host is the execution seam provided by the llmux Handler. It keeps the MCP adapter from duplicating lifecycle machinery: resolution, validation, acceptance (including CatalogAgent), preparation, execution, and Finish.

type Transport

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

Transport owns the stateless Streamable HTTP endpoint for one Handler.

func NewTransport

func NewTransport(host Host) *Transport

NewTransport builds the MCP endpoint transport.

func (*Transport) ServeHTTP

func (t *Transport) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves one MCP request. Host.List runs exactly once with the authenticated request context; the projected tool set is pinned to this request and never shared across callers or identities.

Jump to

Keyboard shortcuts

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