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

badge

package
v1.6.3 Latest Latest
Warning

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

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

Documentation

Overview

Package badge renders the "mcpcheck" status badge a project can put in its README to show that its MCP server passed mcp-tester.

The SVG is self-contained, so the badge works from a plain repository file without any badge service. The JSON variant follows the shields.io endpoint schema for projects that prefer img.shields.io/endpoint.

Index

Constants

View Source
const (
	Green  = "#4c1"
	Yellow = "#dfb317"
	Red    = "#e05d44"
)

Colours as shields.io uses them.

View Source
const Label = "mcpcheck"

Label is the left-hand text of every badge.

Variables

This section is empty.

Functions

func JSON

func JSON(r Result) ([]byte, error)

JSON renders the badge in the shields.io endpoint schema.

func SVG

func SVG(r Result) []byte

SVG renders the badge in the shields.io "flat" style.

Types

type Endpoint

type Endpoint struct {
	SchemaVersion int    `json:"schemaVersion"`
	Label         string `json:"label"`
	Message       string `json:"message"`
	Color         string `json:"color"`
	IsError       bool   `json:"isError,omitempty"`

	Revision string `json:"revision,omitempty"`
	Latest   string `json:"latestRevision,omitempty"`
	Score    int    `json:"score"`
	Errors   int    `json:"errors"`
	Tester   string `json:"tester"`
	Checked  string `json:"checked"`
}

Endpoint is the shields.io endpoint schema (https://shields.io/badges/endpoint-badge), extended by fields shields.io ignores but a reader of the file can check.

type Result

type Result struct {
	// Revision is the protocol revision the server negotiated.
	Revision string
	// Latest is the newest revision mcp-tester checks against.
	Latest string
	Score  int
	// Errors counts protocol errors: MUST violations that break clients.
	Errors int
	// HideScore leaves the score off the badge, for projects that do not
	// want to show a number that rests on mcp-tester's own judgement.
	HideScore bool
	Tester    string
	Checked   time.Time
}

Result is what an inspection contributes to the badge.

func (Result) Color

func (r Result) Color() string

Color is red for protocol errors — they outweigh any score — yellow for a low score or an outdated revision, green otherwise.

func (Result) Message

func (r Result) Message() string

Message is the right-hand text, e.g. "spec 2026-07-28 · 92/100". The "spec" prefix keeps the revision from being read as the test date.

func (Result) Title

func (r Result) Title() string

Title is the tooltip: when and with which mcp-tester the check ran.

Jump to

Keyboard shortcuts

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