File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ import { setupAuthServer } from './demoInMemoryOAuthProvider.js';
1111import { OAuthMetadata } from 'src/shared/auth.js' ;
1212import { checkResourceAllowed } from 'src/shared/auth-utils.js' ;
1313
14+ import cors from 'cors' ;
15+
1416// Check for OAuth flag
1517const useOAuth = process . argv . includes ( '--oauth' ) ;
1618const strictOAuth = process . argv . includes ( '--oauth-strict' ) ;
@@ -420,12 +422,18 @@ const getServer = () => {
420422 return server ;
421423} ;
422424
423- const MCP_PORT = 3000 ;
424- const AUTH_PORT = 3001 ;
425+ const MCP_PORT = process . env . MCP_PORT ? parseInt ( process . env . MCP_PORT , 10 ) : 3000 ;
426+ const AUTH_PORT = process . env . MCP_AUTH_PORT ? parseInt ( process . env . MCP_AUTH_PORT , 10 ) : 3001 ;
425427
426428const app = express ( ) ;
427429app . use ( express . json ( ) ) ;
428430
431+ // Allow CORS all domains, expose the Mcp-Session-Id header
432+ app . use ( cors ( {
433+ origin : '*' , // Allow all origins
434+ exposedHeaders : [ "Mcp-Session-Id" ]
435+ } ) ) ;
436+
429437// Set up OAuth if enabled
430438let authMiddleware = null ;
431439if ( useOAuth ) {
You can’t perform that action at this time.
0 commit comments