Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

Graft

MCP server by trailhq Verified · npm:@nanonets

Gives coding agents like Claude Code, Cursor and Codex a map of your code and a record of what your team has learned. It is built for developers who want agents to find the right files and avoid repeating past mistakes.

  • Score 94
  • 12k stars
  • 20k a week
  • MIT
  • Updated

Install Graft

Built from the published package, never by AI.

claude mcp add graft -- npx -y @nanonets/graft

Run in your terminal. Add --scope user to use it in every project.

Step-by-step: install Graft in Claude Code

MCP servers run with your permissions and can read what you give them access to. Some need an API key: check the README and add it under env in the graft block.

About

Trail-code gives coding agents such as Claude Code, Cursor and Codex a map of your code, called the graft map. It parses your repo with tree-sitter into files, functions and callers, with no model and no API key. The map refreshes itself when code changes, including uncommitted edits, and each prompt gets pointers to the matching files and functions.

It also keeps learnings: decisions, corrections and findings that your agent saves from your conversations, so the next session starts from them. Repo learnings are committed with the code, while personal ones stay on your machine. It is aimed at developers and teams who want agents to stop re-exploring code and repeating mistakes. It is installed with npm as @trailhq/trail-code and runs locally with no daemon or server.

Written from the project's README and checked against it.

Tools it gives your assistant

  • trail initBuilds the graft map from your repo, creates .trail/ and wires up your coding agents.
  • trail checkFlags a change that undoes a recorded team decision, quoting who decided it and why.
  • trail grepSearches the graft map for code related to a query.
  • trail mapShows an orientation view of the repo's code structure.
  • trail build --deepAdds plain-English summaries of each part of the system, using your own model provider key.
  • trail note --always-followMarks a learning that the agent should follow even when asked to go against it.

What you need

  • Node.js 22.3 or newer (20.16 also works)
  • A supported coding agent such as Claude Code, Cursor or Codex
  • A model provider API key, only for trail build --deep

Try asking

  • Check what depends on this file before you change it.
  • Run trail check on my changes and tell me if they undo a team decision.
  • Save this correction as a learning so the next session follows it.

Good to know

  • Team sharing of learnings is marked as soon in the source.
  • Summaries from trail build --deep use your own model provider key.
  • The graft map is a local cache and is kept out of git by default.

Security check

B
  • Runs a script automatically when the package is installedIn package.json: "postinstall":

Checked automatically: README.md, package.json. This looks for known risky patterns and is not a full audit. How grades work

Alternatives to Graft

All alternatives →

Compare with GitDiagram, mockserver or XcodeBuildMCP

Graft: common questions

Does Trail-code need an API key?

The graft map is built with no model, no API key and no network. Only trail build --deep uses a model provider, under your own key.

Where are learnings stored?

Repo learnings are kept in the repo's .trail/ folder and committed with the code. Personal learnings are kept in ~/.trail and are never committed or uploaded.

Do the old graft commands still work?

Yes. Every graft command still works, and the graft package runs the same code as trail.

How do I install Graft?

In Claude Code run claude mcp add graft -- npx -y @nanonets/graft. For Claude Desktop, Cursor and VS Code, paste the config shown above and restart. See the install guides.

Is Graft the official server?

Graft is published by npm:@nanonets from its verified domain in the official MCP Registry.

Is Graft free?

The code is published under the MIT licence. The service it connects to may have its own pricing.

Is Graft safe to use?

It scores 94 of 100. Grades: maintenance A, licence A, quality A. Security check: grade B (runs a script automatically when the package is installed). Review the code before you install. How grades work.

What are alternatives to Graft?

Similar MCP servers: GitDiagram, mockserver, XcodeBuildMCP, draw.io.

Does Graft work with ChatGPT?

Not directly. It runs locally, and ChatGPT only connects to remote servers with a URL. Use it in Claude Code, Claude Desktop, Cursor, VS Code or Codex.

Add to stack

Loading.