Skip to content

Commit e8e9909

Browse files
fix: bind to localhost by default to prevent DNS rebinding attacks
- Change default binding from 0.0.0.0 (all interfaces) to 127.0.0.1 (localhost only) - Add HOST environment variable to override binding address when needed - Update console output to show actual binding address - Document security change in README with warnings about binding to all interfaces This prevents remote attackers from accessing the MCP Inspector proxy server, which has the ability to execute local processes. The proxy should only be accessible from the local machine unless explicitly configured otherwise.
1 parent 03edbb0 commit e8e9909

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,16 @@ The inspector supports bearer token authentication for SSE connections. Enter yo
137137

138138
The MCP Inspector includes a proxy server that can run and communicate with local MCP processes. The proxy server should not be exposed to untrusted networks as it has permissions to spawn local processes and can connect to any specified MCP server.
139139

140+
#### Local-only Binding
141+
142+
By default, the MCP Inspector proxy server binds only to `127.0.0.1` (localhost) to prevent network access. This ensures the server is not accessible from other devices on the network. If you need to bind to all interfaces for development purposes, you can override this with the `HOST` environment variable:
143+
144+
```bash
145+
HOST=0.0.0.0 npm start
146+
```
147+
148+
**Warning:** Only bind to all interfaces in trusted network environments, as this exposes the proxy server's ability to execute local processes.
149+
140150
### Configuration
141151

142152
The MCP Inspector supports the following configuration settings. To change them, click on the `Configuration` button in the MCP Inspector UI:

server/src/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,11 +415,12 @@ app.get("/config", (req, res) => {
415415
}
416416
});
417417

418-
const PORT = process.env.PORT || 6277;
418+
const PORT = parseInt(process.env.PORT || '6277', 10);
419+
const HOST = process.env.HOST || '127.0.0.1';
419420

420-
const server = app.listen(PORT);
421+
const server = app.listen(PORT, HOST);
421422
server.on("listening", () => {
422-
console.log(`⚙️ Proxy server listening on port ${PORT}`);
423+
console.log(`⚙️ Proxy server listening on ${HOST}:${PORT}`);
423424
});
424425
server.on("error", (err) => {
425426
if (err.message.includes(`EADDRINUSE`)) {

0 commit comments

Comments
 (0)