mcp

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: MIT Imports: 18 Imported by: ? 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 mcp finds the MCP servers that MCP client configs in a source tree launch or connect to, and judges each launched package with the SCANOSS vulnerabilities API.

Index

Constants

View Source
const (
	TransportStdio = "stdio"
	TransportSSE   = "sse"
	TransportHTTP  = "http"
)

Transports of an MCP server.

View Source
const (
	RuleID   = "ai.mcp.server-config"
	Category = "mcp_server"
)

Rule and category of an MCP server finding.

View Source
const (
	StatusMalicious  = "malicious"
	StatusVulnerable = "vulnerable"
	StatusClean      = "clean"
	StatusUnknown    = "unknown"
	// StatusUnpinned is a package without a version and no MAL-* advisory: not known malicious,
	// but whatever version is latest runs, and its advisories cannot be told apart.
	StatusUnpinned = "unpinned"
)

Verdict statuses of an MCP server.

View Source
const VerdictSource = "vulnerabilities-api"

VerdictSource names where verdicts come from.

Variables

This section is empty.

Functions

func Checkable

func Checkable(servers []Server) int

Checkable counts the servers whose package the vulnerabilities API can be asked about.

func Findings

func Findings(servers []Server, verdicts []Verdict) []sbom.AIUsageFinding

Findings renders each server with its verdict as an ai_usage finding.

func IsConfig

func IsConfig(rel string) bool

IsConfig reports whether rel, a slash-separated path, names an MCP client config.

Types

type Server

type Server struct {
	// Name is the server's key in the config.
	Name string
	// File is the config's path relative to the scanned root, with forward slashes.
	File string
	// Line is the line of the server's key.
	Line      int
	Transport string
	// Launcher is the program a stdio server runs (npx, uvx, docker, node); empty for a remote one.
	Launcher string
	// Package is the purl of the package the launcher runs; empty when it names none.
	Package string
	// Pinned is true when the launch names one exact version.
	Pinned bool
	// URL is a remote server's endpoint, without credentials or query.
	URL string
	// contains filtered or unexported fields
}

Server is one server entry of an MCP client config.

func Find

func Find(root string) ([]Server, error)

Find returns the servers of every MCP client config under root, ordered by file and line. A config that does not parse is skipped with a warning.

func Parse

func Parse(file string, data []byte) ([]Server, error)

Parse returns the servers one MCP client config declares. Environment variables, headers and launch arguments are never copied: that is where configs keep credentials.

type Verdict

type Verdict struct {
	Status string
	// IDs are the advisories behind a malicious or vulnerable status, e.g. MAL-2025-47604.
	IDs []string
}

Verdict is what the vulnerabilities API says about the package a server launches.

func Judge

func Judge(ctx context.Context, api scanoss.VulnerabilityAPI, servers []Server) ([]Verdict, error)

Judge looks up every server's package in one batched call and returns a verdict per server, in order. A server with no package is unknown. When the lookup fails every server is unknown and the error is returned for the caller to report.

Jump to

Keyboard shortcuts

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