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 · 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.

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

Install Trail Code

Built from the published package, never by AI.

claude mcp add trail-code -- npx -y @trailhq/trail-code

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 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 →

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.

Trail Code Install

Add to stack

Loading.