Skip to content

Commit 8aae7d6

Browse files
Sbussisoclaude
andcommitted
Block free tier from MCP tools, remove free fallback rate limit
Free plan now gets rejected outright with upgrade prompt instead of a 10 calls/min fallback. Only Pro and Business have MCP access. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e8e2b93 commit 8aae7d6

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

backend/app/mcp/server.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@
5353
RATE_LIMITS = {
5454
"pro_org": 30,
5555
"business_org": 120,
56-
"free_org": 10, # shouldn't happen (MCP requires Pro+), but safe default
5756
}
58-
DEFAULT_RATE_LIMIT = 10
57+
DEFAULT_RATE_LIMIT = 0 # Block unrecognized plans (MCP requires Pro+)
5958

6059

6160
class _RateLimiter:
@@ -138,9 +137,12 @@ def _resolve_org(headers: dict | None) -> tuple[str, Session]:
138137
db.close()
139138
raise ToolError("Unauthorized: invalid or revoked API key")
140139

141-
# Look up org plan and enforce rate limit
140+
# Look up org plan and enforce access + rate limit
142141
plan = Setting.get(db, mcp_key.org_id, "org_plan", "free_org")
143-
limit = RATE_LIMITS.get(plan, DEFAULT_RATE_LIMIT)
142+
limit = RATE_LIMITS.get(plan)
143+
if limit is None:
144+
db.close()
145+
raise ToolError("MCP requires a Pro or Business plan. Upgrade at /pricing.")
144146
allowed, remaining = _rate_limiter.check(key_hash, limit)
145147
if not allowed:
146148
db.close()

0 commit comments

Comments
 (0)