-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Open
Labels
P3Nice to haves, rare edge casesNice to haves, rare edge casesneeds confirmationNeeds confirmation that the PR is actually required or needed.Needs confirmation that the PR is actually required or needed.specSpecification complianceSpecification compliance
Description
Initial Checks
- I confirm that I'm using the latest version of MCP Python SDK
- I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue
Description
How to reproduce:
echo '{"jsonrpc":"2.0","method":"invalid/method","id":1,"params":{}}' | your-mcp-serverExpected result:
{"jsonrpc":"2.0","id":1,"error":{"code":-32601,"message":"Method not found"}}Actual result:
{"jsonrpc":"2.0","id":1,"error":{"code":-32602,"message":"Invalid request parameters","data":""}}The issue appears to occur because request validation in mcp/shared/session.py (lines 360-375) catches the validation exception and returns -32602 before the proper method-not-found handler in mcp/server/lowlevel/server.py (lines 716-718) can be reached.
Example Code
Python & MCP Python SDK
**Environment:**
- Python SDK version: `1.2.0`
- Python version: `3.12`
- Platform: macOS
Metadata
Metadata
Assignees
Labels
P3Nice to haves, rare edge casesNice to haves, rare edge casesneeds confirmationNeeds confirmation that the PR is actually required or needed.Needs confirmation that the PR is actually required or needed.specSpecification complianceSpecification compliance