← Back to directory
L

Lat MCP Server

Community
A knowledge graph for your codebase, written in markdown
GitHub source repository ↗
★ 1.9k Stars Category · Dev Tools Very popular
62FMRS · C

lat.md is a markdown-based knowledge graph for codebases, published from the Vercel Labs repository (MIT license, npm package lat.md). It splits domain knowledge into interconnected markdown files under lat.md/, binding docs to code with [[wiki links]], source-symbol links, and // @lat: backlink comments, with lat check enforcing consistency. The CLI also offers lat search for semantic search, lat expand for expanding refs, and lat mcp to start an MCP server for editor integration. Semantic search is offline by default (a bundled all-MiniLM-L6-v2 WASM model) and can optionally use hosted embeddings via OpenAI or Vercel AI Gateway keys. The README provides no MCP server manifest, tool list, or client config example, so this profile contains no concrete tool names or install config. Overall it suits teams using coding agents that are willing to maintain domain knowledge in markdown; it offers limited value where adding source annotations is undesirable or agents are not used.

Reliability
10/20
Security and permissions
12/20
Maintenance
14/20
Documentation
15/20
Setup experience
11/20
Read the FMRS scoring method →

lat.md is a markdown-based knowledge graph for your codebase. It keeps a set of interconnected markdown files in a lat.md/ directory at the project root, describing architecture, business logic, and test specs: sections link to each other with [[wiki links]], docs link into the codebase ([[src/auth.ts#validateToken]]), source files link back with // @lat: [[section-id]] comments (# @lat: [[section-id]] in Python), and lat check ensures nothing drifts out of sync. It addresses the fact that a single flat AGENTS.md does not scale: key design decisions get buried and agents hallucinate context they should be able to look up. The CLI provides lat init, lat check, lat locate, lat section, lat refs, lat search, and lat expand; lat mcp starts an MCP server for editor integration. Semantic search works offline by default using a bundled local all-MiniLM-L6-v2 embedding model compiled to WebAssembly (no native binaries, no network), and can optionally use hosted embeddings via an OpenAI or Vercel AI Gateway key.

Setup

  1. Install globally: npm install -g lat.md
  2. Run lat init in the repository where you want to use lat; this sets up popular coding agents with hooks and instructions and scaffolds a lat.md/ directory.
  3. Write markdown files in lat.md/ describing architecture, business logic, test specs, and anything else that matters.
  4. Link between sections with [[file#Section#Subsection]] syntax and link to source symbols with [[src/auth.ts#validateToken]].
  5. Annotate source code with // @lat: [[section-id]] comments (or # @lat: [[section-id]] in Python) to tie implementation back to concepts.
  6. Run lat check to validate graph and documentation consistency.
  7. Run lat mcp to start the MCP server for editor integration.

Development requires Node.js 22, pnpm, and Rust installed through rustup; build with pnpm install, pnpm buildall, pnpm test.

Fit and risk

Best for

  • Teams and individual developers who want a maintainable knowledge graph for their codebase
  • Users of coding agents who want them to work from stable, searchable context
  • Projects that treat markdown as the documentation medium and want docs and source to stay in sync
  • Environments that need offline semantic search (the default local WASM embedding model)

Not for

  • Small projects that only need a single flat AGENTS.md file (limited benefit from a knowledge graph)
  • Teams that do not use coding agents and do not plan to maintain markdown domain docs
  • Users expecting an out-of-the-box hosted service or a cloud multi-user documentation platform
  • Projects unwilling to add // @lat: annotations to source code

Required permissions

  • Read/write access to the project repository (lat init creates the lat.md/ directory and configures coding agents' hooks and instructions)
  • Read access to API keys when hosted embeddings are configured: the LAT_LLM_KEY environment variable, a file named by LAT_LLM_KEY_FILE, or a shell command named by LAT_LLM_KEY_HELPER
  • Write access to local index and config (lat reindex and lat config involve local caches and a config file)

Risks and side effects

  • If hosted embeddings are used with an API key (OpenAI or Vercel AI Gateway), relevant text may be sent to an external service; the default local model makes no network requests
  • LAT_LLM_KEY_HELPER executes a shell command to print the key; if that variable is set from an untrusted source it poses a command execution risk
  • A key file with weak permissions could be read by other local processes
  • A knowledge graph that is not kept up to date with lat check can drift from the actual code and mislead agents
  • lat init modifies coding agents' hooks and instructions, which may affect existing workflows

Troubleshooting

  1. lat check fails: it indicates inconsistent references or specs missing a // @lat: backlink; add the links or comments as indicated
  2. Semantic search results are poor: try rebuilding the index with lat reindex; use --remote for hosted embeddings or --local to force the offline model
  3. Key is not found: check the resolution order of LAT_LLM_KEY, LAT_LLM_KEY_FILE, and LAT_LLM_KEY_HELPER, or run lat config to print the config file location
  4. Build or run failures: confirm Node.js 22, that pnpm is installed, and that Rust is installed through rustup with the matching WASM target
  5. lat mcp is not usable in the editor: confirm the command is started at the project root and that the client config points to this MCP server
  6. Cannot find a section: use lat locate for exact or fuzzy name search, then lat section to view the section with its links and refs

Use cases

Let agents search the knowledge graph to discover key design decisions, constraints, and domain context quickly instead of grepping through the codebase
Start code review from the semantic changes in lat.md/ to understand what changed and why
Capture the context and reasoning behind a prompt into the graph as agents work, so future sessions start with full context
Describe test cases as sections in lat.md/ marked require-code-mention: true and have lat check flag specs without a // @lat: backlink
Build pre-commit hooks, GitHub bots, and CI tasks that improve the knowledge graph in the background
Use lat search for semantic search and lat expand to expand [[refs]] in a prompt for agents