<IfModule mod_rewrite.c>
RewriteEngine On

# >>> MCP .well-known BEGIN /project >>>
# AUTO-GENERATED by RemoteData/Mcp/Config — do not edit inside the markers.
# @see https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization

# OAuth 2.0 / MCP .well-known discovery metadata
RewriteRule ^\.well-known/oauth-protected-resource/project/RemoteData/Mcp$ /project/disp.php?module=RemoteData/Mcp&action=oauthProtectedResource [L,QSA]
RewriteRule ^\.well-known/oauth-authorization-server/project/Authenticate/OAuth2$ /project/disp.php?module=RemoteData/Mcp&action=oauthAuthorizationServer [L,QSA]

# OAuth 2.0 server endpoints (issuer/authorize, /token, /register)
RewriteRule ^project/Authenticate/OAuth2/authorize$ /project/disp.php?module=Authenticate/OAuth2&action=authorize [L,QSA]
RewriteRule ^project/Authenticate/OAuth2/token$ /project/disp.php?module=Authenticate/OAuth2&action=token [L,QSA]
RewriteRule ^project/Authenticate/OAuth2/register$ /project/disp.php?module=Authenticate/OAuth2&action=register [L,QSA]

# MCP endpoint — clean alias (…/mcp) mapped straight to the dispatcher. It is not a real
# directory, so BOTH the no-slash and trailing-slash forms are matched here (there is no
# mod_dir/DirectoryIndex to serve either), and no 301 redirect is ever emitted.
RewriteRule ^project/RemoteData/Mcp(/index\.php)?/?$ /project/disp.php?module=RemoteData/Mcp&action=index [L,QSA]
# <<< MCP .well-known END /project <<<
</IfModule>
