cursor-usage-mcp

cursor-usage-mcp

Monitors your Cursor usage and provides a conserve flag to the agent, helping you manage request quota by batching questions, preferring defaults, and cutting unnecessary confirmations.

Category
访问服务器

README

cursor-usage-mcp

Purpose: stop the Cursor agent from burning through your request quota.

On many Cursor plans you get a fixed pool of included requests (e.g. 500 / month) and then pay per request out of a budget. Every time the agent stops mid-task to ask you a one-off question, your answer starts a new billable turn — so a chatty agent quietly eats your quota.

This is a local MCP server that fixes that. It reads your live usage from the same backend your Cursor dashboard uses, and hands the agent a conserve flag. When you're consuming your quota, a bundled rule makes the agent conserve requests by:

  • batching all clarifying questions into a single prompt (one turn instead of many),
  • preferring sensible defaults and proceeding instead of stopping to ask,
  • cutting needless confirmation round-trips ("should I continue?").

How it works (three pieces)

  1. login (one-time) — opens a browser via Playwright, you log into Cursor, and it captures your session cookie + auto-discovers the usage endpoints, storing them at ~/.cursor-usage/.
  2. get_usage — makes a direct authenticated API call (no browser) and returns your included-request usage (e.g. 278/500), on-demand spend ($0/$75), and a conserve decision computed against a threshold.
  3. conserve-requests rule (installed globally) — tells the agent to call get_usage at the start of each task and follow the conserve behavior above when the flag is on.

The threshold controls when conserving kicks in: 0 (default) = conserve whenever you still have requests; 80 = only conserve once you've used 80% of the quota. See Tuning below.

Heads up / caveats

  • This scrapes an undocumented internal Cursor endpoint (the same one your dashboard calls). It can change without notice and may be against Cursor's ToS to script against. Personal, read-only use only.
  • Your session cookie is stored locally at ~/.cursor-usage/store.json (chmod 600) and is never committed. It expires periodically — just re-run login when that happens.

How it works

  1. login opens a real Chromium window (via Playwright). You log in to Cursor normally and open your usage/dashboard page. While the page loads, the server sniffs the network, finds the JSON endpoint that returns your usage numbers, and saves both that endpoint and your session cookie to ~/.cursor-usage/.
  2. get_usage replays that request with your stored cookie, parses out used / limit / usedPct, and returns a conserve flag based on your activationThresholdPct.
  3. A globally-installed rule (~/.cursor/rules/conserve-requests.mdc) tells the agent to call get_usage at the start of each task and follow the conserve policy when the flag is on.

Setup

cd cursor-usage-mcp
npm install
npx playwright install chromium   # one-time: downloads the browser Playwright drives
npm run build

First-time login (either works):

# call the `login` tool from inside Cursor once the MCP is loaded (Simply by asking log into cursor-usage)

# — or — standalone CLI flow
npm run login

The server is already registered in ~/.cursor/mcp.json as cursor-usage. Restart Cursor (or reload the MCP) after npm run build so it picks up dist/index.js.

Applying changes to existing chats

New chats pick up the rule and MCP automatically — nothing to do.

For a chat that was already open before you installed/updated this:

  1. Reload the MCP once (Settings → MCP → toggle cursor-usage off/on). This restarts the shared server, so every chat — including open ones — sees the latest code and tools on its next turn.

  2. Nudge the existing chat so it starts behaving immediately (rules are re-read per turn, but an explicit nudge guarantees it):

    From now on follow the conserve-requests rule: call the cursor-usage get_usage tool,
    report my current usage, and if conserve is on — batch questions and prefer defaults.
    If verbose is on, end every message with the footer.
    

There is no skill or API to broadcast a rule into already-open chats — the one-time MCP reload plus this nudge is the mechanism.

Tools

Tool What it does
get_usage Reads usage and returns the conserve decision. Call at task start. Includes included-request count, on-demand spend, plan, billing-cycle reset + days left, and a burn-rate projection (requests/day → projected total by reset).
usage_breakdown This cycle's usage broken down by model: cost, request count, and token totals (input/output/cache). Heavier than get_usage; call on request.
login Browser login + endpoint auto-discovery. Re-run when the session expires. Reports current usage immediately.
logout Clears the stored session (cookie + endpoints). forgetBrowser=true also wipes the saved browser profile.
set_threshold Sets the persisted threshold (0-100). Default 0 = conserve whenever requests remain. Overridden by the CURSOR_USAGE_THRESHOLD_PCT env var if set.
set_verbose Enables/disables the per-message usage footer (persisted). Overridden by the CURSOR_USAGE_VERBOSE env var if set.
status Shows whether a session/endpoints are stored, capture time, and stored/env/effective threshold.

Tuning when conserve mode kicks in

The threshold is the minimum used percentage at which conserve mode activates:

  • 0 (default): conserve as long as any requests remain.
  • 80: only conserve once you've used ≥80% of the limit.

There are two ways to set it, and the env var wins if both are set:

1. Env var (recommended — declarative, in mcp.json):

"cursor-usage": {
  "command": "node",
  "args": ["/ABSOLUTE/PATH/TO/cursor-usage-mcp/dist/index.js"],
  "env": {
    "CURSOR_USAGE_THRESHOLD_PCT": "80"
  }
}

Change the number and reload the MCP. Accepts 0100. Leave it as "0" (or remove it) for the default always-conserve behavior. If CURSOR_USAGE_THRESHOLD_PCT is set, it overrides any value set via the tool below.

Verbose mode (usage footer on every message)

Set CURSOR_USAGE_VERBOSE to true in the mcp.json env to have the agent append a usage footer to the end of every message:

"env": { "CURSOR_USAGE_VERBOSE": "true" }

Footer format (rendered as a fenced code block):

Cursor Usage: 290/500 requests · $0.00/$75.00 (~as of task start)

You can also toggle it at runtime without editing mcp.json via the set_verbose tool (persisted in ~/.cursor-usage). The CURSOR_USAGE_VERBOSE env var, if set, overrides the tool value — remove it from mcp.json to control verbose purely via set_verbose.

Notes: the numbers reflect the reading from the start of the task (not refreshed per message), and because appending a footer to every message is a model behavior, it may occasionally be missed. Default is off.

Threshold, continued

2. set_threshold tool (persisted in ~/.cursor-usage):

set_threshold { "activationThresholdPct": 80 }

Used only when the env var is unset/empty. Run status to see storedThresholdPct, envThresholdPct, and the resulting effectiveThresholdPct.

How usage is read (no browser at query time)

get_usage does not open a browser. It makes direct authenticated GET requests (with your stored cookie) to the two reliable dashboard endpoints:

  • /api/usage → included-request count (gpt-4.numRequests / maxRequestUsage), e.g. 278/500.
  • /api/usage-summarymembershipType, isUnlimited, and on-demand spend (individualUsage.onDemand, cents → dollars).

The browser (Playwright) is used only during login to capture your session cookie and discover these endpoints. The conserve decision is based on the included-request percentage (the "X / 500" number).

Budget vs. team cap. The spend line reports your actual on-demand budget from individualUsage.onDemand.limit (authoritative for you), and — for context — the team-wide default per-user cap from get-hard-limit (hardLimitPerUser). These usually match, but can differ if your org sets per-user overrides; the tool flags it when they diverge.

get_usage always returns the raw JSON per source, so if a field ever looks off you can inspect raw and adjust parseIncludedRequests / parseSummary in src/usage.ts.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选