httpserver

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 13 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 httpserver serves the MCP server over streamable HTTP.

It does not authenticate clients: that belongs to whatever sits in front of it (see SPEC §9). It does reject browser requests from origins that aren't allowed, which guards against DNS rebinding and cross-site requests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(opts Options) http.Handler

Handler returns the HTTP handler: the MCP endpoint at Config.Path, plus /healthz, /readyz and, if enabled, /metrics.

func Serve

func Serve(ctx context.Context, opts Options) error

Serve listens on Config.Addr and serves until ctx is canceled, then shuts down gracefully.

func ServeListener

func ServeListener(ctx context.Context, ln net.Listener, opts Options) error

ServeListener is Serve on an existing listener, which it closes.

Types

type Options

type Options struct {
	Config config.HTTP
	Server *mcp.Server
	Logger *slog.Logger
	// Devices is reported by /readyz.
	Devices []string
	// Metrics, if set, is served at /metrics.
	Metrics http.Handler
}

Options configures the HTTP server.

Jump to

Keyboard shortcuts

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