Commit graph inspector/client/src/lib
Author SHA1 Message Date
Richard Michael
0d202ee47b Update client name during Elicitation test init 2025-08-22 10:28:50 -07:00
Richard Michael
f942df7e4c Consistent MCP Client() name from package
Make both clients use name from package.json for consistency and protocol clarity

 - web client changes `mcp-inspector` -> `inspector-client` (package.json)
 - cli client remains `inspector-cli` (package.json)
2025-08-22 10:28:50 -07:00
cliffhall
9dbd5cc85b * Remove handling of out-of-spec 'notification/stderr' messages. It's not a thing. See https://github.com/modelcontextprotocol/servers/pull/2469
* Inspect the stderr output of STDIO servers and attempt to assign an appropriate RFC 5424 Syslog Protocol level before sending a leveled logging message to the client
2025-08-21 18:01:29 -04:00
Jenn Newton
650f3090d2
fix: add validation for OAuth redirect URLs
- Create shared validateRedirectUrl utility to centralize URL validation
- Only allow HTTP and HTTPS protocols in OAuth authorization URLs
- Fix three vulnerable redirect paths that bypassed validation:
  - AuthDebugger.tsx: Direct window.location.href redirect
  - OAuthFlowProgress.tsx: window.open() without validation
  - OAuthFlowProgress.tsx: Direct anchor href attribute
- Add comprehensive test coverage for URL validation
- Update existing auth.ts to use shared validation utility

This prevents malicious MCP servers from injecting javascript: or data:
protocol URLs that would execute XSS attacks when users are redirected
to the authorization endpoint.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-20 10:08:20 -03:00
cliffhall
3adb1dd5c9 Prettier 2025-08-15 18:55:15 -04:00
cliffhall
5323d4d8f4 Fix connect button behavior for Oauth by making sure that scope is included in client metadata when client is registered.
- In auth.ts
    - in InspectorOAuthClientProvider constructor
      - add optional scope param
      - set instance var this.scope to scope param
    - in clientMetadata getter
      - add scope param set to this.scope or ""
  - in useConnection.ts
    - in handleAuthError handler
      - move instantiation of serverAuthProvider until after scope has been determined
      - pass scope to InspectorOAuthClientProvider constructor
2025-08-15 18:40:21 -04:00
cliffhall
94f44c7b57 Prettier 2025-08-15 17:19:27 -04:00
cliffhall
0831e812bb Align Quick OAuth Flow with Guided OAuth Flow behavior
- In oauth-state-machine.ts
  - in token_request transition
    - ensure resource is URL type, not string
    - this fixes Quick flow which was sending string, while guided was using proper URL type and working
2025-08-15 14:44:51 -04:00
Bobby Tiernay
739e0aaa68
fix: lint 2025-08-14 15:00:54 -04:00
Bobby Tiernay
74900fca5d
feat: unify OAuth scope discovery between automatic and manual flows
- Add shared discoverScopes function in auth.ts with resource metadata preference
- Update automatic flow (handleAuthError) to use dynamic scope discovery
- Update manual flow (OAuth state machine) to use shared scope discovery logic
- Add comprehensive test suite for discoverScopes function (11 test cases)
- Fix empty array handling to return undefined instead of empty string
- Maintain backward compatibility with existing oauthScope parameter
- All quality gates pass: TypeScript, linting, formatting, and tests

Resolves OAuth scope discovery inconsistency where automatic flow used static
scopes while manual flow used metadata scopes. Both flows now use identical
shared logic with proper resource metadata preference.
2025-08-14 14:02:29 -04:00
Felix Weinberger
36b9acc97e
fix: filter out client_secret when storing OAuth client information 2025-08-14 17:04:38 +01:00
Ola Hungerford
ddd06c207c
Merge branch 'main' into dcr-fallback-fix 2025-08-13 05:34:14 -07:00
Cliff Hall
b4d1bc71f6
Merge branch 'main' into main 2025-08-12 16:25:42 -04:00
cliffhall
0d8e8fce4b This fixes #610
* In useConnection.ts
  - During initialization, if there is an error immediately following the client sending 'logging/setLevel', pops up a toast with the message `Server declares logging capability but doesn't implement method "logging/setLevel"`
2025-08-12 15:26:15 -04:00
cliffhall
15b58c8142 This fixes #610
* In useConnection.ts
  - During initialization, if there is an error immediately following the client sending 'logging/setLevel', pops up a toast with the message `Server declares logging capability but doesn't implement method "logging/setLevel"`
2025-08-12 15:25:09 -04:00
superboy-zjc
d21e51e6ab fix(auth): sanitize authorization URL 2025-08-12 11:26:44 -07:00
Ola Hungerford
e604321024
Merge branch 'main' into debugger-auth-svr-metadata 2025-08-12 06:44:32 -07:00
2underscores
9ef2a6c22d Use new auth svr discovery method from latest auth SDK 2025-08-12 14:13:31 +10:00
2underscores
0b123acdac Static client attempt before DCR 2025-08-12 09:20:28 +10:00
Konstantin Konstantinov
60049a5b6c
reorder methods 2025-08-12 00:29:53 +03:00
Konstantin Konstantinov
929b930618
reusable generateOAuthState helper, introduce in InspectorOAuthClientProvider and in oauth-state-machine, add test 2025-08-11 21:24:26 +03:00
2underscores
37f634d651 rm console.log 2025-08-11 14:43:04 +10:00
2underscores
6a95056731 Refactor 2025-08-06 08:47:21 +10:00
2underscores
b99b3d29d9 Using static client data as DCR fallback 2025-08-06 08:34:34 +10:00
Ola Hungerford
816f6c2c4c
Merge branch 'main' into bugfix/authorization-url-generate-state 2025-07-31 18:41:24 -07:00
oleina
eec20ff1fc add missing close bracket 2025-07-31 10:20:47 -07:00
Ola Hungerford
94c75204fe
Merge branch 'main' into bugfix/authorization-url-generate-state 2025-07-26 20:41:35 -07:00
Ola Hungerford
e573e855f0
Merge branch 'main' into oleina/logging 2025-07-26 10:51:01 -07:00
Ola Hungerford
1ed920297f
Merge branch 'main' into oleina/logging 2025-07-26 09:43:20 -07:00
Ola Hungerford
f274a52612
Merge branch 'main' into feature/completion-context 2025-07-26 09:41:56 -07:00
Konstantin Konstantinov
8383714484
Merge branch 'main' into bugfix/authorization-url-generate-state 2025-07-25 15:28:04 +03:00
Cliff Hall
eda6c05ba1
Merge branch 'main' into feature/elicitations 2025-07-24 11:00:41 -04:00
Ola Hungerford
144755b369
Merge branch 'main' into feature/elicitations 2025-07-23 21:50:48 -07:00
Xiao Yijun
f6c9342678
test: update tests 2025-07-23 07:57:21 +08:00
Xiao Yijun
ee39d56e6d
chore: fix lint issue 2025-07-21 11:26:27 +08:00
oleina
7ce0938e27 run linter 2025-07-14 08:01:10 -07:00
Xiao Yijun
91aacba85d
Merge branch 'main' into feat-support-enter-oauth-client-information-manually 2025-07-14 17:24:38 +08:00
Konstantin Konstantinov
4ef85f744c
generate random state parameter in oauth state machine 2025-07-13 08:44:57 +03:00
Konstantin Konstantinov
1c8bf36ea2
generate random state parameter in oauth state machine 2025-07-13 08:42:46 +03:00
Dennis Geurts
e2de80fd84 feat: Removes prompt argument from completion state
This commit removes the prompt argument from the completion state.
The argument is deleted from the context after the completion is handled.
This prevents unexpected behavior and ensures a cleaner state.
2025-07-12 12:45:02 +02:00
Dennis Geurts
de474e5411 feat: Add context argument to completion handlers
This commit adds a `context` argument to the completion handlers in `PromptsTab`, `ResourcesTab`, `useCompletionState`, and `useConnection`.

The context argument allows passing additional information to the completion engine, which can be used to improve the quality of the completions.  The context is passed as a dictionary of key-value pairs.

The `ResourcesTab` component was also updated to pass `templateValues` as the `context` to the completion handler.

The `useConnection` hook was updated to include the context in the completion request sent to the server.
2025-07-12 12:42:21 +02:00
oleina
925d11a91d initalize logging for UI 2025-07-11 11:44:39 -07:00
Xiao Yijun
3b3205228f
refactor: remove resource config 2025-07-08 10:21:40 +08:00
Xiao Yijun
b8120d9f85
feat: support manual entry of OAuth client information 2025-07-08 09:41:55 +08:00
Ola Hungerford
e106194b40
Merge branch 'main' into completion-support-default 2025-07-07 05:00:52 -07:00
Alex Andru
19ff315dd1 Merge branch 'origin/main' into feature/elicitations
Resolved conflicts by adopting the improved form input handling from main:
- Standardized JsonSchemaType.required to only accept string arrays (JSON Schema standard)
- Adopted enhanced object and array rendering with proper nested support
- Improved boolean field rendering (removed extra wrapper div)
- Enhanced array handling with add/remove functionality
- Simplified required field validation logic

This maintains elicitation functionality while benefiting from the form input fixes.
2025-07-03 16:14:21 +02:00
Paul Carleton
5db64265ce
[auth] Add resource compatibility to debugger (RFC 8707) (#526)
* pass resource in auth debugger, reusing server url

* throw error on resource url mismatch to match regular auth flow

* lint & tests

* add test

* make authserver url make more sense

* use latest typescript sdk

* more lenient resource checking

* pick resource, and store in state

* fixing tests and types

* [auth] use sdk function for selecting resource (#537)

* use sdk function

* bump typescript sdk

* fix some tests
2025-06-23 16:39:07 +01:00
Alex Andru
dfbf10c575 test: elicitation handling 2025-06-19 17:39:24 +02:00
Alex Andru
e163aea0e0 feat: add elicitations to useConnection 2025-06-19 15:03:39 +02:00
Jerome
ef90c58882
Lint 2025-06-14 18:45:14 +01:00