modelcontextprotocol / modelcontextprotocol/python-sdk

Middleware Support in MCP

Open
#1,233 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement needs decision P1 v2
Dominant language
Python
Stars
24.3k
Forks
4k
Avg merge
1d 1h
Merged PRs (30d)
31

Description

Description

We need a proper middleware mechanic in the server code. This must support adding custom Starlette middlware and have a pre-defined order of middleware when auth is enabled. See FastMCP 2.0 for inspiration.

References

No response

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

The issue names only the server code and custom Starlette middleware; start by locating the existing middleware and authentication setup, then compare the intended approach with FastMCP 2.0. Done means custom middleware can be added and its order is predefined when authentication is enabled, but the issue names no files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.