mcpentry

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// MaxResourceChunkBytes bounds every report and evidence resource read.
	MaxResourceChunkBytes = 16 << 10
)
View Source
const ProtocolVersion = "2026-07-28"

ProtocolVersion is the newest MCP protocol version accepted by Mulgae.

Variables

View Source
var (

	// ErrRunStatusUnavailable identifies a run identity with neither publication
	// nor a completed diagnostic failure status safe for recovery.
	ErrRunStatusUnavailable = errors.New("run status unavailable")
)
View Source
var ErrUsage = errors.New("mulgae mcp usage error")

ErrUsage marks an invalid MCP command invocation.

Functions

func NewEvidenceResourceURI

func NewEvidenceResourceURI(runID, findingID, targetSHA256 string) (string, error)

NewEvidenceResourceURI returns the canonical first evidence resource URI.

func NewReportResourceURI

func NewReportResourceURI(runID string) (string, error)

NewReportResourceURI returns the canonical first report resource URI.

func ProjectDiagnosticRunStatus

func ProjectDiagnosticRunStatus(status ports.RuntimeDiagnosticRunStatus, expectedSessionID domain.SessionID, expectedRunID domain.RunID) (map[string]any, error)

ProjectDiagnosticRunStatus validates and renders the bounded status of an unpublished run. It deliberately carries no publication authority or paths.

func ProjectFindings

func ProjectFindings(view FindingsProjection) (map[string]any, error)

ProjectFindings validates and renders one bounded MCP finding result.

func ProjectRunStatus

func ProjectRunStatus(status RunStatusProjection, expectedSessionID domain.SessionID, expectedRunID domain.RunID) (map[string]any, error)

ProjectRunStatus validates and renders one bounded MCP run-status object.

func Serve

func Serve(ctx context.Context, reader io.Reader, writer io.Writer, config Config) error

Serve runs one attached stdio MCP server until input closes or the context is cancelled. The reader is closed during shutdown when it implements io.Closer.

Types

type Backend

Backend is the application-facing MCP tool boundary. Implementations own project-root confinement and return only public, bounded values.

type BackendResult

type BackendResult struct {
	Outcome string
	Data    map[string]any
}

BackendResult carries a successful tool outcome and its public data object.

type Command

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

Command is the parsed MCP command.

func Parse

func Parse(arguments []string) (Command, error)

Parse parses arguments following the mcp command name.

func (Command) ProjectRoot

func (command Command) ProjectRoot() (string, bool)

ProjectRoot returns the explicitly selected project root, when present.

type Config

type Config struct {
	Name             string
	Version          string
	ProjectRoot      string
	Backend          Backend
	NewRequestID     func() (string, error)
	ToolResultSchema json.RawMessage
}

Config fixes process-scoped MCP server identity and project authority.

type FindingProjection

type FindingProjection struct {
	ID       string
	Severity domain.Severity
	Title    string
}

FindingProjection is one verified finding summary selected by application policy.

type FindingsProjection

type FindingsProjection struct {
	RunID             string
	MinimumSeverity   domain.Severity
	TargetSHA256      string
	ReviewArtifactURI string
	Findings          []FindingProjection
}

FindingsProjection is the typed input to the bounded MCP finding result.

type GetRunInput

type GetRunInput struct {
	RunID string `json:"run_id"`
}

GetRunInput selects one canonical run identity.

type ListFindingsInput

type ListFindingsInput struct {
	RunID           string `json:"run_id"`
	MinimumSeverity string `json:"minimum_severity,omitempty"`
}

ListFindingsInput selects committed findings at or above one severity.

type ListRunsInput

type ListRunsInput struct {
	Limit  int    `json:"limit,omitempty"`
	Cursor string `json:"cursor,omitempty"`
}

ListRunsInput selects a bounded page ordered newest first.

type ResourceContent

type ResourceContent struct {
	MIMEType string
	Bytes    []byte
	Text     bool
}

ResourceContent is verified full content returned by the project-confined backend before MCP-owned chunk projection.

type ResourceKind

type ResourceKind string

ResourceKind is one closed verified MCP resource family.

const (
	ResourceReport   ResourceKind = "report"
	ResourceEvidence ResourceKind = "evidence"
)

type ResourceRequest

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

ResourceRequest is one canonical project-confined resource selector parsed by the MCP entrypoint. Accessors expose only values needed by the backend query.

func ParseResourceURI

func ParseResourceURI(raw string) (ResourceRequest, error)

ParseResourceURI admits one canonical MCP resource selector.

func (ResourceRequest) FindingID

func (request ResourceRequest) FindingID() string

FindingID returns the admitted finding identity for evidence resources.

func (ResourceRequest) Kind

func (request ResourceRequest) Kind() ResourceKind

Kind returns the admitted resource family.

func (ResourceRequest) Offset

func (request ResourceRequest) Offset() int

Offset returns the canonical chunk boundary requested by the client.

func (ResourceRequest) RunID

func (request ResourceRequest) RunID() string

RunID returns the admitted run identity.

func (ResourceRequest) TargetSHA256

func (request ResourceRequest) TargetSHA256() string

TargetSHA256 returns the admitted target digest for evidence resources.

func (ResourceRequest) URI

func (request ResourceRequest) URI() string

URI returns the canonical resource URI supplied by the client.

type ResourceResult

type ResourceResult struct {
	URI      string
	MIMEType string
	Text     string
	Blob     []byte
	Meta     map[string]any
}

ResourceResult is one verified bounded resource chunk and its continuation metadata. Exactly one of Text and Blob is populated.

type ReviewTarget

type ReviewTarget struct {
	Kind  string `json:"kind"`
	Value string `json:"value,omitempty"`
}

ReviewTarget is one non-stdin Mulgae target selector.

type RoleReportProjection

type RoleReportProjection struct {
	Role string
	URI  string
}

RoleReportProjection is one verified role report identity in a run status.

type RunReviewInput

type RunReviewInput struct {
	Target    ReviewTarget `json:"target"`
	Objective string       `json:"objective,omitempty"`
	Roles     []string     `json:"roles,omitempty"`
}

RunReviewInput selects one immutable review target and optional review guidance. MCP transport stdin is never a review target.

type RunStatusProjection

type RunStatusProjection struct {
	SessionID        string
	RunID            string
	RunState         domain.RunState
	HasRunState      bool
	PublicationState domain.PublicationStatus
	RecoveryAction   domain.RecoveryAction
	FinalArtifactURI string
	HasFinalArtifact bool
	ContentVerdict   domain.ContentVerdict
	CoverageStatus   domain.CoverageStatus
	CIDecision       domain.CIDecision
	HasAxes          bool
	RoleReports      []RoleReportProjection
}

RunStatusProjection is the typed input to the MCP public run-status shape.

type ToolError

type ToolError struct {
	Class     string  `json:"class"`
	Code      string  `json:"code"`
	Stage     string  `json:"stage"`
	Message   string  `json:"message"`
	Retryable bool    `json:"retryable"`
	SessionID *string `json:"session_id"`
	RunID     *string `json:"run_id"`
}

ToolError is a bounded, typed MCP tool failure without native paths or raw provider output.

type ToolResult

type ToolResult struct {
	SchemaVersion string         `json:"schema_version"`
	Tool          string         `json:"tool"`
	RequestID     string         `json:"request_id"`
	Outcome       string         `json:"outcome"`
	Data          map[string]any `json:"data"`
	Error         *ToolError     `json:"error"`
}

ToolResult is the common structured-content envelope for Mulgae MCP tools.

func (ToolResult) Validate

func (result ToolResult) Validate() error

Validate enforces the semantic relationships in the public tool envelope.

Jump to

Keyboard shortcuts

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