claude-usage-mcp
Reports your Claude subscription usage (5-hour and weekly limits) with a forecast and velocity recommendation, using Claude Code's existing OAuth session without requiring an API key.
README
claude-usage-mcp
A tiny MCP server that reports your Claude
subscription usage — the 5-hour and weekly limit windows — with a forecast
and a velocity recommendation. No API key required: it reuses the OAuth
session that Claude Code already stores on your machine, exactly like Claude
Code's own /usage command.
How it works
- Reads Claude Code's OAuth credentials from
~/.claude/.credentials.json(or the macOS Keychain itemClaude Code-credentials), refreshing the access token when needed. - Calls the undocumented usage endpoint
GET https://api.anthropic.com/api/oauth/usagewithAuthorization: Bearer <token>andanthropic-beta: oauth-2025-04-20. The response containsfive_hour,seven_dayandseven_day_opus, each withutilization(0–100) andresets_at. - Because Anthropic's edge fingerprints the TLS handshake and rejects Node's
fetchwith403 "Request not allowed", the server triesfetchfirst and falls back to the systemcurlbinary (which is accepted).curlships with Windows 10+, macOS and Linux. SetCLAUDE_USAGE_FORCE_CURL=1to skip straight to curl.
You must be signed in via Claude Code (
claude) for this to work.
Tools
get_usage
No arguments. Returns every available window with:
utilization, resetsAt, remainingHours, projectedEndUtilization
(where you'd land at reset at the current pace), exhaustAt (when you'd hit
100% if you will), and velocityRecommendation.
get_velocity
Argument window: "5h", "weekly", or "weekly_opus". Returns just the
velocity recommendation and forecast for that one window.
The velocity recommendation (0–120%)
A single number telling you how hard you can push. It compares the sustainable pace (the rate that exactly finishes the quota at reset) to your current average pace:
- 100% — full speed. At your current pace you land exactly at the limit right when the window resets.
- < 100% — the fraction of your current pace you should slow to in order not
to run out early. e.g.
40%= go at roughly 40% of your current speed. - > 100% (capped at 120%) — you have so much headroom you can't burn through the quota at anything like this pace. Go all out.
The 5-hour and weekly windows are evaluated separately, so you get
5h and weekly velocities independently.
Math per window (length L = 5h or 168h, utilization u%, reset at R):
elapsed = now - (R - L)
remaining = R - now
rate = u / elapsed # % per hour
forecast = u / (elapsed / L) # % at reset if pace continues
exhaustAt = now + (100 - u) / rate # only if forecast > 100
velocity = ((100 - u) / remaining) / rate * 100 # clamped to [0, 120]
Install & build
npm install
npm run build
Register with an MCP client
Claude Desktop (claude_desktop_config.json), or any stdio MCP client:
{
"mcpServers": {
"claude-usage": {
"command": "node",
"args": ["/absolute/path/to/claude-usage-mcp/dist/index.js"]
}
}
}
Caveats
- The usage endpoint is undocumented and can change or disappear without notice — treat it as best-effort.
- The server can read your Claude Code OAuth tokens (the same file Claude Code
itself uses). It never sends them anywhere except Anthropic's own endpoints,
and passes the bearer token to
curlvia a stdin config file so it never appears in the process list. - Velocity uses the average pace over the elapsed window (one snapshot per call). It's a guide, not a guarantee; a burst right before reset can still overshoot.
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.