modelcontextprotocol / modelcontextprotocol/servers

feat(brave-search): Make rate limits configurable via environment variables

Open
#3,127 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
90.5k
Forks
11.7k
Avg merge
2d 2h
Merged PRs (30d)
5

Description

Summary

The brave-search server (now in servers-archived) has hardcoded rate limits that don't match Brave Search API tier limits. This artificially throttles users with paid plans.

Problem

// Current hardcoded limits
const RATE_LIMIT = {
  perSecond: 1,
  perMonth: 15000
};
Brave Plan Actual Limit Server Allows
Free 1 req/s 1 req/s ✓
Base 20 req/s 1 req/s ✗
Pro Unlimited 1 req/s ✗

Users with Base ($5/mo) or Pro plans are artificially throttled to Free tier limits.

Proposed Solution

Make rate limits configurable via environment variables with backward-compatible defaults:

const RATE_LIMIT = {
  perSecond: parseInt(process.env.BRAVE_RATE_LIMIT_PER_SECOND || '1', 10),
  perMonth: parseInt(process.env.BRAVE_RATE_LIMIT_PER_MONTH || '15000', 10)
};

Benefits:

  • Zero breaking changes (defaults match current behaviour)
  • Users can configure based on their actual API tier
  • Simple 2-line change

Example Configuration

{
  "mcpServers": {
    "brave-search": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-brave-search"],
      "env": {
        "BRAVE_API_KEY": "your-key",
        "BRAVE_RATE_LIMIT_PER_SECOND": "20"
      }
    }
  }
}

Note

I understand brave-search was moved to servers-archived (which is read-only). I'm happy to submit a PR if you can advise the best path forward - whether that's:

  1. Unarchiving just for this fix
  2. Bringing brave-search back to this repo
  3. Another approach

The fix is minimal and backward-compatible.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the archived brave-search server and its RATE_LIMIT definition; the issue does not name a file or test. Confirm where this change could be made given that servers-archived is read-only, then verify that omitted environment variables preserve the current limits and configured values are applied.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.