Skip to content

Commit 6ebe947

Browse files
committed
add MCP_OAUTH_HOST env var
1 parent bf6af2e commit 6ebe947

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/examples/server/simpleStreamableHttp.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,8 +537,9 @@ app.use(
537537
let authMiddleware = null;
538538
if (useOAuth) {
539539
// Create auth middleware for MCP endpoints
540-
const mcpServerUrl = new URL(`http://localhost:${MCP_PORT}/mcp`);
541-
const authServerUrl = new URL(`http://localhost:${AUTH_PORT}`);
540+
const hostname = process.env.MCP_OAUTH_HOST || 'localhost';
541+
const mcpServerUrl = new URL(`http://${hostname}:${MCP_PORT}/mcp`);
542+
const authServerUrl = new URL(`http://${hostname}:${AUTH_PORT}`);
542543

543544
const oauthMetadata: OAuthMetadata = setupAuthServer({ authServerUrl, mcpServerUrl, strictResource: strictOAuth });
544545

0 commit comments

Comments
 (0)