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

httpcheck

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package httpcheck probes a Streamable HTTP MCP endpoint with hand-built requests and compares the answers with the transport rules of spec revision 2026-07-28: request metadata headers, error codes and HTTP status, Origin validation and the removal of sessions and GET streams.

Index

Constants

View Source
const (
	CodeMethodNotFound             = -32601
	CodeInvalidParams              = -32602
	CodeHeaderMismatch             = -32020
	CodeUnsupportedProtocolVersion = -32022
)

JSON-RPC error codes the checks expect.

View Source
const Revision = "2026-07-28"

Revision is the protocol revision whose transport rules are checked.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checker

type Checker struct {
	Endpoint string
	Client   *http.Client // carries authentication; http.DefaultClient if nil
	// Tools from tools/list; the tools/call header checks are skipped without them.
	Tools []Tool
}

Checker sends the probe requests.

func (*Checker) Run

func (c *Checker) Run(ctx context.Context) *Report

Run executes all checks.

type ParamHeader

type ParamHeader struct {
	Header string   // the Mcp-Param-{Header} name part
	Path   []string // property names from the root
	Type   string
}

ParamHeader is one valid x-mcp-header annotation: the tool parameter at Path is mirrored into the Mcp-Param-{Header} HTTP header.

func XMCPHeaders

func XMCPHeaders(schema any) ([]ParamHeader, []string)

XMCPHeaders validates the x-mcp-header annotations of an inputSchema (spec 2026-07-28): a non-empty token, unique ignoring case, only on string, integer or boolean properties, and only reachable through a chain of "properties" keys. It returns the valid annotations and the problems.

type Report

type Report struct {
	Endpoint          string   `json:"endpoint"`
	SupportedVersions []string `json:"supportedVersions,omitempty"`
	Results           []Result `json:"results"`
}

Report is the outcome of all checks.

func (*Report) Failed

func (r *Report) Failed() bool

Failed reports whether any check failed.

type Result

type Result struct {
	Name   string `json:"name"`
	Status Status `json:"status"`
	Detail string `json:"detail,omitempty"`
}

Result is the outcome of one check.

type Status

type Status string

Status of one check.

const (
	Pass Status = "PASS"
	Fail Status = "FAIL" // a MUST is violated
	Warn Status = "WARN" // a SHOULD is violated
	Skip Status = "SKIP"
)

type Tool

type Tool struct {
	Name        string
	InputSchema any
}

Tool is what the checks need to know about a listed tool.

Jump to

Keyboard shortcuts

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