Sandbox
@kuberstar/qartez-mcp

MCP server for codebase intelligence in Claude Code

Qartez builds a pre-computed graph of your repository and serves it to MCP clients. It exposes tools for finding symbols, mapping dependencies, measuring blast radius, spotting hotspots, and blocking edits until the agent checks impact first.

73 stars5 forksRustUpdated 1mo ago
Who it's for

Builders who want their coding agent to search, inspect, and edit a codebase with less guesswork.

What it delivers

You can ask your agent for the right files, the likely breakage, and the safest refactor path without re-reading the whole repo.

What it does

Project maps and symbol search

`qartez_map`, `qartez_find`, `qartez_grep`, `qartez_outline`, and `qartez_read` return the important files, symbols, and source ranges directly from the index.

Impact and dependency analysis

`qartez_impact`, `qartez_deps`, `qartez_refs`, `qartez_calls`, `qartez_cochange`, and `qartez_diff_impact` show what a change affects and which files move together.

Refactor and safety tools

`qartez_rename`, `qartez_move`, `qartez_replace_symbol`, `qartez_safe_delete`, and `qartez_guard` help agents change code with fewer blind edits.

Quality and risk analysis

`qartez_hotspots`, `qartez_smells`, `qartez_security`, `qartez_test_gaps`, `qartez_trend`, and `qartez_health` surface risky code, missing tests, and security issues.

MCP setup and workflow prompts

`qartez-setup` configures supported editors and agents, and `/qartez_review`, `/qartez_architecture`, and related prompts bundle common workflows.

How to get it

  1. 1macOS / Linux / WSL 2 - bash installer, binaries land in ~/.local/bin/
    curl -sSfL https://qartez.dev/install | sh
  2. 2Windows (native PowerShell 5.1+/7+) - PowerShell installer, binaries land in…
    powershell -ExecutionPolicy Bypass -c "iwr https://raw.githubusercontent.com/kuberstar/qartez-mcp/main/install.ps1 -useb | iex"
  3. 3Open any project in your IDE - Qartez indexes it automatically on session start. No…
    git clone https://github.com/kuberstar/qartez-mcp.git
    cd qartez-mcp
    make deploy
  4. 4A single Rust binary (qartez-setup) detects and configures every supported editor. No…
    make deploy                          # Configure every detected IDE (non-interactive)
    make setup                           # Same, but interactive checkbox prompt
    qartez-setup --ide cursor,zed       # Configure specific IDEs only
    make uninstall                       # Remove qartez from every IDE and delete binaries
  5. 5Run
    qartez-setup --ide cursor,zed,claude
  6. 6Qartez indexes automatically on session start. For manual re-indexing
    qartez --root /path/to/your/project --reindex

README

Qartez

Qartez MCP

X-ray vision for your codebase - built for AI agents, not humans.

The first code-intelligence server designed from day one to be
consumed by language models, not read by people. Cuts AI token usage by ~94%.

Quickstart · 43 Tools · Guard · Benchmarks · Comparison · 37 Languages · CLI · Contributing · Security · Changelog

License MSRV 1.88 37 languages 43 MCP tools


Why this exists

grep, find, cat, and ls were invented in the 1970s for humans reading one file at a time in a terminal. Half a century later, your AI assistant is still using them - scanning files byte by byte, re-reading the same directories on every question, guessing at what matters, and burning your tokens on work the tools were never designed to do.

Qartez is a different species of tooling. It is not a wrapper around grep. It is a pre-computed knowledge graph of your repository - symbols, imports, call edges, blast radii, PageRank, git co-change, cyclomatic complexity - served to any LLM through the Model Context Protocol. The agent stops reading your codebase and starts querying it.

Think of it as the first purpose-built sensory organ for coding agents. Grep sees one line at a time. Qartez sees the entire shape of the codebase in one glance.

Every time your AI assistant touches code, three expensive things happen:

1. It reads the same files over and over. No memory of the repo. Every question starts from scratch. You pay for every token - again and again.

2. It can't see what will break. Your assistant edits utils.ts without knowing 14 other files import it. You find out in CI. Or in production.

3. It wastes tokens finding things. "Where is handleRequest defined?" turns into Grep across 200 files, Read on 5 candidates, and 1,600 tokens burned before it finds the answer. Qartez answers that in 50 tokens.

The fix isn't a smarter model. It's a smarter index.


Quickstart

Platform support: macOS 13+, Ubuntu 22.04+ (and other modern Linux, gnu or musl), Windows (native PowerShell 5.1+/7+) and WSL 2. Architectures: x86_64 and arm64. Rust MSRV is 1.88 - only needed for unsupported platforms or the --from-source escape hatch.

Install (recommended)

Pick the one-liner for your operating system. Both commands do the same thing: download a pre-built binary, verify its SHA-256 against the release's SHA256SUMS, install the three binaries (qartez, qartez-guard, qartez-setup), and launch qartez-setup in non-interactive mode to configure every MCP-capable IDE it detects (including the modification-guard hooks for Claude Code).

macOS / Linux / WSL 2 - bash installer, binaries land in ~/.local/bin/:

curl -sSfL https://qartez.dev/install | sh

Windows (native PowerShell 5.1+/7+) - PowerShell installer, binaries land in %LOCALAPPDATA%\Programs\qartez\:

powershell -ExecutionPolicy Bypass -c "iwr https://raw.githubusercontent.com/kuberstar/qartez-mcp/main/install.ps1 -useb | iex"

Unsupported platforms (e.g. linux-musl arm64 without a published artifact) fall back to a local cargo build automatically; pass --from-source (bash) or -FromSource (PowerShell) to force that path. Rust MSRV 1.88 is only required for that fallback.

Open any project in your IDE - Qartez indexes it automatically on session start. No manual step needed. The file watcher keeps the index fresh as you edit.

Alternative: install from source (all platforms)
git clone https://github.com/kuberstar/qartez-mcp.git
cd qartez-mcp
make deploy

Want to inspect the install script before piping it into sh? Read it on GitHub: install.sh (bash) or install.ps1 (PowerShell).

Interactive install, targeted install, and other options

Works with 19 editors and agents

A single Rust binary (qartez-setup) detects and configures every supported editor. No per-editor shell scripts, no copy-paste JSON.

make deploy                          # Configure every detected IDE (non-interactive)
make setup                           # Same, but interactive checkbox prompt
qartez-setup --ide cursor,zed       # Configure specific IDEs only
make uninstall                       # Remove qartez from every IDE and delete binaries

Supported out of the box: Claude Code, Claude Desktop, Gemini, Cursor, Windsurf, Kiro, Zed, Continue.dev, Copilot CLI, Amazon Q, Amp, Cline, Roo Code, Goose, Warp, Augment, OpenCode, Codex CLI, Antigravity.

Targeted install

qartez-setup --ide cursor,zed,claude

Configure a specific subset of IDEs only. Detected paths:

IDEConfig path
Claude Code~/.claude/settings.json
Claude Desktop~/Library/Application Support/Claude/claude_desktop_config.json
Gemini~/.gemini/settings.json
Cursor~/.cursor/mcp.json
Windsurf~/.codeium/windsurf/mcp_config.json
Kiro~/.kiro/settings/mcp.json
Zed~/.config/zed/settings.json
Continue.dev~/.continue/config.yaml
Copilot CLI~/.copilot/mcp-config.json
Amazon Q~/.aws/amazonq/mcp.json
Amp~/.config/amp/settings.json
ClineVS Code global storage saoudrizwan.claude-dev/settings/cline_mcp_settings.json
Roo CodeVS Code global storage rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json
Goose~/.config/goose/config.yaml
Warp~/.warp/mcp_settings.json
Augment~/.augment/settings.json
OpenCode~/.config/opencode/opencode.json (or opencode.jsonc)
Codex CLI~/.codex/config.toml
Antigravity~/.gemini/antigravity/mcp_config.json

Every install path is idempotent and backs up the existing config.

Enable Qartez in a project

Qartez indexes automatically on session start. For manual re-indexing:

qartez --root /path/to/your/project --reindex

Claude Desktop (manual)

{
  "mcpServers": {
    "qartez": {
      "command": "/absolute/path/to/qartez",
      "args": []
    }
  }
}

Uninstall

make uninstall

Removes Qartez from every configured IDE and deletes the binaries.


What Qartez does

Qartez builds a knowledge graph of your codebase - once - and serves it to any AI assistant through MCP. Instead of scanning files from scratch on every question, your assistant queries a pre-computed index that knows:

  • Which files matter most (PageRank on the import graph)
  • What breaks if you change a file (blast radius analysis)
  • Which files always change together (git co-change mining)
  • Which functions are the most dangerous to touch (cyclomatic complexity x coupling x churn)
  • Where every symbol is defined, who uses it, and who calls it
  • Which blocks of code are duplicated (structural AST shape hashing)
  • Which architecture boundaries the imports are violating
  • What types implement a trait/interface, and vice versa

The result: your AI works faster, uses fewer tokens, refactors safely, and stops making blind changes to load-bearing files.

Before and after

TaskWithout QartezWith Qartez
"Where is QartezServer defined?"Grep 200 files, Read candidates. 1,490 tokens.qartez_find. 52 tokens.
"What breaks if I change storage/read.rs?"BFS grep from imports, depth 2. 9,243 tokens.qartez_impact: direct + transitive importers + co-change. 352 tokens.
"Outline src/server/mod.rs (96 symbols)"Read full 300KB file. 77,843 tokens.qartez_outline with signatures. 3,009 tokens.
"Find all dead exports"Impossible without tooling.qartez_unused: pre-materialized, instant. 468 tokens.
"Which functions are the riskiest to refactor?"Nothing to query.qartez_hotspots: complexity x PageRank x churn.

The 43 tools

Think of these as the standard library for AI code understanding. Each one replaces a multi-step human workflow with a single, token-efficient call the agent can reason about.

Tools are organized into tiers with progressive disclosure. Core tools are always available. Additional tiers can be unlocked on demand via qartez_tools enable: ["analysis"] (or "all").

Core (always available)

ToolWhat it does
qartez_mapStart here. Project skeleton ranked by importance. PageRank, exports, blast radii. Boost by files or terms to focus on what you're working on.
qartez_findJump to a symbol definition by exact name. File, line range, signature, visibility. No scanning.
qartez_grepFTS5 search across indexed symbols. Prefix matching, regex fallback, optional body search.
qartez_readRead one or more symbols' source code with line numbers. No file scanning. Jumps directly to the symbol.
qartez_outlineTable of contents for any file: every symbol grouped by kind, with signatures.
qartez_impactCall before editing any important file. Shows direct importers, transitive dependents, and co-change partners. Everything that could break.
qartez_depsDependency graph for a file: what it imports, what imports it.
qartez_statsCodebase dashboard: files, symbols, edges by language, most-connected files.

Analysis (unlock via qartez_tools)

ToolWhat it does
qartez_refsTrace every usage of a symbol across the codebase, with optional transitive chains.
qartez_callsCall hierarchy: who calls this function, and what does it call.
qartez_cochangeFiles that historically change together in git. Logical coupling invisible to the import graph.
qartez_contextSmart context builder: given files you plan to modify, returns the optimal set of related files to read first.
qartez_unusedDead-code finder: exported symbols with zero importers, pre-materialized at index time.
qartez_diff_impactBatch impact for a git diff range. Pass a revspec like main..HEAD to get changed files with PageRank, union blast radius, convergence points, and co-change omissions. One call replaces N calls to qartez_impact + qartez_cochange.
qartez_hotspotsThe refactor radar. Ranks files and functions by hotspot score = cyclomatic complexity x PageRank x (1 + churn). Points straight at the highest-risk code in the repo.
qartez_clonesStructural code-clone detection via AST shape hashing (identifiers, literals, and comments are normalized away). Finds duplicate logic the human reviewer would never spot.
qartez_boundariesArchitecture-boundary enforcement. Declare "these modules may not import those" in .qartez/boundaries.toml and get every violating edge back. suggest=true seeds a starter config from the Leiden clustering.
qartez_hierarchyType hierarchy queries: find all types implementing a trait/interface, or all traits/interfaces a type implements. Works across Rust, TypeScript, Java, Python, and Go.
qartez_trendComplexity trend over git history: tracks how a function's cyclomatic complexity evolved commit by commit. Flags functions that are GROWING, STABLE, or SHRINKING.
qartez_securitySecurity scanner with 13 built-in rules. Regex-based pattern matching scored by PageRank to prioritize high-impact files. Custom rules via .qartez/security.toml. Filters by severity (low/medium/high/critical) and category.
qartez_smellsCode smell detector: finds god functions (high complexity + long body), long parameter lists, and feature envy (methods that use another type more than their own). Tuneable thresholds.
qartez_healthPrioritized fix list. Cross-references qartez_hotspots with qartez_smells and buckets files as Critical (hotspot + smell), High (hotspot only), or Medium (smell only). Each entry carries a concrete suggested refactor technique.
qartez_refactor_planOrdered, safety-annotated refactor plan for one file. Each step names a technique (Extract Method, Introduce Parameter Object), an estimated CC impact category (High/Medium/Low) with a range, and safety signals from impact, test coverage, and caller count.
qartez_test_gapsTest coverage gap analysis via the import graph. Three modes: gaps ranks untested source files by risk, map shows test-to-source mappings, suggest recommends tests to run for a git diff range.
qartez_knowledgeBus-factor analysis. Git-blame-based authorship at file and module level. Surfaces single-author files and modules where knowledge is concentrated in one contributor.
qartez_blameSymbol-scoped git blame. Resolves a function/type name to its line range and blames only those lines: per-hunk commits/authors, or a per-author rollup with each author's latest commit.
qartez_semanticSemantic search using a local embedding model. Natural-language queries ranked by hybrid FTS5 + vector similarity (RRF). Requires the semantic cargo feature and a one-time model download (~270 MB).
qartez_pathShortest call/reference path between two symbols. Forward BFS over the symbol-reference graph returns the ordered symbol/file chain plus a count of alternative shortest paths. Filter edges by kind (call or type).

Refactor (unlock via qartez_tools)

ToolWhat it does
qartez_renameRename a symbol across the entire codebase. Definition, imports, all usages. Preview by default, apply=true to execute.
qartez_moveMove a symbol to another file and rewrite all import paths. One MCP call.
qartez_rename_fileRename a file and update every import pointing to it.
qartez_replace_symbolReplace a symbol's whole line range with new source. Caller provides the full replacement including the signature; preview by default, apply=true executes atomically.
qartez_insert_before_symbolSplice new code immediately before an anchor symbol. Anchor lookup goes through the indexed symbol table - no need for the exact surrounding context.
qartez_insert_after_symbolSplice new code immediately after an anchor symbol. Same anchor-based addressing as qartez_insert_before_symbol.
qartez_safe_deleteDelete a symbol after reporting every file that still imports it. Refuses to apply when importers exist unless force=true.

Meta (unlock via qartez_tools)

ToolWhat it does
qartez_projectAuto-detects your toolchain (Cargo, npm/bun/yarn, Go, Python, Make, Gradle) and runs test/build/lint/typecheck through a single tool.
qartez_wikiGenerates a markdown architecture wiki using Leiden community detection on the import graph. Partitions files into clusters, names each one, and emits ARCHITECTURE.md with inter-cluster edges.
qartez_workspaceAdd or remove workspace domains at runtime. Registers external directories under a custom alias in .qartez/workspace.toml, indexes them, and purges them on removal.
qartez_add_rootRegister an additional project root at runtime. Indexes the directory, refreshes pagerank/co-change, and hot-attaches a file watcher; the alias is optional (derived from the path basename) and persistence is toggleable for ephemeral roots.
qartez_list_rootsList every project root currently tracked by the server with its alias, source (cli/config/runtime), watcher attachment state, file count, and last index timestamp.
qartez_maintenanceInspect and compact .qartez/index.db. Default action stats reports DB / WAL sizes, top tables, current workspace fingerprint, and last full-reindex timestamp. Other actions: checkpoint, optimize_fts (merge FTS5 segments), vacuum_incremental, vacuum, convert_incremental (one-shot conversion to auto_vacuum=INCREMENTAL), purge_stale (drop rows for roots no longer in the workspace). Use this on a bloated DB instead of deleting .qartez/index.db by hand.

Tier management

ToolWhat it does
qartez_toolsAlways visible. Lists all tiers and their tools. Use enable: ["analysis"], enable: ["all"], or disable: ["refactor"] to control which tools are exposed to the agent. Core tools cannot be disabled.

Workflow prompts

Six ready-to-use recipes that chain the tools above in the right order. Invoke them as slash commands in Claude Code or any MCP client that supports prompts.

PromptWhat it does
/qartez_review <file>Code review: blast radius, outline, references, co-change - then a focused checklist.
/qartez_architecture [top_n]One-minute architecture overview grounded in PageRank data.
/qartez_debug <symbol>Definition + callers + callees + references in one shot.
/qartez_onboard [area]Five-file reading list for new contributors, ranked by importance.
/qartez_pre_merge <files>Pre-merge safety check with a ship/hold recommendation.
/qartez_arch_review [focus]Architecture risk audit: fragile hubs, tangled boundaries, security surface, complexity debt.

Modification guard

Qartez ships a safety net that prevents your AI from blindly editing load-bearing files.

The qartez-guard binary hooks into Claude Code's PreToolUse system and blocks Edit/Write/MultiEdit on any file that exceeds a PageRank or blast-radius threshold - until the AI calls qartez_impact first to acknowledge the risk.

How it works:

  1. AI tries to edit src/server/mod.rs
  2. Guard checks: PageRank 0.23 (> 0.05 threshold), blast radius 10 (>= 10 threshold)
  3. Edit is blocked with an explanation listing which thresholds fired
  4. AI calls qartez_impact file_path=src/server/mod.rs - reviews the blast radius
  5. Guard grants a 10-minute edit window for that file
  6. AI retries the edit - allowed

Zero configuration. Tuneable via QARTEZ_GUARD_PAGERANK_MIN, QARTEZ_GUARD_BLAST_MIN, QARTEZ_GUARD_ACK_TTL_SECS, or disabled with QARTEZ_GUARD_DISABLE=1.


Benchmarks

Not claims. Measured. Reproducible. Run make bench and verify yourself.

Headline

Aggregate token savings vs Glob + Grep + Read + git log: +91.8% (sum of MCP 38,789 / sum of non-MCP 472,109 tokens across all 28 scenarios on the Qartez self-bench. Conservative under-count: 10 of 28 scenarios have an incomplete non-MCP sim - those rows still contribute their MCP tokens to both sums. On the 18 scenarios with a fair token-to-token comparison the saving rises to +94.5%.)

LLM-judge quality (claude-opus-4-6): MCP 8.3 / 10 vs non-MCP 4.3 / 10 across five axes (correctness, completeness, usability, groundedness, conciseness), n=28.

Session cost context. A typical Claude Code session starts at ~20,000 tokens of prompt overhead. A single make bench run saves ~433,000 tokens - ~21 empty sessions worth of budget bought back, just from routing questions through the right tool.

Per-tool breakdown (Rust self-bench)

18 tools with complete non-MCP simulations (fair token-to-token comparison):

ToolMCP tokensWithout MCPSavingsSpeedup
qartez_cochange9214,622+99.4%2x
qartez_context1074,489+97.6%533x
qartez_find521,490+96.5%210x
qartez_impact3529,243+96.2%140x
qartez_outline3,00977,843+96.1%5x
qartez_project681,394+95.1%0x
qartez_unused4686,750+93.1%22x
qartez_deps1662,286+92.7%118x
qartez_map87674+87.1%1x
qartez_rename_file27185+85.4%211x
qartez_grep127763+83.4%72x
qartez_stats155848+81.7%1x
qartez_move161701+77.0%159x
qartez_calls5642,409+76.6%3x
qartez_refs201692+71.0%26x
qartez_read150495+69.7%100x
qartez_hierarchy7352,056+64.3%127x
qartez_rename439648+32.3%11x

10 additional analytical tools have no meaningful grep/read equivalent - they solve problems the non-MCP stack cannot solve at all:

qartez_hotspots, qartez_clones, qartez_smells, qartez_test_gaps, qartez_wiki, qartez_boundaries, qartez_trend, qartez_knowledge, qartez_diff_impact, qartez_security.

Multi-language bench

make bench-all runs the same 28-scenario harness against five pinned OSS fixtures - colinhacks/zod (TypeScript), spf13/cobra (Go), encode/httpx (Python), FasterXML/jackson-core (Java), plus the Qartez self-bench (Rust) - then emits a cross-language summary to reports/benchmark-<lang>.md plus a combined matrix. Every tool, every language, every scenario - measured with the cl100k_base tokenizer against a faithful Glob + Grep + Read + git log simulation.

make bench          # Rust self-bench only - fresh measurements
make bench-all      # All 5 languages (Rust, TypeScript, Python, Go, Java) + cross-language summary
make bench-fixtures # Clone and index the pinned fixture repos

Reports land in reports/benchmark.md / reports/benchmark.json for the single-language run, or reports/benchmark-<lang>.md plus a combined cross-language summary for bench-all.


How it works under the hood

Four layers, computed once, queried from SQLite on every tool call.

1. Tree-sitter parsing

Every source file is parsed by a language-specific tree-sitter grammar. No LSP server, no per-language SDK installs, no cold-start penalty. The parser extracts symbols (functions, methods, types, constants), their signatures, line ranges, export visibility, import relationships, and - for 21 imperative languages - cyclomatic complexity per function.

2. Structural shape hashing

Function bodies are canonicalized into an AST skeleton (identifiers, literals, and comments normalized away) and hashed. Two symbols with the same hash are structural clones. That's what qartez_clones queries.

3. Graph analysis

Import edges form a directed graph. Three algorithms run on top:

  • PageRank - the same random-walk algorithm Google used for web pages. Applied to your import graph, it surfaces the files that form the architectural backbone of your project.
  • Blast radius - reverse BFS that counts how many files are transitively affected by a change. qartez_impact uses this to warn before edits.
  • Leiden clustering - community detection that partitions your codebase into logical modules for the auto-generated architecture wiki and the qartez_boundaries starter config.

4. Git history mining

Walks the last N commits (default 300) and counts file pairs that appear in the same commit. This reveals logical coupling

Files in the repo

Repository payload29 top-level entries
  • .cargo
  • .github
  • benchmarks
  • docs
  • fuzz
  • qartez-dashboard
  • reports
  • scripts
  • src
  • tests
  • .gitattributes
  • .gitignore
  • Cargo.lock
  • Cargo.toml
  • CHANGELOG.md
  • CLA.md
  • CODE_OF_CONDUCT.md
  • COMMERCIAL.md
  • CONTRIBUTING.md
  • deny.toml
  • install.ps1
  • install.sh
  • LICENSE
  • logo.png
  • Makefile
  • osv-scanner.toml
  • README.md
  • rust-toolchain.toml
  • SECURITY.md

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More connectors

High-performance code intelligence MCP server. Indexes codebases into a persistent knowledge graph — average repo in milliseconds. 158 languages, sub-ms queries, 99% fewer tokens. Single static binary, zero dependencies.

43k

Universal provider proxy for OpenAI Codex & Claude Code — use any LLM (Claude, Gemini, Grok, DeepSeek, Ollama…) with Codex CLI, App, SDK, and Claude Code

14k
okf-memory/
okf-agent-memory

Git-native persistent memory for AI coding agents. Implements Google OKF v0.2 with sub-300µs in-memory BM25 search, embedded MCP server, and progressive disclosure. Slashes token bloat by 80% with zero external databases or dependencies. Built in pure Go.

547
tirth8205/
code-review-graph

Local-first code intelligence graph for MCP and CLI. Builds a persistent map of your codebase so AI coding tools read only what matters, with benchmarked context reductions on reviews and large-repo workflows.

31k
2akouwu/
reverify

Stop your AI from making things up — it proposes, deterministic tools decide, every claim checked against ground truth with evidence. Grounded facts and context survive resets. Reverse engineering is the proving ground. MCP server + CLI.

1.1k
t8y2/dbxConnectors

20 MB lightweight cross-platform database client for 90+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 90+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP Server。

19k