Use this file to discover all available pages before exploring further.
New in version 2.9.1MCP clients can receive various types of messages from servers, including requests that need responses and notifications that don’t. The message handler provides a unified way to process all these messages.
The simplest way to handle messages is with a function that receives all messages:
from fastmcp import Clientasync def message_handler(message): """Handle all MCP messages from the server.""" if hasattr(message, 'root'): method = message.root.method print(f"Received: {method}") # Handle specific notifications if method == "notifications/tools/list_changed": print("Tools have changed - might want to refresh tool cache") elif method == "notifications/resources/list_changed": print("Resources have changed")client = Client( "my_mcp_server.py", message_handler=message_handler,)