Repository navigation
Closed
Labels
Milestone
Description
Summary
Every REST request, /api/mcp included, counts against one global limit per network address. A hosted AI app, such as claude.ai, ChatGPT or Replit, calls docs.plus from its own servers. So all of that app's users may share one address bucket, and one busy group could block everyone on that app. The MCP connector already has a fair per-person budget. This issue decides whether /api/mcp should rely on that budget instead of the per-address limit.
Parent: #230.
Facts (read from code on 2026-10-20, not measured)
- Global limiter (
apps/hocuspocus.server/src/middleware/index.ts):RATE_LIMIT_MAXpoints per 15 minutes, keyed byx-real-ip(or the firstx-forwarded-forhop). A code comment says production runsRATE_LIMIT_MAX=500. Only/healthand media reads have their own rule./api/mcptakes the global one. - MCP tool budget (
apps/hocuspocus.server/src/modules/mcp/infra/toolBudget.ts): 60 tool calls per minute per signed-in person (sub), in Redis. If Redis is down, it allows the call. - Not measured: how many addresses each hosted AI app uses, and whether any app has hit the global limit. The admin
/mcpusage page and theRATE_LIMIT_EXCEEDEDlogs would show it.
Open decisions
- Take
/api/mcpoff the per-address limit once the bearer token verifies? Recommended: yes. Keep the per-person tool budget, and keep a high per-address ceiling for requests without a valid token. Reason: the person, not the shared address of the AI app, is the fair unit. - Decide before more hosted apps are listed? Recommended: yes. Reason: Replit and the official MCP Registry listing (Publish docs.plus to the official MCP Registry #459) bring more hosted traffic through the same few addresses.
- Measure first? Recommended: check the
RATE_LIMIT_EXCEEDEDlog lines on/api/mcpfor the last 30 days before building. Reason: a ruling on numbers beats a ruling on argument.
Where
apps/hocuspocus.server/src/middleware/index.ts: the global limiter and its path rules.apps/hocuspocus.server/src/modules/mcp/http/controller.ts: where the token is verified.
Acceptance criteria
- The measurement in decision 3 is posted here.
- The ruling is posted here.
- If built: a verified
/api/mcprequest never spends the per-address budget, an unverified one still does, and the per-person budget is unchanged.
Activity
HMarzban commentedon Oct 20, 2026
Maintainer ruling, 2026-10-20
Build decisions 1 and 2 as recommended: a verified
/api/mcprequest does not spend the per-address budget, an unverified one still does, and the per-person tool budget stays. Decision 3 (measure first) is skipped for now: the build goes ahead without the 30-day log count.feat(mcp): let a verified MCP call skip the per-address limit
fix(mcp): bound every verified MCP request per person
HMarzban commentedon Oct 20, 2026
Rulings (maintainer, 2026-10-20), shipped in
2c3596eeaand7f550750f:/api/mcpcall skips the per-address limit only while the address still has budget. A spent address gets429even for a good token, and it never reaches Supabase Auth. That stops forged tokens from driving Auth calls.mcp-req, 300 a minute). Over it, the transport answers429withRetry-After. Tool calls still spend the separate 60-a-minute tool budget. 300 is not measured against host traffic yet. Watch formcp-req429s from Claude and ChatGPT, and raise it if a normal session hits it.Docs:
apps/hocuspocus.server/API.md§Rate limiting,docs/mcp/reference.md§Limits.