mcp

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Server)

Option configures an MCP Server at construction time.

func WithVectorIndexes

func WithVectorIndexes(vi VectorIndexResolver) Option

WithVectorIndexes wires a per-project HNSW index cache into the MCP search tools. Nil (the default) makes LocalSearch fall back to brute-force inside the search package.

type Server

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

Server wraps the MCP server.

func New

func New(stores Storer, prov llm.Provider, emb *embedder.Embedder, cfg *config.Config, registry *project.Registry, opts ...Option) *Server

New creates and registers all docs + notes MCP tools.

Wave-2 signature change: drops the long-lived *store.Store — the MCP layer now resolves a per-project store on every tool invocation via Storer.ForProject(slug). Passing nil for stores yields an error on any doc-tool call (notes tools still work if they only need cfg).

func (*Server) Close

func (s *Server) Close() error

Close is a no-op after Wave-2 — the per-project store cache is owned by the caller (typically cmd/serve), not by the MCP server. Retained for symmetry with the REST server shutdown path and to keep existing test teardown hooks (`_ = s.Close()`) compiling.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns an http.Handler for the Streamable HTTP MCP transport.

type Storer

type Storer interface {
	ForProject(slug string) (*store.Store, error)
}

Storer is the narrow contract the MCP server uses to obtain a per-project *store.Store on every tool invocation. It mirrors the REST-side api.Storer so the same cache can be injected into both.

type VectorIndexResolver

type VectorIndexResolver interface {
	ForProject(slug string, st *store.Store) vectorindex.Index
}

VectorIndexResolver returns the per-project HNSW index (or nil if unavailable / brute-force). Implementations must be safe for concurrent use. *api.VectorIndexes satisfies this — but the mcp package can't import api, so the resolver is declared as an interface here.

Jump to

Keyboard shortcuts

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