Code indexing library for AI coding agents. Parses source code with tree-sitter, chunks it into semantic units (functions, structs, classes, impl blocks), embeds them locally, and stores everything in a single SQLite file with vector + full-text search.
No Docker, no server, no API keys. One .db file per codebase.
Why
Codemogger is a code indexing library and MCP server for AI coding agents
ดาว
348
เครื่องมือ
—
อัปไทม์
—
Coding agents need to understand codebases. They need to find where things are defined, discover how concepts are implemented across files, and navigate unfamiliar code quickly. This requires both keyword search (precise identifier lookup) and semantic search (natural language queries when you don't know the exact names).
As AI coding tools become more composable - agents calling agents, MCP servers plugging into different hosts - this capability needs to exist as a library that runs locally. No external servers, no API keys, no Docker containers. Just a function call that returns results.
codemogger is that library. Embedded SQLite (via Turso) with FTS + vector search in a single .db file.
Install
npm install -g codemogger
Or use npx to run without installing.
Quick start
# Index a project
codemogger index ./my-project
# Search
codemogger search "authentication middleware"
Add to your coding agent's MCP config (Claude Code, OpenCode, etc.):
Benchmarked on 4 real-world codebases on an Apple M2 (8GB). Each project uses its own isolated database. Embeddings use vector8 (int8 quantized, 395 bytes/chunk vs 1,536 for float32). Embedding model: all-MiniLM-L6-v2 (q8 quantized, local CPU). Search times are p50 over 3 runs.
function checkContainerStateTransition - pkg/kubelet/status/status_manager.go
function TestDoProbe_TerminatedContainerWithRestartPolicyNever - pkg/kubelet/prober/worker_test.go
function proveHealthCheckNodePortDeallocated - pkg/registry/core/service/storage/storage_test.go
ripgrep matches thousands of files on common keywords. codemogger returns the 5 most relevant definitions.
Dependencies note
@tursodatabase/database is currently pinned to a pre-release version (0.5.0-pre.14). There is no stable 0.5.x release yet; once one is published this should be updated. The pre-release is stable enough for development use but may have breaking changes before it reaches a final release.
Architecture
Bun/TypeScript runtime
tree-sitter (WASM) for AST-aware chunking - 13 language grammars
all-MiniLM-L6-v2 for local embeddings (384 dimensions, q8 quantized)
Turso for storage - embedded SQLite with FTS + vector search extensions
Single DB file stores multiple codebases with per-codebase FTS tables and global vector search
License
MIT
C
Codemogger
glommer·348 ดาว·
Codemogger is a code indexing library and MCP server for AI coding agents