codebase-synapse

io.github.iwiels由 GitHub 账号 iwiels 发布v0.1.13更新于 Oct 25, 2026

Indexes codebase into a local knowledge graph with 40+ AI tools and codebase-guard.

发布方自己的服务:Codebase

概览

AI 生成的概览

一个本地 MCP 服务器,读取预先构建的代码库 SQLite 知识图谱,让助手搜索代码、追踪调用链并分析改动影响。

可以做什么
搜索与发现代码:语义搜索、全文搜索、符号搜索、混合搜索,以及结构相似度和跨项目符号定位。浏览知识图谱:调用者与被调用者、导入与依赖方、最短路径、死代码、PageRank 和类 Cypher 图查询。查看架构:项目概览、文件结构、路由映射、模块边界与聚类。分析 git 历史:文件考古、热点、变更耦合和近期语义变更。维护记忆与上下文:持久和会话笔记、为编辑准备的预算上下文、工作集以及架构决策记录。
适用场景
当助手需要针对大型代码库给出有结构依据的答案而非猜测时适用,例如调用链、编辑前的依赖影响、架构热点或某个文件的历史。适合已在本机代码库上使用支持 MCP 的编程客户端的开发者。
运行要求
通过 npx 以 stdio 在本地运行(npm 包,附带 Windows、macOS 和 Linux 预编译二进制)。需先用独立的 CLI 命令为代码库建立索引,索引写入用户主目录下的本地 SQLite 数据库。无需 Docker、云服务、API 密钥或账号,嵌入模型在本地运行。
安装前请注意
服务器本身只读取已建好的索引,但独立的索引命令会在用户主目录写入数据库文件,并读取代码库及其 git 历史。可选的 codebase-guard 钩子会在运行影响分析前阻止对高影响文件的写入,从而改变助手的编辑行为。

安装

在 SourceWeft 中

  1. 打开 控制台中的 codebase-synapse,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

🧠 Codebase Synapse

Give your AI agent a deep understanding of your entire codebase.

An MCP server that indexes your codebase into a local knowledge graph with 52 AI tools — semantic search, call-graph traversal, git archaeology, blast-radius analysis, and more.


[Codebase Synapse — Knowledge graph visualization]

Works with Claude Code · Cursor · Windsurf · Zed · Any MCP client

[CI] [npm version] [License: Apache-2.0] [MCP Registry]


The Problem

AI coding agents (Claude, Cursor, etc.) are powerful — but they work with limited context. They can only see the files you open or feed them. Ask about call chains, architectural patterns, or blast-radius impact, and they guess.

Codebase Synapse fixes this. It indexes your entire repo into a local knowledge graph stored in SQLite, giving your AI agent real answers backed by structural analysis — not hallucinations.

How it works

mermaid
graph LR    A["📁 Your Codebase"] -->|Tree-sitter| B["🧩 Parser"]    B -->|Symbols & Edges| C["🕸️ Knowledge Graph"]    C -->|SQLite| D["💾 Local DB"]    D -->|52 MCP Tools| E["🤖 AI Agent"]        style A fill:#1a1b26,stroke:#7aa2f7,color:#c0caf5    style B fill:#1a1b26,stroke:#bb9af7,color:#c0caf5    style C fill:#1a1b26,stroke:#9ece6a,color:#c0caf5    style D fill:#1a1b26,stroke:#e0af68,color:#c0caf5    style E fill:#1a1b26,stroke:#f7768e,color:#c0caf5

⚡ Quick Start

1. Index your project (CLI, Zoekt-style)

bash
codebase-synapse index /path/to/your/repo

Indexing runs as a separate CLI command and writes into ~/.codebase-synapse/codebase.db. The first index is the slow one; re-running it only re-indexes changed files. The MCP server never indexes — it only reads the pre-built index.

2. Start the MCP server

bash
npx codebase-synapse

That's it. No Docker. No database setup. No cloud. The server starts via stdio and serves the pre-built index to your MCP client.

Configure your client

Claude Code / Claude Desktop

Add to your claude_desktop_config.json or mcp_servers.json:

json
{  "mcpServers": {    "codebase-synapse": {      "command": "npx",      "args": ["-y", "codebase-synapse"]    }  }}
Cursor

Add to your .cursor/mcp.json:

json
{  "mcpServers": {    "codebase-synapse": {      "command": "npx",      "args": ["-y", "codebase-synapse"]    }  }}
Other MCP clients

Any MCP client that supports stdio transport works. Just point it at:

bash
npx -y codebase-synapse

✨ What It Does

🔍 Search & Discovery

ToolDescription
semantic_searchVector similarity search using local embeddings (all-MiniLM-L6-v2)
search_codeFull-text search across code (FTS5 + BM25 ranking)
search_symbolFind functions, classes, types by name or pattern
hybrid_searchCombined semantic + lexical search with RRF fusion
find_similarFind structurally similar code using MinHash + LSH
find_symbol_everywhereLocate a symbol across all indexed projects

🕸️ Knowledge Graph

ToolDescription
get_callers / get_calleesNavigate the call graph in either direction
get_imports / get_dependentsTrace dependency chains
impact_analysisCompute blast radius before editing a file
find_pathFind the shortest connection between two symbols
find_dead_codeDetect unreachable functions and unused exports
get_pagerankIdentify the most critical nodes in your architecture
query_graphRun Cypher-like queries against the knowledge graph

🏗️ Architecture

ToolDescription
get_architectureFull project architecture overview (languages, entry points, hotspots)
get_file_structureDirectory tree with symbol annotations
project_overviewHigh-level summary with key metrics
get_route_mapExtract HTTP routes and their handler mappings
suggest_boundariesDetect module boundaries via Leiden clustering
check_boundariesValidate cross-module dependencies against defined boundaries
get_clustersCommunity detection across the codebase

🔬 Git Archaeology

ToolDescription
git_archaeologyDeep history analysis of a file (authors, churn, evolution)
get_hotspotsFiles with highest complexity × change frequency
detect_change_couplingFiles that always change together
get_recent_semantic_changesSemantically meaningful recent changes
index_git_historyBuild temporal analysis from git log

🧠 Memory & Context

ToolDescription
memory_store / memory_search / memory_listPersistent notes, facts, and decisions across sessions
session_remember / session_recallShort-term memory within a session
get_contextBudgeted context preparation for AI agents
get_edit_contextFocused context for a specific file edit
get_working_setRecently accessed and modified files
manage_adrArchitecture Decision Records management

🛡️ Codebase Guard

Included as a bonus: codebase-guard is a PreToolUse hook for Claude Code that blocks writes to high-impact files until the agent runs impact_analysis first.

It uses PageRank scores and blast-radius data from the knowledge graph to identify architectural hubs. No more accidental edits to core files.

🔧 Technical Details

LanguageRust (compiled native binary)
TransportMCP stdio (JSON-RPC)
StorageSQLite (WAL mode, zero config)
Embeddingsall-MiniLM-L6-v2 via Candle (offline, local, lazy-loaded)
ParsingTree-sitter (10 languages)
Distributionnpm with prebuilt binaries (Windows, macOS, Linux × x64, arm64)

Supported Languages

Rust · Python · TypeScript · JavaScript · Go · Java · C# · PHP · C · C++

Architecture

src/├── parser/       # Tree-sitter parsing & entity extraction├── graph/        # Knowledge graph, PageRank, Leiden clustering├── indexer/      # Repository indexing pipeline├── search/       # BM25 full-text + vector cosine + hybrid RRF├── embedding/    # Candle-based local embeddings (feature-gated)├── memory/       # Persistent & session memory stores├── mcp/          # MCP protocol transport + 52 tool handlers├── git/          # Git archaeology, intent classification, hotspots├── context/      # Budgeted context preparation for AI├── cypher/       # Nom-based Cypher parser → SQL CTE planner├── similarity/   # MinHash + LSH structural similarity├── semantic/     # Multi-signal scoring (tokens, directory, AST)└── cli/          # Interactive TUI installer + artifact export/import

🤝 Contributing

Contributions are welcome! The project uses standard Rust tooling:

bash
# Run testscargo test
# Lintcargo clippy -- -D warnings
# Formatcargo fmt --all

📄 License

Apache-2.0

来源:README.md,提交 41a965b

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.13最新Sep 16, 2026

评分

已满足适用检查项的 40%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

    请在仓库或注册中心条目中声明许可证。

其他 Codebase 集成