MCP Catalogs
Homelean-ctx screenshot

lean-ctx

by yvgude·1,676·Score 57

lean-ctx is an MCP server that reduces token waste in AI coding tools by 60-95% through intelligent context compression and caching.

developer-toolsai-llmproductivity
172
Forks
1
Open issues
this month
Last commit
2d ago
Indexed

Overview

lean-ctx is a local-first context runtime that functions as both an MCP server and shell hook. It compresses file reads and shell output before they reach the LLM, with cached re-reads dropping to approximately 13 tokens. The project provides 51 tools, 10 read modes, and 60+ patterns to optimize context management across multiple AI coding tools like Cursor, Claude Code, and Copilot. It features a property graph for code intelligence, session memory capabilities, and context packaging for sharing across projects.

Try asking AI

After installing, here are 5 things you can ask your AI assistant:

you:Reduce token usage in AI coding assistants while maintaining full context awareness
you:Optimize context management for large codebases and monorepos
you:Create shareable context packages for team collaboration
you:Which AI coding tools does lean-ctx support?
you:How does lean-ctx reduce token usage?

When to choose this

Choose lean-ctx if you regularly use AI coding assistants in medium-to-large repositories and want to significantly reduce token costs while maintaining full context awareness.

When NOT to choose this

Avoid lean-ctx if you primarily work with very small repositories, don't use shell commands from your AI tools, or need raw/unfiltered logs for debugging.

Tools this server exposes

12 tools extracted from the README
  • ctx_refactor

    Language-server-powered refactoring operations (rename, references, go-to-definition, find-implementations)

  • ctx_expand

    Archive full-text search over all previously archived tool outputs

  • ctx_read

    Cached + mode-aware file reads with multiple options

  • ctx_pack

    Create context packages bundling knowledge, graph, session, and gotchas

  • ctx_search

    Search across codebase with hybrid search capabilities

  • ctx_memory

    Persist and query session facts across multiple conversations

  • ctx_graph

    Query the property graph for code relationships and impact analysis

  • ctx_benchmark

    Benchmark and measure compression effectiveness by language and mode

  • ctx_inspect

    Inspect repository structure and configuration

  • ctx_export

    Export context data for external tools or sharing

  • ctx_import

    Import external context or previous sessions

  • ctx_analyze

    Analyze code patterns and provide insights

Comparable tools

ctx-mcpmemgptcontextplus

Installation

Install lean-ctx using one of these methods:

# Universal installer (no Rust needed)
curl -fsSL https://leanctx.com/install.sh | sh

# macOS / Linux via Homebrew
brew tap yvgude/lean-ctx && brew install lean-ctx

# Node.js
npm install -g lean-ctx-bin

# Rust
cargo install lean-ctx

# Pi Coding Agent
pi install npm:pi-lean-ctx

After installation, set up with:

lean-ctx setup

Then restart your shell and AI tools. For Claude Desktop, add to your config.json:

{
  "mcpServers": {
    "lean-ctx": {
      "command": "lean-ctx",
      "args": ["mcp"]
    }
  }
}

FAQ

Which AI coding tools does lean-ctx support?
lean-ctx supports over 20 AI coding tools including Cursor, Claude Code, GitHub Copilot, Windsurf, Gemini, and many others. It works with any MCP-compatible client and has specific integrations for various IDEs like VS Code, Neovim, and JetBrains.
How does lean-ctx reduce token usage?
lean-ctx reduces token usage by caching file reads with compression (down to ~13 tokens for cached re-reads), compressing shell output using 60+ patterns, and using intelligent read modes that only send relevant context based on the task.

Compare lean-ctx with

GitHub →

Last updated · Auto-generated from public README + GitHub signals.