Lain logo

Lain

Indexes code relationships and exposes callers, dependencies, call chains, symbols, and co-change data through MCP.

Install Lain

Run the project’s own setup commands, in order.

Setup steps from the project

lain installs with its own steps rather than a config we can generate, so these are copied as-is. Follow them in order and run the commands in a terminal. Source: github.com

  1. 1. Install
    curl -fsSL https://raw.githubusercontent.com/spuentesp/lain/main/install.sh | bash
    
  2. 2. Install
    npm install -g @spuentesp/lain-mcp
    
  3. 3. Install
    npm install -g --prefix ~/.local/lain-npm @spuentesp/lain-mcp
    
  4. 4. Add to your MCP client
    lain setup --agent claude-code
    
  5. 5. Add to your MCP client
    lain setup --agent codex
    
  6. 6. Add to your MCP client
    lain setup --agent cursor
    

Overview

lain is an MCP server that builds a local code graph for coding agents, including callers, dependencies, symbols, and Git co-change relationships. Agents can query the graph over stdio to assess change impact, trace call chains, find symbols, and search code by name or meaning. It supports multiple repositories and optional semantic search, while graph queries work without an embedding model. Reach for lain when an agent needs repository context before editing code, especially across unfamiliar or interconnected codebases.

Use cases

  • Assess the blast radius before changing a function
  • Trace a call chain from an entry point to a helper
  • Search symbols and code across multiple repositories
  • Check whether another agent claims files before editing

Key features

  • On-disk code graph for callers, dependencies, and symbols
  • Git co-change analysis
  • Call-chain and blast-radius queries
  • Optional semantic search
  • Multi-repository and cross-repository queries
  • Agent presence, intents, and advisory file claims

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

14/14 checks healthy over the last 84d

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars9Stargazers on the source repository.
Last commit3d agoMost recent push to the default branch.
Directory activity1 viewsConfig copies, upvotes, and views on AllMCPs.

How Lain works

What lain does

lain indexes source repositories into an on-disk graph that records symbols, definitions, callers, dependencies, call paths, and Git co-change patterns. An MCP-connected coding agent can use that graph to investigate a proposed edit before changing code. Typical questions include which callers may be affected, how an entry point reaches a helper, and which files commonly change alongside another file.

The index can cover one repository or a configured workspace containing multiple repositories. Cross-repository queries support organization-wide search and blast-radius analysis. Lain also tracks agent presence, intents, and advisory file claims so agents can identify overlapping work before editing the same area.

Built-in parsers cover Rust, Python, TypeScript, JavaScript, Go, Java, C, C++, C#, Ruby, Swift, Kotlin, Scala, PHP, and script blocks in Vue and Svelte components. Optional language servers can add precision.

How it works

Lain walks upward from the agent's working directory to locate a Git repository, builds .lain/graph.bin, and serves the repository through MCP over stdio. The graph persists between runs and follows committed changes. After new work is committed, run lain reindex or start a fresh session to update it.

Static analysis cannot resolve every dynamic call through message buses, dependency injection, or reflection. For dispatch analysis, explain_dispatch combines static callers with convention matches, runtime traces, and Git co-change evidence. When the available evidence is insufficient, the result reports that condition rather than treating an empty result as proof that an edit is safe.

Semantic search is optional. Name-based and graph queries remain available without an embedding model.

Setup and configuration

Install with the release installer or the npm package @spuentesp/lain-mcp. Source builds require Rust 1.89 or newer. When npm install scripts are disabled, the first invocation downloads and verifies the platform binary, so that initial run requires network access.

From the repository to index, run lain setup --agent with a supported client such as claude-code, codex, cursor, vscode, or continue. Use generic for another MCP host. Setup writes the selected client's configuration, uses the absolute path to the binary, and verifies the MCP handshake. Restart the agent afterward.

Language-server installation is optional. Specify languages with --lsp python,go, install all detected missing servers with --lsp detected, or disable them with --lsp none. For multiple repositories, add repositories and create a workspace, then run the server with a configuration file. HTTP mode listens on localhost by default; network exposure requires LAIN_BIND_ADDR and LAIN_API_KEYS.

Tools and capabilities

  • get_blast_radius and assess_change inspect likely effects of changing a symbol.
  • get_call_chain traces the relationship between functions.
  • find_anchors and list_entry_points help locate architectural entry points.
  • find_symbol searches symbols, while search_code supports name or semantic search.
  • get_cross_repo_blast_radius and search_org query across repositories.
  • explain_dispatch combines static and additional evidence for indirect dispatch.
  • Intents, presence, and advisory claims expose overlapping agent activity.

The same operations can be exercised from a terminal; for example, lain oneshot get_blast_radius <symbol> runs a blast-radius query without asking an agent.

Limitations and notes

Results are based on indexed committed code and can lag behind recent commits until reindexing. Dynamic dispatch may remain unresolved even with supplemental evidence. The graph is local and persisted on disk, and the default HTTP server is restricted to localhost. Exposing it beyond localhost requires API keys as well as a bind-address setting.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Lain

lain is an MCP server that connects coding agents to a local graph of indexed Git repositories. Its main tools inspect blast radius, trace call chains, find symbols, search code, analyze indirect dispatch, and query relationships across repositories, helping agents understand code dependencies before making edits.

Install lain with the release installer or `npm install -g @spuentesp/lain-mcp`. Then run `lain setup --agent <client>` from the repository you want to index, restart the agent, and let lain build its on-disk graph. Source builds require Rust 1.89 or newer.

Yes, lain supports Cursor through `lain setup --agent cursor`. The setup command writes Cursor's MCP configuration using the absolute path to the lain binary, verifies the MCP handshake, and requires an agent restart before use.

No, an embedding model is not required for graph queries or name-based symbol searches. Semantic search is optional, so tools such as blast-radius, call-chain, and dependency queries work without one.

Run `lain reindex` or start a fresh session after committing changes. Lain indexes committed code, keeps the graph on disk, and can otherwise return answers that do not include recent work.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewLain AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/lain?style=directory)](https://allmcps.com/mcp/lain)
HTML Embed
<a href="https://allmcps.com/mcp/lain"><img src="https://allmcps.com/api/badge/lain?style=directory" alt="Lain on AllMCPs" /></a>