Skip to content

Commit c934d82

Browse files
committed
chore: warn about insecure httpHost usage
1 parent 76aa332 commit c934d82

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/common/logger.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export const LogId = {
5656
streamableHttpTransportCloseFailure: mongoLogId(1_006_006),
5757
streamableHttpTransportKeepAliveFailure: mongoLogId(1_006_007),
5858
streamableHttpTransportKeepAlive: mongoLogId(1_006_008),
59+
streamableHttpTransportHttpHostWarning: mongoLogId(1_006_009),
5960

6061
exportCleanupError: mongoLogId(1_007_001),
6162
exportCreationError: mongoLogId(1_007_002),

src/transports/streamableHttp.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,17 @@ export class StreamableHttpRunner extends TransportRunnerBase {
205205
message: `Server started on ${this.serverAddress}`,
206206
noRedaction: true,
207207
});
208+
209+
if (this.userConfig.httpHost === "0.0.0.0") {
210+
this.logger.warning({
211+
id: LogId.streamableHttpTransportHttpHostWarning,
212+
context: "streamableHttpTransport",
213+
message: `Binding to \`0.0.0.0\` exposes the MCP Server to the entire local
214+
network, which allows other devices on the same network to
215+
potentially access the MCP Server. This is a security risk and could
216+
allow unauthorized access to your database context. `,
217+
});
218+
}
208219
}
209220

210221
async closeTransport(): Promise<void> {

0 commit comments

Comments
 (0)