mcp

package
v0.0.0-...-515337b Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package mcp provides an MCP server for Zero analysis data

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultMaxOutputSize is the default maximum size of JSON output (1MB)
	DefaultMaxOutputSize = 1024 * 1024
	// DefaultMaxFindingsPerCategory is the default limit for findings per category
	DefaultMaxFindingsPerCategory = 500
	// DefaultMaxFileSize is the default maximum analysis file size (50MB)
	DefaultMaxFileSize = int64(50 * 1024 * 1024)
)

Default limits - can be overridden via ServerConfig

Functions

This section is empty.

Types

type AnalysisRawInput

type AnalysisRawInput struct {
	// Project ID in owner/repo format
	Project string `json:"project"`
	// Type of analysis (e.g. package-vulns, package-health)
	AnalysisType string `json:"analysis_type"`
}

AnalysisRawInput parameters for get_analysis_raw tool

type EmptyInput

type EmptyInput struct{}

EmptyInput for tools that take no parameters

type KnowledgeInput

type KnowledgeInput struct {
	// Analyzer name (e.g., "code-packages", "code-security")
	Analyzer string `json:"analyzer"`
	// Resource type: "patterns", "guidance", or "prompts"
	ResourceType string `json:"resource_type"`
	// Specific resource name (optional, lists all if omitted)
	Name string `json:"name,omitempty"`
}

KnowledgeInput parameters for get_knowledge tool

type ListProjectsInput

type ListProjectsInput struct {
	// Filter projects by owner/org name
	Owner string `json:"owner,omitempty"`
}

ListProjectsInput parameters for list_projects tool

type MalcontentInput

type MalcontentInput struct {
	// Project ID in owner/repo format
	Project string `json:"project"`
	// Minimum risk level to include
	MinRisk string `json:"min_risk,omitempty"`
	// Maximum number of findings to return
	Limit int `json:"limit,omitempty"`
}

MalcontentInput parameters for get_malcontent tool

type Project

type Project struct {
	ID                string   `json:"id"`
	Owner             string   `json:"owner"`
	Repo              string   `json:"repo"`
	Path              string   `json:"path"`
	AnalysisPath      string   `json:"analysis_path"`
	AvailableAnalyses []string `json:"available_analyses"`
	AvailableScans    []string `json:"available_scans,omitempty"` // Deprecated: use AvailableAnalyses
}

Project represents a hydrated project

type ProjectInput

type ProjectInput struct {
	// Project ID in owner/repo format
	Project string `json:"project"`
}

ProjectInput common parameter for tools that take a project

type SearchInput

type SearchInput struct {
	// Search query string
	Query string `json:"query"`
	// Limit search to specific project
	Project string `json:"project,omitempty"`
	// Limit search to specific analysis type
	Type string `json:"type,omitempty"`
}

SearchInput parameters for search_findings tool

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server implements the Zero MCP server

func NewServer

func NewServer(zeroHome string) *Server

NewServer creates a new MCP server with default configuration

func NewServerWithConfig

func NewServerWithConfig(zeroHome string, config ServerConfig) *Server

NewServerWithConfig creates a new MCP server with custom configuration

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

Run starts the MCP server on stdio

type ServerConfig

type ServerConfig struct {
	// MaxOutputSize limits JSON output size in bytes (default: 1MB)
	MaxOutputSize int
	// MaxFindingsPerCategory limits findings returned per category (default: 500)
	MaxFindingsPerCategory int
	// MaxFileSize limits analysis file size in bytes (default: 50MB)
	MaxFileSize int64
	// LazyEvaluation enables on-demand analyzer execution when cache is stale
	LazyEvaluation bool
	// CacheConfig holds per-analyzer TTL settings
	CacheConfig freshness.CacheConfig
}

ServerConfig holds configurable limits for the MCP server

func DefaultServerConfig

func DefaultServerConfig() ServerConfig

DefaultServerConfig returns the default server configuration

type TextOutput

type TextOutput struct {
	Text string `json:"text"`
}

Output types for tools

type VulnerabilitiesInput

type VulnerabilitiesInput struct {
	// Project ID in owner/repo format
	Project string `json:"project"`
	// Filter by severity (critical/high/medium/low)
	Severity string `json:"severity,omitempty"`
}

VulnerabilitiesInput parameters for get_vulnerabilities tool

Jump to

Keyboard shortcuts

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