One MCP server for 128 API subscriptions
One MCP server that gives AI agents about 128 RapidAPI subscriptions through five tools, with a quota guard that blocks a call before it can run past a hard monthly cap.
- API subscriptions
- ~128
- tools cover them all
- 5
- lines of Python
- ~300
The problem
An agent with access to 128 APIs would normally need 128 tool definitions, or one server per API. That crowds out the room the agent needs to think, and most of those tools go unused in any single task.
Free and basic API plans also have hard monthly caps. One agent stuck in a loop can use up a plan, or run into overage charges, before anyone notices.
The approach
- The subscriptions share one key, and one catalog file lists every API's address, endpoints and plan limits. The server reads the catalog and takes the key from the environment, so the key is never copied into config.
- Four tools cover discovery and use: list categories, search the catalog, describe one API, and call any endpoint. The usual flow is search, then describe, then call.
- Before each call a quota guard estimates this month's usage: the last known usage percentage from the provider dashboard, plus a local count of calls made since. For plans with a hard cap, the call is blocked before it is sent once the estimate reaches the cap. A force flag overrides it on purpose.
- The local counter is saved to disk and resets each month. Failed sign-in responses are not counted, since they do not use quota.
- A fifth tool reports estimated usage across the whole catalog, sorted by least remaining, with a filter for APIs that have 20% or less left.
- Responses are cut to a character limit, so one oversized payload cannot flood the agent's context.
How it flows
- AI assistant to MCP server: Search the catalog
- MCP server to AI assistant: Matching APIs
- AI assistant to MCP server: Describe one API
- AI assistant to MCP server: Call an endpoint
- MCP server to Quota guard: Estimate this month's usage
- Quota guard to MCP server: Allowed, or blocked at the cap
- MCP server to API provider: Send the request
- API provider to MCP server: Response
- MCP server to AI assistant: Trimmed result
Show this diagram as Mermaid text
sequenceDiagram
participant P0 as AI assistant
participant P1 as MCP server
participant P2 as Quota guard
participant P3 as API provider
P0->>P1: Search the catalog
P1-->>P0: Matching APIs
P0->>P1: Describe one API
P0->>P1: Call an endpoint
P1->>P2: Estimate this month's usage
P2-->>P1: Allowed, or blocked at the cap
P1->>P3: Send the request
P3-->>P1: Response
P1-->>P0: Trimmed resultTech stack
- Language
- Python
- Server
- MCP Python SDK, stdio transport
- HTTP client
- httpx
- Catalog
- One JSON file: API address, endpoints, plan limits
- Quota state
- Small JSON counter file, monthly reset
Results
- About 128 subscribed APIs are reachable through five tools, in roughly 300 lines of Python.
- Hard-capped plans are protected by default: a call that would pass the cap is refused with the estimate and the reason, instead of being sent.
- It runs as a tool server for our own agents.
- The estimate is a floor, not live truth. It starts from the last dashboard snapshot, so the real number can be higher. The tool output says so.
Every figure on this page comes from the project's own code, tests or notes. Where there is no measured number, we describe the outcome in words.
Demo
rapidapi_categories() categories and counts
rapidapi_search(query, category, limit) find subscribed APIs
rapidapi_describe(slug) address, endpoints, quota, notes
rapidapi_call(slug, path, method, params, json_body, host, force)
rapidapi_quota(slug, near_cap_only) estimated usage per API
estimate = ceil(cap * snapshot_pct / 100) + local_calls_this_month
{
"error": "quota guard blocked call",
"detail": "hard cap reached: ~100/100 this month (snapshot 97% + 3 local). Pass force=true to override."
}A recorded session showing a search, a call and a blocked call is being prepared.
Source code
The code is public. View the RapidAPI MCP repository on GitHub.
Related
Service
Agent pipelines
Multi-agent research systems with validation gates, built for a specific research task.
See all custom build servicesFree tools built the same way
More builds
- AI Stack CVE Labs: Security research
- Agentic Agency: Agent framework
- AI Usage Dashboard: AI infrastructure and operations
- Geo-Intel: Data pipeline
- Security Knowledge Base: Knowledge base
- Claude Budget: AI spend control
- Flightdeck: Agent operations
- Niagara BQL and NEQL Reference: OT reference
- IG Sanitize: Privacy tool
- WinHostPEAS: Security tooling
Last updated 2026-11-11