mcp

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package mcp provides Model Context Protocol server functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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

func NewFileURI(repoID int64, blobName, path string) FileURI

NewFileURI creates a FileURI with the required fields.

func (FileURI) String

func (u FileURI) String() string

String builds the file:// URI string.

func (FileURI) WithLineRange

func (u FileURI) WithLineRange(start, end int) FileURI

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 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) MCPServer

func (s *Server) MCPServer() *server.MCPServer

MCPServer returns the underlying MCP server for stdio serving.

func (*Server) ServeStdio

func (s *Server) ServeStdio() error

ServeStdio runs the MCP server on stdio.

Jump to

Keyboard shortcuts

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