Synapse
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Synapsewhat are the dependencies of CartService?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
π Synapse
Your codebase. Fully understood. Zero waste.
The structural code intelligence layer that makes AI assistants dramatically more accurate, efficient, and useful on real-world codebases.
π€ The Problem
You have a large codebase. Your AI assistant doesn't.
Every time you start a new conversation β with Claude, Cursor, or any other AI β it starts completely blind. It has no idea what CartService does, who calls validateEmail, or whether there's a circular import hiding in your auth module. So you do what everyone does:
You paste files. Lots of files.
And the problems stack up fast:
Problem | Real Cost |
Hallucinated symbol names | AI invents functions that don't exist β you burn time chasing ghosts |
Pasting entire files for context | 500-line files sent when you need 20 lines β tokens wasted, latency added |
Repeating architecture every session | "Here's how our auth worksβ¦" β again, every time |
No dependency awareness | AI can't know what breaking |
Wrong answers at scale | Beyond ~3 files, accuracy collapses without structured context |
No history awareness | AI can't tell you who changed a function or why without git context |
The bigger your codebase, the worse all of this gets.
Related MCP server: CodeGraph
π‘ The Solution
Synapse indexes your entire codebase into a local SQLite graph β every symbol, every call edge, every import, every embedding β and serves it to your AI through a Model Context Protocol (MCP) server with 26 precise tools.
Instead of pasting files, your AI asks for exactly what it needs:
AI: "What does CartService depend on?"
Without Synapse β With Synapse
βββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββ
Developer manually locates β AI calls outgoing_calls("CartService")
and pastes cart.ts (400 β Gets: 6 precise edges, file:line
lines) + cartService.ts β locations, resolved targets
(280 lines) into context β β in ~1 KB, under 100ms
~15,000 tokens consumed β ~300 tokens consumedThe result: AI that works from ground truth, not guesswork.
π Token Consumption β The Numbers
This is the core business case. Token costs are real. Context limits are real. Latency from giant prompts is real.
Before Synapse
Developer asks: "Refactor CartService to support multiple currencies"
Step 1: Find relevant files (manual, ~5 min)
Step 2: Paste cart.ts β ~8,000 tokens
Step 3: Paste cartService.ts β ~6,000 tokens
Step 4: Paste product.ts β ~4,000 tokens
Step 5: Explain dependencies β ~1,000 tokens
βββββββββββββββββ
Total context load: ~19,000 tokens
(before AI even responds)After Synapse
AI uses Synapse tools automatically:
explore_symbol("CartService") β ~400 tokens (definition + callers + callees)
find_references("CartService") β ~200 tokens (who depends on it)
get_source("cart.ts", 45, 92) β ~300 tokens (only the relevant lines)
outgoing_calls("CartService") β ~150 tokens (exact dependencies)
βββββββββββββββββ
Total context load: ~1,050 tokensThat's an 18Γ reduction in token consumption for this query. At scale β across a team, across hundreds of sessions β this compounds into thousands of dollars saved per month.
Why targeted queries beat file-pasting
Scenario | File-paste tokens | Synapse tokens | Reduction |
Find where a function is defined | ~5,000 (whole file) | ~50 ( | 100Γ |
Understand a class's dependencies | ~15,000 (3 files) | ~600 ( | 25Γ |
Check who uses an API | ~20,000 (search manually) | ~200 ( | 100Γ |
Trace a call chain 3 levels deep | ~40,000 (many files) | ~800 ( | 50Γ |
Find a bug by pattern | ~30,000 (manual search) | ~400 ( | 75Γ |
π― Why Synapse
β Ground truth, not guesswork
Synapse reads your actual parsed AST. Every symbol location, every call edge, every import binding comes from the real code β not from a language model's training data. No hallucinated function names. No wrong file paths. No invented APIs.
β AI that understands your architecture
The call graph tells the full story: what calls what, what imports what, what's dead, what's a hub. Your AI can answer architectural questions β circular imports, dependency chains, hub identification β that are impossible without this structure.
β Works across your entire codebase, instantly
43 languages. Every file indexed. Cross-file references resolved. Semantic search via local embeddings. Whether your repo has 100 files or 100,000, the AI always has an index β not a partial, hallucinated memory.
β Fully local β zero data exposure
Everything runs on your machine. The SQLite database lives in your repo. No code is sent to any server. Embedding inference runs locally via Transformers.js. This matters for enterprise codebases, proprietary code, and compliance requirements.
β Persistent intelligence
Index once. Query forever. The incremental indexer detects file changes via xxhash and only re-parses what changed. Your AI doesn't need a "warm-up" monologue about your codebase every session β the graph is always ready.
β Compatible with any MCP client
Works with Claude Desktop, Cursor, VS Code, and any editor that supports MCP. One index, any client.
π Quick Start
# 1. Install
git clone <repo-url> && cd synapse
./setup.sh # macOS / Linux
./setup.ps1 # Windows
# 2. Index your project (one time, incremental after that)
synapse init /path/to/your/repo
# 3. Connect to your AI client
synapse configure /path/to/your/repo
# 4. (Optional) Enable semantic search β 23 MB one-time download
synapse embed /path/to/your/repo
# Done. Open your AI client and ask about your code.π οΈ Tech Stack
π¦ Installation
Requirements: Node.js β₯ 20, pnpm 9.12+
git clone <repo-url>
cd synapse
./setup.shgit clone <repo-url>
cd synapse
./setup.ps1git clone <repo-url>
cd synapse
setup.batThe setup script handles everything: verifies Node β₯ 20, installs pnpm 9.12 via corepack, builds all packages, links synapse + synapse-mcp globally, and writes .vscode/mcp.json.
{
"servers": {
"synapse": {
"type": "stdio",
"command": "node",
"args": [
"${workspaceFolder}/packages/mcp-server/dist/bin.js",
"--root", "${workspaceFolder}",
"--db", "${workspaceFolder}/.synapse/graph.db"
]
}
}
}π» CLI Reference
synapse <command> [options]Command | Description |
| ποΈ Index a repo β skips unchanged files via xxhash |
| π Force full re-index (ignores hash cache) |
| ποΈ Incremental indexer β re-parses files on save |
| π§ Generate vector embeddings for semantic search |
| βοΈ Write config + MCP client snippets |
| π©Ί Diagnose Node, DB, MCP binary |
| ποΈ VACUUM + ANALYZE the DB |
| π Changed public APIs between git refs |
| π₯ Ingest a SCIP JSON index |
| π Look up symbols by name |
| π Every reference to a symbol |
| π File / symbol / edge counts |
| β Sanity check |
Flag | Default | Description |
|
| Override DB path |
|
| Parallel file workers (init/reindex) |
| all | Restrict to specific adapter IDs |
|
| Watch mode debounce window |
| β | Watch: skip up-front full-repo index |
| β | configure: |
| β | configure: print snippet only, skip writing |
| β | query/refs: max results |
| β | stats: emit JSON |
| β | init/reindex: print parse-error file paths |
π Keeping the Index Fresh β 3 Sync Modes
Synapse has three distinct modes for handling codebase changes. You don't need all three β pick what fits your workflow.
Mode 1 β synapse init (on-demand)
Run once, or re-run whenever you want a manual refresh.
synapse init /path/to/repoComputes an xxhash for every file on disk
Compares against stored hashes in SQLite β skips unchanged files instantly
Re-parses AST only for new or modified files
Run
synapse reindexinstead to force a full re-parse (ignores hash cache)
Typical re-run on a large repo: a few seconds, not minutes.
Mode 2 β synapse watch (live, manual)
Long-running process in a terminal. Keeps the DB warm as you code.
synapse watch /path/to/repoDoes one full incremental index on startup (same as
init)Then starts a chokidar file watcher β reacts to every save/create/delete
Debounced β rapid saves don't trigger a parse storm (default 250 ms)
What it logs on each event:
[+] src/cart.ts 12 sym / 34 edge (43ms) β file changed/added
[-] src/old.ts β file deleted β symbols removed
[r] resolved 5 imports + 12 edges (8ms) β cross-file references re-resolvedDeleted files are fully cleaned up β all their symbols are removed and incoming edges are nulled.
Mode 3 β MCP server auto-sync (always-on, zero config)
No command needed. This runs automatically every time the MCP server starts (i.e., when VS Code loads it).
What it does, in order:
Lock check β tries to acquire a file lock. If another MCP instance is already watching β silently backs off (avoids duplicate watchers)
Crash recovery β if a previous index run crashed mid-way (
indexing=trueleft in the manifest) β forces a clean full reindex automaticallyHEAD check β compares the current git
HEADtolast_indexed_headin the DB. If HEAD changed (you pulled, switched branches, rebased) β triggers an incremental reindex before serving any tool callsChokidar watcher β starts the same live watcher as Mode 2 in the background
This is why you never need to manually re-run
initafter switching branches. The MCP server catches the HEAD change on next startup and reindexes silently.
Which mode should you use?
Situation | Recommended |
First-time setup |
|
Active development session |
|
Already using the MCP server in VS Code | nothing β auto-sync handles it |
After a large branch switch or rebase | nothing β auto-sync detects HEAD change |
CI / pre-commit hook |
|
π MCP Server
26 tools and 3 resources over stdio (default) or HTTP.
# stdio β VS Code / Claude Desktop
node packages/mcp-server/dist/bin.js \
--root /path/to/repo \
--db /path/to/repo/.synapse/graph.db
# HTTP β remote, containerized, or shared deployments
node packages/mcp-server/dist/bin.js \
--root /path/to/repo \
--db /path/to/repo/.synapse/graph.db \
--transport http --port 4000 --host 0.0.0.0 \
--token "$CODEGRAPH_TOKEN" \
--redact-pathsFlag | Default | Description |
|
|
|
|
| Listen port |
|
| Bind address |
| β | Bearer token auth (timing-safe comparison) |
| β | Strip home dir and username from all responses |
GET /healthzβ{ ok: true, sessions: N }Stateful sessions via
mcp-session-idheaderCORS restricted to localhost when auth is enabled
Request body limit: 10 MB
π§° MCP Tools (26)
π·οΈ Symbol Lookup β Find anything in your codebase instantly
Tool | What it answers | Token saving vs. manual |
| Where is | ~100Γ |
| Canonical definition of | ~100Γ |
| Which symbols match | ~50Γ |
| Everything defined in | ~10Γ |
| Is this AI-generated reference actually valid? 0β1 confidence score | prevents hallucination loops |
π Call Graph β Understand dependencies without reading files
Tool | What it answers | Token saving vs. manual |
| Who calls / imports / extends | ~100Γ |
| What does | ~50Γ |
| Full BFS traversal β incoming or outgoing, configurable depth | ~1000Γ |
| Definition + source + callers + callees β everything in one call | ~25Γ |
| What are the architectural hubs? (fan-in + fan-out ranking) | unique insight |
π Code Search β Grep smarter, not broader
Tool | What it does | Why it saves tokens |
| Regex/fixed-string search β ripgrep β FTS5 β disk, auto-fallback | Returns only matches + context, not whole files |
| AST-pattern: | No false positives from comments or strings |
| Exact β FTS5 trigram β fuzzy β semantic β Reciprocal Rank Fusion | Best result without AI guessing where to look |
| "function that validates email" β finds by meaning, not name | Eliminates exploratory file-reading |
| Who imports | Targeted import graph query |
π Source & Metrics β Get exactly the lines you need
Tool | Token efficiency |
| Read only the line range that matters β not the whole file |
| Aggregate counts in ~50 tokens instead of reading the whole DB |
| Health check, drift detection, git HEAD β instant summary |
| Per-file complexity β identify hotspots without manual review |
| Remove dead code confidently β no guessing |
π Git History β Context that lives outside the code
Tool | Value |
| Why was this function changed? Who touched it last? |
| Who wrote this line and in what commit? |
ποΈ Architecture & Security β Systemic insight
Tool | Value |
| Find circular imports before they cause runtime bugs (Tarjan's SCC) |
| Update one file's graph atomically β no full re-index needed |
| OWASP Top 10, secrets, language-specific rules via semgrep |
| Auto-retrieve large payloads offloaded beyond the 8 KB threshold |
π Resources (3)
URI | Returns |
| Repo-wide counts and DB size as JSON |
| Every indexed file path, newline-delimited |
| Schema version, counts, last-indexed time, drift hint |
π grep_code β Smart Three-Backend Chain
grep_code("pattern")
β
ββββΊ 1. ripgrep (rg) Rust + SIMD + parallel I/O
β β not found / not installed
ββββΊ 2. SQLite FTS5 trigram pre-filter β JS regex (no disk I/O)
β β no content stored
ββββΊ 3. Disk scan readFileSync + JS RegExp (always works)
All three return: file Β· line Β· col Β· match text Β· context lines Β· enclosing symbolThe ripgrep backend streams output asynchronously via spawn() + readline β the event loop is never blocked and there is no memory buffer cap, making it safe for very large repos.
π§ Semantic & Hybrid Search
Default: Transformers.js β 100% local, zero server
synapse embed /path/to/repo # ~23 MB one-time download, fully cached afterModel |
|
Dimensions | 384 |
Quantization | INT8 |
Download | ~23 MB (one-time) |
Requires server | β No |
Package |
|
Alternative: Ollama
ollama serve
synapse embed /path/to/repo --provider ollama --model nomic-embed-textDefault model |
|
URL |
|
Requires server | β Yes |
Once embeddings exist, semantic_search and hybrid_search use them automatically.
π Language Support
π₯ Tier 1 β Full adapters (7 languages)
Symbols Β· call edges Β· import resolution Β· cross-file linking Β· SCIP-stable IDs
Language | Extensions |
TypeScript |
|
JavaScript |
|
Python |
|
Go |
|
Java |
|
C# |
|
π₯ Tier 2 β Generic adapters (20 languages)
AST + call tracking Β· no per-language module resolution
C++ Rust Ruby Kotlin Swift PHP Dart Scala Zig Lua Bash Elixir Elm OCaml Solidity Objective-C Vue ReScript and more
π₯ Tier 3 β Text-only (16 languages)
File-level symbols Β· no AST
Markdown JSON YAML TOML SQL XML HTML CSS GraphQL Protobuf .env Dockerfile and more
43 languages Β· 100+ file extensions
ποΈ Database Design
SQLite Β· WAL mode Β· Schema v9 Β· Dual connection handles (read-only db + write-on-demand wdb)
Table | Purpose |
| Indexed files: path, language, xxhash, mtime, |
| Definitions: SCIP IDs, kind, line range, signature, doc |
| Call/reference edges: |
| Import bindings: specifier, |
| Key-value: |
| FTS5 trigram index for symbol name search |
| Dense vectors: |
| Raw source per file (grep backend 2) |
| FTS5 trigram index for grep pre-filtering |
Cross-file edge invariant:
edges.target_idhasON DELETE CASCADE. Before deleting symbols during reindex, Synapse nulls out incoming cross-file edges first β edges survive, and the resolver re-links them on the next pass.
ποΈ Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AI Assistant β
β (Claude Β· Cursor Β· any MCP client) β
β β
β "What breaks if I refactor CartService?" β
β β AI calls find_references + call_hierarchy β
ββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ
β MCP (stdio or HTTP)
ββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββ
β MCP Server β
β 26 tools Β· 3 resources Β· 8 KB auto-offload threshold β
ββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββ
β @synapse/core β
β β
β βββββββββββββββ ββββββββββββββββ βββββββββββββββββββ β
β β Indexer β β Resolver β β Embeddings β β
β β tree-sitter β β cross-file β β Transformers.js β β
β β 43 languagesβ β edges + BFS β β or Ollama β β
β ββββββββ¬βββββββ ββββββββ¬ββββββββ ββββββββββ¬βββββββββ β
β βββββββββββββββββ¬β β β
β ββββββββββββββββββββ-β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β SQLite Β· WAL mode Β· Schema v9 β β
β β files Β· symbols Β· edges Β· file_imports Β· manifest β β
β β symbols_fts Β· symbol_embeddings β β
β β file_content Β· file_content_fts β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββDesign decisions that matter:
Decision | Why |
SCIP-stable symbol IDs | Portable, path-relative IDs survive file renames |
Barrel re-export BFS | Resolves re-exported names through up to 3 levels of |
Async streaming grep |
|
Dual DB handles | Concurrent reads never wait for writes; WAL checkpoint on write close |
8 KB offload | Large responses written to temp files; AI retrieves only if needed β keeps MCP stream lean |
xxhash change detection | Near-zero-cost file diffing β only changed files are re-parsed |
π§ External Dependencies
All optional. Synapse degrades gracefully.
Tool | Used By | Install | Fallback |
ripgrep ( |
|
| FTS5 + disk scan |
semgrep |
|
| Tool returns descriptive error |
ast-grep |
| Bundled via | β |
git |
| Must be on PATH | Tools return descriptive error |
Ollama |
| Use default Transformers.js (no server) |
βοΈ GitHub Action
Index on every push, comment API diffs on PRs β keep your AI's index always current:
- uses: ./
with:
languages: typescript,python
db-path: .synapse/graph.db
comment-on-pr: true
base-ref: ${{ github.base_ref }}Outputs: files-indexed Β· symbols-count Β· api-changes Β· db-path
The DB is cached by source-file hash β incremental runs re-parse only what changed.
π³ Docker
docker build -t synapse .
docker run -p 4000:4000 \
-v /path/to/repo:/repo:ro \
-v /path/to/data:/data \
synapse \
--db /data/graph.db --root /repo \
--transport http --host 0.0.0.0 --port 4000 \
--token "$CODEGRAPH_TOKEN"Multi-stage build (Node 22 slim). Non-root synapse user in the runtime stage.
π§ͺ Development
packages/
core/ @synapse/core β indexer, resolver, DB, embeddings
mcp-server/ @synapse/mcp-server β MCP server, HTTP transport, all 26 tools
cli/ @synapse/cli β CLI commands
fixtures/
sample-shopping-app/ β TypeScript fixture used by all testspnpm install # install dependencies
pnpm -r build # build all packages
pnpm -r test # 261 tests across 30 files
pnpm -r test --watch # watch modeTest coverage: indexing Β· cross-file resolution Β· all 26 MCP tools Β· HTTP transport Β· Bearer auth Β· path redaction Β· Transformers.js embeddings Β· three grep backends Β· SCIP ingestor Β· cycle detection
The Bottom Line
Without Synapse, your AI is reading your codebase one pasted file at a time. With Synapse, it queries a complete, structured graph β and uses a fraction of the tokens to do it.
Less context waste. Fewer hallucinations. Faster answers. Better code.
100% local Β· No cloud Β· No telemetry Β· Works with any MCP client
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/amitsingh2003/Synapse'
If you have feedback or need assistance with the MCP directory API, please join our Discord server