diff --git a/lib/MCP_Endpoint.cpp b/lib/MCP_Endpoint.cpp index fd08f7166..0a68e0e7b 100644 --- a/lib/MCP_Endpoint.cpp +++ b/lib/MCP_Endpoint.cpp @@ -244,6 +244,20 @@ std::shared_ptr MCP_JSONRPC_Resource::handle_jsonrpc_request( // Handle different methods json result; + // Check if this is a notification + if (method == "notifications/initialized") { + // MCP spec: notifications/initialized is sent by client after initialization + // This is a notification - return HTTP 200 OK with {} body per spec + // See: https://modelcontextprotocol.io/specification/2025-03-26/basic/transports + proxy_debug(PROXY_DEBUG_GENERIC, 2, "MCP notification 'notifications/initialized' received on endpoint '%s'\n", endpoint_name.c_str()); + auto response = std::shared_ptr(new string_response( + "{}", + http::http_utils::http_accepted // 202 Accepted + )); + response->with_header("Content-Type", "application/json"); + return response; + } + if (method == "tools/call" || method == "tools/list" || method == "tools/describe") { // Route tool-related methods to the endpoint's tool handler if (!tool_handler) {