File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,12 @@ import { metadataHandler } from './handlers/metadata.js';
77import { OAuthServerProvider } from './provider.js' ;
88import { OAuthMetadata , OAuthProtectedResourceMetadata } from '../../shared/auth.js' ;
99
10+ // Check for dev mode flag that allows HTTP issuer URLs (for development/testing only)
11+ const allowHttpForDev = process . env . MCP_ALLOW_HTTP_AUTH_FOR_DEV_UNSAFE === 'true' || process . env . MCP_ALLOW_HTTP_AUTH_FOR_DEV_UNSAFE === '1' ;
12+ if ( allowHttpForDev ) {
13+ console . warn ( 'MCP_ALLOW_HTTP_AUTH_FOR_DEV_UNSAFE is enabled - HTTP issuer URLs are allowed. Do not use in production.' ) ;
14+ }
15+
1016export type AuthRouterOptions = {
1117 /**
1218 * A provider implementing the actual authorization logic for this router.
@@ -55,9 +61,7 @@ export type AuthRouterOptions = {
5561
5662const checkIssuerUrl = ( issuer : URL ) : void => {
5763 // Technically RFC 8414 does not permit a localhost HTTPS exemption, but this will be necessary for ease of testing
58- // Also allow HTTP in development mode for testing with non-localhost URLs (e.g., Docker environments)
59- const devMode = process . env . MCP_DEV_MODE === 'true' || process . env . MCP_DEV_MODE === '1' ;
60- if ( issuer . protocol !== 'https:' && issuer . hostname !== 'localhost' && issuer . hostname !== '127.0.0.1' && ! devMode ) {
64+ if ( issuer . protocol !== 'https:' && issuer . hostname !== 'localhost' && issuer . hostname !== '127.0.0.1' && ! allowHttpForDev ) {
6165 throw new Error ( 'Issuer URL must be HTTPS' ) ;
6266 }
6367 if ( issuer . hash ) {
You can’t perform that action at this time.
0 commit comments