server

package
v0.0.0-...-1c90dee Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package server wires an mcp.Server behind a net/http.Server with a bearer-token middleware in front. This is the full HTTP surface for a running hearsay instance: POST /mcp for MCP traffic, GET /health for tunnel/reverse-proxy probes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Instance

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

Instance is a running hearsay server; Shutdown() gracefully stops it.

func Start

func Start(opts Options) (*Instance, error)

Start opens a TCP listener and begins serving. Returns immediately on listen error (most importantly EADDRINUSE, which main.go translates into a friendly message).

func (*Instance) Shutdown

func (i *Instance) Shutdown(ctx context.Context) error

Shutdown drains in-flight requests with a short grace period.

type Options

type Options struct {
	Port        int
	Bind        string
	Token       string
	PeerName    string
	PeerVersion string
	DataDir     string
	LiveWindow  time.Duration
	Quiet       bool

	// Agent is non-nil iff `--enable-agent` was set.  When nil, the
	// Phase-2 agent tools (ask_peer_claude, etc.) are not registered
	// and the existing 8 read-only tools are the entire surface.
	Agent agent.Agent
}

Jump to

Keyboard shortcuts

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