chore: respect server settings from config (#502)

This commit is contained in:
Pavel Feldman
2025-05-30 18:17:51 -07:00
committed by GitHub
parent eec177d3ac
commit 656779531c
4 changed files with 37 additions and 11 deletions

View File

@@ -96,7 +96,7 @@ async function handleStreamable(server: Server, req: http.IncomingMessage, res:
res.end('Invalid request');
}
export function startHttpTransport(server: Server, port: number, hostname: string | undefined) {
export function startHttpTransport(server: Server) {
const sseSessions = new Map<string, SSEServerTransport>();
const streamableSessions = new Map<string, StreamableHTTPServerTransport>();
const httpServer = http.createServer(async (req, res) => {
@@ -106,7 +106,8 @@ export function startHttpTransport(server: Server, port: number, hostname: strin
else
await handleSSE(server, req, res, url, sseSessions);
});
httpServer.listen(port, hostname, () => {
const { host, port } = server.config.server;
httpServer.listen(port, host, () => {
const address = httpServer.address();
assert(address, 'Could not bind server socket');
let url: string;