lynx-mcp
LynxMCP is a local code search and code-graph server for AI editors.
Search indexed code and docs by meaning or name across one or all sources, with filters, outline-only output, and multi-query escalation.
Find definitions, usages, similar code, tests, and full symbol context including callers, callees, bases, and subtypes.
Analyze change impact with transitive callers, hop distance, and affected tests.
Query the code graph for callers, callees, inheritance, imports, neighbors, shortest paths, overviews, and surprising connections.
Orient in unfamiliar repos with languages, frameworks, entry points, and build/test/run commands.
Inspect module structure, imports, and dependents for a file.
Export self-contained HTML graph views for symbols or modules.
Manage local indexes: list sources, check freshness/drift, and rebuild changed sources.
Support Claude Code hook workflows for prompt-time code maps and guarded large reads, plus local feedback logging.
Run fully locally/offline with no cloud index or telemetry.
Enables querying the code search index and knowledge graph as SQL tables via HTTP API, allowing correlation with other data sources in DuckDB.
LynxMCP
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.
Quickstart
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.
Claude Code
uv tool install lynx-mcp # or: pipx install lynx-mcp
lynx connect claudeEvery project you open in Claude Code gets its own index, built in the background the first time. lynx connect claude also wires a prompt hook into ~/.claude/settings.json so each request arrives with a compact map of relevant code (up to 12 locations with file, line range and signature) before the first turn. Pass --no-hook to skip it. 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}"}}]}]}}Cursor, Claude Desktop, Windsurf, Antigravity, VS Code
uv tool install lynx-mcp
cd /path/to/your/project
lynx connect cursor # or: claude-desktop | windsurf | antigravity | vscodelynx 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.
Prefer a desktop installer?
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.
Updating
lynx updateDetects 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).
Related MCP server: Code Memory
Why Lynx alongside grep
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 | 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 |
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 |
Questions grep can't answer directly
Question | With | With Lynx |
"What breaks if I change | Textual mentions of the string |
|
"Who implements | Regex guesses + manual file reads to filter comments |
|
"Do we already have a helper like this?" | Guess possible function names |
|
"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 |
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.
Multiple repos, library docs & PDFs in one server
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.jsonOne 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/mcpIt listens on the loopback interface only, and a rebuild one session asks for does not hold up the searches of the others.
Visual tour
Benchmarks (reproducible)
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:
Behavioural queries (Django, Json.NET): Lynx puts the right file first far more often (70% vs 45% on Django, 67% vs 33% on Json.NET) because it matches intent, not just literal tokens.
Exact-name queries (Guava): when class names like
BloomFilterorRateLimiteralready match the question's wording, keyword grep edges ahead, and the two work best side by side.Compact context:
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.0k chars,standard: 10.6k,full: 16.2k).
# 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.mdHow it works
flowchart LR
A["Your code + docs + PDFs"] --> B["Tree-sitter<br/>AST chunker"]
B --> C["bge-small<br/>ONNX embeddings"]
B --> D["code-tokenized<br/>BM25"]
B --> G["Code knowledge graph"]
C --> R{{"RRF fusion"}}
D --> R
Q(["Your query"]) --> R
R --> RR["Optional<br/>reranker"]
RR --> RES["Ranked code<br/>file : line : symbol"]
G --> GT["Graph tools<br/>callers · subclasses · impact"]
classDef store fill:#fff3e6,stroke:#e8742c,color:#24292f;
classDef out fill:#e8742c,stroke:#e8742c,color:#fff;
class C,D,G store;
class RES,GT out;AST chunking (20 languages): Tree-sitter splits code along function and class boundaries, never arbitrary character windows. Supported grammars include Python, TypeScript/TSX, JavaScript, C#, C, C++, Rust, Go, Java, GDScript, Kotlin, Swift, Ruby, PHP, Lua, Scala, SQL, Bash and Objective-C.
Hybrid retrieval: Every search fuses dense ONNX embeddings (
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.Code graph: Built from imports, declarations and call sites across files. It powers
impact,describe_symbol,find_usages,graph_queryandexport_graph.100% local & offline: The embedding model downloads once (with a GitHub Release fallback for firewalled or air-gapped networks). No cloud index, no telemetry, no code leaves your machine.
Fast startup: The MCP handshake completes in 1 to 2 seconds while indexes open in the background; a file watcher re-indexes saved files in ~2 seconds.
The tools your AI gets
The tool surface is fixed regardless of how many sources you configure, split into three profiles:
Profile | Tools | Schema size |
|
| ~1,500 tokens |
|
| ~2,650 tokens |
|
| ~4,050 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 |
| core | Hybrid search across one or all sources. Pass known symbol names in |
| core | Definition, callers, callees and tests in one call; for a class, also bases, subtypes and member signatures. Optional |
| core | Every symbol in a file with its signature and doc line, plus its imports and dependents. |
| core | Callers from the graph, subtypes and textual references with line numbers. |
| core | Transitive blast radius through the call graph with hop distance, plus tests to re-run. |
| core | Called by Claude Code's |
| core | Optional |
| standard | Where a symbol is defined: full body for the top match, signatures for the rest. |
| standard | Checks whether a draft duplicates existing code and ranks similar implementations. |
| standard |
|
| standard | Languages, frameworks, entry points and build/test/run commands. |
| standard | Search scoped to files changed against a base branch, useful for code review. |
| full | Tries multiple query phrasings in sequence when a single |
| full | Tests covering a symbol directly or through the call graph. |
| full | Exports a self-contained offline HTML view of a symbol's blast radius or a file hub. |
| full | Logs local notes when an agent couldn't find something, to help tune sources. |
| 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.
Integrations
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:
Coral 1.x: point it at
/api/v1/openapi.jsonto add Lynx as a typed provider next to GitHub or Sentry (Coral 0.x SQL tables continue to work).DuckDB: query Lynx directly via
read_ndjson_auto('http://127.0.0.1:8765/api/v1/search?...')to join code relevance with git churn, logs or tickets.Steampipe:
lynx_source,lynx_searchandlynx_graphSQL tables (prebuilt binaries).GitHub Action: posts downstream callers and related code on pull requests.
Agent rules & MCP recipes: drop-in
CLAUDE.md/AGENTS.mdpointer and workflows combining Lynx with GitHub, Sentry and Jira.
Documentation
The web UI step by step, with pictures of the current version | |
Configuration, codebase / webdoc / PDF sources, retrieval internals, tool profiles, hooks, air-gapped setup | |
Signatures instead of bodies: 2.4× smaller output, measured data & chart | |
Code search and code graph as typed tools in Coral 1.x | |
Code search and code graph as SQL tables | |
Short pointer for | |
Combining Lynx with GitHub, Sentry and Jira MCP servers | |
Automated PR impact analysis on every pull request | |
Annotated v2 configuration reference |
Status & License
Developed independently; issues and PRs are welcome (see ROADMAP.md). Licensed under Apache 2.0.
Available Tools
18 toolsdeep_searchARead-onlyIdempotent
Escalation for when search came back weak or empty: runs 2-4 genuinely different phrasings of the same need and returns the first set that passes the quality threshold, or the strongest weak set with a warning. Slower than search; do not start here.
Inputs: queries (required), mode, top_k, source, +6 more.
describe_symbolARead-onlyIdempotent
One call to understand a symbol before changing it: its code, callers, callees and tests; for a class, its bases, subtypes and member signatures instead of the body. No read_file needed after. Calls and types need the graph layer; definition and tests always work.
Inputs: symbol (required), file, source, tests_limit, +2 more.
export_graphAIdempotent
Write a self-contained offline HTML view of a symbol's blast radius (mode=symbol) or a file's imports and dependents (mode=module), for a human to open or attach to a PR. Returns the file path.
Inputs: target (required), out, mode, depth, +1 more.
feedbackA
Report that the index could not answer you, before giving up. Appended to a local log (never uploaded) so the index owner can tune sources and filters.
Inputs: stuck (required), tried (required), trying_to_do (required).
find_definitionARead-onlyIdempotent
Jump to where a symbol is defined, when you already know its name; the first match comes with its body, the others with their signature. AST-precise with the graph layer, BM25 otherwise; each hit says which. Use search when you can only describe the code, describe_symbol for the callers and tests too.
Inputs: symbol (required), limit, source.
find_similarARead-onlyIdempotent
Code semantically similar to a snippet you already have, dense search only: use it before writing a function, to check whether something like it exists. search is the one to call when you can describe the need in words instead. Snippets are cut at 2000 chars.
Inputs: snippet (required), top_k, source.
find_tests_forARead-onlyIdempotent
The tests of a symbol: those that reach it through the call graph ([dN] = N calls away, even if they never name it) and those that name it, under conventional test paths (tests/, spec/, tests/, test_*, _test., .spec., *Test.cs, *Tests.cs); test_path_pattern replaces them. describe_symbol and impact include the same tests.
Inputs: symbol (required), limit, source, test_path_pattern.
find_usagesARead-onlyIdempotent
Every use of a symbol: calls and subtypes (from the graph when on) plus textual references that contain the name as a word, with their lines; definition excluded. Answers 'who uses X' at one hop; impact walks the chain further and adds the tests.
Inputs: symbol (required), limit, source.
get_rag_statusARead-onlyIdempotent
Index state for one or all sources: freshness, chunk count, last update, drift. Check it before considering a rebuild.
Inputs: source.
graph_queryARead-onlyIdempotent
Raw access to the code knowledge graph (calls, inheritance, imports), for what find_usages, impact and describe_symbol do not cover. operation: callers | callees | subclasses | superclasses | imports | neighbors | shortest_path | overview | surprising_connections | status | audit (symbol = a C# package folder: SOLID findings, each with its refactor fence). symbol is matched as a case-insensitive substring; results carry file:line.
Inputs: operation (required), depth, limit, top_n, +6 more.
impactARead-onlyIdempotent
Answer 'what breaks if I change this': everything that reaches a symbol transitively through the call graph, with hop distance, plus the tests to re-run. Use find_usages for the direct, one-hop answer; use this before a risky edit, when the indirect callers are the point. max_depth trades reach for noise: 2 stays close to the change, 6 on a hub symbol can return most of the codebase. Transitive callers need the graph layer.
Inputs: symbol (required), source, max_depth, tests_limit.
list_sourcesARead-onlyIdempotent
List which sources exist and what each one is: name, type, path, chunk count and drift flag. Read from config and metadata, no index opened. Call it first when you do not know the source names a source argument expects; for how fresh one index is, and whether to rebuild it, use get_rag_status instead.
Inputs: no named parameters.
module_summaryARead-onlyIdempotent
A file as a unit: each symbol it defines on one line (span, signature, doc line), its imports and the files depending on it (those two need the graph). Read it instead of opening an unknown file; describe_symbol covers one symbol in it.
Inputs: file (required), limit, source.
prompt_hookARead-onlyIdempotent
Hook only, do not call: Claude Code's UserPromptSubmit hook (mcp_tool) sends the prompt and gets the code map of the request as hook JSON.
Inputs: prompt (required).
read_guardBRead-onlyIdempotent
Hook only, do not call: Claude Code's PreToolUse hooks on Read and Bash call it.
Inputs: limit, offset, command, file_path.
repo_overviewARead-onlyIdempotent
Orientation for an unfamiliar codebase: languages by file count, frameworks, manifests, likely entry points, and build/test/run commands. Filesystem scan, no index needed. Call once per session.
Inputs: source.
searchARead-onlyIdempotent
Find where something happens in the indexed code and docs, by meaning and by name: describe it in plain words ('where the player picks a seat to enter'). Ranked file:line hits, the best with its code, the rest as signatures; a score near 0.03 is a strong match. Omit source to search every source. outline=true: signatures only.
Inputs: query (required), top_k, source, outline, +4 more.
update_source_indexAIdempotent
Re-check every file of a source and re-index what changed (a webdoc source is crawled again). Blocking; the watcher keeps codebase sources current, so use it after a big merge, edits made while Lynx was not running, or a drift warning.
Inputs: source (required), force.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 18 tools
The descriptions actively draw boundaries between the most easily confused tools: search vs deep_search ('do not start here'), find_usages (one hop) vs impact (transitive), and find_similar vs search. Some genuine redundancy remains — find_tests_for duplicates tests already returned by describe_symbol and impact, and graph_query overlaps with find_usages/impact for callers/callees — but each overlap is explicitly signposted. The two hook-only tools ('do not call') are noise in the callable surface, though clearly labelled.
Casing is uniformly snake_case, which helps, but the convention is mixed: verb_noun tools (find_definition, find_usages, list_sources, update_source_index, get_rag_status, export_graph) sit alongside bare nouns (impact, feedback, graph_query, module_summary, repo_overview) and one bare verb (search). It stays readable because the domain is coherent, but an agent cannot infer from a name alone whether a tool is an action or a resource.
At 18 tools (16 callable once the two hooks are excluded) this is slightly above the comfortable range, but each tool maps to a distinct query intent — locate, understand, impact, test, orient, maintain index. Nothing feels padded, and the escalation structure (search → deep_search, find_usages → impact) justifies the extra entries.
The surface covers the full code-intelligence lifecycle: discovery (search, deep_search, find_similar), symbol resolution (find_definition, describe_symbol), relationship analysis (find_usages, impact, graph_query, module_summary), tests, orientation (repo_overview), and index maintenance (list_sources, get_rag_status, update_source_index, feedback). Minor gaps exist — no way to enumerate symbols/files by pattern (e.g. list all symbols in a source, or glob-based file listing), and reindexing is source-wide only — but agents can route around them via search and module_summary.
Maintenance
Related MCP Connectors
Self-hosted AI workspace: semantic RAG document search, long-term memory, and AI chat via MCP.
Cloud or self-hosted knowledge for AI agents: hybrid search, reranking, GraphRAG, scoped MCP tools.
An MCP server that gives your AI access to the source code and docs of all public github repos
Shared context for your codebase: a hosted code knowledge graph over MCP. Free plan, OAuth sign-up.
Related MCP Servers
- AlicenseAqualityBmaintenanceNexus-MCP is a local MCP server for coding agents. Hybrid code search and a call graph for 10 languages give the agent the right code in one call, so it reads less. No API key, no telemetry, MIT. * 95% fewer tokens to reach the right file * About 9× faster search than Grep and Read * Live Claude Code runs on 11 repos: cost per task lower on 8 of 115140 PyPIMIT
- AlicenseAqualityDmaintenanceMCP server with local vector search for your codebase. Smart indexing, semantic search, Git history — all offline.750MIT
- AlicenseAqualityBmaintenanceLocal MCP server for semantic code search using Tree-sitter AST parsing, local embeddings, and hybrid search; enables indexing and querying codebases entirely offline.7MIT
- AlicenseAqualityDmaintenanceLocal-first MCP server for semantic + keyword hybrid code search. Zero external services, no API keys required.2MIT