Open source
work / gitnexus
GITNEXUS
MCP server that gives Claude a graph view of any codebase — symbols, callers, callees, execution flows, impact analysis. Used by Claude Code on this very project.
1 · The problem
Cold-loading a 100,000-line codebase into an LLM context window is lossy and slow. The model reads the same files repeatedly, can't see who calls what, and loses track of execution flows. Embeddings help search but don't capture call graphs. What's needed is a queryable structural index — a graph — that an LLM can interrogate with cheap targeted queries instead of dumping raw text.
2 · The architecture
┌──────────────────────────────────┐
│ Tree-sitter parsers │
│ (Python, JS, MQL5, Go, …) │
└──────────────┬───────────────────┘
│ AST + symbols + relationships
▼
┌──────────────────────────────────┐
│ SQLite graph index │
│ symbols · relations · processes │
└──────────────┬───────────────────┘
│
▼
┌──────────────────────────────────┐
│ MCP tools (exposed to AI) │
│ impact · context · query │
│ rename · detect_changes │
└──────────────┬───────────────────┘
│
▼
┌──────────────────────────────────┐
│ Claude Code · Cursor · agents │
└──────────────────────────────────┘
- Tree-sitter parses every supported language into a typed AST; symbol + relationship extractors run per language.
- SQLite graph schema:
symbols(functions / classes / methods),relationships(calls / inherits / imports / references),processes(named execution flows). - MCP tools:
impactreturns blast radius before edits,contextreturns full symbol context,queryruns concept search across execution flows,renameunderstands the call graph. - Real usage today: indexed NBA Playoff Terminal (1,315 symbols / 4,198 relationships), StoneDesk infra, 7tics_intelligence, this very site.
3 · The code
Impact analysis — blast-radius query
// gitnexus_impact({target: "symbolName", direction: "upstream"})
// returns direct callers + affected processes + risk score
function impact(target, direction = 'upstream') {
const symbol = db.symbols.find(name = target);
if (!symbol) return { error: 'not found' };
const edges = db.relationships.where({
[direction === 'upstream' ? 'to' : 'from']: symbol.id,
type: 'calls',
});
const processes = db.processes.touchedBy(symbol.id);
return {
target: symbol.name,
direct: edges.map(e => db.symbols.byId(e.from)),
processes: processes,
risk: classifyRisk(edges.length, processes.length),
};
}
MCP tool registration
// MCP server boilerplate — Claude / Cursor connect to this
server.tool('gitnexus_impact', {
description: 'Run impact analysis on a symbol before editing it',
inputSchema: {
target: z.string(),
direction: z.enum(['upstream', 'downstream']).default('upstream'),
},
}, async ({ target, direction }) => {
const result = impact(target, direction);
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
});
Process discovery — named execution flows
// 'processes' are walks across the call graph that share a name
// e.g. "trade entry flow" = run_entry_signal → check_filters → submit_order → write_journal
// SQL: graph walk from entry symbol, breadth-first, capped at depth 6
WITH RECURSIVE flow(symbol_id, depth) AS (
SELECT id, 0 FROM symbols WHERE name = ?
UNION ALL
SELECT r.to_symbol_id, flow.depth + 1
FROM flow JOIN relationships r ON r.from_symbol_id = flow.symbol_id
WHERE flow.depth < 6 AND r.type IN ('calls', 'invokes')
)
SELECT DISTINCT symbols.* FROM flow JOIN symbols ON symbols.id = flow.symbol_id;
4 · The outcome
Real codebases indexed
2,325 symbols (7tics)
3,051 relationships
46 execution flows
Open source MCP
- Claude Code on this project enforces "run impact analysis before editing any symbol" — backed by GitNexus.
- Saves token cost vs cold-loading source: queries are cheap targeted reads, not 100k-line dumps.
- Catches downstream breakage in PRs by surfacing impact before edits land.
→ Source: github.com/svennm/gitnexus