We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cffff64 commit 339034dCopy full SHA for 339034d
1 file changed
src/server/streamable_http_server.cpp
@@ -372,6 +372,18 @@ bool StreamableHttpServerWrapper::start()
372
{
373
apply_additional_response_headers(res);
374
375
+ // Security: Check authentication if configured
376
+ if (!auth_token_.empty())
377
+ {
378
+ auto auth_it = req.headers.find("Authorization");
379
+ if (auth_it == req.headers.end() || !check_auth(auth_it->second))
380
381
+ res.status = 401;
382
+ res.set_content("{\"error\":\"Unauthorized\"}", "application/json");
383
+ return;
384
+ }
385
386
+
387
auto session_it = req.headers.find("Mcp-Session-Id");
388
if (session_it == req.headers.end() || session_it->second.empty())
389
0 commit comments