Context7 Account Broker
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Context7 Account Brokerresolve library id for pandas and query docs for DataFrame.concat"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Context7 Account Broker
A drop-in Context7 MCP proxy for people who use more than one authorized API key. It balances requests by quota usage, keeps each library on the same account, and caches successful responses on disk.
OpenCode sees the standard Context7 tools:
resolve-library-idquery-docs
The broker handles account selection, failover, caching, and quota refreshes without changing tool schemas or results.
What it does
Routes new work to the account with the lowest proportional quota usage.
Keeps a library on the same account within each project.
Fails over when an account is blocked, rate limited, unauthorized, or temporarily unreachable.
Reads Context7's
RateLimit-*headers instead of estimating quota locally.Caches exact successful calls for 30 days by default.
Coalesces concurrent identical requests into one upstream call.
Stores named credentials in a private
0600configuration file.Provides CLI commands for account management, quota status, and diagnostics.
Related MCP server: MCP Gateway
Quick start
1. Add your Context7 accounts
The command prompts for the API key without displaying it:
npm_config_allow_git=all npx -y \
git+https://github.com/mirsella/context7-account-broker.git \
accounts add personalRepeat the command with a different name for each account. To verify the saved accounts without exposing their keys:
npm_config_allow_git=all npx -y \
git+https://github.com/mirsella/context7-account-broker.git \
accounts list2. Configure OpenCode
Add the server to ~/.config/opencode/opencode.jsonc:
{
"mcp": {
"context7": {
"type": "local",
"command": [
"npx",
"-y",
"git+https://github.com/mirsella/context7-account-broker.git"
],
"environment": {
"npm_config_allow_git": "all"
},
"timeout": 30000,
"enabled": true
}
}
}Restart OpenCode, then check the connection:
opencode mcp listnpm_config_allow_git=all is required by npm 12, which blocks Git package
sources by default. It permits the GitHub package used by this MCP entry.
CLI
The examples below use the GitHub version directly.
Command | Purpose |
| Add a named API key using a hidden prompt or stdin |
| List account names, sources, and key fingerprints |
| Remove a file-configured account |
| Fetch current quota usage and reset times |
| Print effective paths and runtime settings |
| Show command help |
| Start the stdio MCP server (the default) |
For example:
REPO=git+https://github.com/mirsella/context7-account-broker.git
npm_config_allow_git=all npx -y "$REPO" status
npm_config_allow_git=all npx -y "$REPO" config
npm_config_allow_git=all npx -y "$REPO" accounts remove personalFor non-interactive account setup:
printf '%s\n' "$CONTEXT7_API_KEY" |
npm_config_allow_git=all npx -y "$REPO" accounts add personalAccount selection
At startup, the broker probes each key and reads Context7's authoritative
RateLimit-Limit, RateLimit-Remaining, and RateLimit-Reset headers.
For a library without an existing assignment, it chooses the available account with the lowest proportional usage:
used / limit = (limit - remaining) / limitEqual accounts rotate in round-robin order. Once selected, the account is saved as the preferred account for that library and project. A temporary failure can move one request elsewhere without discarding the preference.
Blocked accounts are checked again at their reset time. Free-plan accounts are also checked at the next UTC day so Context7's daily bonus calls can become available.
Cache
Successful tool results are cached by:
project scope
tool name
canonicalized arguments
API-key hash
The API-key partition prevents a removed account from serving its cached private content. Expired files are removed on startup and lazily when read. Concurrent identical calls share one in-flight request.
The default cache directory is:
~/.cache/context7-account-brokerDelete that directory to invalidate all cached results and affinities.
Credentials
Named accounts are stored at:
~/.config/context7-account-broker/accounts.jsonThe directory uses mode 0700 and the file uses mode 0600.
When this file contains accounts, it acts as an allowlist. Inherited
CONTEXT7_API_KEY and CONTEXT7_API_KEYS values are ignored unless
CONTEXT7_BROKER_INCLUDE_ENV=1 is set. This prevents an unrelated shell key from
silently joining a configured pool.
With no configured account file, the broker accepts:
export CONTEXT7_API_KEYS='ctx7sk_first,ctx7sk_second'Configuration
Environment variable | Default | Description |
| unset | One API key when no account file is configured |
| unset | Separated API keys |
| XDG config path | Override the accounts file path |
| unset | Include environment keys with |
|
| Upstream MCP endpoint |
|
| Transient failure cooldown |
|
| Result and affinity cache lifetime |
| XDG cache path | Override the cache directory |
| current directory | Cache and affinity scope |
Quota cost
Context7 attaches quota state to normal API responses rather than exposing a
free status endpoint. Each startup probe, refresh, and status check consumes
one API request per checked account.
Development
Requirements: Node.js 20 or newer and pnpm.
git clone https://github.com/mirsella/context7-account-broker.git
cd context7-account-broker
pnpm install
pnpm typecheck
pnpm test
pnpm buildRun the local binary:
node dist/index.js accounts list
node dist/index.js status
node dist/index.js serveResponsible use
Use API keys only for accounts you own or are authorized to aggregate. Follow Context7's terms and plan limits. The broker does not create accounts, bypass authentication, or hide upstream failures.
License
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-qualityBmaintenanceMCP Foxxy Bridge is a one-to-many proxy for the Model Context Protocol (MCP). It lets you aggregate and route requests to multiple MCP servers through a single endpoint, so you can centralize configuration for all your MCP servers.7
- Alicense-qualityDmaintenanceA production-ready unified entry point for AI agents that implements the Model Context Protocol (MCP). It provides a secure gateway with rate limiting, authentication, and observability for managing and proxying requests to multiple downstream APIs.MIT
- AlicenseAqualityAmaintenanceA proxy MCP server that connects to Tavily's official Streamable HTTP MCP, managing multiple API keys and automatically switching to the next one when the current key's quota is exhausted.581MIT
- AlicenseBqualityBmaintenanceAggregates multiple MCP servers via a single interface with token optimization and multiple operating modes (Gateway, Meta, Proxy, Search, Code).78MIT
Related MCP Connectors
A paid remote MCP for Context7 MCP docs, built to return verdicts, receipts, usage logs, and audit-r
Hosted MCP server for LLM cost estimation, model comparison, and budget-aware routing.
A paid remote MCP for hosted MCP server, built to return verdicts, receipts, usage logs, and audit-r
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/mirsella/context7-account-broker'
If you have feedback or need assistance with the MCP directory API, please join our Discord server