Skip to content

add default MCP server URL on startup #288

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ The MCP Inspector supports the following configuration settings. To change them,
| `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_SERVER_URL` | Set this to configure the default MCP Server to connect to on startup. Example: http://localhost:8080 | "" |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • It would be nice if this could be MCP_SERVER_BASE_URL, and keep the example http://localhost:8080.
  • You would need to add /sse to it in the UI before passing it to the sidebar.
  • Otherwise, this needs to be the full url to an endpoint, not just the server and port.
  • Note soon the /sse part will need to become /mcp.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about just changing the example? It's likely that people want to change the endpoint as well for example my.domain.com/prefix/sse


These settings can be adjusted in real-time through the UI and will persist across sessions.

Expand Down
4 changes: 4 additions & 0 deletions client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ const App = () => {
if (data.defaultArgs) {
setArgs(data.defaultArgs);
}
if (data.defaultMcpServerUrl) {
setSseUrl(data.defaultMcpServerUrl);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is to be the full endpoint and not just the location and port of the server, we should look at the path and see if it is /sse or /mcp and set the transport type accordingly.

setTransportType("sse");
}
})
.catch((error) =>
console.error("Error fetching default environment:", error),
Expand Down
2 changes: 2 additions & 0 deletions server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const defaultEnvironment = {
...getDefaultEnvironment(),
...(process.env.MCP_ENV_VARS ? JSON.parse(process.env.MCP_ENV_VARS) : {}),
};
const defaultMcpServerUrl = process.env.MCP_SERVER_URL;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably this environment variable should be MCP_SERVER_ENDPOINT to avoid any confusion.


const { values } = parseArgs({
args: process.argv.slice(2),
Expand Down Expand Up @@ -185,6 +186,7 @@ app.get("/config", (req, res) => {
defaultEnvironment,
defaultCommand: values.env,
defaultArgs: values.args,
defaultMcpServerUrl,
});
} catch (error) {
console.error("Error in /config route:", error);
Expand Down