Lean Ctx

v3.6.14Coding Agentsstable

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.

agentic-codingaiai-codingclaude-codecontext-engineering
Share:
2,062
Stars
0
Downloads
0
Weekly
0/5

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

Cognitive context layer for agentic systems
Up to 99% token savings with 51+ MCP tools
yvgude

Maintainer

LicenseApache-2.0
Languagerust
Versionv3.6.14
UpdatedMay 22, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

NPM

npx -y pi-lean-ctx

Manual Installation

npx -y pi-lean-ctx

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

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)
1

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-ctx
2

Run 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 doctor
3

Configure 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"]
    }
  }
}
4

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"
5

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

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

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.

Quick Config Preview

{ "mcpServers": { "lean-ctx": { "command": "npx", "args": ["-y", "pi-lean-ctx"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

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.

33,000+ ServersFree & Open SourceStep-by-Step Guides