Initial Checks
Description
How to reproduce:
echo '{"jsonrpc":"2.0","method":"invalid/method","id":1,"params":{}}' | your-mcp-server
Expected 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
Initial Checks
Description
How to reproduce:
Expected 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-32602before the proper method-not-found handler inmcp/server/lowlevel/server.py(lines 716-718) can be reached.Example Code
Python & MCP Python SDK