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

mcpentry

package
v0.1.26 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 30 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 ErrReviewTargetInvalid = errors.New("MCP review target is invalid")

ErrReviewTargetInvalid marks selector rejection before request-field mapping.

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 NewReviewRequest added in v0.1.26

func NewReviewRequest(input RunReviewInput, root, requestID string, preflight bool) (reviewrun.Request, error)

NewReviewRequest maps decoded MCP fields without constructing a CLI invocation. Public handlers enforce their JSON grammar and 4096-byte objective bound first. Mapping preserves supported/public-admitted behavior, plus the former direct byte guard and role normalization. It does not recreate every private CLI parsing cause for arbitrary malformed direct calls.

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 ProjectInspection added in v0.1.24

func ProjectInspection(page query.Inspection, runID, minimum, kind string) (map[string]any, error)

ProjectInspection preserves the query owner's page and receipt without a second publication read. JSON numbers retain their exact integer spelling.

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 GetRunInput

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

GetRunInput selects one canonical run identity.

type InvocationInput added in v0.1.17

type InvocationInput struct {
	InvocationID string `json:"invocation_id"`
}

InvocationInput selects one exact invocation owned by the current MCP server process.

type ListFindingsInput

type ListFindingsInput struct {
	RequirementsLimit          int     `json:"requirements_limit,omitempty"`
	RequirementsCursor         string  `json:"requirements_cursor,omitempty"`
	ExpectedProjectBinding     *string `json:"expected_project_binding,omitempty"`
	ExpectedPublicationReceipt string  `json:"expected_publication_receipt,omitempty"`
	Limit                      int     `json:"limit,omitempty"`
	Cursor                     string  `json:"cursor,omitempty"`
	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 {
	Chunk          *query.ContentChunk
	ProjectBinding string
	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 (
	ResourceRequirement   ResourceKind = "requirement"
	ResourceFindingDetail ResourceKind = "detail"
	ResourceReport        ResourceKind = "report"
	ResourceEvidence      ResourceKind = "evidence"
	ResourceSourceImage   ResourceKind = "source_image"
)

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) Continuation added in v0.1.24

func (request ResourceRequest) Continuation() query.ContentContinuation

func (ResourceRequest) EvidenceIndex added in v0.1.24

func (request ResourceRequest) EvidenceIndex() int

func (ResourceRequest) FindingID

func (request ResourceRequest) FindingID() string

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) ProjectBinding added in v0.1.24

func (request ResourceRequest) ProjectBinding() string

func (ResourceRequest) RequirementID added in v0.1.26

func (request ResourceRequest) RequirementID() string

FindingID returns the admitted finding identity for evidence resources.

func (ResourceRequest) Role added in v0.1.24

func (request ResourceRequest) Role() string

func (ResourceRequest) RunID

func (request ResourceRequest) RunID() string

RunID returns the admitted run identity.

func (ResourceRequest) SourceIdentitySHA256 added in v0.1.25

func (request ResourceRequest) SourceIdentitySHA256() string

func (ResourceRequest) SourcePath added in v0.1.25

func (request ResourceRequest) SourcePath() string

func (ResourceRequest) SourceSide added in v0.1.25

func (request ResourceRequest) SourceSide() string

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.

func (ResourceRequest) Verified added in v0.1.24

func (request ResourceRequest) Verified() bool

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 {
	RequirementsPath       *string      `json:"requirements_path,omitempty"`
	ExpectedProjectBinding *string      `json:"expected_project_binding,omitempty"`
	Target                 ReviewTarget `json:"target"`
	Objective              string       `json:"objective,omitempty"`
	Roles                  []string     `json:"roles,omitempty"`
}

RunReviewInput selects original source state and optional review guidance.

type RunStatusProjection

type RunStatusProjection struct {
	FailedRunRecovery    recovery.Status
	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
	DiagnosticSummary    ports.RuntimeDiagnosticSummary
	HasDiagnosticSummary bool
}

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"`
	InvocationID *string `json:"invocation_id,omitempty"`
}

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