dispatch

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package dispatch aggregates tools of several worker Lambda functions into one MCP server. The dispatcher lists tools of workers once (at cold start) and forwards tools/call to the worker owning the tool through Lambda Invoke, together with the caller's TokenInfo. Each worker keeps its own IAM role (least privilege per tool), clients connect to the single endpoint.

Workers are Lambda functions running serve.Handler, e.g. serve.Tool.

Index

Constants

View Source
const (
	// Comma separated names (or ARNs) of worker functions
	EnvWorkers = "CLOUDMCP_WORKERS"

	// Implementation name and version reported to clients
	EnvName    = "CLOUDMCP_NAME"
	EnvVersion = "CLOUDMCP_VERSION"

	// CloudWatch namespace of metrics, metrics are disabled if empty
	EnvMetrics = "CLOUDMCP_METRICS"
)

Environment variables of the dispatcher function (cmd/dispatcher).

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, cfg Config) (*mcp.Server, error)

New lists tools of all workers and returns the MCP server forwarding tool calls to workers. Call it at cold start, the tools are listed once. Tool names must be unique across workers.

Workers list their tools without the caller's identity (TokenInfo is nil), use serve.Filter at the dispatcher to choose tools per caller.

Types

type Config

type Config struct {
	// Implementation reported to clients (required)
	Implementation *mcp.Implementation

	// Options of the MCP server
	Options *mcp.ServerOptions

	// Names (or ARNs) of worker functions
	Workers []string

	// Lambda client
	Client Invoker
}

Config of the dispatcher.

type Invoker

type Invoker interface {
	Invoke(context.Context, *lambda.InvokeInput, ...func(*lambda.Options)) (*lambda.InvokeOutput, error)
}

Invoker is the subset of Lambda client used by the dispatcher.

Jump to

Keyboard shortcuts

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