
LynxMCP
100% local semantic code search for AI agents: AST-aware chunking (tree-sitter), hybrid BM25+dense retrieval, and a code knowledge graph (callers, inheritance, imports) over codebases, docs sites, and PDFs. Install via pipx install lynx-mcp.
Quick Install
Automated & IDE SetupCopy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
Manual Client & Custom JSON ConfigExpand JSON βΎ
Install Config Generator
π‘ Paste into ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
Documentation Overview
Lynx
A 100% local MCP server for semantic code search β AST-aware chunking, hybrid BM25 + dense retrieval, and an optional code knowledge graph. Works with any MCP client (Claude Code, Cursor, Windsurf, Antigravity, ...).
Your AI assistant greps file names and guesses. Lynx gives it real retrieval over your code, your library docs, and your PDFs β without a single byte leaving your machine.
πΈ What it saves you β every wrong file your AI opens is billed tokens
Agentic coding burns tokens re-reading files the assistant grepped into the wrong place. Lynx hands it the right code in one tool call, with file:line and symbol β measured on real codebases:
| Tokens to get the answer into context | Agentic grep | Lynx | |
|---|---|---|---|
| Django 5.2 β Python, 158k lines | 4,150 | 1,725 | β58% |
| Json.NET β C#, 69k lines | 6,590 | 1,540 | β77% |
| Guava β Java, 181k lines | 5,892 | 807 | β86% |
Plus: outline triage is 2.4Γ fewer tokens, and the code arrives in 1 tool call instead of 2+ (chunks included, with symbol + file:line + score). The token cut holds across languages β even where grep ranks results just as well, because Lynx returns the whole function in one call instead of match-lines plus a follow-up read.
That's real money at today's frontier API prices. For 25 engineers (β31,500 retrievals/month), the yearly API bill Lynx removes:
| Flagship model (input $/1M) | Django (Python) | Json.NET (C#) | Guava (Java) |
|---|---|---|---|
| Claude Fable 5 β Anthropic flagship ($10) | β $85,000 | β $95,000 | β $95,000 |
| GPTβ5.5 β OpenAI flagship ($5) | β $42,000 | β $47,000 | β $47,000 |
| Claude Opus 4.8 β top coding model ($5) | β $42,000 | β $47,000 | β $47,000 |
Token deltas are measured (Django Β· Json.NET Β· Guava). The yearly figures add one eliminated grep roundβtrip reβbilling a 20kβtoken context; the conservative floor (tool output only, zero assumptions) is $0.4kβ1.6k/mo depending on model and codebase. Run it for your own team, prices and codebase: CLI python benchmarks/savings_calculator.py --devs N, or the interactive savings calculator β pick the codebase and model from dropβdowns and edit the $/1M price live (presets in benchmarks/pricing.json + measured.json, yours to change).
- AST-aware indexing β tree-sitter parses 18+ languages (19 grammars, counting TSX) and indexes whole functions/classes, not arbitrary text windows.
- Hybrid retrieval β dense embeddings + code-tokenized BM25, fused with RRF; optional cross-encoder reranker.
- Token-efficient triage β
view=outlinereturns signatures instead of bodies, so an agent scans the candidates for ~2.4Γ fewer tokens and reads only the code it picks (measured). - Code knowledge graph (opt-in) β who-calls-what, inheritance, imports: ask "what breaks if I change this?" and get the actual blast radius β or export it as a single, shareable, offline graph view (
lynx graph export). - Joinable as SQL β search and the graph are also served as rows over a local HTTP API, so you can correlate your code with tickets, PRs, or logs in DuckDB or Coral β no data leaves your machine.
- Multi-source β index codebases, public docs sites (fetched once, on demand; JS-rendered SPAs supported via optional headless Chromium), and PDFs side by side.
- Live index β a file watcher re-indexes saves in ~2s. No manual rebuild ritual.
- Web manager UI β
lynx manager uigives you guided setup, a query playground, diagnostics, and client config snippets.
LynxManager β guided setup, query playground & diagnostics, all in the browser. Full walkthrough β
Shareable graph views β lynx graph export --symbol GetVoxel writes one self-contained, offline file (no server, no CDN): the symbol's blast radius β who calls it (above) and what it calls (below). Attach it to a PR or archive it for an audit.
Quickstart
Then register Lynx in your MCP client (Claude Code shown; see the full guide for Cursor, Antigravity, and generic stdio clients β or let lynx manager ui generate the snippet for you):
Prefer zero terminal? There are double-click installers for macOS and Windows.
The tools your AI gets
The tool set is fixed β it does not grow with the number of sources, so your client's tool list (and context window) stays small. Tools take a source argument where relevant.
| Tool | What it answers |
|---|---|
search(query, source?, outline?) | Primary hybrid search. Omit source to search every source at once (RRF-fused). outline=true returns signatures-only for cheap triage (see below). |
deep_search(queries, source?) | Escalation: tries multiple query phrasings until one passes a quality threshold. |
graph_query(operation, symbol?) | callers, callees, subclasses, superclasses, imports, neighbors, shortest_path, overview, surprising_connections, status. |
find_definition(symbol) | Where is X defined? (AST-precise when the graph is on, BM25 fallback otherwise.) |
find_usages(symbol) | Every use of X β calls and non-call references (generics, decorators, docs). |
find_tests_for(symbol) | Are there tests for X? |
find_similar(snippet) | Does code like this already exist? |
describe_symbol(symbol) | One-shot context for X: definition + who calls it + what it calls + its tests, in a single call. |
impact(symbol) | Blast radius: everything that reaches X transitively through the call graph (with hop distance) + the tests to re-run. |
module_summary(file) | A file as a unit: the symbols it defines, what it imports, and which files depend on it. (graph) |
repo_overview() | "What is this and where do I start": detected languages, frameworks, entry points, and build/test/run commands. |
export_graph(target, mode?) | Render a shareable, offline graph view β a symbol's blast radius or a file hub β as a single self-contained file. (graph) |
search_diff(query, base?) | Search only the files changed vs a base branch β built for code review. |
feedback(trying_to_do, tried, stuck) | The agent files a report when the index couldn't answer β stored 100% locally, your signal for tuning sources. |
list_sources / get_rag_status / update_source_index | Introspection and maintenance. |
Retrieval tools carry MCP readOnlyHint annotations (clients can auto-approve them); the only write is export_graph, which saves a graph view file. The server ships its usage playbook in the MCP handshake (instructions + a lynx://guide resource) β your agent knows how to query well without any rules-file setup.
(graph) tools need the optional code knowledge graph enabled for the source. The tool set is per-capability, never per-source.
How it works
Everything runs locally: HuggingFace models are downloaded once, then Lynx switches to offline mode. No telemetry, no cloud index, no code upload. The only network access is the model download and the explicit webdoc fetch step you trigger yourself.
Restricted networks / air-gapped machines
The embedding model is a public HuggingFace model (BAAI/bge-small-en-v1.5, ~130MB) β no account or token is required. If you hit We couldn't connect to 'https://huggingface.co', the machine simply can't reach the Hub (firewall, proxy, DNS, or an offline box).
You usually don't need to do anything. When the HuggingFace download fails, Lynx automatically falls back to a copy of the model hosted on this repo's GitHub Releases and installs it from there β including on the installer's first run. You only need the steps below if GitHub is also unreachable, or if you want to use a mirror / a shared cache / your own host.
- Point the fallback elsewhere β if you can't reach github.com either but you host the archive somewhere reachable (an internal server, an artifact store), set the base URL and the automatic fallback uses it:
- Mirror β point Lynx at a reachable HuggingFace mirror and (optionally) a shared cache, then download normally:
- Transfer an archive β on a machine with access, export the model, copy the file to the offline machine (USB,
scp, an internal shareβ¦), then import it: A URL only works if it serves the file directly, with no authentication and no interstitial page. A GitHub Release asset on a public repo is the easiest option β the bundledPublish model archiveworkflow can create one for you. Google Drive does not work as a--from-archiveURL for this model: for files larger than ~100MB Drive returns a "can't scan for viruses" HTML page instead of the file, so the import would get HTML, not a zip (Lynx detects this and tells you). Use Drive only to hand the file to a person, who downloads it in a browser and passes the local path. - Check what's configured β
lynx manager doctorreports the active cache dir, whether a mirror is set, and whether the model is present.
Why not just let the agent grep?
Grep is great when you know the identifier. It fails when you (or the agent) know the behavior: "where do we clamp the camera zoom?" matches nothing literal. Agentic grep also burns tokens β every wrong file the agent opens is context spent. Lynx answers behavioral queries in one tool call with file + line + symbol citations, and the graph layer answers structural questions (callers, inheritance) that grep fundamentally cannot β polymorphic dispatch leaves no textual trace.
Honest counterpoint: on a small repo that fits in the agent's context, built-in tools are fine. Lynx pays off on large codebases, on framework docs your model's training data has gone stale on, and on repeated sessions where re-exploring from scratch is waste.
Benchmarks (reproducible)
On the django/ package of Django 5.2 (883 files, ~158k lines), 20 behavioral questions with known ground-truth files β full methodology, per-task results, and an intentionally strong grep baseline in benchmarks/RESULTS.md:
| Agentic grep | Lynx | |
|---|---|---|
| median tokens to answer (tool output + required follow-up read) | 4,150 | 1,725 |
| tool round-trips before the code is in context | 2+ | 1 (chunks included, with symbol + file:line + score) |
| hit@1 / MRR | 45% / 0.64 | 55% / 0.67 |
"what inherits from Field?" β full descendant tree (100 classes) | 101 grep rounds | 4 graph calls, same recall, file:line per edge |
The ranking quality is comparable (Django's docstring-rich code is grep's best case β we say so in the report). The structural difference is not: every tool round-trip is a full model inference over the growing context, and class-relation questions force grep into one round per discovered class while graph_query reads resolved inheritance edges.
Second language, sparser docs β the gap widens. The same test on Json.NET (C#) β Src/Newtonsoft.Json/, 240 files, 69k lines, 15 behavioral questions (RESULTS_csharp.md). With C#'s PascalCase identifiers and fewer narrative comments, Lynx wins every metric, ranking included:
| Agentic grep | Lynx | |
|---|---|---|
| median tokens to answer | 6,590 | 1,540 (β77%) |
| hit@1 / MRR | 33% / 0.47 | 47% / 0.58 |
This is the counter-example the Django report predicts: move off grep's best case and the lexical baseline drops, while semantic retrieval holds.
Third language, grep's best case β the token gap holds anyway. Guava (Java) β com/google/common/, 606 files, 181k lines, 15 questions (RESULTS_java.md). Guava's self-documenting class names (BloomFilter, RateLimiter, Splitter) are ideal for lexical search β so here grep actually out-ranks Lynx. The metric you pay for still collapses:
| Agentic grep | Lynx | |
|---|---|---|
| median tokens to answer | 5,892 | 807 (β86%) |
| hit@1 / MRR | 73% / 0.81 | 60% / 0.70 |
The honest takeaway across all three. Ranking parity swings with how self-documenting the code is β Lynx ahead on C#, level on Python, behind on Guava. But the token cost β the line on your invoice β drops 58β86% every time, because Lynx hands back the whole function in one call instead of match-lines plus a follow-up read. That's the number that scales to a team's monthly bill.
Two ways to read a result: full vs outline
Every Lynx search ranks the same way (hybrid dense + BM25 over whole functions). What differs is how much of each hit you pull into the model's context:
- Full search (default) returns the matching functions with their bodies β
file,symbol, line range,score, and the realcontent. The model has the code immediately: one tool call and it can explain, review, or edit. - Outline search (
search(query, outline=true)from an MCP agent, or?view=outlineover HTTP) returns the same ranked hits but drops the bodies β just a one-linesignatureplus the first line of the docstring. The model scans the candidates to decide which one it needs, then reads that single body on demand (every row still carriesfile_path+start_line/end_line). The agent is told when to reach for it in the tool description and the MCP handshake instructions.
It's progressive disclosure: triage cheap, fetch deep only where it pays. Most of the bodies in a result set are ones the model will never use β outline stops paying for them up front. On a public repo (psf/requests) it cut the search step to ~2.4Γ fewer tokens β measured, with the chart.
When to use which β there's no silver bullet:
| Use full (default) when⦠| Use outline when⦠|
|---|---|
| You'll use the code now β explain, review, or edit a specific area | You're navigating: "where is X / which function does Y" |
| Few, precise results; you already know roughly what you want | Broad or exploratory queries, or a large top_k |
| The body is the answer (a one-shot question) | Building a mental map, or chaining many searches |
| Context budget is tight (large repos, long sessions) |
Rule of thumb for an agent: triage with outline, then pull the one body you need β a follow-up full search or a direct read of the cited line range. (view is opt-in; the default is unchanged, so Coral / DuckDB are unaffected.)
Lynx + Coral: your code, joined with everything else
Coral turns your live tools β GitHub, Sentry, Jira, Linear β into one local SQL interface. Plug in Lynx (source spec) and your codebase becomes a queryable source too: ask in plain language, get ranked code locations back, and correlate them with the tools your team already lives in β without a byte leaving your machine.
You register Lynx as a Coral source yourself today β
coral source add --file integrations/coral/manifest.yaml(full steps in docs/CORAL.md). A community-source PR to ship it in Coral's registry is approved and awaiting merge.
What that unlocks:
- π Find logic by behavior, not keywords. "Where do we validate session tokens?" returns the actual functions β file, symbol, line, score β even when nothing matches literally.
- π Refactor without surprises. Locate the code behind a feature and line it up against the repo's open PRs in one query β see who's already in there before you touch it.
- π¨ Triage crashes to code. Take the behavior from a Sentry alert and get the ranked code locations; when your source exposes a file column, correlate them with the live issues.
- π« Turn a backlog into a map. Pull your open tickets from Coral and β with the included Python helper β batch-search Lynx to surface the likely code area for each.
- π 100% local. Repo and embeddings never leave your machine; only the live-data side hits an API.
Once the idea clicks, the syntax is just SQL:
The search string is a literal you pass (Coral resolves table-function arguments at plan time) β so it's code search as a joinable source, not a per-row enrichment. For one search per row of another table, use the batch endpoint + the Python helper. lynx.sources lists your indexed sources; lynx.search(q => 'β¦') is the ranked search function (source => 'β¦', top_k => N to narrow it). Full setup in docs/CORAL.md.
Lynx + DuckDB: code search as a local SQL table
Lynx serves its search and its code graph as NDJSON over a local HTTP API, and DuckDB reads that URL straight into a table. So you can JOIN your code with anything DuckDB reads β Parquet, CSV, SQLite, Postgres, a git log, a JSON log β in one engine, on your machine, with no plugin and no service to run.
- π¦ Zero setup.
read_ndjson_auto('http://127.0.0.1:8765/api/v1/search?β¦')is a table. No connector, no daemon. - π Join with any local data. Cross code relevance with git churn, error logs, ownership, ticket exports β whatever you can read.
- π§ͺ Total flexibility. Shape and filter in SQL, then hand a tiny, hyper-targeted context to an LLM or a notebook.
The code graph is one URL away too (β¦/api/v1/graph?operation=callers&symbol=β¦), so you can pivot a hit to its blast radius and join that with your data. Recipes for git freshness, error-log triage, and per-row batch search in docs/DUCKDB.md.
Lynx + Steampipe: code as a SQL table that joins per row
Steampipe exposes APIs as Postgres tables. The steampipe-plugin-lynx plugin maps the local /api/v1 to three tables β lynx_source, lynx_search, lynx_graph β so you query your code in plain SQL and join it with Steampipe's 140+ connectors (GitHub, Jira, AWS, β¦). Prebuilt macOS/Linux binaries on the latest release β no Go toolchain to install.
- π Drop-in. Install the binary, point
lynx.spcat your Lynx API (127.0.0.1:8765), query with any Postgres client. - βοΈ Per-row joins β the differentiator. Steampipe pushes
WHEREquals down and runs a nested loop in joins, solynx_searchcan be driven by another table's column β one search per row. That's the per-row fan-out the plan-time engines (Coral, DuckDB) can't do without a batch helper. - π Still 100% local. Only the other side of the join (GitHub, Jira, β¦) hits an API; your code and embeddings never leave the machine.
Tables: lynx_source (indexed sources), lynx_search (semantic + lexical hits; query qual, optional source / top_k), lynx_graph (callers / callees / subclasses / imports; operation + symbol quals). Install, config, and the engine note (macOS / Linux / WSL2) in the plugin README.
Documentation
| Full guide | Configuration, all source types (codebase / webdoc / PDF), retrieval internals, troubleshooting |
| Manager UI | Guided setup, playground, diagnostics |
| Use Lynx from Coral | SQL over your code search: SELECT ... FROM lynx.search joined with live GitHub/Sentry data |
| Use Lynx from DuckDB | read_ndjson_auto('β¦/api/v1/search?format=ndjson') β join code search + the code graph with any local data |
| Outline mode (token-efficient triage) | view=outline β signatures instead of bodies; ~2.4Γ fewer tokens, with the measured data + chart |
| MCP recipes | Agent patterns combining Lynx with GitHub/Sentry/Jira MCP servers (triage, PR impact, ticketβcode) |
| PR impact analysis (GitHub Action) | On every PR, comment with the downstream callers + semantically related code, indexed locally on the runner |
| Steampipe plugin | SQL plugin exposing lynx_source/lynx_search/lynx_graph, joinable with Steampipe's connectors (GitHub, Jira, AWS, β¦). Prebuilt macOS/Linux binaries on the latest release β no Go toolchain needed. |
| config.example.json | Annotated example configuration |
Status
Actively developed by one author; APIs may still move before 1.x stabilizes. Issues and PRs welcome β the test suite runs with pytest and CI must stay green. See ROADMAP.md for what's under consideration (and what's explicitly not planned).
License
Related MCP Servers
View all alternativesFrequently Asked Questions about LynxMCP
How do I install the lorenzo-cambiaghi/LynxMCP MCP server?
Add the following block to your claude_desktop_config.json under mcpServers: "mcpServers": { "lynxmcp": { "command": "npx", "args": ["-y", "lorenzo-cambiaghi/LynxMCP"] } }
What does lorenzo-cambiaghi/LynxMCP do?
100% local semantic code search for AI agents: AST-aware chunking (tree-sitter), hybrid BM25+dense retrieval, and a code knowledge graph (callers, inheritance, imports) over codebases, docs sites, and PDFs. Install via pipx install lynx-mcp.
Is the lorenzo-cambiaghi/LynxMCP MCP server free to use?
Yes. lorenzo-cambiaghi/LynxMCP is listed on AllMCPs as a free, open Model Context Protocol server you can install into Claude Desktop, Cursor, or any MCP-compatible client.