Skip to content

design: add design for rate limiting #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

samthanawalla
Copy link
Contributor

@samthanawalla samthanawalla commented Jun 25, 2025

I added an example for how rate limiting should be implemented using middleware.

Fixes #22

Motivation and Context

Rate limiting can be enabled using middleware. This adds an example on how to do that.

How Has This Been Tested?

N/A

Breaking Changes

No

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

@samthanawalla samthanawalla marked this pull request as ready for review June 25, 2025 18:44
@findleyr
Copy link
Contributor

I think the section on rate limiting should be brief, suggesting that it be implemented with middleware. Can you instead promote your example to a fully fledged example in the examples/ directory? Then it will be discoverable.

@samthanawalla samthanawalla force-pushed the designRateLimting branch 2 times, most recently from 57d2880 to 55ea3cc Compare June 25, 2025 20:26
@samthanawalla
Copy link
Contributor Author

Sounds good. I added examples/rate-limiting.
For the per session rate limiting, we will need a way to expose a session ID but we can discuss later.

jba
jba previously approved these changes Jun 26, 2025
I added an example for how rate limiting should be implemented using
middleware. We create a go.mod to keep the root go.mod unaffected by the
dependency on x/time.
@samthanawalla samthanawalla merged commit bc59932 into modelcontextprotocol:main Jun 30, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rate limiting support / Best practices
3 participants