code-intel
MCP server for persistent code exploration and diff-aware review, exposing explore and review tools to map call paths, blast radius, and generate explainable risk-scored reports.
README
code-deep
Upgrading from code-intel: install
@team-harness/code-deep, then runcode-deep install --target codex,claude. The installer replaces the old MCP server configuration and permissions. Restart the host after installation so its active MCP process uses code-deep.The legacy command
npm install -g @team-harness/code-intelremains supported: it installs the matching@team-harness/code-deeprelease and exposes only thecode-deepexecutable.
code-deep gives coding agents two focused workflows: understand code before
changing it, then review the resulting diff. It keeps one CodeGraph MCP
connection alive for the lifetime of the outer MCP server and exposes a
deliberately small interface:
explore: find relevant source, trace callers and callees, follow data flow, and understand blast radius without reading the repository broadly.review: diff parsing, changed-symbol mapping, impact collection, explainable risk scoring, and a structured report.
The npm package is @team-harness/code-deep. It installs CodeGraph as an exact dependency; end users do not need a separate global CodeGraph installation.
code-deep and its bundled CodeGraph dependency have independent versions.
CODE_DEEP_VERSION identifies this wrapper release; CODEGRAPH_VERSION
identifies the exact @colbymchenry/codegraph version it runs. This allows the
bridge and reviewer to ship fixes without waiting for a new upstream release.
Install
npm install -g @team-harness/code-deep
code-deep install --target codex,claude
install registers the code-deep MCP server globally for the selected agents.
It also adds a marker-delimited guidance block to Codex ~/.codex/AGENTS.md
and Claude ~/.claude/CLAUDE.md, directing both agents to use explore for
code discovery and review before finalizing changes. Claude receives the
mcp__code-deep__* permission in ~/.claude/settings.json.
The generated MCP configuration invokes the global code-deep command. Run
code-deep install again after upgrading from code-intel so existing agent
configuration, permissions, and instructions migrate to the new identity.
The installer preserves unrelated configuration, backs up each changed existing
file as <file>.code-deep.bak, and is idempotent. It does not initialize a
repository during installation. The first explore or review call in a Git
repository automatically initializes a missing .codegraph/ at that repository
or worktree root. Concurrent first calls in one process share the same
initialization. Existing indexes are left to CodeGraph's connect-time catch-up
and file watcher; use code-deep init only for an explicit refresh or to
diagnose initialization failure.
MCP configuration
{
"mcpServers": {
"code-deep": {
"command": "code-deep",
"args": ["mcp", "--path", "/absolute/path/to/project"]
}
}
}
The agent sees only explore and review. Both leave source files unchanged,
but may create .codegraph/ on first use, so their MCP annotations do not claim
strict read-only behavior. Internally, the review module also uses CodeGraph's
node and impact tools; they are not exposed on the outer MCP surface.
Agent behavior
When the code-deep MCP tools are available, agents must call them directly and
must not probe the shell CLI first. Shell commands are fallback-only. User-facing
messages refer to the capability, server, and tools as code-deep; CodeGraph is
the internal backend name, not a separate tool to switch to.
Explore code
Ask a task-oriented question before reading or editing broadly:
code-deep explore \
"Trace how AuthService login creates and validates sessions, including callers and blast radius" \
--path /path/to/project
explore returns a focused set of relevant source, symbol relationships, call
paths, and downstream impact. A useful query names the task, the symbols or
files already known, and the relationship to trace, such as callers, callees,
data flow, or blast radius.
Agents should prefer the MCP tool. When shell fallback is necessary and a global
code-deep command is not visible in the current process's PATH, run the same
command through npx -y @team-harness/code-deep@2.0.0.
Use --max-files <count> to control the amount of source returned. The MCP
explore tool accepts the same query, project path, and file limit, so agents
can refine an investigation with targeted follow-up questions while reusing the
same persistent CodeGraph connection.
Review modes
Review the current working tree, including staged, unstaged, and untracked files:
code-deep review /path/to/project
Review a branch or pull-request range:
code-deep review /path/to/project --base origin/main --head HEAD
Get the structured report:
code-deep review /path/to/project --json
The MCP review tool accepts the same base and head, or a caller-supplied
unified diff. These modes are mutually exclusive, and head always requires
base. With no diff or range it reviews the target project's current working tree.
It defaults to detailLevel: "minimal", returning the risk summary, signals,
compact changed-line ranges, and the top three review items without embedding
the diff or graph context. reviewItemsOmitted makes any response-only
truncation explicit. Use detailLevel: "standard" when the complete
bounded diff, impact compatibility view, and graph context are needed.
Process diagnostics
Inspect the local code-deep wrappers, CodeGraph proxies, shared project daemons, and watchdogs without changing any process or file:
code-deep ps
code-deep ps --json
The JSON report has schemaVersion: 1 and records each process's role, status,
project, parent PID, uptime, supporting evidence, and whether strong evidence
makes it a future cleanup candidate. A long-running process is never classified
as an orphan based on age alone. This release does not terminate processes or
remove stale metadata.
Architecture
Agent / MCP host
|
| stdio MCP: explore, review
v
code-deep (long-lived process)
|
+-- CodeGraphBridge ---- persistent MCP client ---- CodeGraph MCP
| +-- explore ---- focused source / call paths / blast radius
|
+-- ReviewAnalyzer
+-- structured unified-diff parser
+-- hunk -> current symbol mapping
+-- node / impact / explore queries
+-- deterministic risk scorer
+-- Markdown + structured JSON report
The bridge ensures the requested Git repository or worktree index, lazily starts CodeGraph on the first tool call, reuses that connection for later calls, and reconnects once if the child exits during a tool request. CodeGraph may additionally share its own per-project daemon across MCP clients.
Review semantics
Risk scores are deterministic and explainable. Signals currently cover sensitive paths, missing test-file changes, graph impact width, high-confidence cross-boundary impact, diff size, file count, deleted files, and incomplete graph analysis. Overall risk is the higher of the global signal total and the highest per-symbol risk, so a locally high-risk symbol cannot be hidden by a low aggregate score. Global signals always use metadata from the complete diff; maxFiles and maxSymbols limit only deep graph and patch analysis. Scores prioritize review effort; they are not claims that a bug exists.
Cross-boundary scoring requires a confidently parsed impact and a non-low-confidence symbol mapping. Boundaries are conservatively recognized at workspace roots such as apps/, packages/, services/, modules/, and libs/, or by the first domain below src/. The current backend does not expose structured critical-flow evidence, so code-deep does not infer critical-flow from display text.
Every core report has schemaVersion: 1 and a risk-ordered reviewItems array. Each
report also exposes ignoredPaths for tool-generated files excluded from an implicit
working-tree review; caller-supplied diffs and Git ranges leave it empty. Each
item represents one changed symbol and includes normalized impact symbols,
related test files, mapping and impact confidence, parser warnings, and the exact
reasons contributing to its per-symbol risk score. CLI JSON and library reports
retain the complete structure; MCP responses use schemaVersion: 2, expose the
selected detailLevel and reviewItemsOmitted, and use compact changed-line ranges.
const report = await codeDeep.review();
for (const item of report.reviewItems) {
console.log(item.risk.level, item.symbol.name, item.tests.status);
}
The internal graph adapter keeps CodeGraph's original text in each impact result
for diagnostics, but downstream consumers no longer need to parse that display
format themselves. Unknown or changed backend formats produce explicit
low-confidence warnings instead of silently appearing as an empty graph result.
The default Markdown report includes these warnings and raises an
graph-analysis-incomplete signal so a failed lookup cannot appear as a clean,
low-risk review.
Changed hunks are mapped to the nearest preceding symbol in the current CodeGraph index. Deleted files and symbols can be absent from that index, so deletion findings are explicitly treated as uncertain. A future base-revision index can remove that limitation.
Library use
import { CodeDeepClient } from '@team-harness/code-deep';
const codeDeep = new CodeDeepClient({ projectPath: process.cwd() });
try {
const context = await codeDeep.explore('AuthService login');
const report = await codeDeep.review();
} finally {
await codeDeep.close();
}
CodeDeepClient is the public library boundary. Its explore() and review()
methods share one persistent CodeGraph connection; the bridge and analyzer are
internal implementation details. Automatic initialization is enabled by default;
library consumers that manage indexes separately can pass autoInit: false.
Development
npm install
npm run typecheck
npm test
npm run build
Upstream
This project is powered by @colbymchenry/codegraph, licensed under MIT. code-deep is an independent Team Harness integration and is not an official CodeGraph package.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。