Lean Ctx
Lean Cortex -- the cognitive context layer for agentic systems. 51+ MCP tools, 10 read modes, 95+ shell patterns. Up to 99% token savings. Works with Cursor, Claude Code, Copilot, Windsurf, Codex, Gemini.
What is Lean Ctx?
Lean Ctx is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to lean cortex -- the cognitive context layer for agentic systems. 51+ mcp tools, 10 read modes, 95+ shell patterns. up to 99% token savings. works with cursor, claude code, copilot, windsurf, codex, gem...
Lean Cortex -- the cognitive context layer for agentic systems. 51+ MCP tools, 10 read modes, 95+ shell patterns. Up to 99% token savings. Works with Cursor, Claude Code, Copilot, Windsurf, Codex, Gemini.
This server falls under the Coding Agents category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- Lean Cortex -- the cognitive context layer for agentic syste
Use Cases
Maintainer
Works with
Installation
NPM
npx -y pi-lean-ctxManual Installation
npx -y pi-lean-ctxConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Lean Ctx
Lean Ctx (lean-ctx) is a Rust-powered cognitive context layer for AI coding agents that dramatically reduces token consumption when working with large codebases. It exposes 76+ MCP tools with 10 smart read modes — including map, signatures, diff, and density modes — so AI agents read only what they need instead of entire files, achieving up to 99% token savings. It works with Cursor, Claude Code, GitHub Copilot, Windsurf, Codex, Gemini CLI, and 20+ other AI tools, and includes graph-powered search, language-server refactoring, multi-agent orchestration, and shell output compression for 95+ command patterns.
Prerequisites
- Node.js (for npx installation) or Rust toolchain (for cargo install) or Homebrew on macOS/Linux
- A compatible AI coding tool: Cursor, Claude Code, GitHub Copilot, Windsurf, Codex, Gemini CLI, or another MCP-capable client
- macOS, Linux, or Windows (WSL supported) operating system
- A codebase of 50+ files for meaningful token savings (smaller projects see lower ROI)
Install lean-ctx
Choose the installation method that matches your setup. The universal installer requires no Rust toolchain. The npm package pi-lean-ctx is the name used for MCP configuration.
# Universal installer (no Rust required)
curl -fsSL https://leanctx.com/install.sh | sh
# Homebrew (macOS/Linux)
brew tap yvgude/lean-ctx && brew install lean-ctx
# npm global install
npm install -g lean-ctx-bin
# Rust/Cargo
cargo install lean-ctxRun onboarding and verify installation
Run the onboard command to let lean-ctx auto-detect your installed AI tools and configure them. Then run doctor to verify everything is working.
lean-ctx onboard
lean-ctx doctorConfigure your MCP client manually (if needed)
If onboarding does not auto-configure your client, add lean-ctx to your MCP config. The npm package name for MCP use is pi-lean-ctx.
{
"mcpServers": {
"lean-ctx": {
"command": "npx",
"args": ["-y", "pi-lean-ctx"]
}
}
}Optional: create a per-project config
Add a .lean-ctx.toml file in your project root to set project-specific overrides such as which directories to index or custom read mode defaults.
# .lean-ctx.toml
shell_activation = "agents-only"Verify token savings
After a few coding sessions, check the live savings dashboard to see how many tokens lean-ctx has saved versus a baseline agent without context optimization.
lean-ctx gain --liveLean Ctx Examples
Client configuration
Claude Desktop or Claude Code configuration using the pi-lean-ctx npm package. The -y flag ensures the package is auto-installed on first run.
{
"mcpServers": {
"lean-ctx": {
"command": "npx",
"args": ["-y", "pi-lean-ctx"]
}
}
}Prompts to try
These prompts work best when lean-ctx is active in your AI coding session, leveraging its token-efficient read modes and graph search.
- "Read src/auth.rs in map mode to give me an overview without loading the full file."
- "Search for all functions that reference the 'UserSession' type across the codebase."
- "What is the blast radius if I modify src/db/connection.rs?"
- "Rename the function 'processPayment' to 'handlePayment' using the language server refactor tool."
- "Fetch the PR context pack for the current branch so we can discuss the diff."
- "Show me token savings for this session."Troubleshooting Lean Ctx
lean-ctx doctor reports tools not detected
Run 'lean-ctx onboard' again after installing your AI tool. If your tool is not auto-detected, manually add the MCP config entry as shown above using 'npx -y pi-lean-ctx' as the command.
LEAN_CTX_NO_UPDATE_CHECK or config file not respected
The config file lives at ~/.config/lean-ctx/config.toml. Create it if it does not exist and add 'update_check_disabled = true'. Alternatively export the environment variable: 'export LEAN_CTX_NO_UPDATE_CHECK=1'.
Token savings are lower than expected on a small project
Lean-ctx's savings scale with codebase size. Projects under 50 files see limited benefit since full-file reads are already cheap. For maximum savings, enable map and signatures read modes as defaults in .lean-ctx.toml and use 'ctx_url_read' for external documentation fetches.
Frequently Asked Questions about Lean Ctx
What is Lean Ctx?
Lean Ctx is a Model Context Protocol (MCP) server that lean cortex -- the cognitive context layer for agentic systems. 51+ mcp tools, 10 read modes, 95+ shell patterns. up to 99% token savings. works with cursor, claude code, copilot, windsurf, codex, gemini. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Lean Ctx?
Install via npm with the command: npx -y pi-lean-ctx. Then add the server configuration to your AI client's JSON config file (e.g., claude_desktop_config.json or .cursor/mcp.json).
Which AI clients work with Lean Ctx?
Lean Ctx works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Lean Ctx free to use?
Yes, Lean Ctx is open source and available under the Apache-2.0 license. You can use it freely in both personal and commercial projects.
Lean Ctx Alternatives — Similar Coding Agents Servers
Looking for alternatives to Lean Ctx? Here are other popular coding agents servers you can use with Claude, Cursor, and VS Code.
Dify
★ 142.2kProduction-ready platform for agentic workflow development.
Ruflo
★ 54.0k🌊 The leading agent orchestration platform for Claude. Deploy intelligent multi-agent swarms, coordinate autonomous workflows, and build conversational AI systems. Features enterprise-grade architecture, self-learning swarm intelligence, RAG integrat
Goose
★ 45.7kan open source, extensible AI agent that goes beyond code suggestions - install, execute, edit, and test with any LLM
Antigravity Awesome Skills
★ 38.3kInstallable GitHub library of 1,400+ agentic skills for Claude Code, Cursor, Codex CLI, Gemini CLI, Antigravity, and more. Includes installer CLI, bundles, workflows, and official/community skill collections.
AgentScope
★ 25.5kBuild and run agents you can see, understand and trust.
Serena
★ 24.5kA coding agent toolkit that provides IDE-like semantic code retrieval and editing tools, enabling LLMs to efficiently navigate and modify codebases using symbol-level operations instead of basic file reading and string replacements.
Browse More Coding Agents MCP Servers
Explore all coding agents servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up Lean Ctx in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use Lean Ctx?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.