by lorenzo-cambiaghi
Provides a fully local code index, hybrid semantic‑lexical search powered by ONNX Runtime embeddings, and an interactive call‑graph / blast‑radius analysis for Python, Java, C#, JavaScript and many other languages.
LynxMCP delivers a local MCP server that lets developers search code by meaning, explore call and inheritance graphs, and index library documentation or PDFs alongside the source. All operations run on‑device without cloud services or PyTorch, using ONNX‑based embeddings and tree‑sitter AST chunking.
uv tool install lynx-mcp or pipx install lynx-mcp.lynx serve (defaults to a local HTTP endpoint) or let the CLI launch an embedded server for each editor session.lynx connect claude, lynx connect cursor, lynx connect vscode.lynx search "how to delete a user") or the editor’s built‑in MCP hooks, which automatically inject relevant code snippets before a prompt.lynx source add … and rebuild the index via lynx build.impact, graph_query, and export_graph expose callers, callees, subclasses, and risk analysis.history, change_risk, health, and hotspot ranking.lynx <tool> or via OpenAPI‑exposed HTTP endpoints.change_risk and health highlight risky modifications before PR merge.lynx ci runs secret scanning, impact analysis, and coverage checks automatically on pull requests.lynx serve --http 8791) and point all sessions to it.lynx manager ui) offers source management, architecture visualization, health queue, and RAG status.core, standard, full) or manually list tools in config.json under tools.include.lynx update; it detects the install method (uv, pipx, pip) and upgrades in place without touching indexes.A local code index and call graph for Claude Code, Cursor, Windsurf, Antigravity and VS Code. Search by meaning and by name, trace who calls or implements what, and index library docs or PDFs alongside your code. Everything runs on your machine.
No config file, no Docker, no API key, no PyTorch. Embeddings run locally on ONNX Runtime (~460 MB on disk), the index lives in your user cache so git status stays clean, and the code graph is on by default.
uv tool install lynx-mcp # or: pipx install lynx-mcp
lynx connect claude
Every project you open in Claude Code gets its own index, built in the background the first time. lynx connect claude also wires two hooks into ~/.claude/settings.json. With the first, each request arrives with a compact map of relevant code (up to 12 locations with file, line range and signature) before the first turn. With the second, the first time Claude reads or edits a file it gets a few lines on it: who uses it, what usually changes with it, where its past fixes went, which tests reach it, and what another session edited there in the last hour. Pass --no-hook to skip both. Restart Claude Code (or run /mcp) and start asking questions.
Prefer to test it in a single project first?
claude mcp add lynx -- uvx --from lynx-mcp lynx serve .
{"hooks": {
"UserPromptSubmit": [{"hooks": [{"type": "mcp_tool", "server": "lynx",
"tool": "prompt_hook", "input": {"prompt": "${prompt}"}}]}],
"PostToolUse": [{"matcher": "Read|Edit|Write|MultiEdit", "hooks": [{"type": "mcp_tool",
"server": "lynx", "tool": "file_context", "input": {"file_path": "${tool_input.file_path}",
"tool": "${tool_name}", "session": "${session_id}", "new_string": "${tool_input.new_string}"}}]}]}}
uv tool install lynx-mcp
cd /path/to/your/project
lynx connect cursor # or: claude-desktop | windsurf | antigravity | vscode
lynx connect writes only the lynx entry into your editor's MCP config, keeps a timestamped backup, and leaves every other server untouched. Restart your editor to pick it up.
Download the macOS or Windows installer to open LynxManager in your browser (lynx manager ui opens the same UI from the CLI). Simple mode guides you through three steps: pick a folder, connect your editor in one click, and run a search. Expert mode unlocks the JSON config editor, Doctor diagnostics, the graph/diff playground and the OpenAPI endpoints.
lynx update
Detects uv, pipx, pip and uvx installs and upgrades in place without touching your config or indexes. On Windows, close your AI editors first so no running Lynx process holds index files open (the update button in LynxManager closes itself, updates in a separate window, and reopens automatically).
grep is fast and right whenever you already know the exact identifier. Lynx handles the rest: finding code by what it does, navigating call and inheritance graphs before you edit, checking for duplicate implementations, and searching docs or other repositories that aren't even in your current workspace.
Keyword grep |
Lynx | |
|---|---|---|
| Matches | Exact strings or regexes | Meaning (ONNX embeddings) + code-aware BM25, fused |
| Different wording | Returns nothing | Matches by concept even when names differ |
| Output | Individual lines; you still open the file | Whole AST chunks (function or class) with symbol name and line range |
| Ranking | File order on disk | Ranked by relevance; tests, data and docs ranked below production code |
| Structure & impact | None: a name match doesn't show callers or subtypes | Code graph resolved from imports and declarations: callers, callees, subclasses, blast radius and tests |
| History | git log and git blame, read by hand |
How often each file changes, who wrote it, which files change in the same commits, its fix commits |
| Across sessions | Starts from zero every time | Persistent local index; re-indexes saved files in ~2s |
| Beyond the current repo | Only files in the open folder | Multiple local repos, version-pinned web docs and PDFs in one server |
| Trade-off | Zero setup | One-time index build |
| Question | With grep |
With Lynx |
|---|---|---|
"What breaks if I change ApplyDamage?" |
Textual mentions of the string | impact: transitive callers with hop distance + affected tests |
"Who implements IWeapon or inherits from Field?" |
Regex guesses + manual file reads to filter comments | graph_query: resolved inheritance and call edges with file:line |
| "Do we already have a helper like this?" | Guess possible function names | find_similar: ranks existing implementations by semantic similarity |
| "How does this API work in the library version we ship?" | Model memory (often outdated) | Indexed web docs & PDFs, cited with exact URL or page number |
| "What usually changes with this file, and who knows it?" | git log, read commit by commit |
history: files changed in the same commits, owners, bus factor and fix commits |
| "Did my change leave something out?" | git diff and memory |
change_risk: code outside the change that uses what it touched, files that usually change with it and were left out, the tests that reach it |
| "Where are the risky files?" | A guess | health: complex code that changes often, checked against the repository's own fix commits, the hotspots no test reaches, and a queue of what to fix first |
| "Is this still used? Do the docs still match?" | One name at a time | dead_code and doc_drift: what nothing reaches and nothing names, and doc links or paths that point nowhere |
Built-in grep is still the right choice on small repos or when you already know the exact symbol name. Lynx shines on larger codebases, unfamiliar architectures, multi-repo workspaces, and library docs or PDFs the model hasn't seen.
Index your main project alongside a shared internal library, framework documentation, or a folder of PDF specs, all searchable from the same editor session:
lynx manager init
lynx source add myproject --type codebase --path /path/to/your/repo
lynx source add mylib --type codebase --path /path/to/shared/lib
lynx source add reactdocs --type webdoc --url https://react.dev/reference/
lynx source add manuals --type pdf --path /path/to/pdfs
lynx build
lynx connect cursor --config ./config.json
One config.json holds all sources. You can scope any editor window to a subset with --source myproject --source reactdocs, and multiple editor windows share the same index safely.
Running many Claude Code sessions or agents on one machine? Over stdio each one starts its own server with its own copy of the indexes in memory. Start one server over HTTP instead and point every session at it:
lynx serve --http 8791 --config ./config.json
lynx connect claude --url http://127.0.0.1:8791/mcp
It listens on the loopback interface only, and a rebuild one session asks for does not hold up the searches of the others.
Indexing can also step aside for something that wants the machine alone. Set LYNX_PAUSE_FILE to a path: while that file exists, embedding, graph builds and the startup load of the keyword index wait, and searches keep answering. A benchmark or a game measuring its frames gets the machine back within seconds.
Single-shot retrieval quality on three public codebases in three languages, using behavioural questions with known ground-truth files, compared against an IDF-weighted multi-keyword grep baseline. Per-task tables: Django · Json.NET · Guava.
| grep / Lynx (v1.12.0) | Django 5.2 (Python) | Json.NET (C#) | Guava (Java) |
|---|---|---|---|
| Corpus | 883 files, 158k lines, 20 questions | 240 files, 69k lines, 15 questions | 606 files, 181k lines, 15 questions |
| hit@1 (top result right) | 45% / 70% | 33% / 67% | 73% / 67% |
| hit@5 (in top 5) | 95% / 90% | 67% / 73% | 93% / 87% |
| MRR | 0.64 / 0.79 | 0.47 / 0.70 | 0.81 / 0.76 |
Key takeaways:
BloomFilter or RateLimiter already match the question's wording, keyword grep edges ahead, and the two work best side by side.search(outline=true) returns signatures and first doc lines instead of full bodies (2.4× smaller, measured), and three tool profiles keep schema overhead bounded (core: 6.6k chars, standard: 14.0k, full: 22.3k).# Python (Django 5.2)
git clone --depth 1 --branch 5.2 https://github.com/django/django.git benchmarks/_target/django
python benchmarks/run_benchmark.py && python benchmarks/structural_demo.py
# C# (Json.NET)
git clone --depth 1 https://github.com/JamesNK/Newtonsoft.Json.git benchmarks/_target/jsonnet
python benchmarks/run_benchmark.py --tasks benchmarks/tasks_jsonnet.json \
--target-dir benchmarks/_target/jsonnet --storage-dir benchmarks/_storage_csharp \
--results-json benchmarks/results_csharp.json --results-md benchmarks/RESULTS_csharp.md
# Java (Guava)
git clone --depth 1 https://github.com/google/guava.git benchmarks/_target/guava
python benchmarks/run_benchmark.py --tasks benchmarks/tasks_guava.json \
--target-dir benchmarks/_target/guava --storage-dir benchmarks/_storage_java \
--results-json benchmarks/results_java.json --results-md benchmarks/RESULTS_java.md
BAAI/bge-small-en-v1.5) with a code-tokenized BM25 index (covering bodies, symbol names and file paths) via reciprocal rank fusion, ranking production code above tests, data and docs. An optional local cross-encoder reranker is built in.impact, describe_symbol, find_usages, graph_query, export_graph, dead_code and the Architecture page. graph_query also finds the cycles between folders and files and where to cut them, the entry points and the call tree from each (every branch says why it stops), the folder matrix, and the references that break the dependency rules you write in .lynx-rules.json, which the map draws and lynx ci can enforce.lynx coverage import reads the report your tests write (OpenCover, as Unity's Code Coverage package and coverlet write it, Cobertura, LCOV, JaCoCo, or coverage.py's JSON), merges several (Unity writes one for EditMode and one for PlayMode), keeps them beside the index with the hash of each file, and leaves out a file that changed since. health and the file hook then say which code the tests run from the report instead of the call graph, change_risk gives the share of changed lines the tests run, and lynx coverage check --min 80 fails a CI job below it.health(view="queue") reads the syntax tree for long, deeply nested or repeated code, empty catch blocks, files importing each other in a circle, queries, regexes and file reads inside loops, blocking calls in async code, and what Unity's Update or Godot's _process does every frame (GetComponent, Find, new List, LINQ, loads). It puts first what is serious and in code that changes, gives each the first step and the tests that reach it, keeps your verdict on a finding by a stable id (mark="ID false_positive generated"), and says for each rule whether, on your history, it does better than file size alone. view="plans" turns them into refactoring plans worked out from the graph and the syntax tree: extract a class or a method, split a file, break a circle of imports, move a method, remove dead code, each with the callers to update and the tests to run.lynx secrets finds cloud and service keys, private keys, credentials in URLs and passwords assigned in code, in what git tracks and, with --history, in every line every commit added. Values are masked, a baseline keeps the known ones quiet, the answer comes as text, JSON or SARIF with an exit code for CI, and risky patterns (eval, pickle, shell=True, SQL from strings, verify=False) come as hints. change_risk names a secret in the lines you are about to commit.lynx ci checks a pull request with no index and no model: the findings it brings (compared with its files at the base branch, so old debt does not fail it), secrets, change risk and the coverage of the changed lines, with SARIF, a GitLab Code Quality report and a Markdown summary. The repository is a GitHub Action (uses: lorenzo-cambiaghi/LynxMCP@main) that comments on the pull request, and ci/gitlab/lynx.gitlab-ci.yml does the same for GitLab.history(symptom="...") or lynx suspects takes an error, a stack trace or a failing test and ranks the recent commits that most likely caused it, by the trace, the names, the words and recency (ranks fused), each suspect with its reasons. lynx suspects --check measures it on your own fixes with git blame: here the culprit came in the top five 65% of the time, against 10% by recency.Physics.Raycast, requests.get) are tied to their pages: the file hook and describe_symbol name the docs of what the code calls, and doc_drift lists every call to an API those docs call deprecated or obsolete.lynx wiki give each folder and file a page built with no model: what it is for, its public symbols and their signatures, what it uses and what uses it, owners, hotspot rank, the tests that reach it, its decisions and latest commits. lynx wiki --export DIR writes them as linked Markdown.lynx runtime import reads speedscope, collapsed stacks, .cpuprofile, pstats, JUnit XML and BenchmarkDotNet reports and ties them to the graph's functions; health then says where the time goes and puts the findings in hot code first.lynx distill -- pytest -q (or a dotnet build, npm ci, cargo test, go test, git log, git diff) runs the command and prints what an agent needs: the errors first, the failures and the summary, with the command's exit code. The whole output stays on disk for a week, and lynx expand <ref> prints it back, a range of lines or the lines that match. lynx brief tells the agent to use it; lynx connect claude --distill adds a hook that does it for every such command. On a failing test run of 122 tests it printed 1,050 characters of 11,918.find_usages lists them, dead_code no longer reports the component, and the file hook says where a script is attached before you rename a field), and each .asmdef bounds what its code can name, as MSBuild project references do. In Godot, scenes attach scripts and their signals call methods by name, and both count. The callbacks an engine calls by itself (Update, OnTriggerEnter, _ready) are never dead code.In a git repository Lynx also reads the history into a small store next to the index, once in full and then only the new commits: how often each file changes, who changed it, which files change together and which commits were fixes. history, change_risk and health answer from it, together with the graph, and the Architecture page takes its colours from it.
The tool surface is fixed regardless of how many sources you configure, split into three profiles:
| Profile | Tools | Schema size |
|---|---|---|
core (8) |
search, describe_symbol, module_summary, find_usages, impact, plus the three hook tools (prompt_hook, read_guard, file_context) |
~1,650 tokens |
standard (17, default) |
core + find_definition, find_similar, graph_query, repo_overview, search_diff, history, change_risk, why, recipe |
~3,500 tokens |
full (27) |
standard + deep_search, find_tests_for, export_graph, health, dead_code, doc_drift, feedback, list_sources, get_rag_status, update_source_index |
~5,560 tokens |
Select a profile with --profile core|standard|full, LYNX_TOOL_PROFILE, or tools.profile / tools.include in config.json. Every tool is also a CLI subcommand (lynx search ..., lynx find-definition ApplyDamage, lynx impact ApplyDamage, lynx graph query --op callers --symbol ApplyDamage) with --json for scripts.
| Tool | Profile | What it answers |
|---|---|---|
search(query, identifiers?, source?, outline?) |
core | Hybrid search across one or all sources. Pass known symbol names in identifiers, or outline=true for signatures only (2.4× smaller). |
describe_symbol(symbol, file?) |
core | Definition, callers, callees and tests in one call; for a class, also bases, subtypes and member signatures. Optional file disambiguates same-name definitions. |
module_summary(file) |
core | Every symbol in a file with its signature and doc line, plus its imports and dependents. |
find_usages(symbol) |
core | Callers from the graph, subtypes and textual references with line numbers. |
impact(symbol) |
core | Transitive blast radius through the call graph with hop distance, plus tests to re-run. |
prompt_hook(prompt) |
core | Called by Claude Code's UserPromptSubmit hook (not the model) to prepend a compact map of relevant code. |
read_guard(file_path?, offset?, limit?, command?) |
core | Optional PreToolUse hook on Read / Bash (not for the model): refuses a read of more than 200 lines of an indexed file once, with the file's outline; the same read asked again goes through. |
file_context(file_path?, tool?, session?, new_string?) |
core | Called by Claude Code's PostToolUse hook on Read and the edit tools (not the model): once per file and session, the file's users, co-changing files, fix commits and the functions they touched, hotspot rank and tests; at an edit, the co-changing files not edited yet; and other sessions' recent edits of the file. |
find_definition(symbol) |
standard | Where a symbol is defined: full body for the top match, signatures for the rest. |
find_similar(snippet) |
standard | Checks whether a draft duplicates existing code and ranks similar implementations. |
graph_query(operation, symbol?, depth?) |
standard | callers, callees, subclasses, superclasses (the whole hierarchy in one call with depth 1-10), imports, neighbors, shortest_path, overview, surprising_connections, cycles (and where to cut them), flows (entry points and their call trees), rules (references that break .lynx-rules.json), matrix (references between folders), audit (a C# package's SOLID findings, each with the files its refactor touches), status. |
repo_overview() |
standard | Languages, frameworks, entry points and build/test/run commands. |
search_diff(query, base?) |
standard | Search scoped to files changed against a base branch, useful for code review. |
history(target?, days?, symptom?) |
standard | From git, before an edit: how often a file or folder changes, who wrote it, the files that usually change in the same commits, and its fix commits. With a stack trace or an error as symptom, the recent commits likeliest to have brought it. |
recipe(like) |
standard | Before adding another one of something (a tool, panel, command, exporter): what a complete addition touches here, learned from the commits that added its siblings (the names listed with it, the types sharing its base, the symbols of its kind and name shape): the files most of them changed, with the lines that list the siblings, and the new files they added. A path asks the same for a new file of its folder and name pattern. |
why(target?) |
standard | Why the code is shaped this way: the decisions the repository records, as decision files (docs/decisions/0003-x.md and the like) and WHY: / DECISION: comments, that govern a file, folder or symbol or match some words; with no target, what is in force, what needs review because its code changed a lot since, and what is stale. lynx why --add records one as a file, reviewed in the next commit. |
change_risk(base?) |
standard | After an edit: the symbols the uncommitted changes (or a branch) touch, the code outside the change that uses them, files that usually change with them and are missing, the tests that reach them, and the change's size against recent commits. |
health(target?, days?, view?, mark?) |
full | Hotspots, code both complex and changing (commits x the square root of 1 + its branches), with how the ranking held up against the repository's own fix commits and which hotspots no test reaches. view="queue": the findings to fix first, each with its first step and the tests to run; view="plans": refactoring plans with the callers to update; mark keeps a verdict on one. |
doc_drift(target?, include_possible?) |
full | Docs that name what the code no longer has: links to missing files, paths that match no file and, on request, code names no code file writes; with an outside API's docs indexed, the code's uses of what they call deprecated. |
dead_code(target?, include_low?) |
full | Functions, methods and types nothing reaches: no call, type use or base in the graph, and the name written nowhere else in the source, docs and config included; by tier. |
deep_search(queries, source?) |
full | Tries multiple query phrasings in sequence when a single search is weak. |
find_tests_for(symbol) |
full | Tests covering a symbol directly or through the call graph. |
export_graph(target, mode?) |
full | Exports a self-contained offline HTML view of a symbol's blast radius or a file hub. |
feedback(trying_to_do, tried, stuck) |
full | Logs local notes when an agent couldn't find something, to help tune sources. |
list_sources / get_rag_status / update_source_index |
full | Inspect configured sources and trigger a manual refresh. |
Retrieval tools advertise the MCP readOnlyHint annotation so clients can auto-approve them. search sets anthropic/alwaysLoad so Claude Code keeps it immediately available while loading the remaining tools on demand.
Search and the code graph are also exposed over a local HTTP API (/api/v1) with OpenAPI 3.1 metadata and NDJSON streaming, bound to 127.0.0.1:
/api/v1/openapi.json to add Lynx as a typed provider next to GitHub or Sentry (Coral 0.x SQL tables continue to work).read_ndjson_auto('http://127.0.0.1:8765/api/v1/search?...') to join code relevance with git churn, logs or tickets.lynx_source, lynx_search and lynx_graph SQL tables (prebuilt binaries).uses: lorenzo-cambiaghi/LynxMCP@main) that runs lynx ci with no index; a second one builds the index and posts downstream callers and related code on pull requests.CLAUDE.md / AGENTS.md pointer and workflows combining Lynx with GitHub, Sentry and Jira. lynx brief --write CLAUDE.md adds a short map of the codebase to that file between two markers (build and test commands, the main parts from the foundations up, cycles and, with git, hotspots); a later run rewrites only what is between them.| LynxManager | The web UI step by step, with pictures of the current version |
| Full guide | Configuration, codebase / webdoc / PDF sources, retrieval internals, tool profiles, hooks, air-gapped setup |
| Outline mode | Signatures instead of bodies: 2.4× smaller output, measured data & chart |
| Coral | Code search and code graph as typed tools in Coral 1.x |
| DuckDB / Steampipe | Code search and code graph as SQL tables |
| Agent rules snippet | Short pointer for AGENTS.md / CLAUDE.md |
| MCP recipes | Combining Lynx with GitHub, Sentry and Jira MCP servers |
| GitHub Action | PR impact analysis from the index on every pull request (the checks with no index: action.yml) |
| config.example.json | Annotated v2 configuration reference |
Developed independently; issues and PRs are welcome (see ROADMAP.md). Licensed under Apache 2.0.
Please log in to share your review and rating for this MCP.
Explore related MCPs that share similar capabilities and solve comparable challenges
by headroomlabs-ai
Compress tool outputs, logs, files, RAG chunks, and conversation history before they reach the LLM, keeping answers identical while saving up to 95% of tokens for JSON payloads.
by modelcontextprotocol
A Model Context Protocol server for Git repository interaction and automation.
by zed-industries
A high‑performance, multiplayer code editor designed for speed and collaboration.
by modelcontextprotocol
Model Context Protocol Servers
by modelcontextprotocol
A Model Context Protocol server that provides time and timezone conversion capabilities.
by cline
An autonomous coding assistant that can create and edit files, execute terminal commands, and interact with a browser directly from your IDE, operating step‑by‑step with explicit user permission.
by upstash
Provides up-to-date, version‑specific library documentation and code examples directly inside LLM prompts, eliminating outdated information and hallucinated APIs.
by daytonaio
Provides a secure, elastic infrastructure that creates isolated sandboxes for running AI‑generated code with sub‑90 ms startup, unlimited persistence, and OCI/Docker compatibility.
by continuedev
Enables faster shipping of code by integrating continuous AI agents across IDEs, terminals, and CI pipelines, offering chat, edit, autocomplete, and customizable agent workflows.