Documentation
¶
Index ¶
- Constants
- Variables
- func NewEvidenceResourceURI(runID, findingID, targetSHA256 string) (string, error)
- func NewReportResourceURI(runID string) (string, error)
- func ProjectDiagnosticRunStatus(status ports.RuntimeDiagnosticRunStatus, expectedSessionID domain.SessionID, ...) (map[string]any, error)
- func ProjectFindings(view FindingsProjection) (map[string]any, error)
- func ProjectRunStatus(status RunStatusProjection, expectedSessionID domain.SessionID, ...) (map[string]any, error)
- func Serve(ctx context.Context, reader io.Reader, writer io.Writer, config Config) error
- type Backend
- type BackendResult
- type Command
- type Config
- type FindingProjection
- type FindingsProjection
- type GetRunInput
- type InvocationInput
- type ListFindingsInput
- type ListRunsInput
- type ResourceContent
- type ResourceKind
- type ResourceRequest
- type ResourceResult
- type ReviewTarget
- type RoleReportProjection
- type RunReviewInput
- type RunStatusProjection
- type ToolError
- type ToolResult
Constants ¶
const (
// MaxResourceChunkBytes bounds every report and evidence resource read.
MaxResourceChunkBytes = 16 << 10
)
const ProtocolVersion = "2026-07-28"
ProtocolVersion is the newest MCP protocol version accepted by Mulgae.
Variables ¶
var ( // nor a completed diagnostic failure status safe for recovery. ErrRunStatusUnavailable = errors.New("run status unavailable") )
var ErrUsage = errors.New("mulgae mcp usage error")
ErrUsage marks an invalid MCP command invocation.
Functions ¶
func NewEvidenceResourceURI ¶
NewEvidenceResourceURI returns the canonical first evidence resource URI.
func NewReportResourceURI ¶
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.
Types ¶
type Backend ¶
type Backend interface {
RunReview(context.Context, string, RunReviewInput) (BackendResult, error)
PreflightReview(context.Context, string, RunReviewInput) (BackendResult, error)
ListRuns(context.Context, ListRunsInput) (map[string]any, error)
GetRun(context.Context, GetRunInput) (map[string]any, error)
ListFindings(context.Context, ListFindingsInput) (map[string]any, error)
ReadResource(context.Context, ResourceRequest) (ResourceContent, error)
}
Backend is the application-facing MCP tool boundary. Implementations own project-root confinement and return only public, bounded values.
type BackendResult ¶
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 (Command) ProjectRoot ¶
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 ¶
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 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 {
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 ¶
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 ¶
ReviewTarget is one non-stdin Mulgae target selector.
type RoleReportProjection ¶
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"`
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.