modelcontextprotocol / modelcontextprotocol/rust-sdk

Feature request: native Rate Limiting (MCP spec compliance)

Open
#388 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted P2 T-core
Dominant language
Rust
Stars
3.9k
Forks
645
Avg merge
4d 13h
Merged PRs (30d)
36

Description

Problem

The MCP specification requires rate limiting across multiple message types.

Required (MUST/SHOULD):

  • Progress notifications: "Both parties SHOULD implement rate limiting to prevent flooding"
  • Completion requests: "MUST implement appropriate rate limiting"
  • Sampling requests: "Clients SHOULD implement rate limiting"
  • Logging messages: "Servers SHOULD rate limit log messages"
  • Elicitation requests: "Clients SHOULD implement rate limiting"
Proposed Architecture

Transport Layer Rate Limiting (token bucket algorithm)

Why Transport Layer:

  • Universal Coverage: All message types, all transports (stdio/SSE/HTTP/WebSocket)
  • Single Integration Point: All messages flow through Transport::send()
  • Existing Patterns: Following established decorator pattern (SinkStreamTransport)
  • Performance: Early filtering, concurrent-safe

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 at the transport layer and trace how messages pass through Transport::send(), then read the existing SinkStreamTransport decorator pattern. Define how a concurrent-safe token bucket applies to Progress, Completion, Sampling, Logging, and Elicitation messages across stdio, SSE, HTTP, and WebSocket transports. Done means all listed message types receive the required transport-level rate limiting.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.