Skip to main content
Glama
cbcoutinho

Nextcloud MCP Server

by cbcoutinho
cors-bearer-token.patch1.06 kB
diff --git a/lib/private/AppFramework/Middleware/Security/CORSMiddleware.php b/lib/private/AppFramework/Middleware/Security/CORSMiddleware.php index 4453f5a7d4b..f1ca9b48d21 100644 --- a/lib/private/AppFramework/Middleware/Security/CORSMiddleware.php +++ b/lib/private/AppFramework/Middleware/Security/CORSMiddleware.php @@ -73,6 +73,13 @@ class CORSMiddleware extends Middleware { $user = array_key_exists('PHP_AUTH_USER', $this->request->server) ? $this->request->server['PHP_AUTH_USER'] : null; $pass = array_key_exists('PHP_AUTH_PW', $this->request->server) ? $this->request->server['PHP_AUTH_PW'] : null; + // Allow Bearer token authentication for CORS requests + // Bearer tokens are stateless and don't require CSRF protection + $authorizationHeader = $this->request->getHeader('Authorization'); + if (!empty($authorizationHeader) && str_starts_with($authorizationHeader, 'Bearer ')) { + return; + } + // Allow to use the current session if a CSRF token is provided if ($this->request->passesCSRFCheck()) { return;

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cbcoutinho/nextcloud-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server