
LeanCTX MCP Server: Setup for Claude, Cursor, Codex and Other Apps
Lets Claude, Cursor or Codex read code and run commands through a local layer that trims what goes into the model.
LeanCTX is a command-line tool from a community developer. Its MCP server gives your coding assistant file, search and shell tools that cache reads and shorten output, so fewer tokens reach the model. It runs on your computer. By default the assistant sees 12 core tools, and the rest of its large tool set is reachable on request or through a tool profile. The shell tools run commands on your machine.
Good for
- Developers who hit context limits or high token bills with coding agents
- People who want cached file reads and smaller shell output in Claude Code, Cursor or Codex
- Teams who want a local record of what context was sent to the model
Works in
Tap an app to see how to set it up and any known problems.
Transport not on record
Transport not on record
Transport not on record
Transport not on record
Transport not on record
Transport not on record
Transport not on record
Transport not on record
Transport not on record
Transport not on record
Transport not on record
Transport not on record
Transport not on record
Transport not on record
Install lean-ctx MCP
Claude Code
- 1
Copy this prompt.
Add the lean-ctx MCP server to Claude Code. Run this command: lean-ctx wrap claude Then check that it loaded and tell me if I need to sign in or restart.
- 2
Paste it into Claude Code. It shows the change and asks before running it.
Requires lean-ctx installed.
Read-only mode: There is no read-only mode. The shell and patch tools can change your machine.
Install the program first with one of the README options: curl -fsSL https://leanctx.com/install.sh | sh, brew tap yvgude/lean-ctx && brew install lean-ctx, npm install -g lean-ctx-bin or cargo install lean-ctx. The README shows lean-ctx wrap for Cursor, Claude and Codex; it writes the MCP setup for you, and lean-ctx unwrap undoes it. Other configs run lean-ctx mcp and are adapted by us.
From the project README. Source.
Tools
Picks the files that matter for a task
Given a task description, picks the most relevant files and returns them with their source, sized to fit the context budget.
Try: “Find the files I need to add rate limiting.”
Files ·
ctx_composeReads files with caching and compression
Reads files in modes such as full, signatures, map, diff or line ranges, and caches them for the session. It can read several files in one call.
Try: “Read src/server.ts in signatures mode.”
Files ·
ctx_readSearches code by pattern, meaning or symbol
One search tool with regex (default), semantic, symbol and find-related actions.
Try: “Find every place that calls createUser.”
Files ·
ctx_searchFinds files by name pattern
Matches files by glob, skips what gitignore skips, and works across several roots.
Try: “List all *.test.ts files.”
Files ·
ctx_globShows a compact folder tree
Draws the folder structure of a path and shows how many files each folder holds.
Try: “Show the folder structure of src.”
Files ·
ctx_treeFinds what calls a function
Returns the call edges for one symbol, using language servers where available.
Try: “Who calls parseConfig?”
Files ·
ctx_callgraphEdits files with anchored changes
Applies edits tied to anchors from an anchored read, such as replacing a unique string or creating a file. Some editors that have their own editor do not get it by default.
Try: “Replace the timeout value in config.ts.”
Write ·
ctx_patchRuns shell commands with shorter output
Runs a command on your computer and compresses its output. It can run in the background.
Try: “Run the test suite.”
Runs code ·
ctx_shellSame as the shell tool, under another name
An alias for the shell tool for clients whose model prefers a tool called shell.
Try: “Run npm install.”
Runs code ·
shellKeeps notes on tasks, findings and decisions
Notes what you are working on, what was found and what was decided, so the next turn can pick it up.
Try: “Note that we chose Postgres over MySQL.”
Write ·
ctx_sessionBrings back output that was trimmed
Pulls back a tool result that LeanCTX shortened or stored away, found by its ID, from a list, or by searching.
Try: “Show the full output that was trimmed.”
Read ·
ctx_expandCalls any other LeanCTX tool by name
Lets the assistant call tools that are not shown by default. According to the docs, every registered tool stays callable this way, including code execution and web page reading.
Try: “Use ctx_call to run the dependency graph tool.”
Runs code ·
ctx_call
Read from the source code
Permissions
high risk · 4 things to watch · 2 advisories
High risk
It runs shell commands and edits files on your computer, and it has no read-only mode. Review commands before you approve them, and use the unwrap command to undo its setup.
What it can do
- Read your data
- Create and change things
- Delete things
- Read-only mode
Watch out for
It runs shell commands on your machine
The shell tools run any command you or the assistant ask for, and there is no read-only mode. Review commands before approving them. github.com
Hidden tools are still callable
The docs say every registered tool stays callable through the generic call tool, including code execution and web reads. Pin a smaller profile if you want a smaller surface. github.com
It edits files and rewires your agent setup
The patch tool changes files, and the wrap command writes MCP config and rules for your editor. Undo with the unwrap or uninstall commands. github.com
It saves session data locally
It keeps session memory, caches and metrics on disk. Delete them if the project is sensitive. github.com
Security advisories
2 known advisories, all fixed in a newer version.
- NAT64/6to4/Teredo IPv6 transition address bypass of ip_is_blocked SSRF guard in ctx_url_read MCP toolhigh · Fixed in 3.12.0 · GHSA-h693-v7jv-vmv9
- security: signatures prove integrity but not identity (handoff bundles, ctxpkg), and the gateway no longer redacts secrets in downstream MCP outputmedium · Fixed in 3.12.0 · GHSA-gvg8-285q-m62g
6 other advisories are about the wider lean-ctx project, not this MCP server. See them on GitHub
Technical details
| Talks to | Telemetry is described as configurable in the README. Web page reads and bridges to services such as GitHub or Jira, only through tools that are not shown by default |
|---|---|
| Sign-in and keys | No sign-in for the core tools. Optional provider bridges need their own credentials. |
Questions
Is LeanCTX official for Claude, Cursor or Codex?
No. It is a community project by yvgude, and it works alongside those apps.
How do I add it to Claude Code, Cursor or Codex?
Install the program first, then run the wrap command for your app, as shown in the install box. The wrap command writes the MCP setup for you, and an unwrap command undoes it.
Does it need an API key?
No key is needed for the core tools. The optional request proxy for Claude needs an Anthropic API key, because subscription sign-in cannot use a custom endpoint.
How many tools does it have?
The default profile shows 12, and all public tools come to 51. The docs list minimal (5), standard (15), power (all) and auto profiles, which you pick with the tools command.
Can I run it read-only?
No read-only mode is documented. The shell and patch tools can change your machine.
Does it run locally?
Yes. The MCP server runs on your computer. An optional HTTP mode and a browser dashboard also run locally.
How do I remove it?
Run the uninstall command, which has a dry-run option that shows every change first. It removes only the blocks it wrote.
Information
updated Nov 2, 2026
- Publisher
- Community
- License
- Apache-2.0
- Last commit
- Oct 31, 2026
- Open issues
- 10
Sources
Docs, issue trackers and discussions this page is built from. Issues, quotes and findings above link to their own source.
Show all 2Hide
- github.com · github.com
- github.com · github.com