Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,14 @@ ALLOWED_ORIGINS=http://localhost:6274,http://localhost:8000 npm start

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

| Setting | Description | Default |
| --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| `MCP_SERVER_REQUEST_TIMEOUT` | Client-side timeout (ms) - Inspector will cancel the request if no response is received within this time. Note: servers may have their own timeouts | 300000 |
| `MCP_REQUEST_TIMEOUT_RESET_ON_PROGRESS` | Reset timeout on progress notifications | true |
| `MCP_REQUEST_MAX_TOTAL_TIMEOUT` | Maximum total timeout for requests sent to the MCP server (ms) (Use with progress notifications) | 60000 |
| `MCP_PROXY_FULL_ADDRESS` | Set this if you are running the MCP Inspector Proxy on a non-default address. Example: http://10.1.1.22:5577 | "" |
| `MCP_AUTO_OPEN_ENABLED` | Enable automatic browser opening when inspector starts (works with authentication enabled). Only as environment var, not configurable in browser. | true |
| Setting | Description | Default |
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------- |
| `MCP_SERVER_REQUEST_TIMEOUT` | Client-side timeout (ms) - Inspector will cancel the request if no response is received within this time. Note: servers may have their own timeouts | 300000 |
| `MCP_REQUEST_TIMEOUT_RESET_ON_PROGRESS` | Reset timeout on progress notifications | true |
| `MCP_REQUEST_MAX_TOTAL_TIMEOUT` | Maximum total timeout for requests sent to the MCP server (ms) (Use with progress notifications) | 60000 |
| `MCP_PROXY_FULL_ADDRESS` | Set this if you are running the MCP Inspector Proxy on a non-default address. Example: http://10.1.1.22:5577 | "" |
| `MCP_AUTO_OPEN_ENABLED` | Enable automatic browser opening when inspector starts (works with authentication enabled). Only as environment var, not configurable in browser. | true |
| `MCP_SERVER_ENDPOINT` | Default MCP server endpoint to connect to on startup. Transport type is auto-detected from path (`/sse` → SSE, `/mcp` → Streamable HTTP). Example: `http://localhost:8080/sse` | "" |

**Note on Timeouts:** The timeout settings above control when the Inspector (as an MCP client) will cancel requests. These are independent of any server-side timeouts. For example, if a server tool has a 10-minute timeout but the Inspector's timeout is set to 30 seconds, the Inspector will cancel the request after 30 seconds. Conversely, if the Inspector's timeout is 10 minutes but the server times out after 30 seconds, you'll receive the server's timeout error. For tools that require user interaction (like elicitation) or long-running operations, ensure the Inspector's timeout is set appropriately.

Expand Down
38 changes: 36 additions & 2 deletions server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,31 @@ const defaultEnvironment = {
...(process.env.MCP_ENV_VARS ? JSON.parse(process.env.MCP_ENV_VARS) : {}),
};

/**
* Detects the transport type from a server endpoint URL.
* - URLs ending with /sse -> "sse"
* - URLs ending with /mcp -> "streamable-http"
* - Otherwise -> "sse" (default fallback)
*/
const detectTransportFromEndpoint = (
endpoint: string,
): "sse" | "streamable-http" => {
try {
const url = new URL(endpoint);
if (url.pathname.endsWith("/sse")) {
return "sse";
} else if (url.pathname.endsWith("/mcp")) {
return "streamable-http";
}
} catch {
// Invalid URL, fall through to default
}
return "sse";
};

// Environment variable for default MCP server endpoint
const defaultServerEndpoint = process.env.MCP_SERVER_ENDPOINT;

const { values } = parseArgs({
args: process.argv.slice(2),
options: {
Expand Down Expand Up @@ -774,12 +799,21 @@ app.get("/health", (req, res) => {

app.get("/config", originValidationMiddleware, authMiddleware, (req, res) => {
try {
// Determine effective server URL and transport type
// CLI args take precedence over environment variables
const effectiveServerUrl = values["server-url"] || defaultServerEndpoint;
const effectiveTransport =
values.transport ||
(defaultServerEndpoint
? detectTransportFromEndpoint(defaultServerEndpoint)
: "");

res.json({
defaultEnvironment,
defaultCommand: values.command,
defaultArgs: values.args,
defaultTransport: values.transport,
defaultServerUrl: values["server-url"],
defaultTransport: effectiveTransport,
defaultServerUrl: effectiveServerUrl,
});
} catch (error) {
console.error("Error in /config route:", error);
Expand Down