muster

package
v8.85.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package muster mocks a muster aggregator on one server: its own OAuth authorization server -- the protected-resource metadata of RFC 9728, the server metadata of RFC 8414, dynamic client registration, an authorization endpoint that redirects straight back with a code the way a browser of a person who is signed in already does, the token endpoint issuing access and refresh tokens, userinfo -- and the MCP endpoint /mcp over streamable HTTP, whose tools answer from the scenario's sequences by tool name. DEVCTL_MUSTER_URL is the server's URL plus /mcp.

Index

Constants

View Source
const ClientID = "devctl-e2e-client"

ClientID is the client id the registration endpoint hands out.

View Source
const MCPPath = "/mcp"

MCPPath is where the aggregator speaks MCP.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Tools maps a tool name, as muster exposes it (x_<server>_<tool>, or
	// core_auth_login), to its sequence of answers: the Nth call gets the
	// Nth answer and the last one repeats.
	Tools map[string][]ToolResponse `yaml:"tools"`
	// Login is the userinfo answer's email; e2e-engineer@example.com when
	// left out.
	Login string `yaml:"login"`
	// Bearer is an access token the MCP endpoint accepts besides the ones it
	// issued: the scenario's keyring token.
	Bearer string `yaml:"bearer"`
	// RefreshToken is a refresh token the token endpoint accepts besides the
	// ones it issued: the scenario's keyring refresh token.
	RefreshToken string `yaml:"refreshToken"`
}

Config is the mock's script.

type Server

type Server struct {
	*httptest.Server
	// contains filtered or unexported fields
}

Server is a running mock.

func Start

func Start(cfg Config) *Server

Start serves the mock on a loopback port until Close.

func (*Server) MCPURL

func (s *Server) MCPURL() string

MCPURL is the value of DEVCTL_MUSTER_URL.

func (*Server) Requests

func (s *Server) Requests() []sequence.Request

Requests are the requests received so far.

type ToolResponse

type ToolResponse struct {
	// Args, when given, are arguments the call must carry with these values
	// (compared as JSON); a call that does not is answered with a tool error
	// naming the difference, so the scenario fails visibly.
	Args map[string]any `yaml:"args"`
	// Result is the tool's answer: a mapping or list becomes the structured
	// content (and the JSON text content), a string the text content.
	Result any `yaml:"result"`
	// Error makes the answer a tool error with this text.
	Error string `yaml:"error"`
}

ToolResponse is one scripted answer of a tool.

Jump to

Keyboard shortcuts

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