mcp

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package mcp serves the codesearch tools over MCP via stdio.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(cfg *config.IndexConfig) error

Serve runs the codesearch MCP server on stdio until EOF.

The index is opened lazily on the first tool call and released after an idle window (see index.LazyIndex). This is what lets a concurrent `codesearch sync` (e.g. from a git hook) acquire the writer lock between bursts of MCP traffic — the server doesn't hoard the OS file lock when no tool calls are in flight.

cfg.Root and cfg.IndexPath() must already exist (run `codesearch init && codesearch sync` first).

Types

type FacetResult

type FacetResult struct {
	Term  string `json:"term"`
	Count int    `json:"count"`
}

FacetResult is one term entry returned by codesearch_facets.

type FacetsArgs

type FacetsArgs struct {
	Field string `json:"field"`
	Limit int    `json:"limit,omitempty"`
}

FacetsArgs is the typed input for codesearch_facets.

type GetArgs

type GetArgs struct {
	Path     string `json:"path"`
	MaxBytes int    `json:"max_bytes,omitempty"`
}

GetArgs is the typed input for codesearch_get.

type GetResult

type GetResult struct {
	Path      string `json:"path"`
	Content   string `json:"content"`
	Truncated bool   `json:"truncated"`
}

GetResult is the response from codesearch_get.

type SearchArgs

type SearchArgs struct {
	Query  string            `json:"query"`
	Fields map[string]string `json:"fields,omitempty"`
	Limit  int               `json:"limit,omitempty"`
}

SearchArgs is the typed input for codesearch_search.

type StatusResult

type StatusResult struct {
	IndexPath      string `json:"index_path"`
	DocCount       uint64 `json:"doc_count"`
	IndexSizeBytes int64  `json:"index_size_bytes"`
	SchemaVersion  int    `json:"schema_version"`
	LastSyncAt     string `json:"last_sync_at"`
}

StatusResult is the response from codesearch_status.

Jump to

Keyboard shortcuts

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