You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add session token authentication to proxy server
- Generate random session token on server startup using crypto.randomBytes
- Add authentication middleware requiring Bearer token for all sensitive endpoints
- Apply auth to /mcp, /stdio, /sse, and /message endpoints
- Display session token in console on startup
- Add DANGEROUSLY_OMIT_AUTH environment variable to disable auth for development
- Update README with authentication documentation
This prevents unauthorized access to the proxy server's ability to execute
local processes and connect to MCP servers.
Copy file name to clipboardExpand all lines: README.md
+29Lines changed: 29 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -137,6 +137,35 @@ The inspector supports bearer token authentication for SSE connections. Enter yo
137
137
138
138
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.
139
139
140
+
#### Authentication
141
+
142
+
The MCP Inspector proxy server requires authentication by default. When starting the server, a random session token is generated and printed to the console:
This token must be included as a Bearer token in the Authorization header for all requests to the server.
152
+
153
+
**Option 1: Use the pre-filled URL** - Click the link shown in the console to open the inspector with the token already configured.
154
+
155
+
**Option 2: Manual configuration** - If you already have the inspector open:
156
+
157
+
1. Click the "Configuration" button in the sidebar
158
+
2. Find "Proxy Session Token" and enter the token displayed in the proxy console
159
+
3. Click "Save" to apply the configuration
160
+
161
+
The token will be saved in your browser's local storage for future use.
162
+
163
+
If you need to disable authentication (NOT RECOMMENDED), you can set the `DANGEROUSLY_OMIT_AUTH` environment variable:
164
+
165
+
```bash
166
+
DANGEROUSLY_OMIT_AUTH=true npm start
167
+
```
168
+
140
169
#### Local-only Binding
141
170
142
171
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:
0 commit comments