Skip to content

Summary

Builds a searchable markdown graph of your repo so coding agents stop re-exploring it on every task — reported 42% fewer tokens and 46% fewer tool calls.

Features

  • Per-symbol code graph with tree-sitter summaries and crux excerpts
  • Plain-markdown cache: regenerable, diffable, in sync with uncommitted work
  • Six MCP tools for lookup, call tracing and repo mapping
  • 23 languages; monorepo, submodule and multi-repo layouts
  • Reported 42% token savings and 46% fewer tool calls

Installation

Set up this MCP server in your favorite AI agent — copy a ready-made configuration below.

Any MCP-compatible agent

Most agents (Claude, Cursor, Windsurf, VS Code, and more) read a standard mcpServers configuration.

  1. Open your agent's MCP configuration file.
  2. Merge the snippet below into it.
  3. Restart the agent — the "Graft" tools will be available.
{
  "mcpServers": {
    "graft-context-graph": {
      "command": "npx",
      "args": [
        "-y",
        "@nanonets/graft",
        "mcp"
      ]
    }
  }
}

Description

Every task, a coding agent starts blind. It greps a term, opens a file, follows an import, backs out and tries again — paying for the same reconnaissance on every single request. Graft is an open-source context layer that does that exploration once, ahead of time, and keeps the result.

It builds a per-symbol code graph of the repository as a folder of linked markdown files: summaries, "crux" excerpts extracted with tree-sitter, and the call and import edges between them. Because the cache is plain markdown on disk, it is regenerable, diffable and readable by a human, and it stays in sync with the working tree rather than the last commit — uncommitted changes are included. Twenty-three languages are supported, among them TypeScript, Python, Go, Java and Rust, and the layout handles monorepos, submodules and multi-repo folders.

The MCP server exposes six tools — graft_find_code, graft_file_api, graft_trace_calls, graft_find_all, graft_repo_map and graft_check_freshness — so an agent can ask where something is defined, trace who calls it, or pull a map of the repository without reading the files. graft init also wires the graph directly into Claude Code and other agents, and an interactive dependency visualisation ships alongside.

The project publishes its own benchmark numbers: on SWE-bench Verified, correctness moving from 54% to 66%, with 42% token savings and 46% fewer tool calls, and up to 4× cheaper and 3× faster execution against its baseline. LLM provider support is vendor-neutral. Distributed on npm as @nanonets/graft under MIT, and actively released — the package has shipped continuously since July 2026.

Related MCP Servers

MCP: Headroom

by Headroom Labs

Featured

Context-compression MCP server that shrinks tool outputs, logs, files and RAG chunks before they reach the model, cutting 60-95% of tokens on JSON payloads.

MCP: Graphicle

by Graphicle

New

Local-first Rust MCP server that maps your repo into a code graph and project memory, then hands coding agents cited file-and-line excerpts.

MCP: agentmemory

by rohitg00

Self-hosted persistent memory for coding agents: hooks capture what you do, and an MCP server lets any agent recall it across sessions and across tools.

MCP: ripwire

by Red Hat

Featured

Red Hat's zero-dependency C++23 code-context engine — ranked call graphs and blast-radius analysis, indexing a repo in under half a second with no server and no database.

Browse all MCP servers →