From 7564306e181bd5f7ffe428deea6da402c00d6c13 Mon Sep 17 00:00:00 2001 From: Rahim Kanji Date: Sun, 18 Jan 2026 23:26:43 +0500 Subject: [PATCH] Handledwq "notifications/initialized" method --- lib/MCP_Endpoint.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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) {