
quota-mcp
io.github.limitcool由 GitHub 帳號 limitcool 發布v0.3.2更新於 Oct 24, 2026
Usage & quota tracker for AI subscription accounts (StepFun, Command Code)
概覽
本機唯讀 MCP 伺服器,彙整 StepFun 與 Command Code 訂閱帳戶的用量與額度,回答還剩多少額度。
- 可以做什麼
- 列出帳戶的方案、到期時間、剩餘額度以及去識別化後的 session 或金鑰狀態,並提供各平台正常、受限、失效或需重新登入的彙總,以及供排程摘要使用的報告資料。對單一帳戶或全部帳戶向上游廠商即時探測並更新快取資料。檢查已觸發的告警:額度偏低、即將到期、session 失效、金鑰被拒和速率視窗超限。帳戶登錄、續期和刪除不在 MCP 中提供,只存在於伺服器另外的 REST 管理介面。
- 適用情境
- 當你持有 StepFun 或 Command Code 訂閱,希望助理直接回答額度問題、提示餘額不足或方案即將到期,或定期產生用量摘要而不必逐一開啟廠商主控台時適用。
- 執行需求
- 以本機程序執行(二進位檔或已發布的容器映像),SQLite 資料庫路徑由 QUOTA_MCP_DB 指定。正式環境需設定 QUOTA_MCP_MASTER_KEY(64 位十六進位字元)以加密儲存的憑證。帳戶須先透過 REST 介面登錄廠商憑證:StepFun 的瀏覽器 session Cookie 或方案金鑰,或 Command Code 的 API 金鑰或 session Cookie。探測需要連線至廠商介面的網路。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 quota-mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
English | 简体中文
quota-mcp
A usage & quota tracker for AI subscription accounts. It pulls the balances, subscription expiry dates and rate-limit windows that are scattered across vendor dashboards into one place, and exposes them through both a REST management API and an MCP query surface — point your agent (Hermes, Claude Code, …) at it with one config line and it can answer "how much quota do I have left?" on its own.
Two platforms supported today:
Highlights:
- Encrypted at rest: credentials are AES-256-GCM encrypted into SQLite (pure-Go driver, no CGO); every endpoint returns masked views only
- StepFun session auto-renewal: a background goroutine checks every 60 s and renews any session whose TTL drops below 20 min. Renewing an expired session gets you a degraded device token — there is a guard that detects this and refuses to persist it
- Dual auth planes: StepFun's plan key (permanent) and console session (quota data) are managed and probed separately; the verdict is driven by the permanent plane
- MCP is read-only: the query surface (list / probe / summarize) is safe to hand to agents; enrol / renew / delete live on the REST side only
- Single binary, zero external services
Quick start
After startup:
http://127.0.0.1:8780/healthzhealth checkhttp://127.0.0.1:8780/api/stepfun/accountsREST listhttp://127.0.0.1:8780/mcpMCP endpoint
Enrolling accounts
Command Code (two credential planes)
The alpha/API-key plane is the easy one — a permanent Bearer key:
Get the key from commandcode.ai/settings/keys (shown once at creation). The server validates it with whoami first and refuses to store a rejected key.
The internal/session plane mirrors the browser: pass session_text (the whole Cookie: header, a document.cookie dump, or the bare __Secure-commandcode_prod_.session_token value). It is validated against billing/credits and never stored unless it passes. Sessions expire, so refresh them from CookieCloud or by copying the cookie again from DevTools:
When both are stored the API key wins. Each enrol overwrites the credential planes it was given — re-enrolling with only api_key clears any stored session, and vice-versa, so a rotation is never silently skipped.
StepFun (browser session)
Oasis-Token is an HttpOnly cookie, so document.cookie cannot read it — copy it from a request header in DevTools. Paste the whole Cookie: header (or the bare token) to the server:
Protocol findings from real-world testing (all handled in code):
- The
.aiOasis-Tokencookie value is two JWTs concatenated (8 segments); the console only accepts the whole value — a single segment gets youtoken is illegal - Timestamp units differ per site:
.aireturns second-level strings,.comreturns milliseconds; the code infers by magnitude .comdevice tokens live only 30 minutes and its RefreshToken returns a degraded token —.comsessions need periodic re-import- Renewing after expiry yields a device token (
mode 1, data plane alwaystoken is illegal), so renewal must happen before expiry; a degradation guard refuses to store such tokens
REST API
MCP surface (for agents)
Two ways to connect — pick either:
1. Streamable HTTP (served on /mcp) — for always-on deployments:
2. stdio — for clients that spawn the server themselves (Claude Code, containers, mcp-publisher-style registry installs):
Works the same way from Claude Code or any other MCP client.
All tools are read-only:
Alerts, expiry warnings & scheduled digest
quota-mcp owns condition detection (it holds the data and runs a 60 s background loop); scheduling and delivery belong to your agent platform. A hermes-style wiring:
1. Threshold & expiry alerts (event-driven, push)
A background evaluator refreshes stale probe data (>5 min), evaluates rules, keeps a
firing/resolved state machine in SQLite (alert_events), and POSTs only the transitions
to a webhook — the same alert never repeats until it clears and fires again.
Rules: credit_low (remaining share below threshold), expiring_soon (subscription/billing
period ending within N days), session_dead (StepFun console session needs re-import),
key_rejected (Command Code key got 401/403), window_limited (rate window exceeded).
Payload pushed on each transition:
No webhook? No problem — hermes (or anything) can poll instead:
then have a hermes cron every 15–30 min call quota_check_alerts and hermes send anything
new. Same for GET /api/alerts?history=20.
2. Scheduled digest (cron)
quota_report (or GET /api/report) returns a stable, agent-friendly payload: every account's
plan / expiry / remaining quota / session state / window usage / request stats, plus current
alerts. Point hermes's existing 09:30 cron at it: one turn calls the tool, composes the message,
and delivers via hermes send. No scheduler is duplicated inside quota-mcp.
3. Environment variables
Example (quota_status output — what an agent would read to answer "how much quota is left?"):
Project layout
Security boundary
- Ciphertext goes to the DB only — never to logs, never to responses; every endpoint returns masks
- The REST surface contains writes: bind it to loopback or a private network. To expose it publicly, front it with a reverse proxy + auth and only publish the MCP path
- Losing the master key means every stored credential becomes unreadable — back up
QUOTA_MCP_MASTER_KEY
Releases
Binaries for Linux / macOS / Windows (amd64 + arm64) are attached to each GitHub Release. Grab the latest:
Docker
Image is published to ghcr.io/limitcool/quota-mcp (amd64 + arm64) on every main push (:main) and tag (:v1.0.0, :latest).
Or with the bundled compose file (QUOTA_MCP_MASTER_KEY is required, put it in .env):
The database lives in the /data volume (QUOTA_MCP_DB=/data/quota-mcp.db). Back up the master key — losing it makes every stored credential unreadable.
License
MIT
來源:README.md,提交 4f8bc4f
工具
0版本歷史
2- v0.3.2最新Sep 22, 2026
- v0.2.1Sep 21, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分