mcpserver

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package mcpserver exposes the broker over the Model Context Protocol (stdio), so an AI agent can claim and release simulators as tool calls.

Two design points that come straight from the adversarial review:

  • The agent must NOT pass the ephemeral `simbroker claim` invocation's pid as the holder — that process dies instantly and the claim would look dead. So the MCP server claims with ITS OWN pid (the long-lived session process), making this server the heartbeat owner for every claim it creates.
  • A background goroutine renews those claims at TTL/3, independent of whether a tool call is currently blocking, so a busy agent never lets its lease lapse. On exit (stdin EOF / SIGINT / SIGTERM) the server releases them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server wraps a broker with MCP plumbing and ownership tracking.

func New

func New(b *broker.Broker, ttl time.Duration) *Server

New builds an MCP server over the given broker. ttl is the lease length used for claims it creates (0 -> the broker's configured default).

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

Run registers the tools and serves over stdio until the client disconnects or the process is signalled, then releases every claim this server owns.

Jump to

Keyboard shortcuts

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