Commit graph inspector/client/src/utils
Author SHA1 Message Date
Cliff Hall
54484e7e8e
Merge branch 'main' into fix-default-null-array-input 2025-10-30 12:04:47 -04:00
cliffhall
37acee9283 Handle nullable arrays in tool inputSchemas
* In DynamicJsonForm.tsx
  - In debouncedUpdateParent, formatJson, and validateJson,
    - when trimming the JSON value, use ?.trim() in case the field is null

* In jsonUtils.ts
  - in tryParseJson
    - use ?.trim() in case the field is null

* In schemaUtils.ts
  - in normalizeUnionType
    - add condition to handle the case where there is an anyOf with array or null as options

* In ToolsTab.tsx
  - for nullable fields, in null checkbox, in onCheckedChange handler
    - when not checked, if prop type is array, set to undefined (empty input field that can be edited rather than the word "null" as the default could provide

Fixes #846
2025-10-29 14:28:49 -04:00
yanOO1497
fb7fae1436 fix: resolve $ref references in tool input schema properties 2025-10-25 17:02:25 +08:00
olaservo
541a59f1fe Add test to explicitly reproduce issue #846 regression
This test verifies that tools with multiple nullable parameters
(default: null) work correctly. In v0.17.0, cleanParams would
incorrectly remove these null values, breaking tool execution.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-18 21:20:33 -07:00
olaservo
8367ef242b Merge remote-tracking branch 'upstream/main' into issue-846 2025-10-12 20:25:58 -07:00
Greg Saab
9e74437dab update specs 2025-10-08 12:34:13 -04:00
Greg Saab
3fd0feb75a if a field is nullable, provide a means of specifying null 2025-10-08 12:22:47 -04:00
olaservo
0123a71da4 Add input validation guidelines and enhance cleanParams function to preserve default values 2025-10-08 08:43:11 -07:00
olaservo
a11ee99818 Update ToolsTab tests to require JSON fields and adjust default value generation for optional types 2025-09-27 21:17:17 -07:00
olaservo
48fd23064c Remove unused function 2025-09-27 20:39:11 -07:00
olaservo
45a1bde010 Refactor ToolsTab to handle cleared fields as undefined instead of empty strings; update tests for new behavior 2025-09-27 20:21:03 -07:00
olaservo
2846e179a3 Fix formatting with Prettier
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 07:06:31 -07:00
olaservo
754c97956f Omit optional fields with empty strings from tool calls 2025-09-24 07:01:04 -07:00
Max Gerber
71583caf3b
fix: correct authState.authorizationUrl type to URL 2025-09-05 18:40:48 -07:00
Ola Hungerford
73873e2b77
Merge branch 'main' into docs/utils-jsdoc 2025-08-27 20:13:01 -07:00
Jenn Newton
a018a6d758
Apply Prettier formatting
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-21 15:41:33 +00: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
Raghunath Prabhakar
85c86de61e chore: add jsdoc comments to utils 2025-08-13 14:14:32 -05: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
Mats Julius Funke
d4f8e061f3
ci: added tests for the union type 2025-08-03 10:34:40 +02:00
Mats Julius Funke
1d960a1b9a
fix: added explicit handling for float & int 2025-08-03 10:34:19 +02:00
Mats Julius Funke
5469993e27
fix: add boolean union type support for FastMCP optional booleans 2025-08-02 16:35:42 +02:00
Mats Julius Funke
f73d8e6f8a
fix: support FastMCP union types in tool parameter forms 2025-08-02 15:59:45 +02:00
Alex Andru
3a121bc8fc fix: support JSON Schema spec compliant oneOf with const for labeled enums
- Make JsonSchemaType.type optional to support const-only schemas
- Add JsonSchemaConst type for schema objects using const values
- Update oneOf/anyOf to accept both full schemas and const schemas
- Add comprehensive tests for oneOf with const and title patterns

This fixes TypeScript compilation errors when using the JSON Schema
specification's recommended approach for labeled enums:
{ "type": "string", "oneOf": [{ "const": "red", "title": "Stop" }] }

Replaces deprecated enumNames pattern with spec-compliant implementation.
2025-07-04 19:39:03 +02: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
Sebastian Ko
85575de690
Merge branch 'main' into sebastian/patch-remove-addition-slash 2025-07-02 03:17:50 -04:00
Cliff Hall
6a8c831308
Merge pull request #480 from olaservo/fix-required
Fix fundamental schema issue with required fields defined incorrectly on JsonSchemaType
2025-06-27 14:09:10 -04:00
Felix Weinberger
9fcfd89326
fix: pass proxy port via URL params when non-default
- Update client to read MCP_PROXY_PORT from URL parameters
- Update server to include port in displayed URL when non-default
- Update start scripts to pass SERVER_PORT to client
- Use DEFAULT_MCP_PROXY_LISTEN_PORT constant instead of magic numbers

This fixes the issue where the client couldn't connect to the proxy
when SERVER_PORT was set to a non-default value.
2025-06-26 10:52:49 +01:00
Sebastian Ko
7dc7b09cd4
Change var to let 2025-06-25 00:45:03 -04:00
Ola Hungerford
95975c58e7
Merge branch 'main' into fix-required 2025-06-24 21:35:27 -07:00
Alex Andru
6c809bdab6 test: new elicitation format for jsonUtils 2025-06-19 17:39:24 +02:00
Alex Andru
fc939ebeb0 feat: add elicitation support to jsonUtils 2025-06-19 17:39:24 +02:00
Sebastian Ko
5710318f45
Merge branch 'main' into sebastian/patch-remove-addition-slash 2025-06-15 21:25:34 -04:00
Sebastian Ko
03e21bd3e4
Move remove slashes logic to getMCPProxyAddress 2025-06-15 21:25:01 -04:00
Jerome
760c7e4056
fix: replace require() imports with ES modules in tests
- Replaced all require() imports with proper ES module imports
- Fixed ESLint @typescript-eslint/no-require-imports errors
- Removed unused variable mockGetMCPProxyAddress
- Added proper TypeScript types instead of 'any'
- All tests passing and linting clean

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-14 18:11:16 +01:00
Jerome
62402b49c4
test: add tests for proxy auth header in config endpoint
- Added tests for App.tsx config endpoint to verify X-MCP-Proxy-Auth header usage
- Added tests for getMCPProxyAuthToken utility function
- Tests cover:
  - Sending correct proxy auth header when token is configured
  - Not sending header when token is empty
  - Using custom header names (for future flexibility)
  - Handling config endpoint errors gracefully
- All tests passing

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-14 18:01:10 +01:00
Felix Weinberger
ab062d8f9d
refactor: implement split storage for inspector config
- Add is_session_item field to ConfigItem type to control storage location
- Store auth tokens in sessionStorage (cleared on browser close)
- Store other settings in localStorage (persist between sessions)
- Maintain backward compatibility with existing config structure

This provides better security for auth tokens while preserving user
preferences across browser sessions.
2025-06-11 14:42:40 +01:00
olaservo
2fb5d4b684 Fix formatting 2025-06-10 21:29:08 -07:00
olaservo
a2061a6f76 Add check to fix build failure 2025-06-10 21:27:54 -07:00
olaservo
123a462681 Fix formatting 2025-06-10 21:23:04 -07:00
Ola Hungerford
cf2778ad19
Update client/src/utils/schemaUtils.ts
Co-authored-by: Cliff Hall <cliff@futurescale.com>
2025-06-10 21:21:51 -07:00
Ola Hungerford
51eb7cf849
Update client/src/utils/schemaUtils.ts
Co-authored-by: Cliff Hall <cliff@futurescale.com>
2025-06-10 21:21:43 -07:00
Felix Weinberger
908d0ee36a
feat: add client support for proxy authentication
- Add MCP_PROXY_AUTH_TOKEN configuration field to store session token
- Update useConnection hook to include proxy auth token in all requests
- Add separate proxy auth headers to avoid conflicts with MCP server auth
- Add specific error handling for proxy authentication failures
- Show helpful toast message directing users to Configuration settings
- Update README with instructions for configuring token in UI

The client now properly authenticates with the proxy server using the
session token displayed in the proxy console.
2025-06-10 18:16:32 +01:00
olaservo
e5e2edc4a1 Fix formatting 2025-06-01 16:11:20 -07:00
olaservo
06af321530 Fix tests 2025-06-01 16:07:45 -07:00
olaservo
990bc0f7fd Fix formatting 2025-06-01 15:41:30 -07:00
olaservo
b555e41c0b Address the schema architecture crisis 2025-06-01 09:03:02 -07:00
Basil Hosmer
d8a2821344
refactor: Address PR comments
- Extract tool results rendering into separate ToolResults component
- Hoist checkContentCompatibility function to module level following codebase conventions
- Add ajv@6.12.6 as direct dependency to client package.json
- All tests pass and linting is clean

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-28 22:18:19 -04:00
Basil Hosmer
5a628c7a00
fix: Fix lint errors
- Remove unused catch parameter in ToolsTab.tsx
- Replace 'as any' with @ts-expect-error in test for invalid schema

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-28 15:24:40 -04:00
Basil Hosmer
b184654ee5
style: Apply Prettier formatting to structured output code
Applied consistent formatting to ToolsTab.tsx and schemaUtils.ts
to fix linting issues. No functional changes.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-28 15:24:40 -04:00