Help us shape the future of Go! Take the 2026 Go Developer Survey

muster

package
v8.149.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 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, which answers the way a muster aggregator answers a session: the meta-tools listed (list_tools, filter_tools, describe_tool, call_tool, ...), every server tool called through call_tool and answered in its envelope from the scenario's sequences by tool name, and a direct call of a server tool refused as "tool not found". 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; a client id that is an HTTPS URL -- a client ID metadata document, what devctl sends -- is accepted as well, without a fetch.

View Source
const MCPPath = "/mcp"

MCPPath is where the aggregator speaks MCP.

Variables

View Source
var MetaTools = []string{
	"call_tool", "describe_prompt", "describe_resource", "describe_tool", "filter_prompts", "filter_resources",
	"filter_tools", "get_prompt", "get_resource", "list_core_tools", "list_prompts", "list_resources", "list_tools",
}

MetaTools are the tools muster exposes to a session; every other tool is called through call_tool.

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