Skip to content
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

Add "Configuration" support in UI for configuring the request timeout (and more things in the future) #204

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

pulkitsharma07
Copy link

@pulkitsharma07 pulkitsharma07 commented Mar 22, 2025

Screen.Recording.2025-03-22.at.8.33.53.PM.mov

Fixes #142, removes support for setting timeout via search params (added as part of #164) , as that may not be intuitive to end users.

Motivation and Context

Same as #142,

How Has This Been Tested?

Tested locally by adding console.log statements when making a request in useConnection to a custom MCP server, was able to see the custom timeout value which was set manually in the UI, otherwise the default timeout of 10 seconds is used.

Breaking Changes

Removes support for setting the request timeout value via search param: timeout

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • [] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

@pulkitsharma07 pulkitsharma07 changed the title Add "Configuration" support in UI to configuring the request timeouts (and more things in the future) Add "Configuration" support in UI for configuring the request timeout (and more things in the future) Mar 22, 2025
@Cloud-Iris
Copy link

Yeah it is exactly what we need. Thanks for your work.🌹

@cyri113
Copy link

cyri113 commented Mar 26, 2025

Exactly what I was looking for 👍🏽 please merge!

Copy link
Collaborator

@olaservo olaservo left a comment

Choose a reason for hiding this comment

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

Thanks a lot for submitting this! Had some minor feedback.

@@ -19,6 +19,7 @@ export default tseslint.config(
},
rules: {
...reactHooks.configs.recommended.rules,
"react-hooks/rules-of-hooks": "off", // Disable hooks dependency order checking
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you add a little more to this comment to help explain the need to disable this?

Copy link
Author

Choose a reason for hiding this comment

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

I was getting a bunch of eslint warning in Cursor on opening the project for the first time. Particularly for these set of hooks, I believe that is happening because of this condition.

Let me know if I need to configure something in Cursor to avoid the warning.

Copy link
Contributor

Choose a reason for hiding this comment

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

I've been meaning to fix this. I have a fix working but need to test and will add a separate PR. We don't need to turn off rules of hooks.

Copy link
Contributor

@cliffhall cliffhall Mar 27, 2025

Choose a reason for hiding this comment

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

The problem is that there is a conditional at the top of the component that short circuits the rest of the component by returning suspense if the path is oauth/callback. All the subsequent hooks complain because hooks are supposed to be run in the same order every time. Sometimes hooks would run, but sometimes we'd render the component as a suspense, bypassing them.

FYI: Fix is to move the conditional to the bottom where the render happens.
Screenshot 2025-03-27 at 12 56 43 PM

I've raised #217 to address.

Copy link
Author

Choose a reason for hiding this comment

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

ack, will fix it and turn it back on this PR.

// OAuth-related session storage keys
export const SESSION_KEYS = {
CODE_VERIFIER: "mcp_code_verifier",
SERVER_URL: "mcp_server_url",
TOKENS: "mcp_tokens",
CLIENT_INFORMATION: "mcp_client_information",
} as const;

export const DEFAULT_INSPECTOR_CONFIG: InspectorConfig = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It could be helpful for future developers to add some clarification in the Readme (or elsewhere) to explain what types of configs belong in InspectorConfig. Assuming my take on this matches your intentions, maybe something like:

# Configuration
The MCP Inspector supports two types of configurations:
- **Client configurations** apply universally to all MCP server connections and are managed through the Configuration UI.  Example: `MCP_SERVER_REQUEST_TIMEOUT` controls timeout duration for MCP server requests.
- **Server-dependent settings** are managed through other dedicated UI controls or through the CLI. Examples include `args` and environment variables.

Basically I am trying to set the stage for the incoming PR that adds full config file support for servers.

Copy link
Author

Choose a reason for hiding this comment

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

I have gone through #177 and now I am thinking that we should have just a single config file (and remove the UI based configuration).
So the config file:

  • configures which MCP server to use
  • and client specific configurations (like request timeout, authentication, proxy, error handling in the future).

Wdyt ? I guess it depends on how people are using inspector, do they want to change config on the fly (via the UI) or they are okay changing the config file (and restarting inspector).

Personally, I am okay with a config file based approach, with nothing available in the UI. But not sure about other users, need your inputs here. Config file while need a restart and that can get rid of any "state" which MCP inspector had, so maybe we should go into UI direction ?

I think eventual solution would be to use config file as a base config, which is then overridden by the UI.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think having the UI for client configs is still a good idea based on what I've seen users mention before. Thanks for looking at #177 ! I'd like to get that rolled in soon since I think it will help a lot with more programmatic testing. Lets let other reviewers weigh in in case there are any other strong opinions.

Copy link
Author

Choose a reason for hiding this comment

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

Sure..

In terms of programmatic testing, I guess we will need a config file based approach for inspector config. I guess way forward is to get both PRs merged and then look into further improvements of combining them into a single config file.

Copy link
Contributor

@cliffhall cliffhall left a comment

Choose a reason for hiding this comment

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

Don't suppress rules of hooks. See comments. Will fully review when PR is ready to go again.

@@ -19,6 +19,7 @@ export default tseslint.config(
},
rules: {
...reactHooks.configs.recommended.rules,
"react-hooks/rules-of-hooks": "off", // Disable hooks dependency order checking
Copy link
Contributor

Choose a reason for hiding this comment

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

I've been meaning to fix this. I have a fix working but need to test and will add a separate PR. We don't need to turn off rules of hooks.

@@ -19,6 +19,7 @@ export default tseslint.config(
},
rules: {
...reactHooks.configs.recommended.rules,
"react-hooks/rules-of-hooks": "off", // Disable hooks dependency order checking
Copy link
Contributor

@cliffhall cliffhall Mar 27, 2025

Choose a reason for hiding this comment

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

The problem is that there is a conditional at the top of the component that short circuits the rest of the component by returning suspense if the path is oauth/callback. All the subsequent hooks complain because hooks are supposed to be run in the same order every time. Sometimes hooks would run, but sometimes we'd render the component as a suspense, bypassing them.

FYI: Fix is to move the conditional to the bottom where the render happens.
Screenshot 2025-03-27 at 12 56 43 PM

I've raised #217 to address.

@cliffhall cliffhall added enhancement New feature or request waiting on submitter Waiting for the submitter to provide more info labels Mar 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request waiting on submitter Waiting for the submitter to provide more info
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set longer request times for Inspector client
5 participants