Documentation
¶
Overview ¶
Package conformance holds what the official MCP conformance suite (github.com/modelcontextprotocol/conformance) needs from a server under test and nothing a released binary should carry: the suite's named fixture tools, resources and prompts, a loopback-only Streamable HTTP host, and a recovering middleware so one broken handler cannot cost the evidence for every scenario after it.
Nothing here is platform-specific. A server imports this package only from files behind its own `conformance` build tag, which is what keeps the HTTP listener out of the product build.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotLoopback = errors.New("conformance host refuses to bind: loopback only")
ErrNotLoopback reports a listen address that is not loopback.
Functions ¶
func RecoverMiddleware ¶
func RecoverMiddleware(logger *slog.Logger) mcp.Middleware
RecoverMiddleware turns a panicking handler into a JSON-RPC error instead of a dead process.
It belongs on the conformance host and not on a production server. Here the whole point is to finish the run and produce results, so one broken handler must not cost the evidence for every scenario after it: a run whose failures might mean "the server is not there" proves nothing. A production session makes the opposite trade, because a panic there means the engine's state is unknown.
func RequireLoopback ¶
RequireLoopback refuses any address that is not loopback.
The host has no authentication and no authorization: it is a test fixture that serves the full tool manifest of a desktop-automation server. Binding it to a routable interface would publish that manifest, and the ability to call it, to the network. The check is here rather than in a CLI so no future caller can route around it.
func Serve ¶
Serve exposes server over Streamable HTTP at addr+path until ctx ends.
The bound URL is printed to stdout, which is the runner's contract: with an ephemeral port the address is only known here and the suite needs it for --url. Logs go to the logger (stderr by convention) so stdout stays clean.
The transport is stateless: protocol 2026-07-28 removed protocol-level sessions, and the suite's stateless scenarios exercise exactly that. DNS-rebinding protection is left at its default (on); the suite has a scenario for it because a localhost server without HTTPS or auth is the case that needs it.
Types ¶
type AuditDestination ¶
AuditDestination writes the hash-chained audit entries to the logger, so a conformance run leaves the same transparency trail a real session would and the entries land in the workflow log next to the suite's output.
func (*AuditDestination) Close ¶
func (*AuditDestination) Close() error
func (*AuditDestination) Flush ¶
func (*AuditDestination) Flush() error
func (*AuditDestination) Write ¶
func (s *AuditDestination) Write(e audit.AuditEntry) error
type Fixtures ¶
Fixtures reports what was registered, so the rug-pull baselines can be pinned over the manifest the server will actually serve.
func RegisterFixtures ¶
RegisterFixtures adds the suite's fixtures when enabled, and reports what it added. With enabled false it registers nothing — that is the product pass, where the suite measures the manifest this server really ships.
type Probe ¶
type Probe struct{}
Probe satisfies signals.SystemProbe without a desktop engine.
The conformance host drives no real desktop, so the default policy's signals have nothing to read. Every method returns a zero value, which makes run-context report a non-interactive session and therefore fail. Under the default policy that is a warning and nothing more: the middleware is exercised on every request, and no request is refused.
func (*Probe) DeviceIdentity ¶
func (*Probe) DeviceIdentity() signals.DeviceIdentity
func (*Probe) RunContext ¶
func (*Probe) RunContext() signals.RunContext