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.
Install Graft
Built from the published package, never by AI.
claude mcp add graft -- npx -y @nanonets/graftRun in your terminal. Add --scope user to use it in every project.
{
"mcpServers": {
"graft": {
"args": [
"-y",
"@nanonets/graft"
],
"command": "npx"
}
}
}Settings, Developer, Edit config. Paste into claude_desktop_config.json and restart.
{
"mcpServers": {
"graft": {
"args": [
"-y",
"@nanonets/graft"
],
"command": "npx"
}
}
}Add to ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (this project).
{
"servers": {
"graft": {
"args": [
"-y",
"@nanonets/graft"
],
"command": "npx"
}
}
}Add to .vscode/mcp.json. VS Code uses "servers", not "mcpServers".
codex mcp add graft -- npx -y @nanonets/graft{
"mcpServers": {
"graft": {
"args": [
"-y",
"@nanonets/graft"
],
"command": "npx"
}
}
}Add to ~/.gemini/config/mcp_config.json (all projects) or .agents/mcp_config.json (this project).
gemini mcp add graft npx -y @nanonets/graftGemini CLI was replaced by Antigravity CLI in June 2026 and remains only for enterprise licences and paid API keys.
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 →Turns GitHub repositories into architecture diagrams, written explanations, Mermaid source and narrated explainer videos. Built for developers who want to understand a codebase, and for AI agents that need to read one.
Mocks, records, and chaos-tests HTTP(S) dependencies for development and testing. One port serves many protocols, including gRPC, WebSockets, and LLM chat APIs. Built for developers and testers who need stand-in services during tests.
Provides MCP server and CLI tools that let AI coding agents build, test and manage iOS and macOS projects with Xcode and simulators. It is aimed at developers working on Apple platform apps.
Creates editable draw.io diagrams in AI chat from Mermaid, PlantUML, CSV or draw.io XML. Built for people who want diagrams from text prompts that stay editable in draw.io.
Indexes your code, git history, tests and decisions on your machine so AI coding agents can query the index instead of re-reading files. Built for developers who want fewer files opened and clearer answers about change risk and code health.
Gives your AI assistant hosted codebase intelligence for repos indexed on repowise.dev. Use it to ask how code works, what a change may break, and which tests to run.
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.
