Documentation
¶
Overview ¶
Package mcp provides Model Context Protocol server functionality.
Index ¶
- func ServerInstructions() string
- type CommitFinder
- type EnrichmentLookup
- type EnrichmentQuery
- type EnrichmentResolver
- type FileContentReader
- type FileFinder
- type FileLister
- type FileURI
- type Grepper
- type KeywordSearcher
- type ParamDefinition
- type RepositoryLister
- type SemanticSearcher
- type Server
- type ToolDefinition
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ServerInstructions ¶ added in v1.1.3
func ServerInstructions() string
ServerInstructions returns the MCP server usage instructions.
Types ¶
type CommitFinder ¶
type CommitFinder interface {
Find(ctx context.Context, options ...repository.Option) ([]repository.Commit, error)
}
CommitFinder provides commit querying for MCP tools.
type EnrichmentLookup ¶
type EnrichmentLookup interface {
Get(ctx context.Context, options ...repository.Option) (enrichment.Enrichment, error)
}
EnrichmentLookup provides enrichment retrieval by ID for MCP tools.
type EnrichmentQuery ¶
type EnrichmentQuery interface {
List(ctx context.Context, params *service.EnrichmentListParams) ([]enrichment.Enrichment, error)
}
EnrichmentQuery provides enrichment listing for MCP tools.
type EnrichmentResolver ¶
type EnrichmentResolver interface {
SourceFiles(ctx context.Context, enrichmentIDs []int64) (map[string][]int64, error)
LineRanges(ctx context.Context, enrichmentIDs []int64) (map[string]chunk.LineRange, error)
RepositoryIDs(ctx context.Context, enrichmentIDs []int64) (map[string]int64, error)
}
EnrichmentResolver provides enrichment-to-entity resolution.
type FileContentReader ¶
type FileContentReader interface {
Content(ctx context.Context, repoID int64, blobName, filePath string) (service.BlobContent, error)
}
FileContentReader provides raw file content from Git repositories.
type FileFinder ¶
type FileFinder interface {
Find(ctx context.Context, options ...repository.Option) ([]repository.File, error)
}
FileFinder provides file lookups by options.
type FileLister ¶
type FileLister interface {
ListFiles(ctx context.Context, repoID int64, pattern string) ([]service.FileEntry, error)
}
FileLister provides pattern-based file listing from repository working copies.
type FileURI ¶
type FileURI struct {
// contains filtered or unexported fields
}
FileURI builds file resource URIs for MCP resource templates. Immutable value object — methods return copies.
func NewFileURI ¶
NewFileURI creates a FileURI with the required fields.
func (FileURI) WithLineRange ¶
WithLineRange returns a copy with line range set.
type Grepper ¶
type Grepper interface {
Search(ctx context.Context, repoID int64, pattern string, pathspec string, maxFiles int) ([]service.GrepResult, error)
}
Grepper provides git grep search over repositories.
type KeywordSearcher ¶
type KeywordSearcher interface {
SearchKeywordsWithScores(ctx context.Context, query string, limit int, filters search.Filters) ([]enrichment.Enrichment, map[string]float64, error)
}
KeywordSearcher provides BM25 keyword search with scores.
type ParamDefinition ¶ added in v1.1.3
type ParamDefinition struct {
// contains filtered or unexported fields
}
ParamDefinition describes a single parameter in a tool definition.
func (ParamDefinition) Description ¶ added in v1.1.3
func (p ParamDefinition) Description() string
Description returns the parameter description.
func (ParamDefinition) Name ¶ added in v1.1.3
func (p ParamDefinition) Name() string
Name returns the parameter name.
func (ParamDefinition) Required ¶ added in v1.1.3
func (p ParamDefinition) Required() bool
Required reports whether the parameter is required.
func (ParamDefinition) Type ¶ added in v1.1.3
func (p ParamDefinition) Type() string
Type returns the parameter type (e.g. "string", "number").
type RepositoryLister ¶
type RepositoryLister interface {
Find(ctx context.Context, options ...repository.Option) ([]repository.Repository, error)
}
RepositoryLister provides repository listing for MCP tools.
type SemanticSearcher ¶
type SemanticSearcher interface {
SearchCodeWithScores(ctx context.Context, query string, topK int, filters search.Filters) ([]enrichment.Enrichment, map[string]float64, error)
}
SemanticSearcher provides code vector search with scores.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server wraps the MCP server with kodit-specific tools.
func NewServer ¶
func NewServer( repositories RepositoryLister, commits CommitFinder, enrichmentQuery EnrichmentQuery, fileContent FileContentReader, semanticSearch SemanticSearcher, keywordSearch KeywordSearcher, enrichmentResolver EnrichmentResolver, fileLister FileLister, files FileFinder, grepper Grepper, version string, logger zerolog.Logger, ) *Server
NewServer creates a new MCP server with the given dependencies.
func (*Server) ServeStdio ¶
ServeStdio runs the MCP server on stdio.
type ToolDefinition ¶ added in v1.1.3
type ToolDefinition struct {
// contains filtered or unexported fields
}
ToolDefinition describes a tool and its parameters.
func ToolDefinitions ¶ added in v1.1.3
func ToolDefinitions() []ToolDefinition
ToolDefinitions returns the canonical list of MCP tool definitions.
func (ToolDefinition) Description ¶ added in v1.1.3
func (d ToolDefinition) Description() string
Description returns the tool description.
func (ToolDefinition) Name ¶ added in v1.1.3
func (d ToolDefinition) Name() string
Name returns the tool name.
func (ToolDefinition) Params ¶ added in v1.1.3
func (d ToolDefinition) Params() []ParamDefinition
Params returns the tool's parameter definitions.