llmlingua-cursor
v1.0.4
Published
One-command LLMLingua-2 prompt compression for Cursor.
Maintainers
Readme
llmlingua-cursor
One command. Zero config. LLMLingua-2 prompt compression for every Cursor project.
Installation
npm install -g llmlingua-cursorThen run the setup wizard:
llmlingua-cursorYou'll see:
How would you like to install LLMLingua-2?
[1] Global — works across ALL Cursor projects on this machine
[2] Project — works only in the current directory
Enter 1 or 2:That's it. No manual file editing. No copying paths.
What it does
llmlingua-cursor installs and configures LLMLingua-2 as a local MCP server for Cursor. Every prompt you send gets compressed before hitting the LLM — saving tokens, reducing latency, and keeping your context window lean.
Prerequisites
- Node.js 18+
- Python 3.9+ (must be on your PATH, or a venv at
~/.cursor/venv/) - Cursor editor
Setup options
Global (recommended)
Configures LLMLingua-2 for every Cursor project on your machine.
llmlingua-cursor
# → enter 1Files written:
~/.cursor/
├── mcp_llmlingua.py ← MCP server
├── mcp.json ← registers the server with Cursor
└── rules/
└── llmlingua.mdc ← Cursor rule (auto-triggers compression)Per-project
Run from inside your project directory.
cd my-project
llmlingua-cursor
# → enter 2Files written:
~/.cursor/
└── mcp_llmlingua.py ← MCP server (always here, one copy)
my-project/.cursor/
├── mcp.json ← project-scoped server config
└── rules/
└── llmlingua.mdc ← project-scoped Cursor ruleAfter setup
- Restart Cursor completely.
- Open Settings → MCP — confirm a green dot next to
llmlingua-compressor. - Use Agent mode in Cursor for best results.
Compression runs automatically on every prompt.
How compression works
| Prompt type | Compression rate | |---|---| | Default | 50% | | Explain / summarize | 45% | | Quick Q on large context | 35% | | Logs / stack traces | 40% | | Refactor / rewrite | 55% | | Very large input (>500 lines) | 30% |
Structural tokens ({}, [], def, class, import, etc.) are never dropped — code safety is preserved.
Every compressed response is watermarked:
✦ Optimised by LLMLingua 2Project structure
llmlingua-cursor/
├── bin/
│ └── cli.js ← interactive setup wizard
├── scripts/
│ └── mcp_llmlingua.py ← bundled MCP server (LLMLingua-2 via FastMCP)
├── package.json
├── README.md
└── LICENSETroubleshooting
Green dot not showing in Cursor?
- Confirm Python is installed:
python --version - Confirm deps installed:
pip install llmlingua "mcp[cli]" - Confirm
~/.cursor/mcp_llmlingua.pyexists - Fully quit and reopen Cursor
pip install failed during setup?
pip install llmlingua "mcp[cli]"Tool not triggering automatically?
Use Agent mode in Cursor. The .mdc rule instructs the model to call the tool — Agent mode honours this most reliably.
Built by
Mustafa Waqar · Powered by microsoft/llmlingua-2
✦ Optimised by LLMLingua 2
