server

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package server defines the MCP server: its tools, their inputs and outputs, and the validation between an agent's request and the lookups.

Index

Constants

This section is empty.

Variables

View Source
var Version = ""

Version is set at build time for container images, with -ldflags "-X .../internal/server.Version=...". Use BuildVersion to read it.

Functions

func BuildVersion

func BuildVersion() string

BuildVersion is the server's own version, as reported to clients. When the binary was not given one at build time, it falls back to the module version Go records for `go install ...@v1.2.3`, and to "dev" for a local build.

func New

func New(deps Deps) *mcp.Server

New returns the MCP server with all tools registered.

func NewHTTPHandler

func NewHTTPHandler(mcpServer *mcp.Server, options HTTPOptions) http.Handler

NewHTTPHandler serves the MCP server over Streamable HTTP as the 2026-07-28 revision describes it: one endpoint at /mcp that accepts POST, no sessions, and requests from other browser origins refused. /healthz answers 200 for load balancers and container probes, and needs no token.

Types

type ComponentInput

type ComponentInput struct {
	Name      string `json:"name,omitempty" jsonschema:"product name, such as LiteLLM or GitLab. Give this or image."`
	Image     string `` /* 158-byte string literal not displayed */
	Version   string `` /* 132-byte string literal not displayed */
	Ecosystem string `` /* 152-byte string literal not displayed */
	Package   string `json:"package,omitempty" jsonschema:"package name within the ecosystem"`
	Repo      string `json:"repo,omitempty" jsonschema:"upstream GitHub repository as owner/name, to read its security advisories"`
	CPE       string `json:"cpe,omitempty" jsonschema:"NVD product as vendor:product, such as gitlab:gitlab"`
}

ComponentInput identifies one component.

type ComponentSummary

type ComponentSummary struct {
	Component       ResolvedComponent `json:"component"`
	Status          string            `` /* 129-byte string literal not displayed */
	Reason          string            `json:"reason"`
	Counts          intel.Counts      `json:"counts"`
	LatestVersion   string            `json:"latestVersion,omitempty"`
	VersionStatus   string            `json:"versionStatus"`
	Support         intel.Support     `json:"support" jsonschema:"whether this version's release line still receives fixes"`
	OlderAdvisories int               `json:"olderAdvisories" jsonschema:"advisories that apply but were left out because they predate since"`
	TopAdvisories   []string          `json:"topAdvisories" jsonschema:"ids of the most urgent advisories, at most 5"`
	Failed          []string          `json:"failedSources" jsonschema:"sources that could not be checked for this component"`
}

ComponentSummary is one row of a batch answer.

type Deps

type Deps struct {
	Intel   *intel.Client
	Catalog *catalog.Catalog
	Logger  *slog.Logger
}

Deps are what the tools need.

type HTTPOptions

type HTTPOptions struct {
	// Token, when set, must be presented by every MCP request as
	// "Authorization: Bearer <token>". When empty there is no authentication,
	// and the server must only be reachable by callers you trust.
	Token string
	// JSON answers each request with a single application/json body instead
	// of a text/event-stream. Both are valid Streamable HTTP; the stream is
	// the default, and plain JSON suits proxies that buffer responses.
	JSON   bool
	Logger *slog.Logger
}

HTTPOptions configure the Streamable HTTP transport.

type ResolvedComponent

type ResolvedComponent struct {
	Name         string `json:"name"`
	Version      string `json:"version,omitempty"`
	VersionFrom  string `json:"versionFrom,omitempty" jsonschema:"where the version came from: input or image-tag"`
	ResolvedFrom string `` /* 145-byte string literal not displayed */
	Ecosystem    string `json:"ecosystem,omitempty"`
	Package      string `json:"package,omitempty"`
	Repo         string `json:"repo,omitempty"`
	CPE          string `json:"cpe,omitempty"`
}

ResolvedComponent is how the server understood the request.

Jump to

Keyboard shortcuts

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