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';
11
11
import { OAuthMetadata } from 'src/shared/auth.js' ;
12
12
import { checkResourceAllowed } from 'src/shared/auth-utils.js' ;
13
13
14
+ import cors from 'cors' ;
15
+
14
16
// Check for OAuth flag
15
17
const useOAuth = process . argv . includes ( '--oauth' ) ;
16
18
const strictOAuth = process . argv . includes ( '--oauth-strict' ) ;
@@ -420,12 +422,18 @@ const getServer = () => {
420
422
return server ;
421
423
} ;
422
424
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 ;
425
427
426
428
const app = express ( ) ;
427
429
app . use ( express . json ( ) ) ;
428
430
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
+
429
437
// Set up OAuth if enabled
430
438
let authMiddleware = null ;
431
439
if ( useOAuth ) {
You can’t perform that action at this time.
0 commit comments