Trail Code
MCP server by trailhq Verified · gh:trailhq
Trail Code gives coding agents such as Claude Code, Cursor and Codex a map of your code and a record of what your team has learned about it. It suits developers who use these agents on a repository.
Install Trail Code
Built from the published package, never by AI.
claude mcp add trail-code -- npx -y @nanonets/graftRun in your terminal. Add --scope user to use it in every project.
{
"mcpServers": {
"trail-code": {
"args": [
"-y",
"@nanonets/graft"
],
"command": "npx"
}
}
}Settings, Developer, Edit config. Paste into claude_desktop_config.json and restart.
{
"mcpServers": {
"trail-code": {
"args": [
"-y",
"@nanonets/graft"
],
"command": "npx"
}
}
}Add to ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (this project).
{
"servers": {
"trail-code": {
"args": [
"-y",
"@nanonets/graft"
],
"command": "npx"
}
}
}Add to .vscode/mcp.json. VS Code uses "servers", not "mcpServers".
codex mcp add trail-code -- npx -y @nanonets/graft{
"mcpServers": {
"trail-code": {
"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 trail-code 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 trail-code block.
About
Trail Code gives coding agents such as Claude Code, Cursor and Codex a map of your code and the learnings your team has built up about it. The code map, called the graft map, is built with tree-sitter into a graph of files, functions and callers. According to the source, it refreshes when the code changes, including uncommitted edits, and needs no model, API key or network access for that step.
Learnings are saved from your conversations as you work, so the next session starts from past decisions and corrections instead of digging through the code again. Learnings about the code are committed with the repo in .trail/, while personal learnings stay in ~/.trail. The source is written for developers who use these agents on a codebase. Team-wide learnings are marked as coming soon.
Written from the project's README and checked against it.
Tools it gives your assistant
trail initBuilds the graft map, creates .trail/ and wires your coding agents to Trail Code.trail checkFlags a change that undoes a teammate's decision, quoting who decided it and why.trail note --always-followMarks a learning that your agent should not go against, even if asked.trail build --deepAdds plain-English summaries of each part of the system, using your chosen model provider.trail vizVisualizes the code map.trail init --teamSets up Trail Code for your team to commit, instead of only for your own clone.
What you need
- Node.js 22.3 or newer (20.16 also works)
- A coding agent such as Claude Code, Cursor or Codex
- An API key from your chosen model provider, only for trail build --deep
Try asking
- Find the files that handle payment retries in this repo.
- Check whether my change undoes a decision my team already made.
- Which open teammate branches change the code I just edited?
Good to know
- Team-wide learnings are listed as coming soon.
- Summaries from trail build --deep need a model provider and your own key.
- Node.js 22.3 or newer is required, according to the source.
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 Trail Code
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
Trail Code: common questions
Does Trail Code need an API key?
The source says the code map needs no model, no API key and no network. Summaries from trail build --deep use the model provider you choose, under your own key.
Where are learnings stored?
Repo learnings live in the repo's .trail/ folder and are committed with the code. Personal learnings stay in ~/.trail and are never committed or uploaded, according to the source.
Do I still need to write CLAUDE.md by hand?
The source says learnings are saved from your conversations into files you can read, so you do not have to write and update CLAUDE.md by hand.
How do I install Trail Code?
In Claude Code run claude mcp add trail-code -- npx -y @nanonets/graft. For Claude Desktop, Cursor and VS Code, paste the config shown above and restart. See the install guides.
Is Trail Code the official server?
Trail Code is published by gh:trailhq from its verified domain in the official MCP Registry.
Is Trail Code free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is Trail Code 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 Trail Code?
Similar MCP servers: GitDiagram, mockserver, XcodeBuildMCP, draw.io.
Does Trail Code 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.
