Lain Mcp
Description
## What is LAIN-mcp? LAIN-mcp is a Rust MCP server that gives AI coding agents real architectural awareness of your codebase — not just line-by-line search, but system-wide understanding. Built to solve a real problem: navigating large codebases with AI agents burns token…
About
## What is LAIN-mcp? LAIN-mcp is a Rust MCP server that gives AI coding agents real architectural awareness of your codebase — not just line-by-line search, but system-wide understanding. Built to solve a real problem: navigating large codebases with AI agents burns token budgets fast. LAIN-mcp fixes that by…
Details
- Author
- spuentesp
- Downloads
- 115
- Categories
- AI, Knowledge Base, Developer Tools, Other
Jump to
- Blast radius analysis to know what breaks before changes
- Persistent, queryable knowledge graph of every symbol
- Co-change detection from git history analysis
- Local semantic search with ONNX embeddings, no data leaving your machine
- Sub-millisecond graph queries built in Rust with petgraph
- 21 MCP tools for architecture, search, impact, and health
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
Lain McpCommand (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
Install the server and configure it with your MCP client. Invoke any of its 21 MCP tools covering architecture, search, impact analysis, and health monitoring. No API keys or cloud setup are required.
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"lain mcp": {
"lain": {
"command": "/path/to/lain/target/release/lain",
"args": [
"--workspace",
"/path/to/your/project",
"--transport",
"stdio"
]
}
}
}
}
McpServers
{
"lain": {
"command": "/path/to/lain/target/release/lain",
"args": [
"--workspace",
"/path/to/your/project",
"--transport",
"stdio"
]
}
}
LAIN builds a map of how all the code in your project connects — what calls what, what depends on what, which files tend to change together. Then it lets your AI coding assistant ask questions about that map. So instead of the AI just looking at one file and guessing, it can ask "if I change this function, what else breaks?" and get a real answer. It plugs into any AI agent that supports MCP and runs in the background while you work.
# Install (interactive — will add lain to PATH) curl -fsSL https://raw.githubusercontent.com/spuentesp/lain/main/install.sh | bash # Or non-interactive curl -fsSL https://raw.githubusercontent.com/spuentesp/lain/main/install.sh | \ bash /dev/stdin --yes # Configure your project mkdir -p ~/projects/biller && cd ~/projects/biller lain repos add auth-svc https://github.com/acme/auth-svc.git lain repos add billing-svc https://github.com/acme/billing-svc.git lain workspaces create biller-core --members auth-svc,billing-svc # Run the server lain server --config ./repos.yaml --transport http --port 9999 # Open http://localhost:9999 — that's the Command Center.
Lain is a persistent code-intelligence MCP server. The headline islain server: a long-running process that reads arepos.yamlconfig, indexes every registered repository (locally, by clone, or by shallow fetch), and answers structural questions across them through MCP tools. The server also serves a Command Center dashboard atGET /for humans who want to inspect the federation, edit the config, run queries, and exercise the MCP tool surface directly.
The value over LSP-only or RAG-based approaches is cross-file structural reasoning: blast radius for proposed changes, transitive dependency traces, anchor identification, co-change correlation, and contextual build failure decoration so agents can reason about callers rather than just the failing line. Written in Rust, persists across sessions, stays fresh during editing via a file watcher that updates a volatile overlay layered on top of the static graph, and hot-reloads itsrepos.yaml/workspaces.yamlconfig without a restart.
After install,lainexposes exactly five subcommands:
The cut surface (init,agents,hook,projects, top-leveluse) is gone — those concerns are reached through the five commands above.serverplus the two config CLIs (workspaces,repos) cover everything the prior surface did, scoped to a single project directory that owns arepos.yaml.
curl -fsSL https://raw.githubusercontent.com/spuentesp/lain/main/install.sh | bash
The installer downloads thelainbinary to~/.local/lain. After that, configure your agent's MCP config to launchlain server --config ./repos.yaml --transport stdio— seeWire your agent.
# Skip all prompts curl -fsSL https://raw.githubusercontent.com/spuentesp/lain/main/install.sh | \ bash /dev/stdin --yes # Download ONNX model for semantic search (all-MiniLM-L6-v2, ~120MB) curl -fsSL https://raw.githubusercontent.com/spuentesp/lain/main/install.sh | \ bash /dev/stdin --download-model --yes
# Reload your shell (the installer adds to ~/.zshrc or ~/.bashrc) source ~/.zshrc # or ~/.bashrc # Verify lain --version # Show the five commands lain --help
brew tap spuentesp/lain https://github.com/spuentesp/lain brew install lain # Run the server for your project lain server --config ./repos.yaml
git clone https://github.com/spuentesp/lain.git cd lain cargo build --release # requires Rust 1.75+ # Binary at ./target/release/lain
curl -fsSL https://raw.githubusercontent.com/spuentesp/lain/main/install.sh | bash
A project is a directory containingrepos.yaml(and optionallyworkspaces.yaml).
mkdir -p ~/projects/biller && cd ~/projects/biller lain repos add auth-svc https://github.com/acme/auth-svc.git lain repos add billing-svc https://github.com/acme/billing-svc.git lain workspaces create biller-core --members auth-svc,billing-svc
lain server --config ./repos.yaml --transport http --port 9999 # Open http://localhost:9999 in your browser for the Command Center.
Add the following to your agent's MCP config (URL/format depends on the agent).The single-repo form is the recommended default— it walks up from the working directory for.git, norepos.yamlneeded:
{ "mcpServers": { "lain": { "command": "lain", "args": ["mcp"] } } }
If you want the federation tool surface (list_repos,search_org,get_cross_repo_blast_radius) too, point at arepos.yamlinstead:
{ "mcpServers": { "lain": { "command": "lain", "args": ["server", "--config", "./repos.yaml", "--transport", "stdio"] } } }
That's it. The next time your agent starts, it sees the workspace (single-repo form) or the federation, the active workspace, and the full MCP tool surface.
Whenlain serverruns with--transport http, it serves the Command Center dashboard atGET /. It's a self-contained vanilla-JS SPA that talks back to the running server over the same JSON-RPC endpoint the MCP tools use. No separate API, no auth portal.
- Overview—get_health+get_federation_healthin one view.
- Graph— D3 force-directed graph of the active workspace.
- Repos— per-repo table (id, path, health, node/edge counts).
- Query— runsquery_graphagainst the federation.
- Tools— auto-generated MCP tool tester. Callstools/list, then renders a form per tool by introspecting itsinputSchema.Copy as cURLcopies acurl -X POST http://localhost:9999/mcp ...snippet to the clipboard.
The status bar in the footer polls every 2 s forget_server_statusandget_reload_statusso hand-edits torepos.yaml/workspaces.yamlshow up live.
Seedocs/command-center.mdfor the full walkthrough.
lain serverwatchesrepos.yamlandworkspaces.yamland rebuilds its federation state when they change — no restart needed. Both thenotifywatcher (for hand-edits) and the CLI (vialain repos addorlain workspaces create) trigger the sameReloadBus.
When you runlain repos add my-repo …, the CLI writes the YAML atomically (write to temp file, thenrename), then signals the running server over a Unix socket at~/.local/lain/run/<repos-stem>.sock. The server's rebuild task diffs the new file against the live federation and applies add / remove operations againstFederatedIndex.get_reload_statusreports the state (idle/rebuilding/failed); the Command Center status bar shows it live.
Seedocs/hot-reload.mdfor the full picture (internals, observability, failure modes, caveats).
Aprojectis a directory containingrepos.yaml(and optionallyworkspaces.yaml). Each project has its own server: change to the project directory and runlain server --config ./repos.yaml, or keep multiple servers running on different ports. The Command Center shows recently-used projects in the sidebar with aCopy restart cmdbutton that copies the rightlain server --config <path> --workspace <name>line to the clipboard.
Workspaces are scoped to a single project. Pick one withlain workspaces use <name>; the active name is written to~/.config/lain/active_workspaceand is honored at server start via--workspace auto.
For org-wide structural questions — "who else uses this function?", "what depends on this service?" — runlain server --config ./repos.yaml. Federation mode exposes six MCP tools (list_repos,get_repo_info,get_federation_health,search_org,get_cross_repo_blast_radius,get_cross_repo_blast_radius_for_repo) that answer questions spanning repos. Seedocs/FEDERATION.mdfor the full guide anddocs/REPOS_YAML.mdfor the config schema.
- Federation mode— index N repos and answer org-wide structural questions across them.
- Command Center— vanilla-JS SPA atGET /for human inspection, config editing, query running, and MCP tool testing.
- Hot reload—repos.yaml/workspaces.yamlchanges apply without restarting the server.
JSON-based ops array for flexible graph traversals:
{ "ops": [ { "op": "find", "type": "Function" }, { "op": "connect", "edge": "Calls", "depth": { "min": 1, "max": 3 } }, { "op": "filter", "label": "test" }, { "op": "semantic_filter", "like": "error handling", "threshold": 0.35 }, { "op": "limit", "count": 10 } ] }
Available ops:find,connect,filter,semantic_filter,group,sort,limit.
- get_call_chain— Shortest path between two functions.
- get_blast_radius— Everything affected by a change.
- trace_dependency— What a symbol depends on.
- get_coupling_radar— Files that change together.
- find_anchors— Most-called, most-stable symbols (architectural pillars).
- list_entry_points— Findmain(), route handlers, app initialization.
- get_context_depth— How far from an entry point (abstraction layers).
- explore_architecture— High-level tree of modules and files.
- semantic_search— Find code by meaning, not just names. Uses local ONNX embeddings with hybrid scoring (cosine similarity + stemmed token-overlap) and shows body excerpts in the response. BGE-small-en-v1.5 is the recommended model (better than MiniLM for technical corpora); use a query prefix to enable BGE-style asymmetric retrieval.
- find_dead_code— Potentially unreachable code (filters trait defaults, common names).
- suggest_refactor_targets— High-coupling, low-stability nodes.
A project is a directory containingrepos.yaml(and optionallyworkspaces.yaml). Manage it directly with the CLI:
- lain repos add <name> <url>— register a repo inrepos.yaml.
- lain repos list— show registered repos.
- lain repos remove <name>— unregister a repo.
- lain workspaces create <name> --members a,b,c— declare a named workspace.
- lain workspaces list— show all workspaces.
- lain workspaces use <name>— activate a workspace (writes~/.config/lain/active_workspace).
- lain workspaces current— print the active workspace.
- lain workspaces forget <name>— remove a workspace.
Forsemantic_searchto work, you need an ONNX embedding model. The easiest setup uses the provided install script with--download-model. Otherwise, drop a model into.lain/models/:
mkdir -p .lain/models # Option A: bge-small-en-v1.5 (recommended — better MTEB scores, 384d, ~120MB) curl -L https://huggingface.co/BAAI/bge-small-en-v1.5/resolve/main/onnx/model.onnx \ -o .lain/models/model.onnx curl -L https://huggingface.co/BAAI/bge-small-en-v1.5/resolve/main/tokenizer.json \ -o .lain/models/tokenizer.json # Option B: all-MiniLM-L6-v2 (smaller, 384d, ~80MB) curl -L https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2/resolve/main/onnx/model.onnx \ -o .lain/models/model.onnx curl -L https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2/resolve/main/tokenizer.json \ -o .lain/models/tokenizer.json
Export the model path so the server picks it up:
export LAIN_EMBEDDING_MODEL=$PWD/.lain/models/model.onnx
For BGE-style asymmetric retrieval (better for short queries), set the query prefix in.lain/tuning.toml:
query_prefix = "Represent this sentence for searching relevant passages: "
Without the model,semantic_searchreturns "unavailable" but all other features work.
The HTTP transport is no longer combined with stdio in a singlebothmode — start twolain serverprocesses (or use the HTTP transport and exercise tools viacurlagainst/mcp).
The hot-reload watcher is non-recursive and uses atomic rename. Editing the file in place (vim repos.yaml) triggers a notify event within ~1 s. If you've moved the file across directories, save it back into the same directory.
Repo stuck inindexing/degraded/unavailable/missing?
# Check federation health curl -s -X POST http://localhost:9999/mcp \ -H 'Content-Type: application/json' \ -d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"get_federation_health","arguments":{}},"id":1}'
The Command Center's Overview tab shows the same numbers in a single view.
curl -s -X POST http://localhost:9999/mcp \ -H 'Content-Type: application/json' \ -d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"request_reload","arguments":{}},"id":1}'
curl -s -X POST http://localhost:9999/mcp \ -H 'Content-Type: application/json' \ -d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"get_agent_strategy","arguments":{}},"id":1}'
Highly efficient context management for agentic AI: MCP code search, evidence packs, graph context, and memory for large projects.
Local code-knowledge graph + bi-temporal mistakes memory for AI coding agents. Serves a ranked structural packet instead of whole files on read/grep, and surfaces fixes your repo already reverted (mined from git history). Zero cloud, Apache-2.0.
Provides local repo-intelligence by indexing source, symbols, call graphs, Git/GitHub history, and source-bound repo memories into a local database for coding agents.
Graph-based long-term memory skill for AI (LLM) coding agents — faster context, fewer tokens, safer refactors
Memtrace gives AI coding agents structural memory — your codebase as a live knowledge graph so agents stop re-deriving code structure from scratch and start reasoning from fact.
Adaptive MCP memory system for AI applications. Learns which retrieval strategies work for your data, scores results using cognitive science models, builds a knowledge graph automatically, and validates every parameter change against real query history before adopting it. Patent pending.
Agents Remember is a Drift-aware repository memory for coding agents in complex codebases. Captures what code can't say on its own! Retrieves memory by path, semantic search, and relationship (code-graph).
Self-hosted Rust-based MCP server for AI agent memory — persistent, queryable memory with hybrid search, knowledge graphs, built-in embeddings, and 14 core tools (expandable to 86+ with profile-based tiering).
Search, traverse and edit a Filamental knowledge graph from any MCP-compatible AI client. Local-first, no cloud, no auth required.
Authenticated MCP and agent gateway for Forge Cascade private AI memory, provenance, graph search, and capsule lineage.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





