Make your AI coding agent cost-efficient. Budget enforcement for Cursor, Claude Code, Openclaw, & any MCP compatible client.
Project description
l6e-mcp
l6e makes your AI coding agent cost-efficient.
Set a budget per task. Your agent checkpoints before expensive operations, gets halt signals when it's spending too much, and stops when it's done — not when it runs out of money. Import your billing data and l6e learns your actual cost patterns, so estimates get tighter over time.
No proxy. No SDK changes. Just an MCP server that works with Cursor, Claude Code, and Windsurf.
Dogfooding: docs.l6e.ai is built and maintained using l6e itself.
Quick start
1. Install
pip install l6e-mcp
# or, zero-install:
uvx l6e-mcp
2. Add to your MCP config
Cursor (.cursor/mcp.json):
{
"mcpServers": {
"l6e": {
"command": "uvx",
"args": ["l6e-mcp"]
}
}
}
See docs.l6e.ai/setup for Claude Code and Windsurf configs.
3. Add the enforcement rule
Copy the l6e budget enforcement rule to .cursor/rules/ so your agent knows how to use the budget tools.
That's it — start a session, set a budget, and your agent is cost-aware.
4. (Optional) Connect to the dashboard
Create a free account at app.l6e.ai for session history, spend tracking, and billing import for calibration:
{
"mcpServers": {
"l6e": {
"command": "uvx",
"args": ["l6e-mcp"],
"env": {
"L6E_API_KEY": "sk-l6e-...",
"L6E_CLOUD_SYNC": "1"
}
}
}
}
How it works
l6e sits as an MCP server between your IDE and your agent. At each checkpoint, the agent calls l6e_authorize_call — l6e checks the remaining budget and returns allow or halt.
- allow — proceed; check
budget_pressureto decide how aggressively to economize - halt — budget exhausted, stop the session
Session state is persisted locally in SQLite (~/.l6e/sessions.db). No LLM calls are proxied — l6e only sees the metadata your agent passes at each checkpoint (token estimates, model, stage label). It never sees your prompts, completions, or source code.
Calibration
Out of the box, l6e uses raw token estimates from LiteLLM pricing. These are directionally accurate but can diverge significantly from what your provider actually bills, depending on your model and usage patterns.
Import your billing CSV from Cursor or your LLM provider at app.l6e.ai and l6e computes a personal calibration factor for each model you use. The more sessions you run, the tighter the estimates get.
For manual calibration without cloud sync, add a [calibration] section to ~/.l6e/config.toml:
[calibration]
claude-4-opus = 72.0
claude-4-sonnet = 45.0
claude-3.5-haiku = 12.0
Free vs Pro
| Free | Pro ($15/mo) | |
|---|---|---|
| Budget enforcement | ✓ | ✓ |
| Local session storage | ✓ | ✓ |
| Cloud sync + dashboard | ✓ (90-day history) | ✓ (unlimited) |
| Billing import | ✓ (5/month) | ✓ (unlimited) |
| Per-model calibration | ✓ | ✓ |
| Community baseline factors | ✓ | ✓ |
MCP tools
| Tool | Purpose |
|---|---|
l6e_run_start |
Open a new budget session. Returns session_id. |
l6e_authorize_call |
Gate before sub-agents and stage transitions. Returns allow or halt. Pass check_only=True for a lightweight budget pressure check. |
l6e_record_usage |
Attach exact token counts to a call (optional, improves accuracy). |
l6e_run_end |
Close the session and flush the run log. |
Full tool reference at docs.l6e.ai/tools.
Environment variables
| Variable | Default | Purpose |
|---|---|---|
L6E_API_KEY |
(unset) | API key for cloud sync |
L6E_CLOUD_SYNC |
false |
Set to 1 to enable cloud sync |
L6E_CLOUD_ENDPOINT |
https://api.l6e.ai |
Override the cloud sync endpoint |
L6E_LOG_PATH |
.l6e/runs.jsonl |
Run log path — set to an absolute path |
L6E_SESSION_DB_PATH |
~/.l6e/sessions.db |
Local SQLite database path |
L6E_CONFIG_PATH |
~/.l6e/config.toml |
Config file path |
Known limitations
- Estimate-first by default. Exact accounting requires
l6e_record_usagecalls with actual token counts after each LLM call. Without them, budgets are based on the agent's pre-call estimates. - Local persistence by default. Sessions persist in a local SQLite database. Cloud sync is available with a free account at app.l6e.ai — set
L6E_API_KEYandL6E_CLOUD_SYNC=1to enable.
Links
- docs.l6e.ai — setup guides, tool reference, calibration walkthrough
- app.l6e.ai — dashboard, run history, billing import
- l6e core library — embed budget enforcement in Python agent pipelines
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file l6e_mcp-0.6.2.tar.gz.
File metadata
- Download URL: l6e_mcp-0.6.2.tar.gz
- Upload date:
- Size: 54.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0679fb69998475a4f7484868fbaa36d1084fc55e3d09115d842ae14de226b5dd
|
|
| MD5 |
a3c76d87f044f447a34857f4f3e7db17
|
|
| BLAKE2b-256 |
00168078fec6e2a0153944fab6ec4775379195c61306e73920eaa3c4d67b6427
|
Provenance
The following attestation bundles were made for l6e_mcp-0.6.2.tar.gz:
Publisher:
publish-l6e-mcp.yml on l6e-ai/l6e-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
l6e_mcp-0.6.2.tar.gz -
Subject digest:
0679fb69998475a4f7484868fbaa36d1084fc55e3d09115d842ae14de226b5dd - Sigstore transparency entry: 1188969949
- Sigstore integration time:
-
Permalink:
l6e-ai/l6e-mcp@90eb91679e0ea695d2424eae1d2ca738afb70053 -
Branch / Tag:
refs/tags/v0.6.2 - Owner: https://github.com/l6e-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-l6e-mcp.yml@90eb91679e0ea695d2424eae1d2ca738afb70053 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file l6e_mcp-0.6.2-py3-none-any.whl.
File metadata
- Download URL: l6e_mcp-0.6.2-py3-none-any.whl
- Upload date:
- Size: 43.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c0e6741bbbe2f8a30ffaedc43519a279543c01847bbcb871e14efa6e0d38830
|
|
| MD5 |
c680b4f113d9496d2907d11b5002d204
|
|
| BLAKE2b-256 |
77780409559375f23c46dd68ca7170c19fdf8bd5a3ec5e2c7e6cfa22d508dedb
|
Provenance
The following attestation bundles were made for l6e_mcp-0.6.2-py3-none-any.whl:
Publisher:
publish-l6e-mcp.yml on l6e-ai/l6e-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
l6e_mcp-0.6.2-py3-none-any.whl -
Subject digest:
1c0e6741bbbe2f8a30ffaedc43519a279543c01847bbcb871e14efa6e0d38830 - Sigstore transparency entry: 1188969953
- Sigstore integration time:
-
Permalink:
l6e-ai/l6e-mcp@90eb91679e0ea695d2424eae1d2ca738afb70053 -
Branch / Tag:
refs/tags/v0.6.2 - Owner: https://github.com/l6e-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-l6e-mcp.yml@90eb91679e0ea695d2424eae1d2ca738afb70053 -
Trigger Event:
workflow_dispatch
-
Statement type: