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

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.

  • Score 94
  • 12k stars
  • MIT
  • Updated

Install Trail Code

Built from the published package, never by AI.

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

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

Step-by-step: install Trail Code 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 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 →

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.

Trail Code Install

Add to stack

Loading.