Trail Code
MCP server by trailhq Verified · npm:@trailhq
Trail Code gives coding agents a map of your code and the learnings your team has built up about it. It runs on your machine and is built for teams using Claude Code, Cursor, Codex and other coding agents. It was formerly called graft.
Install Trail Code
Built from the published package, never by AI.
claude mcp add trail-code -- npx -y @trailhq/trail-codeRun in your terminal. Add --scope user to use it in every project.
{
"mcpServers": {
"trail-code": {
"args": [
"-y",
"@trailhq/trail-code"
],
"command": "npx"
}
}
}Settings, Developer, Edit config. Paste into claude_desktop_config.json and restart.
{
"mcpServers": {
"trail-code": {
"args": [
"-y",
"@trailhq/trail-code"
],
"command": "npx"
}
}
}Add to ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (this project).
{
"servers": {
"trail-code": {
"args": [
"-y",
"@trailhq/trail-code"
],
"command": "npx"
}
}
}Add to .vscode/mcp.json. VS Code uses "servers", not "mcpServers".
codex mcp add trail-code -- npx -y @trailhq/trail-code{
"mcpServers": {
"trail-code": {
"args": [
"-y",
"@trailhq/trail-code"
],
"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 @trailhq/trail-codeGemini 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 is a context layer for coding agents such as Claude Code, Cursor and Codex. Its graft map parses your repo with tree-sitter into a map of every file, function and caller. The source says this needs no model, no API key and no network. The map refreshes when code changes, including uncommitted edits, and gives the agent pointers to matching files with each prompt.
The second part is learnings. These are notes on what you, your agents and your team have decided or learned, saved from your conversations as you work. Repo learnings are committed with the code, and personal learnings stay on your machine. The source marks the team place as coming soon. It is aimed at developers and teams who want agents to start from past work instead of re-exploring the same code.
Written from the project's README and checked 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
Try asking
- Find the files and functions related to this bug in my repo
- Show what depends on the file I just edited before I commit
- Check whether my change undoes a decision my team already made
Good to know
- The team learnings place is marked as coming soon in the source
- Summaries from trail build --deep use the model provider you choose, under your own key
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
What you can do with it
- Give coding agents a map of a codebase
- Share team learnings across coding sessions
- Avoid undoing decisions a teammate already made
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 send my code anywhere?
The source says the graft map is built without a model and without a network connection. It also says learnings about you stay on your machine, while learnings about the code are committed with the code.
Is graft still supported?
Yes. The source says every graft command still works and the old @nanonets/graft package still works. Trail Code runs the same code as the trail command.
Do I need an API key to use it?
The source says the graft map needs no model and no API key. Plain-English summaries added with trail build --deep use the model provider you choose, under your own key.
How do I install Trail Code?
In Claude Code run claude mcp add trail-code -- npx -y @trailhq/trail-code. 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 npm:@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.
