mcpserver

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package mcpserver exposes GitContribute application capabilities through the Model Context Protocol.

Reader tools and resources are local and offline. Operator tools declare network reads, local writes, durable jobs, or process execution through distinct interfaces and MCP annotations. Protocol payloads are mapped to product-owned application contracts rather than implementing use cases here.

Index

Constants

View Source
const (
	ToolSearchRepositories     = "gitcontribute.corpus.search_repositories"
	ToolSearchThreads          = "gitcontribute.corpus.search_threads"
	ToolSearchCode             = "gitcontribute.corpus.search_code"
	ToolGetRepository          = "gitcontribute.corpus.get_repository"
	ToolGetThread              = "gitcontribute.corpus.get_thread"
	ToolGetRepositoryDossier   = "gitcontribute.corpus.get_repository_dossier"
	ToolExplainMatch           = "gitcontribute.corpus.explain_match"
	ToolGetInvestigation       = "gitcontribute.corpus.get_investigation"
	ToolListOpportunities      = "gitcontribute.corpus.list_opportunities"
	ToolGetOpportunity         = "gitcontribute.corpus.get_opportunity"
	ToolGetEvidence            = "gitcontribute.corpus.get_evidence"
	ToolGetReadiness           = "gitcontribute.corpus.get_readiness"
	ToolFindClusters           = "gitcontribute.corpus.find_clusters"
	ToolFindNeighbors          = "gitcontribute.corpus.find_neighbors"
	ToolGetCoverage            = "gitcontribute.corpus.get_coverage"
	ToolGetLens                = "gitcontribute.corpus.get_lens"
	ToolBuildRepositoryDossier = "gitcontribute.corpus.build_repository_dossier"
	ToolGetJob                 = "gitcontribute.jobs.get"
	ToolCancelJob              = "gitcontribute.jobs.cancel"
	ToolStartCrawl             = "gitcontribute.github.start_crawl"
	ToolSyncRepository         = "gitcontribute.github.sync_repository"
	ToolHydrateThread          = "gitcontribute.github.hydrate_thread"
	ToolHydrateRepository      = "gitcontribute.github.hydrate_repository"
	ToolCreateWorkspace        = "gitcontribute.workspace.create"
	ToolDefineValidation       = "gitcontribute.validation.define"
	ToolRunValidation          = "gitcontribute.validation.run"
	ToolStartInvestigation     = "gitcontribute.workflow.start_investigation"
	ToolRecordHypothesis       = "gitcontribute.workflow.record_hypothesis"
	ToolCheckDuplicates        = "gitcontribute.workflow.check_duplicates"
	ToolCheckCollisions        = "gitcontribute.workflow.check_collisions"
	ToolPromoteOpportunity     = "gitcontribute.workflow.promote_opportunity"
	ToolPrepareContribution    = "gitcontribute.workflow.prepare_contribution"
)

Canonical MCP tool names group operations by capability and side-effect boundary.

Variables

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound lets readers distinguish absent corpus objects from failures.

Functions

This section is empty.

Types

type BuildRepositoryDossierInput

type BuildRepositoryDossierInput RepoInput

BuildRepositoryDossierInput selects a repository for durable dossier generation.

type CancelJobInput

type CancelJobInput GetJobInput

CancelJobInput selects a durable job for persisted cancellation.

type CheckCollisionsInput

type CheckCollisionsInput CheckDuplicatesInput

CheckCollisionsInput selects a hypothesis or opportunity for collision analysis.

type CheckDuplicatesInput

type CheckDuplicatesInput struct {
	Target string `json:"target" jsonschema:"Target scope: hypothesis or opportunity"`
	ID     string `json:"id" jsonschema:"Hypothesis or opportunity ID"`
	Limit  int    `json:"limit,omitempty" jsonschema:"Maximum findings from 1 to 100"`
}

CheckDuplicatesInput selects a hypothesis or opportunity for duplicate analysis.

type CheckOutput

type CheckOutput struct {
	Target         string         `json:"target"`
	ID             string         `json:"id"`
	Repo           string         `json:"repo,omitempty"`
	Query          string         `json:"query,omitempty"`
	Total          int            `json:"total"`
	Findings       []EvidenceItem `json:"findings,omitempty"`
	SourceRevision string         `json:"source_revision,omitempty"`
	Limit          int            `json:"limit"`
}

CheckOutput contains evidence-backed duplicate or collision findings.

type ClusterMemberOutput

type ClusterMemberOutput struct {
	Kind     string  `json:"kind"`
	Owner    string  `json:"owner"`
	Repo     string  `json:"repo"`
	Number   int     `json:"number"`
	Title    string  `json:"title,omitempty"`
	State    string  `json:"state,omitempty"`
	Score    float64 `json:"score"`
	Reason   string  `json:"reason"`
	Included bool    `json:"included"`
}

ClusterMemberOutput describes one member of a duplicate cluster.

type ClusterOutput

type ClusterOutput struct {
	StableID    string                `json:"stable_id"`
	State       string                `json:"state"`
	Canonical   ClusterMemberOutput   `json:"canonical"`
	MemberCount int                   `json:"member_count"`
	Members     []ClusterMemberOutput `json:"members,omitempty"`
}

ClusterOutput contains a stable duplicate cluster and its canonical member.

type CodeMatchOutput

type CodeMatchOutput struct {
	ID       string `json:"id"`
	Repo     string `json:"repo"`
	Commit   string `json:"commit"`
	Path     string `json:"path"`
	Language string `json:"language,omitempty"`
	Snippet  string `json:"snippet"`
	Bytes    int    `json:"bytes"`
}

CodeMatchOutput identifies one stored code match.

type ContributionWorkflowResource

type ContributionWorkflowResource struct {
	SchemaVersion string                `json:"schema_version"`
	OpportunityID string                `json:"opportunity_id"`
	Resources     []WorkflowResourceRef `json:"resources"`
	Prompts       []WorkflowPromptRef   `json:"prompts"`
	Safety        []string              `json:"safety"`
	NextSteps     []string              `json:"next_steps"`
}

ContributionWorkflowResource links safe local resources and prompts for one opportunity.

type CreateWorkspaceInput

type CreateWorkspaceInput struct {
	InvestigationID string `json:"investigation_id" jsonschema:"Investigation ID"`
	Remote          string `json:"remote" jsonschema:"Git remote URL to clone"`
	BaseRef         string `json:"base_ref" jsonschema:"Base ref to resolve"`
	CandidateRef    string `json:"candidate_ref" jsonschema:"Candidate ref to resolve"`
	Name            string `json:"name" jsonschema:"Workspace name"`
}

CreateWorkspaceInput configures a durable managed-workspace creation job.

type DefineValidationInput

type DefineValidationInput struct {
	InvestigationID string   `json:"investigation_id" jsonschema:"Investigation ID"`
	Kind            string   `json:"kind" jsonschema:"Validation kind"`
	Command         string   `json:"command" jsonschema:"Shell-free command to execute"`
	WorkingDir      string   `json:"working_dir" jsonschema:"Working directory"`
	BaseWorkingDir  string   `json:"base_working_dir,omitempty" jsonschema:"Base workspace directory"`
	CandidateDir    string   `json:"candidate_dir,omitempty" jsonschema:"Candidate workspace directory"`
	Env             []string `json:"env,omitempty" jsonschema:"Allowed environment variable names"`
	Timeout         string   `json:"timeout,omitempty" jsonschema:"Positive Go duration; defaults to 30m"`
	MaxOutputBytes  int64    `json:"max_output_bytes,omitempty" jsonschema:"Maximum captured bytes per output stream; defaults to 65536"`
}

DefineValidationInput records a bounded validation command without executing it.

type DossierOutput

type DossierOutput struct {
	Owner    string         `json:"owner"`
	Repo     string         `json:"repo"`
	AsOf     string         `json:"as_of,omitempty"`
	Sections map[string]any `json:"sections"`
}

DossierOutput contains a persisted repository dossier snapshot.

type DraftOutput

type DraftOutput struct {
	OpportunityID string `json:"opportunity_id"`
	Kind          string `json:"kind"`
	Title         string `json:"title"`
	Body          string `json:"body"`
	RenderedAt    string `json:"rendered_at"`
}

DraftOutput contains a rendered contribution draft.

type EvidenceInput

type EvidenceInput struct {
	InvestigationID string `json:"investigation_id,omitempty" jsonschema:"Filter by investigation ID"`
	OpportunityID   string `json:"opportunity_id,omitempty" jsonschema:"Filter by opportunity ID"`
	Relation        string `json:"relation,omitempty" jsonschema:"Optional relation filter: supporting, contradicting, inconclusive, stale, invalid"`
	Limit           int    `json:"limit,omitempty" jsonschema:"Maximum results from 1 to 100"`
}

EvidenceInput filters and bounds stored evidence.

type EvidenceItem

type EvidenceItem struct {
	ID               string                   `json:"id"`
	Type             string                   `json:"type"`
	Relation         string                   `json:"relation"`
	Description      string                   `json:"description"`
	SourceRefs       []SourceRef              `json:"source_refs,omitempty"`
	SourceProvenance []EvidenceSourceRevision `json:"source_provenance,omitempty"`
	Freshness        string                   `json:"freshness,omitempty"`
	FreshnessReason  string                   `json:"freshness_reason,omitempty"`
	CreatedAt        string                   `json:"created_at"`
}

EvidenceItem is the stable MCP representation of one evidence record.

type EvidenceOutput

type EvidenceOutput struct {
	InvestigationID string         `json:"investigation_id,omitempty"`
	OpportunityID   string         `json:"opportunity_id,omitempty"`
	Total           int            `json:"total"`
	Evidence        []EvidenceItem `json:"evidence"`
}

EvidenceOutput contains bounded evidence matching a filter.

type EvidenceSourceRevision

type EvidenceSourceRevision struct {
	Subject             EvidenceSourceSubject `json:"subject"`
	SourceUpdatedAt     string                `json:"source_updated_at,omitempty"`
	ObservationSequence int64                 `json:"observation_sequence"`
	ObservedAt          string                `json:"observed_at"`
}

EvidenceSourceRevision records the source order used by evidence.

type EvidenceSourceSubject

type EvidenceSourceSubject struct {
	Kind       string `json:"kind"`
	Owner      string `json:"owner"`
	Repo       string `json:"repo"`
	ThreadKind string `json:"thread_kind,omitempty"`
	Number     int    `json:"number,omitempty"`
	Facet      string `json:"facet,omitempty"`
}

EvidenceSourceSubject identifies one independently refreshed corpus subject.

type ExplainMatchInput

type ExplainMatchInput struct {
	Query  string `json:"query,omitempty" jsonschema:"Original search query"`
	Owner  string `json:"owner" jsonschema:"Repository owner"`
	Repo   string `json:"repo" jsonschema:"Repository name"`
	Kind   string `json:"kind,omitempty" jsonschema:"Match kind: repo, issue, pull_request, or code"`
	Number int    `json:"number,omitempty" jsonschema:"Thread number for issue or pull_request matches"`
	Path   string `json:"path,omitempty" jsonschema:"File path for code matches"`
	Commit string `json:"commit,omitempty" jsonschema:"Commit SHA for code matches"`
	Limit  int    `json:"limit,omitempty" jsonschema:"Maximum explanation facets from 1 to 100"`
}

ExplainMatchInput identifies an exact stored result and its original query.

type ExplainMatchOutput

type ExplainMatchOutput struct {
	Query          string                `json:"query"`
	Kind           string                `json:"kind"`
	Owner          string                `json:"owner"`
	Repo           string                `json:"repo"`
	Number         int                   `json:"number,omitempty"`
	Path           string                `json:"path,omitempty"`
	Commit         string                `json:"commit,omitempty"`
	State          string                `json:"state,omitempty"`
	Title          string                `json:"title"`
	Snippet        string                `json:"snippet,omitempty"`
	MatchedFields  []string              `json:"matched_fields,omitempty"`
	Score          float64               `json:"score"`
	Reason         string                `json:"reason"`
	SourceRevision string                `json:"source_revision,omitempty"`
	Facets         []FacetCoverageOutput `json:"facets,omitempty"`
	AsOf           string                `json:"as_of,omitempty"`
}

ExplainMatchOutput reports the stored facts that contributed to a match score.

type FacetCoverageOutput

type FacetCoverageOutput struct {
	Facet     string `json:"facet"`
	Complete  bool   `json:"complete"`
	Status    string `json:"status"`
	UpdatedAt string `json:"updated_at"`
}

FacetCoverageOutput reports completeness and freshness for one facet.

type FindClustersInput

type FindClustersInput struct {
	Owner string `json:"owner" jsonschema:"GitHub repository owner"`
	Repo  string `json:"repo" jsonschema:"GitHub repository name"`
	Limit int    `json:"limit,omitempty" jsonschema:"Maximum clusters from 1 to 100"`
}

FindClustersInput selects a repository and bounds duplicate clusters.

type FindClustersOutput

type FindClustersOutput struct {
	Owner    string          `json:"owner"`
	Repo     string          `json:"repo"`
	Total    int             `json:"total"`
	Clusters []ClusterOutput `json:"clusters"`
}

FindClustersOutput contains duplicate clusters for a repository.

type FindNeighborsInput

type FindNeighborsInput struct {
	Owner  string `json:"owner" jsonschema:"GitHub repository owner"`
	Repo   string `json:"repo" jsonschema:"GitHub repository name"`
	Kind   string `json:"kind" jsonschema:"Thread kind: issue or pull_request"`
	Number int    `json:"number" jsonschema:"GitHub issue or pull request number"`
	Limit  int    `json:"limit,omitempty" jsonschema:"Maximum neighbors from 1 to 100"`
}

FindNeighborsInput selects a thread and bounds similar-thread results.

type FindNeighborsOutput

type FindNeighborsOutput struct {
	Owner          string           `json:"owner"`
	Repo           string           `json:"repo"`
	Kind           string           `json:"kind"`
	Number         int              `json:"number"`
	SourceRevision string           `json:"source_revision"`
	Neighbors      []NeighborOutput `json:"neighbors"`
}

FindNeighborsOutput contains deterministic neighbors for a stored thread.

type GetCoverageInput

type GetCoverageInput struct {
	Owner string `json:"owner" jsonschema:"GitHub repository owner"`
	Repo  string `json:"repo" jsonschema:"GitHub repository name"`
}

GetCoverageInput selects repository facet coverage.

type GetCoverageOutput

type GetCoverageOutput struct {
	Owner  string                `json:"owner"`
	Repo   string                `json:"repo"`
	AsOf   string                `json:"as_of"`
	Facets []FacetCoverageOutput `json:"facets"`
}

GetCoverageOutput reports all known coverage for a repository.

type GetJobInput

type GetJobInput struct {
	ID string `json:"id" jsonschema:"Durable job ID"`
}

GetJobInput selects a durable job by opaque ID.

type GetJobOutput

type GetJobOutput struct {
	ID                    string `json:"id"`
	Kind                  string `json:"kind"`
	Status                string `json:"status"`
	Request               any    `json:"request,omitempty"`
	Result                any    `json:"result,omitempty"`
	Error                 string `json:"error,omitempty"`
	Progress              string `json:"progress,omitempty"`
	Statistics            string `json:"statistics,omitempty"`
	CreatedAt             string `json:"created_at"`
	StartedAt             string `json:"started_at,omitempty"`
	CompletedAt           string `json:"completed_at,omitempty"`
	CancelledAt           string `json:"cancelled_at,omitempty"`
	CancellationRequested bool   `json:"cancellation_requested"`
}

GetJobOutput reports durable state, progress, and result fields for a job.

type GetRepositoryDossierInput

type GetRepositoryDossierInput RepoInput

GetRepositoryDossierInput selects a persisted repository dossier.

type HydrateRepositoryInput

type HydrateRepositoryInput struct {
	Owner    string   `json:"owner" jsonschema:"GitHub repository owner"`
	Repo     string   `json:"repo" jsonschema:"GitHub repository name"`
	Facets   []string `json:"facets,omitempty" jsonschema:"Facets to hydrate; empty selects all applicable facets"`
	MaxPages int      `json:"max_pages,omitempty" jsonschema:"Maximum pages per facet from 1 to 100"`
	State    string   `json:"state,omitempty" jsonschema:"Optional thread state filter: open, closed, or all"`
	Numbers  []int    `json:"numbers,omitempty" jsonschema:"Optional exact thread numbers to hydrate"`
}

HydrateRepositoryInput configures a durable repository-wide hydration job.

type HydrateThreadInput

type HydrateThreadInput struct {
	Owner    string   `json:"owner" jsonschema:"GitHub repository owner"`
	Repo     string   `json:"repo" jsonschema:"GitHub repository name"`
	Number   int      `json:"number" jsonschema:"GitHub issue or pull request number"`
	Facets   []string `json:"facets,omitempty" jsonschema:"Facets to hydrate; empty selects all applicable facets"`
	MaxPages int      `json:"max_pages,omitempty" jsonschema:"Maximum pages per facet from 1 to 100"`
}

HydrateThreadInput configures explicit child-facet retrieval for one thread.

type HydrateThreadOutput

type HydrateThreadOutput struct {
	Owner    string                `json:"owner"`
	Repo     string                `json:"repo"`
	Number   int                   `json:"number"`
	Kind     string                `json:"kind"`
	Requests int                   `json:"requests"`
	Facets   []HydratedFacetOutput `json:"facets"`
	Message  string                `json:"message"`
}

HydrateThreadOutput summarizes a completed thread hydration.

type HydratedFacetOutput

type HydratedFacetOutput struct {
	Facet    string `json:"facet"`
	Count    int    `json:"count"`
	Pages    int    `json:"pages"`
	Complete bool   `json:"complete"`
}

HydratedFacetOutput summarizes one persisted hydration facet.

type HypothesisOutput

type HypothesisOutput struct {
	ID                 string      `json:"id"`
	InvestigationID    string      `json:"investigation_id"`
	Title              string      `json:"title"`
	Description        string      `json:"description"`
	Category           string      `json:"category"`
	ExpectedBehavior   string      `json:"expected_behavior,omitempty"`
	ObservedBehavior   string      `json:"observed_behavior,omitempty"`
	PotentialImpact    string      `json:"potential_impact,omitempty"`
	OpenQuestions      []string    `json:"open_questions,omitempty"`
	AffectedComponents []string    `json:"affected_components,omitempty"`
	SourceRefs         []SourceRef `json:"source_refs,omitempty"`
	Status             string      `json:"status"`
	CreatedAt          string      `json:"created_at"`
	UpdatedAt          string      `json:"updated_at"`
}

HypothesisOutput is the stable MCP representation of a hypothesis.

type HypothesisSummary

type HypothesisSummary struct {
	ID          string `json:"id"`
	Title       string `json:"title"`
	Category    string `json:"category"`
	Status      string `json:"status"`
	Description string `json:"description,omitempty"`
}

HypothesisSummary is the compact hypothesis representation nested in an investigation.

type InvestigationInput

type InvestigationInput struct {
	ID              string `json:"id" jsonschema:"Investigation ID"`
	HypothesisLimit int    `json:"hypothesis_limit,omitempty" jsonschema:"Maximum hypotheses from 1 to 100"`
}

InvestigationInput selects an investigation and bounds nested hypotheses.

type InvestigationOutput

type InvestigationOutput struct {
	ID              string              `json:"id"`
	Owner           string              `json:"owner"`
	Repo            string              `json:"repo"`
	CommitSHA       string              `json:"commit_sha,omitempty"`
	Lens            string              `json:"lens,omitempty"`
	Status          string              `json:"status"`
	CreatedAt       string              `json:"created_at"`
	UpdatedAt       string              `json:"updated_at"`
	HypothesisTotal int                 `json:"hypothesis_total"`
	Hypotheses      []HypothesisSummary `json:"hypotheses,omitempty"`
}

InvestigationOutput is the stable MCP representation of an investigation.

type JobReference

type JobReference struct {
	ID      string `json:"id"`
	Kind    string `json:"kind"`
	Status  string `json:"status"`
	Message string `json:"message"`
}

JobReference is returned by long-running tools that submit durable jobs.

type LensInput

type LensInput struct {
	Name string `json:"name" jsonschema:"Lens name"`
}

LensInput selects a saved lens by name.

type LensOutput

type LensOutput struct {
	Name       string          `json:"name"`
	Definition lens.Definition `json:"definition"`
	CreatedAt  string          `json:"created_at"`
	UpdatedAt  string          `json:"updated_at"`
}

LensOutput contains a saved lens definition and timestamps.

type ListOpportunitiesInput

type ListOpportunitiesInput struct {
	InvestigationID string `json:"investigation_id" jsonschema:"Investigation ID"`
	Limit           int    `json:"limit,omitempty" jsonschema:"Maximum results from 1 to 100"`
}

ListOpportunitiesInput selects and bounds opportunities for an investigation.

type ListOpportunitiesOutput

type ListOpportunitiesOutput struct {
	Opportunities []OpportunitySummary `json:"opportunities"`
	Total         int                  `json:"total"`
}

ListOpportunitiesOutput contains bounded opportunities for an investigation.

type NeighborOutput

type NeighborOutput struct {
	Kind   string  `json:"kind"`
	Owner  string  `json:"owner"`
	Repo   string  `json:"repo"`
	Number int     `json:"number"`
	Title  string  `json:"title"`
	State  string  `json:"state"`
	Score  float64 `json:"score"`
	Reason string  `json:"reason"`
}

NeighborOutput describes one similar stored thread and its score.

type NeighborReader

type NeighborReader interface {
	FindNeighbors(context.Context, FindNeighborsInput) (FindNeighborsOutput, error)
}

NeighborReader is the optional local nearest-thread query capability.

type OpportunityInput

type OpportunityInput struct {
	ID            string `json:"id" jsonschema:"Opportunity ID"`
	EvidenceLimit int    `json:"evidence_limit,omitempty" jsonschema:"Maximum evidence IDs from 1 to 100"`
}

OpportunityInput selects an opportunity and bounds nested evidence.

type OpportunityOutput

type OpportunityOutput struct {
	ID                  string      `json:"id"`
	InvestigationID     string      `json:"investigation_id"`
	HypothesisID        string      `json:"hypothesis_id,omitempty"`
	Title               string      `json:"title"`
	ProblemStatement    string      `json:"problem_statement"`
	Category            string      `json:"category"`
	Scope               string      `json:"scope"`
	Impact              string      `json:"impact"`
	Confidence          float64     `json:"confidence"`
	ExpectedEffort      string      `json:"expected_effort,omitempty"`
	Dependencies        []string    `json:"dependencies,omitempty"`
	CollisionStatus     string      `json:"collision_status"`
	MaintainerAlignment string      `json:"maintainer_alignment,omitempty"`
	SourceRefs          []SourceRef `json:"source_refs,omitempty"`
	EvidenceTotal       int         `json:"evidence_total"`
	EvidenceIDs         []string    `json:"evidence_ids,omitempty"`
	Status              string      `json:"status"`
	CreatedAt           string      `json:"created_at"`
	UpdatedAt           string      `json:"updated_at"`
}

OpportunityOutput is the stable MCP representation of a contribution opportunity.

type OpportunitySummary

type OpportunitySummary struct {
	ID              string  `json:"id"`
	InvestigationID string  `json:"investigation_id"`
	Title           string  `json:"title"`
	Category        string  `json:"category"`
	Status          string  `json:"status"`
	Confidence      float64 `json:"confidence"`
	CollisionStatus string  `json:"collision_status"`
	CreatedAt       string  `json:"created_at"`
	UpdatedAt       string  `json:"updated_at"`
}

OpportunitySummary is the compact opportunity representation used in lists.

type PrepareContributionInput

type PrepareContributionInput struct {
	OpportunityID string `json:"opportunity_id" jsonschema:"Opportunity ID"`
	Kind          string `json:"kind" jsonschema:"Contribution kind: issue or pull_request"`
	WorkspaceID   string `json:"workspace_id,omitempty" jsonschema:"Workspace ID for pull_request drafts"`
	Approach      string `json:"approach,omitempty" jsonschema:"Approach summary for pull requests"`
	Changes       string `json:"changes,omitempty" jsonschema:"Changes summary for pull requests"`
	Compatibility string `json:"compatibility,omitempty" jsonschema:"Compatibility notes for pull requests"`
	Limitations   string `json:"limitations,omitempty" jsonschema:"Limitations for pull requests"`
	LinkedIssue   string `json:"linked_issue,omitempty" jsonschema:"Linked issue for pull requests"`
	Guidance      string `json:"guidance,omitempty" jsonschema:"Optional guidance to include"`
	Success       string `json:"success,omitempty" jsonschema:"Success criteria for issue drafts"`
}

PrepareContributionInput renders a local issue or pull-request draft.

type PromoteOpportunityInput

type PromoteOpportunityInput struct {
	HypothesisID        string      `json:"hypothesis_id" jsonschema:"Hypothesis ID to promote"`
	ProblemStatement    string      `json:"problem_statement" jsonschema:"Problem statement"`
	Scope               string      `json:"scope" jsonschema:"Scope of the opportunity"`
	Impact              string      `json:"impact" jsonschema:"Impact of the opportunity"`
	ExpectedEffort      string      `json:"expected_effort" jsonschema:"Expected effort"`
	Confidence          float64     `json:"confidence" jsonschema:"Confidence from 0.0 to 1.0"`
	Dependencies        []string    `json:"dependencies,omitempty" jsonschema:"Dependencies"`
	MaintainerAlignment string      `json:"maintainer_alignment,omitempty" jsonschema:"Maintainer alignment note"`
	SourceRefs          []SourceRef `json:"source_refs,omitempty" jsonschema:"Source references"`
}

PromoteOpportunityInput converts a hypothesis into a scoped opportunity.

type ReadinessCheck

type ReadinessCheck struct {
	CheckID      string   `json:"check_id"`
	RuleID       string   `json:"rule_id"`
	RuleVersion  string   `json:"rule_version"`
	Status       string   `json:"status"`
	Summary      string   `json:"summary"`
	EvidenceRefs []string `json:"evidence_refs,omitempty"`
	Remediation  string   `json:"remediation,omitempty"`
	EvaluatedAt  string   `json:"evaluated_at"`
}

ReadinessCheck is one explainable readiness rule result.

type ReadinessInput

type ReadinessInput struct {
	OpportunityID string `json:"opportunity_id" jsonschema:"Opportunity ID"`
}

ReadinessInput selects a contribution opportunity readiness report.

type ReadinessOutput

type ReadinessOutput struct {
	OpportunityID  string           `json:"opportunity_id"`
	RuleSetVersion string           `json:"rule_set_version"`
	Status         string           `json:"status"`
	EvaluatedAt    string           `json:"evaluated_at"`
	Checks         []ReadinessCheck `json:"checks"`
}

ReadinessOutput is the stable MCP representation of one readiness report.

type RecordHypothesisInput

type RecordHypothesisInput struct {
	InvestigationID    string      `json:"investigation_id" jsonschema:"Investigation ID"`
	Title              string      `json:"title" jsonschema:"Hypothesis title"`
	Description        string      `json:"description" jsonschema:"Hypothesis description"`
	Category           string      `json:"category" jsonschema:"Category such as bug, performance, or documentation"`
	ExpectedBehavior   string      `json:"expected_behavior,omitempty" jsonschema:"Expected behavior"`
	ObservedBehavior   string      `json:"observed_behavior,omitempty" jsonschema:"Observed behavior"`
	PotentialImpact    string      `json:"potential_impact,omitempty" jsonschema:"Potential impact"`
	OpenQuestions      []string    `json:"open_questions,omitempty" jsonschema:"Open questions"`
	AffectedComponents []string    `json:"affected_components,omitempty" jsonschema:"Affected components"`
	SourceRefs         []SourceRef `json:"source_refs,omitempty" jsonschema:"Source references"`
}

RecordHypothesisInput records a structured hypothesis and its provenance.

type RepoInput

type RepoInput struct {
	Owner string `json:"owner" jsonschema:"GitHub repository owner"`
	Repo  string `json:"repo" jsonschema:"GitHub repository name"`
}

RepoInput identifies a repository for an MCP operation.

type RepositoryOutput

type RepositoryOutput struct {
	Owner     string         `json:"owner"`
	Repo      string         `json:"repo"`
	UpdatedAt string         `json:"updated_at,omitempty"`
	Fields    map[string]any `json:"fields,omitempty"`
}

RepositoryOutput is the stable MCP representation of a repository.

type RunValidationInput

type RunValidationInput struct {
	ID      string `json:"id" jsonschema:"Validation definition ID"`
	Kind    string `json:"kind" jsonschema:"Run kind: base or candidate"`
	Execute bool   `json:"execute" jsonschema:"Must be true to authorize host execution"`
}

RunValidationInput selects a validation definition and explicitly authorizes execution.

type SearchCodeInput

type SearchCodeInput struct {
	Query  string `json:"query" jsonschema:"Code search query"`
	Owner  string `json:"owner,omitempty" jsonschema:"Optional repository owner"`
	Repo   string `json:"repo,omitempty" jsonschema:"Optional repository name"`
	Limit  int    `json:"limit,omitempty" jsonschema:"Maximum results from 1 to 100"`
	Cursor string `json:"cursor,omitempty" jsonschema:"Opaque cursor returned by the previous page"`
}

SearchCodeInput describes an offline code search page.

type SearchCodeOutput

type SearchCodeOutput struct {
	Query      string            `json:"query"`
	Total      int               `json:"total"`
	Matches    []CodeMatchOutput `json:"matches"`
	NextCursor string            `json:"next_cursor,omitempty"`
}

SearchCodeOutput contains one page of offline code matches.

type SearchInput

type SearchInput struct {
	Query  string `json:"query" jsonschema:"Full-text query"`
	Owner  string `json:"owner,omitempty" jsonschema:"Optional repository owner"`
	Repo   string `json:"repo,omitempty" jsonschema:"Optional repository name"`
	Kind   string `json:"kind,omitempty" jsonschema:"Optional thread kind"`
	Limit  int    `json:"limit,omitempty" jsonschema:"Maximum results from 1 to 100"`
	Cursor string `json:"cursor,omitempty" jsonschema:"Opaque cursor returned by the previous page"`
}

SearchInput describes an offline thread search page.

type SearchOutput

type SearchOutput struct {
	Query      string         `json:"query"`
	Matches    []ThreadOutput `json:"matches"`
	Total      int            `json:"total"`
	NextCursor string         `json:"next_cursor,omitempty"`
}

SearchOutput contains one page of offline thread matches.

type SearchRepositoriesInput

type SearchRepositoriesInput struct {
	Query  string `json:"query,omitempty" jsonschema:"Full-text query over repository owner, name, and description"`
	Owner  string `json:"owner,omitempty" jsonschema:"Optional repository owner"`
	Repo   string `json:"repo,omitempty" jsonschema:"Optional repository name"`
	Limit  int    `json:"limit,omitempty" jsonschema:"Maximum results from 1 to 100"`
	Cursor string `json:"cursor,omitempty" jsonschema:"Opaque cursor returned by the previous page"`
}

SearchRepositoriesInput describes an offline repository search page.

type SearchRepositoriesOutput

type SearchRepositoriesOutput struct {
	Query      string             `json:"query"`
	Total      int                `json:"total"`
	Matches    []RepositoryOutput `json:"matches"`
	NextCursor string             `json:"next_cursor,omitempty"`
}

SearchRepositoriesOutput contains one page of repository matches.

type SearchThreadsInput

type SearchThreadsInput struct {
	Query  string `json:"query" jsonschema:"Full-text query over thread titles and bodies"`
	Owner  string `json:"owner,omitempty" jsonschema:"Optional repository owner"`
	Repo   string `json:"repo,omitempty" jsonschema:"Optional repository name"`
	Kind   string `json:"kind,omitempty" jsonschema:"Optional thread kind: issue or pull_request"`
	Limit  int    `json:"limit,omitempty" jsonschema:"Maximum results from 1 to 100"`
	Cursor string `json:"cursor,omitempty" jsonschema:"Opaque cursor returned by the previous page"`
}

SearchThreadsInput describes an offline issue and pull-request search page.

type Server

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

Server owns the MCP protocol adapter around a local Reader.

func New

func New(reader Reader, version string) *Server

New constructs an MCP server over reader and registers all supported tools and resources. A blank version is reported as "dev".

func (*Server) MCP

func (s *Server) MCP() *mcp.Server

MCP returns the underlying SDK server for embedding in another transport.

func (*Server) ServeStdio

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

ServeStdio serves MCP messages over standard input and output until the context is cancelled or the transport stops.

type SourceRef

type SourceRef struct {
	Source     string `json:"source" jsonschema:"Source identifier"`
	URL        string `json:"url,omitempty" jsonschema:"Source URL"`
	CommitSHA  string `json:"commit_sha,omitempty" jsonschema:"Source commit SHA"`
	ObservedAt string `json:"observed_at,omitempty" jsonschema:"Observation timestamp"`
	AsOf       string `json:"as_of,omitempty" jsonschema:"As-of timestamp"`
}

SourceRef records provenance for an MCP result or workflow artifact.

type StartCrawlInput

type StartCrawlInput struct {
	Source string `json:"source" jsonschema:"Crawl source name"`
	Since  string `json:"since,omitempty" jsonschema:"Optional Go duration such as 720h"`
	Budget int    `json:"budget,omitempty" jsonschema:"Maximum number of repository windows to crawl"`
}

StartCrawlInput configures a durable crawl job for a saved discovery source.

type StartInvestigationInput

type StartInvestigationInput struct {
	Owner     string `json:"owner" jsonschema:"GitHub repository owner"`
	Repo      string `json:"repo" jsonschema:"GitHub repository name"`
	CommitSHA string `json:"commit_sha,omitempty" jsonschema:"Optional commit SHA"`
	Lens      string `json:"lens,omitempty" jsonschema:"Optional lens name"`
}

StartInvestigationInput creates a local investigation for a repository revision.

type SyncRepositoryInput

type SyncRepositoryInput struct {
	Owner    string `json:"owner" jsonschema:"GitHub repository owner"`
	Repo     string `json:"repo" jsonschema:"GitHub repository name"`
	State    string `json:"state,omitempty" jsonschema:"Thread state: open, closed, or all"`
	Since    string `json:"since,omitempty" jsonschema:"Positive Go duration limiting thread history, such as 720h; omit for all matching history"`
	Numbers  []int  `json:"numbers,omitempty" jsonschema:"Optional exact issue or pull request numbers"`
	MaxPages int    `json:"max_pages,omitempty" jsonschema:"Maximum issue-list pages from 1 to 1000"`
}

SyncRepositoryInput configures an explicit GitHub repository read.

type SyncRepositoryOutput

type SyncRepositoryOutput struct {
	Owner   string `json:"owner"`
	Repo    string `json:"repo"`
	Updated int    `json:"updated"`
	Message string `json:"message"`
}

SyncRepositoryOutput summarizes a completed repository synchronization.

type ThreadByNumberInput

type ThreadByNumberInput struct {
	Owner  string `json:"owner"`
	Repo   string `json:"repo"`
	Number int    `json:"number"`
}

ThreadByNumberInput identifies a stored issue or pull request by number.

type ThreadInput

type ThreadInput struct {
	Owner  string `json:"owner" jsonschema:"GitHub repository owner"`
	Repo   string `json:"repo" jsonschema:"GitHub repository name"`
	Kind   string `json:"kind" jsonschema:"Thread kind: issue or pull_request"`
	Number int    `json:"number" jsonschema:"GitHub issue or pull request number"`
}

ThreadInput identifies an issue or pull request for an MCP operation.

type ThreadOutput

type ThreadOutput struct {
	Owner     string   `json:"owner"`
	Repo      string   `json:"repo"`
	Kind      string   `json:"kind"`
	Number    int      `json:"number"`
	State     string   `json:"state"`
	Title     string   `json:"title"`
	Body      string   `json:"body,omitempty"`
	Author    string   `json:"author,omitempty"`
	Labels    []string `json:"labels,omitempty"`
	UpdatedAt string   `json:"updated_at,omitempty"`
}

ThreadOutput is the stable MCP representation of an issue or pull request.

type ValidationOutput

type ValidationOutput struct {
	ID              string   `json:"id"`
	InvestigationID string   `json:"investigation_id"`
	Kind            string   `json:"kind"`
	Command         []string `json:"command"`
	WorkingDir      string   `json:"working_dir"`
	BaseWorkingDir  string   `json:"base_working_dir,omitempty"`
	CandidateDir    string   `json:"candidate_dir,omitempty"`
	Env             []string `json:"environment_allowlist,omitempty"`
	Timeout         string   `json:"timeout,omitempty"`
	MaxOutputBytes  int64    `json:"max_output_bytes,omitempty"`
	CreatedAt       string   `json:"created_at"`
}

ValidationOutput is the stable MCP representation of a validation definition.

type WorkflowPromptRef

type WorkflowPromptRef struct {
	Name        string            `json:"name"`
	Description string            `json:"description"`
	Arguments   map[string]string `json:"arguments,omitempty"`
}

WorkflowPromptRef describes an MCP prompt useful for a workflow.

type WorkflowResourceRef

type WorkflowResourceRef struct {
	URI         string `json:"uri"`
	Description string `json:"description"`
	Capability  string `json:"capability"`
}

WorkflowResourceRef describes a local MCP resource used by a workflow.

Jump to

Keyboard shortcuts

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