rapidapi-mcp
by dexteon
README.md
# rapidapi-mcp
One MCP server exposing your RapidAPI subscriptions through the single shared
`x-rapidapi-key`. Discovery and execution in 5 tools, with no per-API server needed.
## Tools
- `rapidapi_categories(include_dead)`: categories with counts, plus a count per status.
- `rapidapi_search(query, category, limit, include_dead, status)`: find APIs. Every word of
the query must match (any order) in the name, search_for, category or notes. Name matches
rank above search_for above notes, then active before unverified before the rest.
- `rapidapi_describe(slug)`: status and evidence, host, endpoints, plan, quota, notes.
- `rapidapi_call(slug, path, method, params, json_body, host, max_chars, force, fields, max_items)`:
proxy any endpoint, quota-guarded, with size control and structured errors.
- `rapidapi_quota(slug, near_cap_only)`: live remaining per API where known.
Typical flow: `search`, `describe`, `call`.
## Status model
Every catalog entry has `status`, `status_evidence` and `last_verified`:
| status | meaning | shown by default |
|---|---|---|
| `active` | confirmed working or listed in a billing export | yes |
| `unverified` | no dated evidence either way; not the same as inactive | yes |
| `exhausted` | monthly allowance used up | yes |
| `not_rapidapi` | listed but uses its own host and auth; not callable here | yes, labeled |
| `dead` | delisted, down or gone | hidden (`include_dead=true`) |
| `unsubscribed` | absent from an authoritative billing export | hidden |
`status="dead"` (or any comma list) as a search filter overrides the default hiding.
Set the fields once with `python tools/migrate_status.py` (idempotent, backs the catalog up
first, prints counts). Load the real subscription list with
`python tools/import_subscriptions.py --file export.json` (see the script header for the
JSON shape and the pasted-table format; `--authoritative` marks absent entries
unsubscribed, `--restore-from-backup` re-adds rows found in `rapidapi_catalog.json.backup`).
RapidAPI has no key-based way to list your subscriptions. `python tools/fetch_subscriptions.py
--profile <browser-profile-dir> --apply` opens a browser profile that is signed in to
rapidapi.com, runs the billing page's own data call headless, writes the list as JSON and
(with `--apply`) imports and reconciles it. It never reads cookie files or prints a token.
## Quota and guards
Every response's `x-ratelimit-requests-limit`, `-remaining` and `-reset` headers are stored
per slug with a timestamp in the usage file, and `rapidapi_call` returns
`quota.remaining`. A live value from the current month is the truth; otherwise the local
call counter against the catalog cap is used. The May 2026 dashboard snapshot is shown but
never blocks. Only calls the provider billed are counted (not 401, 403, 404, 429 or 5xx).
A call is blocked unless `force=true` when:
- live remaining is at or under the floor (default 2, env `RAPIDAPI_MIN_REMAINING`),
- the local count has reached the hard cap, or
- the plan has a known overage or bandwidth price (the message states the price).
### Shared guard (optional)
When the module `rapidapi_guard.py` can be imported (folder in `RAPIDAPI_GUARD_DIR`), every
call also goes through one guard that all your RapidAPI callers share (scripts, bots, this
server), with its state in one file:
- **Session stop:** at most 200 calls per process, all APIs together. `force` never lifts it.
It catches loops.
- **Floor:** an API is refused once fewer than 60 calls are left this month (on plans under
500 calls, 12% of the plan). `force` lifts the floor only, and each forced call is logged.
- **Monthly tally:** billed calls per API per month, kept for 13 months. It stops nothing.
The stricter of this server's own guard and the shared guard wins. Without the module the
server logs one warning and runs with its own guard only.
## Errors and size control
Failures return `{ok: false, status, error, hint, body_excerpt}` with plain-language
errors (401/403 key rejected or not subscribed; 404 with no rate-limit headers means wrong
path or not subscribed; 429 limit reached with retry-after; 5xx provider error).
`fields` keeps dotted paths, `max_items` cuts arrays, `max_chars` bounds the body. Anything
cut still comes back as valid JSON with `truncated: true` and the dropped counts.
## Run
```
pip install -r requirements.txt
set RAPIDAPI_KEY=<your-key>
python server.py
```
## Env
- `RAPIDAPI_KEY`: required.
- `RAPIDAPI_KEY_2`: optional second account key. One retry with it, only on a "not
subscribed" answer and only when its value differs from `RAPIDAPI_KEY`.
- `RAPIDAPI_CATALOG`: path to `rapidapi_catalog.json` (default
`%USERPROFILE%/Desktop/rapidapi_catalog.json`). It is reloaded whenever the file changes.
- `RAPIDAPI_USAGE_FILE`: per-slug usage file (default `~/.rapidapi_mcp_usage.json`).
- `RAPIDAPI_MIN_REMAINING`: quota floor (default 2).
- `RAPIDAPI_GUARD_DIR`: folder holding `rapidapi_guard.py` for the shared guard (optional).
- `RAPIDAPI_SESSION_CAP`, `RAPIDAPI_FLOOR`, `RAPIDAPI_GUARD_STATE`: shared guard session stop
(default 200), floor (default 60) and state file.
The catalog is the single source of truth (slug, host, endpoints, plan); the server reads
it and never copies the key.
## Tests
```
pip install pytest
python -m pytest -q
```
No test touches the network or the real catalog.
## Register in hermes
Stdio server, register by command, not a URL:
```
hermes mcp add rapidapi --command python --args <path-to-repo>/server.py
```
or in `%LOCALAPPDATA%/hermes/config.yaml` under `mcp_servers:`:
```yaml
rapidapi:
type: stdio
command: python
args: [ <path-to-repo>/server.py ]
env:
RAPIDAPI_KEY: ${RAPIDAPI_KEY}
enabled: true
```
<!-- ca-tracked-link -->
[cyberautomations.com](https://cyberautomations.com/?utm_source=github&utm_medium=readme&utm_campaign=rapidapi-mcp)
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues