diff --git a/.github/workflows/cli_tests.yml b/.github/workflows/cli_tests.yml index 8bd3bb8ec..9fe2f710f 100644 --- a/.github/workflows/cli_tests.yml +++ b/.github/workflows/cli_tests.yml @@ -28,11 +28,13 @@ jobs: cd .. npm ci --ignore-scripts - - name: Build CLI - run: npm run build + - name: Build shared package + working-directory: . + run: npm run build-shared - - name: Explicitly pre-install test dependencies - run: npx -y @modelcontextprotocol/server-everything --help || true + - name: Build CLI + working-directory: . + run: npm run build-cli - name: Run tests run: npm test diff --git a/.gitignore b/.gitignore index 230d72d41..05d4978cb 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,8 @@ client/dist client/tsconfig.app.tsbuildinfo client/tsconfig.node.tsbuildinfo cli/build +tui/build +shared/build test-output tool-test-output metadata-test-output diff --git a/cli/__tests__/README.md b/cli/__tests__/README.md new file mode 100644 index 000000000..dd3f5ccca --- /dev/null +++ b/cli/__tests__/README.md @@ -0,0 +1,44 @@ +# CLI Tests + +## Running Tests + +```bash +# Run all tests +npm test + +# Run in watch mode (useful for test file changes; won't work on CLI source changes without rebuild) +npm run test:watch + +# Run specific test file +npm run test:cli # cli.test.ts +npm run test:cli-tools # tools.test.ts +npm run test:cli-headers # headers.test.ts +npm run test:cli-metadata # metadata.test.ts +``` + +## Test Files + +- `cli.test.ts` - Basic CLI functionality: CLI mode, environment variables, config files, resources, prompts, logging, transport types +- `tools.test.ts` - Tool-related tests: Tool discovery, JSON argument parsing, error handling, prompts +- `headers.test.ts` - Header parsing and validation +- `metadata.test.ts` - Metadata functionality: General metadata, tool-specific metadata, parsing, merging, validation + +## Helpers + +The `helpers/` directory contains shared utilities: + +- `cli-runner.ts` - Spawns CLI as subprocess and captures output +- `test-mcp-server.ts` - Standalone stdio MCP server script for stdio transport testing +- `instrumented-server.ts` - In-process MCP test server for HTTP/SSE transports with request recording +- `assertions.ts` - Custom assertion helpers for CLI output validation +- `fixtures.ts` - Test config file generators and temporary directory management + +## Notes + +- Tests run in parallel across files (Vitest default) +- Tests within a file run sequentially (we have isolated config files and ports, so we could get more aggressive if desired) +- Config files use `crypto.randomUUID()` for uniqueness in parallel execution +- HTTP/SSE servers use dynamic port allocation to avoid conflicts +- Coverage is not used because much of the code that we want to measure is run by a spawned process, so it can't be tracked by Vitest +- /sample-config.json is no longer used by tests - not clear if this file serves some other purpose so leaving it for now +- All tests now use built-in MCP test servers, there are no external dependencies on servers from a registry diff --git a/cli/__tests__/cli.test.ts b/cli/__tests__/cli.test.ts new file mode 100644 index 000000000..c8d6d862e --- /dev/null +++ b/cli/__tests__/cli.test.ts @@ -0,0 +1,871 @@ +import { describe, it, beforeAll, afterAll, expect } from "vitest"; +import { runCli } from "./helpers/cli-runner.js"; +import { + expectCliSuccess, + expectCliFailure, + expectValidJson, +} from "./helpers/assertions.js"; +import { + NO_SERVER_SENTINEL, + createSampleTestConfig, + createTestConfig, + createInvalidConfig, + deleteConfigFile, +} from "./helpers/fixtures.js"; +import { getTestMcpServerCommand } from "../../shared/test/test-server-stdio.js"; +import { createTestServerHttp } from "../../shared/test/test-server-http.js"; +import { + createEchoTool, + createTestServerInfo, +} from "../../shared/test/test-server-fixtures.js"; + +describe("CLI Tests", () => { + describe("Basic CLI Mode", () => { + it("should execute tools/list successfully", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "--cli", + "--method", + "tools/list", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("tools"); + expect(Array.isArray(json.tools)).toBe(true); + + // Validate expected tools from test-mcp-server + const toolNames = json.tools.map((tool: any) => tool.name); + expect(toolNames).toContain("echo"); + expect(toolNames).toContain("get-sum"); + expect(toolNames).toContain("get-annotated-message"); + }); + + it("should fail with nonexistent method", async () => { + const result = await runCli([ + NO_SERVER_SENTINEL, + "--cli", + "--method", + "nonexistent/method", + ]); + + expectCliFailure(result); + }); + + it("should fail without method", async () => { + const result = await runCli([NO_SERVER_SENTINEL, "--cli"]); + + expectCliFailure(result); + }); + }); + + describe("Environment Variables", () => { + it("should accept environment variables", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "-e", + "KEY1=value1", + "-e", + "KEY2=value2", + "--cli", + "--method", + "resources/read", + "--uri", + "test://env", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("contents"); + expect(Array.isArray(json.contents)).toBe(true); + expect(json.contents.length).toBeGreaterThan(0); + + // Parse the env vars from the resource + const envVars = JSON.parse(json.contents[0].text); + expect(envVars.KEY1).toBe("value1"); + expect(envVars.KEY2).toBe("value2"); + }); + + it("should reject invalid environment variable format", async () => { + const result = await runCli([ + NO_SERVER_SENTINEL, + "-e", + "INVALID_FORMAT", + "--cli", + "--method", + "tools/list", + ]); + + expectCliFailure(result); + }); + + it("should handle environment variable with equals sign in value", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "-e", + "API_KEY=abc123=xyz789==", + "--cli", + "--method", + "resources/read", + "--uri", + "test://env", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + const envVars = JSON.parse(json.contents[0].text); + expect(envVars.API_KEY).toBe("abc123=xyz789=="); + }); + + it("should handle environment variable with base64-encoded value", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "-e", + "JWT_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0=", + "--cli", + "--method", + "resources/read", + "--uri", + "test://env", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + const envVars = JSON.parse(json.contents[0].text); + expect(envVars.JWT_TOKEN).toBe( + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0=", + ); + }); + }); + + describe("Config File", () => { + it("should use config file with CLI mode", async () => { + const configPath = createSampleTestConfig(); + try { + const result = await runCli([ + "--config", + configPath, + "--server", + "test-stdio", + "--cli", + "--method", + "tools/list", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("tools"); + expect(Array.isArray(json.tools)).toBe(true); + expect(json.tools.length).toBeGreaterThan(0); + } finally { + deleteConfigFile(configPath); + } + }); + + it("should fail when using config file without server name", async () => { + const configPath = createSampleTestConfig(); + try { + const result = await runCli([ + "--config", + configPath, + "--cli", + "--method", + "tools/list", + ]); + + expectCliFailure(result); + } finally { + deleteConfigFile(configPath); + } + }); + + it("should fail when using server name without config file", async () => { + const result = await runCli([ + "--server", + "test-stdio", + "--cli", + "--method", + "tools/list", + ]); + + expectCliFailure(result); + }); + + it("should fail with nonexistent config file", async () => { + const result = await runCli([ + "--config", + "./nonexistent-config.json", + "--server", + "test-stdio", + "--cli", + "--method", + "tools/list", + ]); + + expectCliFailure(result); + }); + + it("should fail with invalid config file format", async () => { + // Create invalid config temporarily + const invalidConfigPath = createInvalidConfig(); + try { + const result = await runCli([ + "--config", + invalidConfigPath, + "--server", + "test-stdio", + "--cli", + "--method", + "tools/list", + ]); + + expectCliFailure(result); + } finally { + deleteConfigFile(invalidConfigPath); + } + }); + + it("should fail with nonexistent server in config", async () => { + const configPath = createSampleTestConfig(); + try { + const result = await runCli([ + "--config", + configPath, + "--server", + "nonexistent", + "--cli", + "--method", + "tools/list", + ]); + + expectCliFailure(result); + } finally { + deleteConfigFile(configPath); + } + }); + }); + + describe("Resource Options", () => { + it("should read resource with URI", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "--cli", + "--method", + "resources/read", + "--uri", + "demo://resource/static/document/architecture.md", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("contents"); + expect(Array.isArray(json.contents)).toBe(true); + expect(json.contents.length).toBeGreaterThan(0); + expect(json.contents[0]).toHaveProperty( + "uri", + "demo://resource/static/document/architecture.md", + ); + expect(json.contents[0]).toHaveProperty("mimeType", "text/markdown"); + expect(json.contents[0]).toHaveProperty("text"); + expect(json.contents[0].text).toContain("Architecture Documentation"); + }); + + it("should fail when reading resource without URI", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "--cli", + "--method", + "resources/read", + ]); + + expectCliFailure(result); + }); + }); + + describe("Prompt Options", () => { + it("should get prompt by name", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "--cli", + "--method", + "prompts/get", + "--prompt-name", + "simple-prompt", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("messages"); + expect(Array.isArray(json.messages)).toBe(true); + expect(json.messages.length).toBeGreaterThan(0); + expect(json.messages[0]).toHaveProperty("role", "user"); + expect(json.messages[0]).toHaveProperty("content"); + expect(json.messages[0].content).toHaveProperty("type", "text"); + expect(json.messages[0].content.text).toBe( + "This is a simple prompt for testing purposes.", + ); + }); + + it("should get prompt with arguments", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "--cli", + "--method", + "prompts/get", + "--prompt-name", + "args-prompt", + "--prompt-args", + "city=New York", + "state=NY", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("messages"); + expect(Array.isArray(json.messages)).toBe(true); + expect(json.messages.length).toBeGreaterThan(0); + expect(json.messages[0]).toHaveProperty("role", "user"); + expect(json.messages[0]).toHaveProperty("content"); + expect(json.messages[0].content).toHaveProperty("type", "text"); + // Verify that the arguments were actually used in the response + expect(json.messages[0].content.text).toContain("city=New York"); + expect(json.messages[0].content.text).toContain("state=NY"); + }); + + it("should fail when getting prompt without name", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "--cli", + "--method", + "prompts/get", + ]); + + expectCliFailure(result); + }); + }); + + describe("Logging Options", () => { + it("should set log level", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + logging: true, + }); + + try { + const port = await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--cli", + "--method", + "logging/setLevel", + "--log-level", + "debug", + "--transport", + "http", + ]); + + expectCliSuccess(result); + // Validate the response - logging/setLevel should return an empty result + const json = expectValidJson(result); + expect(json).toEqual({}); + + // Validate that the server actually received and recorded the log level + expect(server.getCurrentLogLevel()).toBe("debug"); + } finally { + await server.stop(); + } + }); + + it("should reject invalid log level", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "--cli", + "--method", + "logging/setLevel", + "--log-level", + "invalid", + ]); + + expectCliFailure(result); + }); + }); + + describe("Combined Options", () => { + it("should handle config file with environment variables", async () => { + const configPath = createSampleTestConfig(); + try { + const result = await runCli([ + "--config", + configPath, + "--server", + "test-stdio", + "-e", + "CLI_ENV_VAR=cli_value", + "--cli", + "--method", + "resources/read", + "--uri", + "test://env", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("contents"); + expect(Array.isArray(json.contents)).toBe(true); + expect(json.contents.length).toBeGreaterThan(0); + + // Parse the env vars from the resource + const envVars = JSON.parse(json.contents[0].text); + expect(envVars).toHaveProperty("CLI_ENV_VAR"); + expect(envVars.CLI_ENV_VAR).toBe("cli_value"); + } finally { + deleteConfigFile(configPath); + } + }); + + it("should handle all options together", async () => { + const configPath = createSampleTestConfig(); + try { + const result = await runCli([ + "--config", + configPath, + "--server", + "test-stdio", + "-e", + "CLI_ENV_VAR=cli_value", + "--cli", + "--method", + "tools/call", + "--tool-name", + "echo", + "--tool-arg", + "message=Hello", + "--log-level", + "debug", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("content"); + expect(Array.isArray(json.content)).toBe(true); + expect(json.content.length).toBeGreaterThan(0); + expect(json.content[0]).toHaveProperty("type", "text"); + expect(json.content[0].text).toBe("Echo: Hello"); + } finally { + deleteConfigFile(configPath); + } + }); + }); + + describe("Config Transport Types", () => { + it("should work with stdio transport type", async () => { + const { command, args } = getTestMcpServerCommand(); + const configPath = createTestConfig({ + mcpServers: { + "test-stdio": { + type: "stdio", + command, + args, + env: { + TEST_ENV: "test-value", + }, + }, + }, + }); + try { + // First validate tools/list works + const toolsResult = await runCli([ + "--config", + configPath, + "--server", + "test-stdio", + "--cli", + "--method", + "tools/list", + ]); + + expectCliSuccess(toolsResult); + const toolsJson = expectValidJson(toolsResult); + expect(toolsJson).toHaveProperty("tools"); + expect(Array.isArray(toolsJson.tools)).toBe(true); + expect(toolsJson.tools.length).toBeGreaterThan(0); + + // Then validate env vars from config are passed to server + const envResult = await runCli([ + "--config", + configPath, + "--server", + "test-stdio", + "--cli", + "--method", + "resources/read", + "--uri", + "test://env", + ]); + + expectCliSuccess(envResult); + const envJson = expectValidJson(envResult); + const envVars = JSON.parse(envJson.contents[0].text); + expect(envVars).toHaveProperty("TEST_ENV"); + expect(envVars.TEST_ENV).toBe("test-value"); + } finally { + deleteConfigFile(configPath); + } + }); + + it("should fail with SSE transport type in CLI mode (connection error)", async () => { + const configPath = createTestConfig({ + mcpServers: { + "test-sse": { + type: "sse", + url: "http://localhost:3000/sse", + note: "Test SSE server", + }, + }, + }); + try { + const result = await runCli([ + "--config", + configPath, + "--server", + "test-sse", + "--cli", + "--method", + "tools/list", + ]); + + expectCliFailure(result); + } finally { + deleteConfigFile(configPath); + } + }); + + it("should fail with HTTP transport type in CLI mode (connection error)", async () => { + const configPath = createTestConfig({ + mcpServers: { + "test-http": { + type: "streamable-http", + url: "http://localhost:3001/mcp", + note: "Test HTTP server", + }, + }, + }); + try { + const result = await runCli([ + "--config", + configPath, + "--server", + "test-http", + "--cli", + "--method", + "tools/list", + ]); + + expectCliFailure(result); + } finally { + deleteConfigFile(configPath); + } + }); + + it("should work with legacy config without type field", async () => { + const { command, args } = getTestMcpServerCommand(); + const configPath = createTestConfig({ + mcpServers: { + "test-legacy": { + command, + args, + env: { + LEGACY_ENV: "legacy-value", + }, + }, + }, + }); + try { + // First validate tools/list works + const toolsResult = await runCli([ + "--config", + configPath, + "--server", + "test-legacy", + "--cli", + "--method", + "tools/list", + ]); + + expectCliSuccess(toolsResult); + const toolsJson = expectValidJson(toolsResult); + expect(toolsJson).toHaveProperty("tools"); + expect(Array.isArray(toolsJson.tools)).toBe(true); + expect(toolsJson.tools.length).toBeGreaterThan(0); + + // Then validate env vars from config are passed to server + const envResult = await runCli([ + "--config", + configPath, + "--server", + "test-legacy", + "--cli", + "--method", + "resources/read", + "--uri", + "test://env", + ]); + + expectCliSuccess(envResult); + const envJson = expectValidJson(envResult); + const envVars = JSON.parse(envJson.contents[0].text); + expect(envVars).toHaveProperty("LEGACY_ENV"); + expect(envVars.LEGACY_ENV).toBe("legacy-value"); + } finally { + deleteConfigFile(configPath); + } + }); + }); + + describe("Default Server Selection", () => { + it("should auto-select single server", async () => { + const { command, args } = getTestMcpServerCommand(); + const configPath = createTestConfig({ + mcpServers: { + "only-server": { + command, + args, + }, + }, + }); + try { + const result = await runCli([ + "--config", + configPath, + "--cli", + "--method", + "tools/list", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("tools"); + expect(Array.isArray(json.tools)).toBe(true); + expect(json.tools.length).toBeGreaterThan(0); + } finally { + deleteConfigFile(configPath); + } + }); + + it("should require explicit server selection even with default-server key (multiple servers)", async () => { + const { command, args } = getTestMcpServerCommand(); + const configPath = createTestConfig({ + mcpServers: { + "default-server": { + command, + args, + }, + "other-server": { + command: "node", + args: ["other.js"], + }, + }, + }); + try { + const result = await runCli([ + "--config", + configPath, + "--cli", + "--method", + "tools/list", + ]); + + expectCliFailure(result); + } finally { + deleteConfigFile(configPath); + } + }); + + it("should require explicit server selection with multiple servers", async () => { + const { command, args } = getTestMcpServerCommand(); + const configPath = createTestConfig({ + mcpServers: { + server1: { + command, + args, + }, + server2: { + command: "node", + args: ["other.js"], + }, + }, + }); + try { + const result = await runCli([ + "--config", + configPath, + "--cli", + "--method", + "tools/list", + ]); + + expectCliFailure(result); + } finally { + deleteConfigFile(configPath); + } + }); + }); + + describe("HTTP Transport", () => { + it("should infer HTTP transport from URL ending with /mcp", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + tools: [createEchoTool()], + }); + + try { + await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--cli", + "--method", + "tools/list", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("tools"); + expect(Array.isArray(json.tools)).toBe(true); + expect(json.tools.length).toBeGreaterThan(0); + } finally { + await server.stop(); + } + }); + + it("should work with explicit --transport http flag", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + tools: [createEchoTool()], + }); + + try { + await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--transport", + "http", + "--cli", + "--method", + "tools/list", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("tools"); + expect(Array.isArray(json.tools)).toBe(true); + expect(json.tools.length).toBeGreaterThan(0); + } finally { + await server.stop(); + } + }); + + it("should work with explicit transport flag and URL suffix", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + tools: [createEchoTool()], + }); + + try { + await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--transport", + "http", + "--cli", + "--method", + "tools/list", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("tools"); + expect(Array.isArray(json.tools)).toBe(true); + expect(json.tools.length).toBeGreaterThan(0); + } finally { + await server.stop(); + } + }); + + it("should fail when SSE transport is given to HTTP server", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + tools: [createEchoTool()], + }); + + try { + await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--transport", + "sse", + "--cli", + "--method", + "tools/list", + ]); + + expectCliFailure(result); + } finally { + await server.stop(); + } + }); + + it("should fail when HTTP transport is specified without URL", async () => { + const result = await runCli([ + "--transport", + "http", + "--cli", + "--method", + "tools/list", + ]); + + expectCliFailure(result); + }); + + it("should fail when SSE transport is specified without URL", async () => { + const result = await runCli([ + "--transport", + "sse", + "--cli", + "--method", + "tools/list", + ]); + + expectCliFailure(result); + }); + }); +}); diff --git a/cli/__tests__/headers.test.ts b/cli/__tests__/headers.test.ts new file mode 100644 index 000000000..910f5f973 --- /dev/null +++ b/cli/__tests__/headers.test.ts @@ -0,0 +1,210 @@ +import { describe, it, expect } from "vitest"; +import { runCli } from "./helpers/cli-runner.js"; +import { + expectCliFailure, + expectOutputContains, + expectCliSuccess, +} from "./helpers/assertions.js"; +import { createTestServerHttp } from "../../shared/test/test-server-http.js"; +import { + createEchoTool, + createTestServerInfo, +} from "../../shared/test/test-server-fixtures.js"; + +describe("Header Parsing and Validation", () => { + describe("Valid Headers", () => { + it("should parse valid single header and send it to server", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + tools: [createEchoTool()], + }); + + try { + const port = await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--cli", + "--method", + "tools/list", + "--transport", + "http", + "--header", + "Authorization: Bearer token123", + ]); + + expectCliSuccess(result); + + // Check that the server received the request with the correct headers + const recordedRequests = server.getRecordedRequests(); + expect(recordedRequests.length).toBeGreaterThan(0); + + // Find the tools/list request (should be the last one) + const toolsListRequest = recordedRequests[recordedRequests.length - 1]; + expect(toolsListRequest).toBeDefined(); + expect(toolsListRequest.method).toBe("tools/list"); + + // Express normalizes headers to lowercase + expect(toolsListRequest.headers).toHaveProperty("authorization"); + expect(toolsListRequest.headers?.authorization).toBe("Bearer token123"); + } finally { + await server.stop(); + } + }); + + it("should parse multiple headers", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + tools: [createEchoTool()], + }); + + try { + const port = await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--cli", + "--method", + "tools/list", + "--transport", + "http", + "--header", + "Authorization: Bearer token123", + "--header", + "X-API-Key: secret123", + ]); + + expectCliSuccess(result); + + const recordedRequests = server.getRecordedRequests(); + const toolsListRequest = recordedRequests[recordedRequests.length - 1]; + expect(toolsListRequest.method).toBe("tools/list"); + expect(toolsListRequest.headers?.authorization).toBe("Bearer token123"); + expect(toolsListRequest.headers?.["x-api-key"]).toBe("secret123"); + } finally { + await server.stop(); + } + }); + + it("should handle header with colons in value", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + tools: [createEchoTool()], + }); + + try { + const port = await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--cli", + "--method", + "tools/list", + "--transport", + "http", + "--header", + "X-Time: 2023:12:25:10:30:45", + ]); + + expectCliSuccess(result); + + const recordedRequests = server.getRecordedRequests(); + const toolsListRequest = recordedRequests[recordedRequests.length - 1]; + expect(toolsListRequest.method).toBe("tools/list"); + expect(toolsListRequest.headers?.["x-time"]).toBe( + "2023:12:25:10:30:45", + ); + } finally { + await server.stop(); + } + }); + + it("should handle whitespace in headers", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + tools: [createEchoTool()], + }); + + try { + const port = await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--cli", + "--method", + "tools/list", + "--transport", + "http", + "--header", + " X-Header : value with spaces ", + ]); + + expectCliSuccess(result); + + const recordedRequests = server.getRecordedRequests(); + const toolsListRequest = recordedRequests[recordedRequests.length - 1]; + expect(toolsListRequest.method).toBe("tools/list"); + // Header values should be trimmed by the CLI parser + expect(toolsListRequest.headers?.["x-header"]).toBe( + "value with spaces", + ); + } finally { + await server.stop(); + } + }); + }); + + describe("Invalid Header Formats", () => { + it("should reject header format without colon", async () => { + const result = await runCli([ + "https://example.com", + "--cli", + "--method", + "tools/list", + "--transport", + "http", + "--header", + "InvalidHeader", + ]); + + expectCliFailure(result); + expectOutputContains(result, "Invalid header format"); + }); + + it("should reject header format with empty name", async () => { + const result = await runCli([ + "https://example.com", + "--cli", + "--method", + "tools/list", + "--transport", + "http", + "--header", + ": value", + ]); + + expectCliFailure(result); + expectOutputContains(result, "Invalid header format"); + }); + + it("should reject header format with empty value", async () => { + const result = await runCli([ + "https://example.com", + "--cli", + "--method", + "tools/list", + "--transport", + "http", + "--header", + "Header:", + ]); + + expectCliFailure(result); + expectOutputContains(result, "Invalid header format"); + }); + }); +}); diff --git a/cli/__tests__/helpers/assertions.ts b/cli/__tests__/helpers/assertions.ts new file mode 100644 index 000000000..e3ed9d02b --- /dev/null +++ b/cli/__tests__/helpers/assertions.ts @@ -0,0 +1,52 @@ +import { expect } from "vitest"; +import type { CliResult } from "./cli-runner.js"; + +/** + * Assert that CLI command succeeded (exit code 0) + */ +export function expectCliSuccess(result: CliResult) { + expect(result.exitCode).toBe(0); +} + +/** + * Assert that CLI command failed (non-zero exit code) + */ +export function expectCliFailure(result: CliResult) { + expect(result.exitCode).not.toBe(0); +} + +/** + * Assert that output contains expected text + */ +export function expectOutputContains(result: CliResult, text: string) { + expect(result.output).toContain(text); +} + +/** + * Assert that output contains valid JSON + * Uses stdout (not stderr) since JSON is written to stdout and warnings go to stderr + */ +export function expectValidJson(result: CliResult) { + expect(() => JSON.parse(result.stdout)).not.toThrow(); + return JSON.parse(result.stdout); +} + +/** + * Assert that output contains JSON with error flag + */ +export function expectJsonError(result: CliResult) { + const json = expectValidJson(result); + expect(json.isError).toBe(true); + return json; +} + +/** + * Assert that output contains expected JSON structure + */ +export function expectJsonStructure(result: CliResult, expectedKeys: string[]) { + const json = expectValidJson(result); + expectedKeys.forEach((key) => { + expect(json).toHaveProperty(key); + }); + return json; +} diff --git a/cli/__tests__/helpers/cli-runner.ts b/cli/__tests__/helpers/cli-runner.ts new file mode 100644 index 000000000..073aa9ae4 --- /dev/null +++ b/cli/__tests__/helpers/cli-runner.ts @@ -0,0 +1,98 @@ +import { spawn } from "child_process"; +import { resolve } from "path"; +import { fileURLToPath } from "url"; +import { dirname } from "path"; + +const __dirname = dirname(fileURLToPath(import.meta.url)); +const CLI_PATH = resolve(__dirname, "../../build/cli.js"); + +export interface CliResult { + exitCode: number | null; + stdout: string; + stderr: string; + output: string; // Combined stdout + stderr +} + +export interface CliOptions { + timeout?: number; + cwd?: string; + env?: Record; + signal?: AbortSignal; +} + +/** + * Run the CLI with given arguments and capture output + */ +export async function runCli( + args: string[], + options: CliOptions = {}, +): Promise { + return new Promise((resolve, reject) => { + const child = spawn("node", [CLI_PATH, ...args], { + stdio: ["pipe", "pipe", "pipe"], + cwd: options.cwd, + env: { ...process.env, ...options.env }, + signal: options.signal, + // Kill child process tree on exit + detached: false, + }); + + let stdout = ""; + let stderr = ""; + let resolved = false; + + // Default timeout of 10 seconds (less than vitest's 15s) + const timeoutMs = options.timeout ?? 10000; + const timeout = setTimeout(() => { + if (!resolved) { + resolved = true; + // Kill the process and all its children + try { + if (process.platform === "win32") { + child.kill("SIGTERM"); + } else { + // On Unix, kill the process group + process.kill(-child.pid!, "SIGTERM"); + } + } catch (e) { + // Process might already be dead, try direct kill + try { + child.kill("SIGKILL"); + } catch (e2) { + // Process is definitely dead + } + } + reject(new Error(`CLI command timed out after ${timeoutMs}ms`)); + } + }, timeoutMs); + + child.stdout.on("data", (data) => { + stdout += data.toString(); + }); + + child.stderr.on("data", (data) => { + stderr += data.toString(); + }); + + child.on("close", (code) => { + if (!resolved) { + resolved = true; + clearTimeout(timeout); + resolve({ + exitCode: code, + stdout, + stderr, + output: stdout + stderr, + }); + } + }); + + child.on("error", (error) => { + if (!resolved) { + resolved = true; + clearTimeout(timeout); + reject(error); + } + }); + }); +} diff --git a/cli/__tests__/helpers/fixtures.ts b/cli/__tests__/helpers/fixtures.ts new file mode 100644 index 000000000..e1cf83e51 --- /dev/null +++ b/cli/__tests__/helpers/fixtures.ts @@ -0,0 +1,89 @@ +import fs from "fs"; +import path from "path"; +import os from "os"; +import crypto from "crypto"; +import { getTestMcpServerCommand } from "../../../shared/test/test-server-stdio.js"; + +/** + * Sentinel value for tests that don't need a real server + * (tests that expect failure before connecting) + */ +export const NO_SERVER_SENTINEL = "invalid-command-that-does-not-exist"; + +/** + * Create a sample test config with test-stdio and test-http servers + * Returns a temporary config file path that should be cleaned up with deleteConfigFile() + * @param httpUrl - Optional full URL (including /mcp path) for test-http server. + * If not provided, uses a placeholder URL. The test-http server exists + * to test server selection logic and may not actually be used. + */ +export function createSampleTestConfig(httpUrl?: string): string { + const { command, args } = getTestMcpServerCommand(); + return createTestConfig({ + mcpServers: { + "test-stdio": { + type: "stdio", + command, + args, + env: { + HELLO: "Hello MCP!", + }, + }, + "test-http": { + type: "streamable-http", + url: httpUrl || "http://localhost:3001/mcp", + }, + }, + }); +} + +/** + * Create a temporary directory for test files + * Uses crypto.randomUUID() to ensure uniqueness even when called in parallel + */ +function createTempDir(prefix: string = "mcp-inspector-test-"): string { + const uniqueId = crypto.randomUUID(); + const tempDir = path.join(os.tmpdir(), `${prefix}${uniqueId}`); + fs.mkdirSync(tempDir, { recursive: true }); + return tempDir; +} + +/** + * Clean up temporary directory + */ +function cleanupTempDir(dir: string) { + try { + fs.rmSync(dir, { recursive: true, force: true }); + } catch (err) { + // Ignore cleanup errors + } +} + +/** + * Create a test config file + */ +export function createTestConfig(config: { + mcpServers: Record; +}): string { + const tempDir = createTempDir("mcp-inspector-config-"); + const configPath = path.join(tempDir, "config.json"); + fs.writeFileSync(configPath, JSON.stringify(config, null, 2)); + return configPath; +} + +/** + * Create an invalid config file (malformed JSON) + */ +export function createInvalidConfig(): string { + const tempDir = createTempDir("mcp-inspector-config-"); + const configPath = path.join(tempDir, "invalid-config.json"); + fs.writeFileSync(configPath, '{\n "mcpServers": {\n "invalid": {'); + return configPath; +} + +/** + * Delete a config file and its containing directory + */ +export function deleteConfigFile(configPath: string): void { + cleanupTempDir(path.dirname(configPath)); +} diff --git a/cli/__tests__/metadata.test.ts b/cli/__tests__/metadata.test.ts new file mode 100644 index 000000000..e15d58f0b --- /dev/null +++ b/cli/__tests__/metadata.test.ts @@ -0,0 +1,933 @@ +import { describe, it, expect } from "vitest"; +import { runCli } from "./helpers/cli-runner.js"; +import { + expectCliSuccess, + expectCliFailure, + expectValidJson, +} from "./helpers/assertions.js"; +import { createTestServerHttp } from "../../shared/test/test-server-http.js"; +import { + createEchoTool, + createAddTool, + createTestServerInfo, +} from "../../shared/test/test-server-fixtures.js"; +import { NO_SERVER_SENTINEL } from "./helpers/fixtures.js"; + +describe("Metadata Tests", () => { + describe("General Metadata", () => { + it("should work with tools/list", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + tools: [createEchoTool()], + }); + + try { + await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--cli", + "--method", + "tools/list", + "--metadata", + "client=test-client", + "--transport", + "http", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("tools"); + + // Validate metadata was sent + const recordedRequests = server.getRecordedRequests(); + const toolsListRequest = recordedRequests.find( + (r) => r.method === "tools/list", + ); + expect(toolsListRequest).toBeDefined(); + expect(toolsListRequest?.metadata).toEqual({ client: "test-client" }); + } finally { + await server.stop(); + } + }); + + it("should work with resources/list", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + resources: [ + { + uri: "test://resource", + name: "test-resource", + text: "test content", + }, + ], + }); + + try { + await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--cli", + "--method", + "resources/list", + "--metadata", + "client=test-client", + "--transport", + "http", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("resources"); + + // Validate metadata was sent + const recordedRequests = server.getRecordedRequests(); + const resourcesListRequest = recordedRequests.find( + (r) => r.method === "resources/list", + ); + expect(resourcesListRequest).toBeDefined(); + expect(resourcesListRequest?.metadata).toEqual({ + client: "test-client", + }); + } finally { + await server.stop(); + } + }); + + it("should work with prompts/list", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + prompts: [ + { + name: "test-prompt", + description: "A test prompt", + }, + ], + }); + + try { + await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--cli", + "--method", + "prompts/list", + "--metadata", + "client=test-client", + "--transport", + "http", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("prompts"); + + // Validate metadata was sent + const recordedRequests = server.getRecordedRequests(); + const promptsListRequest = recordedRequests.find( + (r) => r.method === "prompts/list", + ); + expect(promptsListRequest).toBeDefined(); + expect(promptsListRequest?.metadata).toEqual({ + client: "test-client", + }); + } finally { + await server.stop(); + } + }); + + it("should work with resources/read", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + resources: [ + { + uri: "test://resource", + name: "test-resource", + text: "test content", + }, + ], + }); + + try { + await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--cli", + "--method", + "resources/read", + "--uri", + "test://resource", + "--metadata", + "client=test-client", + "--transport", + "http", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("contents"); + + // Validate metadata was sent + const recordedRequests = server.getRecordedRequests(); + const readRequest = recordedRequests.find( + (r) => r.method === "resources/read", + ); + expect(readRequest).toBeDefined(); + expect(readRequest?.metadata).toEqual({ client: "test-client" }); + } finally { + await server.stop(); + } + }); + + it("should work with prompts/get", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + prompts: [ + { + name: "test-prompt", + description: "A test prompt", + }, + ], + }); + + try { + await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--cli", + "--method", + "prompts/get", + "--prompt-name", + "test-prompt", + "--metadata", + "client=test-client", + "--transport", + "http", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("messages"); + + // Validate metadata was sent + const recordedRequests = server.getRecordedRequests(); + const getPromptRequest = recordedRequests.find( + (r) => r.method === "prompts/get", + ); + expect(getPromptRequest).toBeDefined(); + expect(getPromptRequest?.metadata).toEqual({ client: "test-client" }); + } finally { + await server.stop(); + } + }); + }); + + describe("Tool-Specific Metadata", () => { + it("should work with tools/call", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + tools: [createEchoTool()], + }); + + try { + await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--cli", + "--method", + "tools/call", + "--tool-name", + "echo", + "--tool-arg", + "message=hello world", + "--tool-metadata", + "client=test-client", + "--transport", + "http", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("content"); + + // Validate metadata was sent + const recordedRequests = server.getRecordedRequests(); + const toolCallRequest = recordedRequests.find( + (r) => r.method === "tools/call", + ); + expect(toolCallRequest).toBeDefined(); + expect(toolCallRequest?.metadata).toEqual({ client: "test-client" }); + } finally { + await server.stop(); + } + }); + + it("should work with complex tool", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + tools: [createAddTool()], + }); + + try { + await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--cli", + "--method", + "tools/call", + "--tool-name", + "add", + "--tool-arg", + "a=10", + "b=20", + "--tool-metadata", + "client=test-client", + "--transport", + "http", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("content"); + + // Validate metadata was sent + const recordedRequests = server.getRecordedRequests(); + const toolCallRequest = recordedRequests.find( + (r) => r.method === "tools/call", + ); + expect(toolCallRequest).toBeDefined(); + expect(toolCallRequest?.metadata).toEqual({ client: "test-client" }); + } finally { + await server.stop(); + } + }); + }); + + describe("Metadata Merging", () => { + it("should merge general and tool-specific metadata (tool-specific overrides)", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + tools: [createEchoTool()], + }); + + try { + await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--cli", + "--method", + "tools/call", + "--tool-name", + "echo", + "--tool-arg", + "message=hello world", + "--metadata", + "client=general-client", + "shared_key=shared_value", + "--tool-metadata", + "client=tool-specific-client", + "--transport", + "http", + ]); + + expectCliSuccess(result); + + // Validate metadata was merged correctly (tool-specific overrides general) + const recordedRequests = server.getRecordedRequests(); + const toolCallRequest = recordedRequests.find( + (r) => r.method === "tools/call", + ); + expect(toolCallRequest).toBeDefined(); + expect(toolCallRequest?.metadata).toEqual({ + client: "tool-specific-client", // Tool-specific overrides general + shared_key: "shared_value", // General metadata is preserved + }); + } finally { + await server.stop(); + } + }); + }); + + describe("Metadata Parsing", () => { + it("should handle numeric values", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + tools: [createEchoTool()], + }); + + try { + await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--cli", + "--method", + "tools/list", + "--metadata", + "integer_value=42", + "decimal_value=3.14159", + "negative_value=-10", + "--transport", + "http", + ]); + + expectCliSuccess(result); + + // Validate metadata values are sent as strings + const recordedRequests = server.getRecordedRequests(); + const toolsListRequest = recordedRequests.find( + (r) => r.method === "tools/list", + ); + expect(toolsListRequest).toBeDefined(); + expect(toolsListRequest?.metadata).toEqual({ + integer_value: "42", + decimal_value: "3.14159", + negative_value: "-10", + }); + } finally { + await server.stop(); + } + }); + + it("should handle JSON values", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + tools: [createEchoTool()], + }); + + try { + await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--cli", + "--method", + "tools/list", + "--metadata", + 'json_object="{\\"key\\":\\"value\\"}"', + 'json_array="[1,2,3]"', + 'json_string="\\"quoted\\""', + "--transport", + "http", + ]); + + expectCliSuccess(result); + + // Validate JSON values are sent as strings + const recordedRequests = server.getRecordedRequests(); + const toolsListRequest = recordedRequests.find( + (r) => r.method === "tools/list", + ); + expect(toolsListRequest).toBeDefined(); + expect(toolsListRequest?.metadata).toEqual({ + json_object: '{"key":"value"}', + json_array: "[1,2,3]", + json_string: '"quoted"', + }); + } finally { + await server.stop(); + } + }); + + it("should handle special characters", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + tools: [createEchoTool()], + }); + + try { + await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--cli", + "--method", + "tools/list", + "--metadata", + "unicode=🚀🎉✨", + "special_chars=!@#$%^&*()", + "spaces=hello world with spaces", + "--transport", + "http", + ]); + + expectCliSuccess(result); + + // Validate special characters are preserved + const recordedRequests = server.getRecordedRequests(); + const toolsListRequest = recordedRequests.find( + (r) => r.method === "tools/list", + ); + expect(toolsListRequest).toBeDefined(); + expect(toolsListRequest?.metadata).toEqual({ + unicode: "🚀🎉✨", + special_chars: "!@#$%^&*()", + spaces: "hello world with spaces", + }); + } finally { + await server.stop(); + } + }); + }); + + describe("Metadata Edge Cases", () => { + it("should handle single metadata entry", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + tools: [createEchoTool()], + }); + + try { + await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--cli", + "--method", + "tools/list", + "--metadata", + "single_key=single_value", + "--transport", + "http", + ]); + + expectCliSuccess(result); + + // Validate single metadata entry + const recordedRequests = server.getRecordedRequests(); + const toolsListRequest = recordedRequests.find( + (r) => r.method === "tools/list", + ); + expect(toolsListRequest).toBeDefined(); + expect(toolsListRequest?.metadata).toEqual({ + single_key: "single_value", + }); + } finally { + await server.stop(); + } + }); + + it("should handle many metadata entries", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + tools: [createEchoTool()], + }); + + try { + await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--cli", + "--method", + "tools/list", + "--metadata", + "key1=value1", + "key2=value2", + "key3=value3", + "key4=value4", + "key5=value5", + "--transport", + "http", + ]); + + expectCliSuccess(result); + + // Validate all metadata entries + const recordedRequests = server.getRecordedRequests(); + const toolsListRequest = recordedRequests.find( + (r) => r.method === "tools/list", + ); + expect(toolsListRequest).toBeDefined(); + expect(toolsListRequest?.metadata).toEqual({ + key1: "value1", + key2: "value2", + key3: "value3", + key4: "value4", + key5: "value5", + }); + } finally { + await server.stop(); + } + }); + }); + + describe("Metadata Error Cases", () => { + it("should fail with invalid metadata format (missing equals)", async () => { + const result = await runCli([ + NO_SERVER_SENTINEL, + "--cli", + "--method", + "tools/list", + "--metadata", + "invalid_format_no_equals", + ]); + + expectCliFailure(result); + }); + + it("should fail with invalid tool-metadata format (missing equals)", async () => { + const result = await runCli([ + NO_SERVER_SENTINEL, + "--cli", + "--method", + "tools/call", + "--tool-name", + "echo", + "--tool-arg", + "message=test", + "--tool-metadata", + "invalid_format_no_equals", + ]); + + expectCliFailure(result); + }); + }); + + describe("Metadata Impact", () => { + it("should handle tool-specific metadata precedence over general", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + tools: [createEchoTool()], + }); + + try { + await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--cli", + "--method", + "tools/call", + "--tool-name", + "echo", + "--tool-arg", + "message=precedence test", + "--metadata", + "client=general-client", + "--tool-metadata", + "client=tool-specific-client", + "--transport", + "http", + ]); + + expectCliSuccess(result); + + // Validate tool-specific metadata overrides general + const recordedRequests = server.getRecordedRequests(); + const toolCallRequest = recordedRequests.find( + (r) => r.method === "tools/call", + ); + expect(toolCallRequest).toBeDefined(); + expect(toolCallRequest?.metadata).toEqual({ + client: "tool-specific-client", + }); + } finally { + await server.stop(); + } + }); + + it("should work with resources methods", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + resources: [ + { + uri: "test://resource", + name: "test-resource", + text: "test content", + }, + ], + }); + + try { + await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--cli", + "--method", + "resources/list", + "--metadata", + "resource_client=test-resource-client", + "--transport", + "http", + ]); + + expectCliSuccess(result); + + // Validate metadata was sent + const recordedRequests = server.getRecordedRequests(); + const resourcesListRequest = recordedRequests.find( + (r) => r.method === "resources/list", + ); + expect(resourcesListRequest).toBeDefined(); + expect(resourcesListRequest?.metadata).toEqual({ + resource_client: "test-resource-client", + }); + } finally { + await server.stop(); + } + }); + + it("should work with prompts methods", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + prompts: [ + { + name: "test-prompt", + description: "A test prompt", + }, + ], + }); + + try { + await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--cli", + "--method", + "prompts/get", + "--prompt-name", + "test-prompt", + "--metadata", + "prompt_client=test-prompt-client", + "--transport", + "http", + ]); + + expectCliSuccess(result); + + // Validate metadata was sent + const recordedRequests = server.getRecordedRequests(); + const getPromptRequest = recordedRequests.find( + (r) => r.method === "prompts/get", + ); + expect(getPromptRequest).toBeDefined(); + expect(getPromptRequest?.metadata).toEqual({ + prompt_client: "test-prompt-client", + }); + } finally { + await server.stop(); + } + }); + }); + + describe("Metadata Validation", () => { + it("should handle special characters in keys", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + tools: [createEchoTool()], + }); + + try { + await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--cli", + "--method", + "tools/call", + "--tool-name", + "echo", + "--tool-arg", + "message=special keys test", + "--metadata", + "key-with-dashes=value1", + "key_with_underscores=value2", + "key.with.dots=value3", + "--transport", + "http", + ]); + + expectCliSuccess(result); + + // Validate special characters in keys are preserved + const recordedRequests = server.getRecordedRequests(); + const toolCallRequest = recordedRequests.find( + (r) => r.method === "tools/call", + ); + expect(toolCallRequest).toBeDefined(); + expect(toolCallRequest?.metadata).toEqual({ + "key-with-dashes": "value1", + key_with_underscores: "value2", + "key.with.dots": "value3", + }); + } finally { + await server.stop(); + } + }); + }); + + describe("Metadata Integration", () => { + it("should work with all MCP methods", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + tools: [createEchoTool()], + }); + + try { + await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--cli", + "--method", + "tools/list", + "--metadata", + "integration_test=true", + "test_phase=all_methods", + "--transport", + "http", + ]); + + expectCliSuccess(result); + + // Validate metadata was sent + const recordedRequests = server.getRecordedRequests(); + const toolsListRequest = recordedRequests.find( + (r) => r.method === "tools/list", + ); + expect(toolsListRequest).toBeDefined(); + expect(toolsListRequest?.metadata).toEqual({ + integration_test: "true", + test_phase: "all_methods", + }); + } finally { + await server.stop(); + } + }); + + it("should handle complex metadata scenario", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + tools: [createEchoTool()], + }); + + try { + await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--cli", + "--method", + "tools/call", + "--tool-name", + "echo", + "--tool-arg", + "message=complex test", + "--metadata", + "session_id=12345", + "user_id=67890", + "timestamp=2024-01-01T00:00:00Z", + "request_id=req-abc-123", + "--tool-metadata", + "tool_session=session-xyz-789", + "execution_context=test", + "priority=high", + "--transport", + "http", + ]); + + expectCliSuccess(result); + + // Validate complex metadata merging + const recordedRequests = server.getRecordedRequests(); + const toolCallRequest = recordedRequests.find( + (r) => r.method === "tools/call", + ); + expect(toolCallRequest).toBeDefined(); + expect(toolCallRequest?.metadata).toEqual({ + session_id: "12345", + user_id: "67890", + timestamp: "2024-01-01T00:00:00Z", + request_id: "req-abc-123", + tool_session: "session-xyz-789", + execution_context: "test", + priority: "high", + }); + } finally { + await server.stop(); + } + }); + + it("should handle metadata parsing validation", async () => { + const server = createTestServerHttp({ + serverInfo: createTestServerInfo(), + tools: [createEchoTool()], + }); + + try { + await server.start("http"); + const serverUrl = `${server.getUrl()}/mcp`; + + const result = await runCli([ + serverUrl, + "--cli", + "--method", + "tools/call", + "--tool-name", + "echo", + "--tool-arg", + "message=parsing validation test", + "--metadata", + "valid_key=valid_value", + "numeric_key=123", + "boolean_key=true", + 'json_key=\'{"test":"value"}\'', + "special_key=!@#$%^&*()", + "unicode_key=🚀🎉✨", + "--transport", + "http", + ]); + + expectCliSuccess(result); + + // Validate all value types are sent as strings + // Note: The CLI parses metadata values, so single-quoted JSON strings + // are preserved with their quotes + const recordedRequests = server.getRecordedRequests(); + const toolCallRequest = recordedRequests.find( + (r) => r.method === "tools/call", + ); + expect(toolCallRequest).toBeDefined(); + expect(toolCallRequest?.metadata).toEqual({ + valid_key: "valid_value", + numeric_key: "123", + boolean_key: "true", + json_key: '\'{"test":"value"}\'', // Single quotes are preserved + special_key: "!@#$%^&*()", + unicode_key: "🚀🎉✨", + }); + } finally { + await server.stop(); + } + }); + }); +}); diff --git a/cli/__tests__/tools.test.ts b/cli/__tests__/tools.test.ts new file mode 100644 index 000000000..461a77026 --- /dev/null +++ b/cli/__tests__/tools.test.ts @@ -0,0 +1,523 @@ +import { describe, it, expect } from "vitest"; +import { runCli } from "./helpers/cli-runner.js"; +import { + expectCliSuccess, + expectCliFailure, + expectValidJson, + expectJsonError, +} from "./helpers/assertions.js"; +import { getTestMcpServerCommand } from "../../shared/test/test-server-stdio.js"; + +describe("Tool Tests", () => { + describe("Tool Discovery", () => { + it("should list available tools", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "--cli", + "--method", + "tools/list", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("tools"); + expect(Array.isArray(json.tools)).toBe(true); + expect(json.tools.length).toBeGreaterThan(0); + // Validate that tools have required properties + expect(json.tools[0]).toHaveProperty("name"); + expect(json.tools[0]).toHaveProperty("description"); + // Validate expected tools from test-mcp-server + const toolNames = json.tools.map((tool: any) => tool.name); + expect(toolNames).toContain("echo"); + expect(toolNames).toContain("get-sum"); + expect(toolNames).toContain("get-annotated-message"); + }); + }); + + describe("JSON Argument Parsing", () => { + it("should handle string arguments (backward compatibility)", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "--cli", + "--method", + "tools/call", + "--tool-name", + "echo", + "--tool-arg", + "message=hello world", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("content"); + expect(Array.isArray(json.content)).toBe(true); + expect(json.content.length).toBeGreaterThan(0); + expect(json.content[0]).toHaveProperty("type", "text"); + expect(json.content[0].text).toBe("Echo: hello world"); + }); + + it("should handle integer number arguments", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "--cli", + "--method", + "tools/call", + "--tool-name", + "get-sum", + "--tool-arg", + "a=42", + "b=58", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("content"); + expect(Array.isArray(json.content)).toBe(true); + expect(json.content.length).toBeGreaterThan(0); + expect(json.content[0]).toHaveProperty("type", "text"); + // test-mcp-server returns JSON with {result: a+b} + const resultData = JSON.parse(json.content[0].text); + expect(resultData.result).toBe(100); + }); + + it("should handle decimal number arguments", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "--cli", + "--method", + "tools/call", + "--tool-name", + "get-sum", + "--tool-arg", + "a=19.99", + "b=20.01", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("content"); + expect(Array.isArray(json.content)).toBe(true); + expect(json.content.length).toBeGreaterThan(0); + expect(json.content[0]).toHaveProperty("type", "text"); + // test-mcp-server returns JSON with {result: a+b} + const resultData = JSON.parse(json.content[0].text); + expect(resultData.result).toBeCloseTo(40.0, 2); + }); + + it("should handle boolean arguments - true", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "--cli", + "--method", + "tools/call", + "--tool-name", + "get-annotated-message", + "--tool-arg", + "messageType=success", + "includeImage=true", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("content"); + expect(Array.isArray(json.content)).toBe(true); + // Should have both text and image content + expect(json.content.length).toBeGreaterThan(1); + const hasImage = json.content.some((item: any) => item.type === "image"); + expect(hasImage).toBe(true); + }); + + it("should handle boolean arguments - false", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "--cli", + "--method", + "tools/call", + "--tool-name", + "get-annotated-message", + "--tool-arg", + "messageType=error", + "includeImage=false", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("content"); + expect(Array.isArray(json.content)).toBe(true); + // Should only have text content, no image + const hasImage = json.content.some((item: any) => item.type === "image"); + expect(hasImage).toBe(false); + // test-mcp-server returns "This is a {messageType} message" + expect(json.content[0].text.toLowerCase()).toContain("error"); + }); + + it("should handle null arguments", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "--cli", + "--method", + "tools/call", + "--tool-name", + "echo", + "--tool-arg", + 'message="null"', + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("content"); + expect(Array.isArray(json.content)).toBe(true); + expect(json.content[0]).toHaveProperty("type", "text"); + // The string "null" should be passed through + expect(json.content[0].text).toBe("Echo: null"); + }); + + it("should handle multiple arguments with mixed types", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "--cli", + "--method", + "tools/call", + "--tool-name", + "get-sum", + "--tool-arg", + "a=42.5", + "b=57.5", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("content"); + expect(Array.isArray(json.content)).toBe(true); + expect(json.content.length).toBeGreaterThan(0); + expect(json.content[0]).toHaveProperty("type", "text"); + // test-mcp-server returns JSON with {result: a+b} + const resultData = JSON.parse(json.content[0].text); + expect(resultData.result).toBeCloseTo(100.0, 1); + }); + }); + + describe("JSON Parsing Edge Cases", () => { + it("should fall back to string for invalid JSON", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "--cli", + "--method", + "tools/call", + "--tool-name", + "echo", + "--tool-arg", + "message={invalid json}", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("content"); + expect(Array.isArray(json.content)).toBe(true); + expect(json.content[0]).toHaveProperty("type", "text"); + // Should treat invalid JSON as a string + expect(json.content[0].text).toBe("Echo: {invalid json}"); + }); + + it("should handle empty string value", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "--cli", + "--method", + "tools/call", + "--tool-name", + "echo", + "--tool-arg", + 'message=""', + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("content"); + expect(Array.isArray(json.content)).toBe(true); + expect(json.content[0]).toHaveProperty("type", "text"); + // Empty string should be preserved + expect(json.content[0].text).toBe("Echo: "); + }); + + it("should handle special characters in strings", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "--cli", + "--method", + "tools/call", + "--tool-name", + "echo", + "--tool-arg", + 'message="C:\\\\Users\\\\test"', + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("content"); + expect(Array.isArray(json.content)).toBe(true); + expect(json.content[0]).toHaveProperty("type", "text"); + // Special characters should be preserved + expect(json.content[0].text).toContain("C:"); + expect(json.content[0].text).toContain("Users"); + expect(json.content[0].text).toContain("test"); + }); + + it("should handle unicode characters", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "--cli", + "--method", + "tools/call", + "--tool-name", + "echo", + "--tool-arg", + 'message="🚀🎉✨"', + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("content"); + expect(Array.isArray(json.content)).toBe(true); + expect(json.content[0]).toHaveProperty("type", "text"); + // Unicode characters should be preserved + expect(json.content[0].text).toContain("🚀"); + expect(json.content[0].text).toContain("🎉"); + expect(json.content[0].text).toContain("✨"); + }); + + it("should handle arguments with equals signs in values", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "--cli", + "--method", + "tools/call", + "--tool-name", + "echo", + "--tool-arg", + "message=2+2=4", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("content"); + expect(Array.isArray(json.content)).toBe(true); + expect(json.content[0]).toHaveProperty("type", "text"); + // Equals signs in values should be preserved + expect(json.content[0].text).toBe("Echo: 2+2=4"); + }); + + it("should handle base64-like strings", async () => { + const { command, args } = getTestMcpServerCommand(); + const base64String = + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0="; + const result = await runCli([ + command, + ...args, + "--cli", + "--method", + "tools/call", + "--tool-name", + "echo", + "--tool-arg", + `message=${base64String}`, + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("content"); + expect(Array.isArray(json.content)).toBe(true); + expect(json.content[0]).toHaveProperty("type", "text"); + // Base64-like strings should be preserved + expect(json.content[0].text).toBe(`Echo: ${base64String}`); + }); + }); + + describe("Tool Error Handling", () => { + it("should fail with nonexistent tool", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "--cli", + "--method", + "tools/call", + "--tool-name", + "nonexistent_tool", + "--tool-arg", + "message=test", + ]); + + // CLI returns exit code 0 but includes isError: true in JSON + expectJsonError(result); + }); + + it("should fail when tool name is missing", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "--cli", + "--method", + "tools/call", + "--tool-arg", + "message=test", + ]); + + expectCliFailure(result); + }); + + it("should fail with invalid tool argument format", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "--cli", + "--method", + "tools/call", + "--tool-name", + "echo", + "--tool-arg", + "invalid_format_no_equals", + ]); + + expectCliFailure(result); + }); + }); + + describe("Prompt JSON Arguments", () => { + it("should handle prompt with JSON arguments", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "--cli", + "--method", + "prompts/get", + "--prompt-name", + "args-prompt", + "--prompt-args", + "city=New York", + "state=NY", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("messages"); + expect(Array.isArray(json.messages)).toBe(true); + expect(json.messages.length).toBeGreaterThan(0); + expect(json.messages[0]).toHaveProperty("content"); + expect(json.messages[0].content).toHaveProperty("type", "text"); + // Validate that the arguments were actually used in the response + // test-mcp-server formats it as "This is a prompt with arguments: city={city}, state={state}" + expect(json.messages[0].content.text).toContain("city=New York"); + expect(json.messages[0].content.text).toContain("state=NY"); + }); + + it("should handle prompt with simple arguments", async () => { + // Note: simple-prompt doesn't accept arguments, but the CLI should still + // accept the command and the server should ignore the arguments + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "--cli", + "--method", + "prompts/get", + "--prompt-name", + "simple-prompt", + "--prompt-args", + "name=test", + "count=5", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("messages"); + expect(Array.isArray(json.messages)).toBe(true); + expect(json.messages.length).toBeGreaterThan(0); + expect(json.messages[0]).toHaveProperty("content"); + expect(json.messages[0].content).toHaveProperty("type", "text"); + // test-mcp-server's simple-prompt returns standard message (ignoring args) + expect(json.messages[0].content.text).toBe( + "This is a simple prompt for testing purposes.", + ); + }); + }); + + describe("Backward Compatibility", () => { + it("should support existing string-only usage", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "--cli", + "--method", + "tools/call", + "--tool-name", + "echo", + "--tool-arg", + "message=hello", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("content"); + expect(Array.isArray(json.content)).toBe(true); + expect(json.content[0]).toHaveProperty("type", "text"); + expect(json.content[0].text).toBe("Echo: hello"); + }); + + it("should support multiple string arguments", async () => { + const { command, args } = getTestMcpServerCommand(); + const result = await runCli([ + command, + ...args, + "--cli", + "--method", + "tools/call", + "--tool-name", + "get-sum", + "--tool-arg", + "a=10", + "b=20", + ]); + + expectCliSuccess(result); + const json = expectValidJson(result); + expect(json).toHaveProperty("content"); + expect(Array.isArray(json.content)).toBe(true); + expect(json.content.length).toBeGreaterThan(0); + expect(json.content[0]).toHaveProperty("type", "text"); + // test-mcp-server returns JSON with {result: a+b} + const resultData = JSON.parse(json.content[0].text); + expect(resultData.result).toBe(30); + }); + }); +}); diff --git a/cli/package.json b/cli/package.json index 6551c80aa..81cd71768 100644 --- a/cli/package.json +++ b/cli/package.json @@ -17,15 +17,23 @@ "scripts": { "build": "tsc", "postbuild": "node scripts/make-executable.js", - "test": "node scripts/cli-tests.js && node scripts/cli-tool-tests.js && node scripts/cli-header-tests.js", - "test:cli": "node scripts/cli-tests.js", - "test:cli-tools": "node scripts/cli-tool-tests.js", - "test:cli-headers": "node scripts/cli-header-tests.js" + "test": "vitest run", + "test:watch": "vitest", + "test:cli": "vitest run cli.test.ts", + "test:cli-tools": "vitest run tools.test.ts", + "test:cli-headers": "vitest run headers.test.ts", + "test:cli-metadata": "vitest run metadata.test.ts" + }, + "devDependencies": { + "@types/express": "^5.0.6", + "tsx": "^4.7.0", + "vitest": "^4.0.17" }, - "devDependencies": {}, "dependencies": { + "@modelcontextprotocol/inspector-shared": "*", "@modelcontextprotocol/sdk": "^1.25.2", "commander": "^13.1.0", + "express": "^5.2.1", "spawn-rx": "^5.1.2" } } diff --git a/cli/scripts/cli-header-tests.js b/cli/scripts/cli-header-tests.js deleted file mode 100644 index 0f1d22a93..000000000 --- a/cli/scripts/cli-header-tests.js +++ /dev/null @@ -1,252 +0,0 @@ -#!/usr/bin/env node - -/** - * Integration tests for header functionality - * Tests the CLI header parsing end-to-end - */ - -import { spawn } from "node:child_process"; -import { resolve, dirname } from "node:path"; -import { fileURLToPath } from "node:url"; - -const __dirname = dirname(fileURLToPath(import.meta.url)); -const CLI_PATH = resolve(__dirname, "..", "build", "index.js"); - -// ANSI colors for output -const colors = { - GREEN: "\x1b[32m", - RED: "\x1b[31m", - YELLOW: "\x1b[33m", - BLUE: "\x1b[34m", - NC: "\x1b[0m", // No Color -}; - -let testsPassed = 0; -let testsFailed = 0; - -/** - * Run a CLI test with given arguments and check for expected behavior - */ -function runHeaderTest( - testName, - args, - expectSuccess = false, - expectedInOutput = null, -) { - return new Promise((resolve) => { - console.log(`\n${colors.BLUE}Testing: ${testName}${colors.NC}`); - console.log( - `${colors.BLUE}Command: node ${CLI_PATH} ${args.join(" ")}${colors.NC}`, - ); - - const child = spawn("node", [CLI_PATH, ...args], { - stdio: ["pipe", "pipe", "pipe"], - timeout: 10000, - }); - - let stdout = ""; - let stderr = ""; - - child.stdout.on("data", (data) => { - stdout += data.toString(); - }); - - child.stderr.on("data", (data) => { - stderr += data.toString(); - }); - - child.on("close", (code) => { - const output = stdout + stderr; - let passed = true; - let reason = ""; - - // Check exit code expectation - if (expectSuccess && code !== 0) { - passed = false; - reason = `Expected success (exit code 0) but got ${code}`; - } else if (!expectSuccess && code === 0) { - passed = false; - reason = `Expected failure (non-zero exit code) but got success`; - } - - // Check expected output - if (passed && expectedInOutput && !output.includes(expectedInOutput)) { - passed = false; - reason = `Expected output to contain "${expectedInOutput}"`; - } - - if (passed) { - console.log(`${colors.GREEN}PASS: ${testName}${colors.NC}`); - testsPassed++; - } else { - console.log(`${colors.RED}FAIL: ${testName}${colors.NC}`); - console.log(`${colors.RED}Reason: ${reason}${colors.NC}`); - console.log(`${colors.RED}Exit code: ${code}${colors.NC}`); - console.log(`${colors.RED}Output: ${output}${colors.NC}`); - testsFailed++; - } - - resolve(); - }); - - child.on("error", (error) => { - console.log( - `${colors.RED}ERROR: ${testName} - ${error.message}${colors.NC}`, - ); - testsFailed++; - resolve(); - }); - }); -} - -async function runHeaderIntegrationTests() { - console.log( - `${colors.YELLOW}=== MCP Inspector CLI Header Integration Tests ===${colors.NC}`, - ); - console.log( - `${colors.BLUE}Testing header parsing and validation${colors.NC}`, - ); - - // Test 1: Valid header format should parse successfully (connection will fail) - await runHeaderTest( - "Valid single header", - [ - "https://example.com", - "--method", - "tools/list", - "--transport", - "http", - "--header", - "Authorization: Bearer token123", - ], - false, - ); - - // Test 2: Multiple headers should parse successfully - await runHeaderTest( - "Multiple headers", - [ - "https://example.com", - "--method", - "tools/list", - "--transport", - "http", - "--header", - "Authorization: Bearer token123", - "--header", - "X-API-Key: secret123", - ], - false, - ); - - // Test 3: Invalid header format - no colon - await runHeaderTest( - "Invalid header format - no colon", - [ - "https://example.com", - "--method", - "tools/list", - "--transport", - "http", - "--header", - "InvalidHeader", - ], - false, - "Invalid header format", - ); - - // Test 4: Invalid header format - empty name - await runHeaderTest( - "Invalid header format - empty name", - [ - "https://example.com", - "--method", - "tools/list", - "--transport", - "http", - "--header", - ": value", - ], - false, - "Invalid header format", - ); - - // Test 5: Invalid header format - empty value - await runHeaderTest( - "Invalid header format - empty value", - [ - "https://example.com", - "--method", - "tools/list", - "--transport", - "http", - "--header", - "Header:", - ], - false, - "Invalid header format", - ); - - // Test 6: Header with colons in value - await runHeaderTest( - "Header with colons in value", - [ - "https://example.com", - "--method", - "tools/list", - "--transport", - "http", - "--header", - "X-Time: 2023:12:25:10:30:45", - ], - false, - ); - - // Test 7: Whitespace handling - await runHeaderTest( - "Whitespace handling in headers", - [ - "https://example.com", - "--method", - "tools/list", - "--transport", - "http", - "--header", - " X-Header : value with spaces ", - ], - false, - ); - - console.log(`\n${colors.YELLOW}=== Test Results ===${colors.NC}`); - console.log(`${colors.GREEN}Tests passed: ${testsPassed}${colors.NC}`); - console.log(`${colors.RED}Tests failed: ${testsFailed}${colors.NC}`); - - if (testsFailed === 0) { - console.log( - `${colors.GREEN}All header integration tests passed!${colors.NC}`, - ); - process.exit(0); - } else { - console.log( - `${colors.RED}Some header integration tests failed.${colors.NC}`, - ); - process.exit(1); - } -} - -// Handle graceful shutdown -process.on("SIGINT", () => { - console.log(`\n${colors.YELLOW}Test interrupted by user${colors.NC}`); - process.exit(1); -}); - -process.on("SIGTERM", () => { - console.log(`\n${colors.YELLOW}Test terminated${colors.NC}`); - process.exit(1); -}); - -// Run the tests -runHeaderIntegrationTests().catch((error) => { - console.error(`${colors.RED}Test runner error: ${error.message}${colors.NC}`); - process.exit(1); -}); diff --git a/cli/scripts/cli-metadata-tests.js b/cli/scripts/cli-metadata-tests.js deleted file mode 100755 index 0bc664d2c..000000000 --- a/cli/scripts/cli-metadata-tests.js +++ /dev/null @@ -1,676 +0,0 @@ -#!/usr/bin/env node - -// Colors for output -const colors = { - GREEN: "\x1b[32m", - YELLOW: "\x1b[33m", - RED: "\x1b[31m", - BLUE: "\x1b[34m", - ORANGE: "\x1b[33m", - NC: "\x1b[0m", // No Color -}; - -import fs from "fs"; -import path from "path"; -import { spawn } from "child_process"; -import os from "os"; -import { fileURLToPath } from "url"; - -// Get directory paths with ESM compatibility -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); - -// Track test results -let PASSED_TESTS = 0; -let FAILED_TESTS = 0; -let SKIPPED_TESTS = 0; -let TOTAL_TESTS = 0; - -console.log( - `${colors.YELLOW}=== MCP Inspector CLI Metadata Tests ===${colors.NC}`, -); -console.log( - `${colors.BLUE}This script tests the MCP Inspector CLI's metadata functionality:${colors.NC}`, -); -console.log( - `${colors.BLUE}- General metadata with --metadata option${colors.NC}`, -); -console.log( - `${colors.BLUE}- Tool-specific metadata with --tool-metadata option${colors.NC}`, -); -console.log( - `${colors.BLUE}- Metadata parsing with various data types${colors.NC}`, -); -console.log( - `${colors.BLUE}- Metadata merging (tool-specific overrides general)${colors.NC}`, -); -console.log( - `${colors.BLUE}- Metadata evaluation in different MCP methods${colors.NC}`, -); -console.log(`\n`); - -// Get directory paths -const SCRIPTS_DIR = __dirname; -const PROJECT_ROOT = path.join(SCRIPTS_DIR, "../../"); -const BUILD_DIR = path.resolve(SCRIPTS_DIR, "../build"); - -// Define the test server command using npx -const TEST_CMD = "npx"; -const TEST_ARGS = ["@modelcontextprotocol/server-everything"]; - -// Create output directory for test results -const OUTPUT_DIR = path.join(SCRIPTS_DIR, "metadata-test-output"); -if (!fs.existsSync(OUTPUT_DIR)) { - fs.mkdirSync(OUTPUT_DIR, { recursive: true }); -} - -// Create a temporary directory for test files -const TEMP_DIR = path.join(os.tmpdir(), "mcp-inspector-metadata-tests"); -fs.mkdirSync(TEMP_DIR, { recursive: true }); - -// Track servers for cleanup -let runningServers = []; - -process.on("exit", () => { - try { - fs.rmSync(TEMP_DIR, { recursive: true, force: true }); - } catch (err) { - console.error( - `${colors.RED}Failed to remove temp directory: ${err.message}${colors.NC}`, - ); - } - - runningServers.forEach((server) => { - try { - process.kill(-server.pid); - } catch (e) {} - }); -}); - -process.on("SIGINT", () => { - runningServers.forEach((server) => { - try { - process.kill(-server.pid); - } catch (e) {} - }); - process.exit(1); -}); - -// Function to run a basic test -async function runBasicTest(testName, ...args) { - const outputFile = path.join( - OUTPUT_DIR, - `${testName.replace(/\//g, "_")}.log`, - ); - - console.log(`\n${colors.YELLOW}Testing: ${testName}${colors.NC}`); - TOTAL_TESTS++; - - // Run the command and capture output - console.log( - `${colors.BLUE}Command: node ${BUILD_DIR}/cli.js ${args.join(" ")}${colors.NC}`, - ); - - try { - // Create a write stream for the output file - const outputStream = fs.createWriteStream(outputFile); - - // Spawn the process - return new Promise((resolve) => { - const child = spawn("node", [path.join(BUILD_DIR, "cli.js"), ...args], { - stdio: ["ignore", "pipe", "pipe"], - }); - - const timeout = setTimeout(() => { - console.log(`${colors.YELLOW}Test timed out: ${testName}${colors.NC}`); - child.kill(); - }, 15000); - - // Pipe stdout and stderr to the output file - child.stdout.pipe(outputStream); - child.stderr.pipe(outputStream); - - // Also capture output for display - let output = ""; - child.stdout.on("data", (data) => { - output += data.toString(); - }); - child.stderr.on("data", (data) => { - output += data.toString(); - }); - - child.on("close", (code) => { - clearTimeout(timeout); - outputStream.end(); - - // Check if we got valid JSON output (indicating success) even if process didn't exit cleanly - const hasValidJsonOutput = - output.includes('"tools"') || - output.includes('"resources"') || - output.includes('"prompts"') || - output.includes('"content"') || - output.includes('"messages"') || - output.includes('"contents"'); - - if (code === 0 || hasValidJsonOutput) { - console.log(`${colors.GREEN}✓ Test passed: ${testName}${colors.NC}`); - console.log(`${colors.BLUE}First few lines of output:${colors.NC}`); - const firstFewLines = output - .split("\n") - .slice(0, 5) - .map((line) => ` ${line}`) - .join("\n"); - console.log(firstFewLines); - PASSED_TESTS++; - resolve(true); - } else { - console.log(`${colors.RED}✗ Test failed: ${testName}${colors.NC}`); - console.log(`${colors.RED}Error output:${colors.NC}`); - console.log( - output - .split("\n") - .map((line) => ` ${line}`) - .join("\n"), - ); - FAILED_TESTS++; - - // Stop after any error is encountered - console.log( - `${colors.YELLOW}Stopping tests due to error. Please validate and fix before continuing.${colors.NC}`, - ); - process.exit(1); - } - }); - }); - } catch (error) { - console.error( - `${colors.RED}Error running test: ${error.message}${colors.NC}`, - ); - FAILED_TESTS++; - process.exit(1); - } -} - -// Function to run an error test (expected to fail) -async function runErrorTest(testName, ...args) { - const outputFile = path.join( - OUTPUT_DIR, - `${testName.replace(/\//g, "_")}.log`, - ); - - console.log(`\n${colors.YELLOW}Testing error case: ${testName}${colors.NC}`); - TOTAL_TESTS++; - - // Run the command and capture output - console.log( - `${colors.BLUE}Command: node ${BUILD_DIR}/cli.js ${args.join(" ")}${colors.NC}`, - ); - - try { - // Create a write stream for the output file - const outputStream = fs.createWriteStream(outputFile); - - // Spawn the process - return new Promise((resolve) => { - const child = spawn("node", [path.join(BUILD_DIR, "cli.js"), ...args], { - stdio: ["ignore", "pipe", "pipe"], - }); - - const timeout = setTimeout(() => { - console.log( - `${colors.YELLOW}Error test timed out: ${testName}${colors.NC}`, - ); - child.kill(); - }, 15000); - - // Pipe stdout and stderr to the output file - child.stdout.pipe(outputStream); - child.stderr.pipe(outputStream); - - // Also capture output for display - let output = ""; - child.stdout.on("data", (data) => { - output += data.toString(); - }); - child.stderr.on("data", (data) => { - output += data.toString(); - }); - - child.on("close", (code) => { - clearTimeout(timeout); - outputStream.end(); - - // For error tests, we expect a non-zero exit code - if (code !== 0) { - console.log( - `${colors.GREEN}✓ Error test passed: ${testName}${colors.NC}`, - ); - console.log(`${colors.BLUE}Error output (expected):${colors.NC}`); - const firstFewLines = output - .split("\n") - .slice(0, 5) - .map((line) => ` ${line}`) - .join("\n"); - console.log(firstFewLines); - PASSED_TESTS++; - resolve(true); - } else { - console.log( - `${colors.RED}✗ Error test failed: ${testName} (expected error but got success)${colors.NC}`, - ); - console.log(`${colors.RED}Output:${colors.NC}`); - console.log( - output - .split("\n") - .map((line) => ` ${line}`) - .join("\n"), - ); - FAILED_TESTS++; - - // Stop after any error is encountered - console.log( - `${colors.YELLOW}Stopping tests due to error. Please validate and fix before continuing.${colors.NC}`, - ); - process.exit(1); - } - }); - }); - } catch (error) { - console.error( - `${colors.RED}Error running test: ${error.message}${colors.NC}`, - ); - FAILED_TESTS++; - process.exit(1); - } -} - -// Run all tests -async function runTests() { - console.log( - `\n${colors.YELLOW}=== Running General Metadata Tests ===${colors.NC}`, - ); - - // Test 1: General metadata with tools/list - await runBasicTest( - "metadata_tools_list", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/list", - "--metadata", - "client=test-client", - ); - - // Test 2: General metadata with resources/list - await runBasicTest( - "metadata_resources_list", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "resources/list", - "--metadata", - "client=test-client", - ); - - // Test 3: General metadata with prompts/list - await runBasicTest( - "metadata_prompts_list", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "prompts/list", - "--metadata", - "client=test-client", - ); - - // Test 4: General metadata with resources/read - await runBasicTest( - "metadata_resources_read", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "resources/read", - "--uri", - "test://static/resource/1", - "--metadata", - "client=test-client", - ); - - // Test 5: General metadata with prompts/get - await runBasicTest( - "metadata_prompts_get", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "prompts/get", - "--prompt-name", - "simple_prompt", - "--metadata", - "client=test-client", - ); - - console.log( - `\n${colors.YELLOW}=== Running Tool-Specific Metadata Tests ===${colors.NC}`, - ); - - // Test 6: Tool-specific metadata with tools/call - await runBasicTest( - "metadata_tools_call_tool_meta", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/call", - "--tool-name", - "echo", - "--tool-arg", - "message=hello world", - "--tool-metadata", - "client=test-client", - ); - - // Test 7: Tool-specific metadata with complex tool - await runBasicTest( - "metadata_tools_call_complex_tool_meta", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/call", - "--tool-name", - "add", - "--tool-arg", - "a=10", - "b=20", - "--tool-metadata", - "client=test-client", - ); - - console.log( - `\n${colors.YELLOW}=== Running Metadata Merging Tests ===${colors.NC}`, - ); - - // Test 8: General metadata + tool-specific metadata (tool-specific should override) - await runBasicTest( - "metadata_merging_general_and_tool", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/call", - "--tool-name", - "echo", - "--tool-arg", - "message=hello world", - "--metadata", - "client=general-client", - "--tool-metadata", - "client=test-client", - ); - - console.log( - `\n${colors.YELLOW}=== Running Metadata Parsing Tests ===${colors.NC}`, - ); - - // Test 10: Metadata with numeric values (should be converted to strings) - await runBasicTest( - "metadata_parsing_numbers", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/list", - "--metadata", - "integer_value=42", - "decimal_value=3.14159", - "negative_value=-10", - ); - - // Test 11: Metadata with JSON values (should be converted to strings) - await runBasicTest( - "metadata_parsing_json", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/list", - "--metadata", - 'json_object="{\\"key\\":\\"value\\"}"', - 'json_array="[1,2,3]"', - 'json_string="\\"quoted\\""', - ); - - // Test 12: Metadata with special characters - await runBasicTest( - "metadata_parsing_special_chars", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/list", - "--metadata", - "unicode=🚀🎉✨", - "special_chars=!@#$%^&*()", - "spaces=hello world with spaces", - ); - - console.log( - `\n${colors.YELLOW}=== Running Metadata Edge Cases ===${colors.NC}`, - ); - - // Test 13: Single metadata entry - await runBasicTest( - "metadata_single_entry", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/list", - "--metadata", - "single_key=single_value", - ); - - // Test 14: Many metadata entries - await runBasicTest( - "metadata_many_entries", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/list", - "--metadata", - "key1=value1", - "key2=value2", - "key3=value3", - "key4=value4", - "key5=value5", - ); - - console.log( - `\n${colors.YELLOW}=== Running Metadata Error Cases ===${colors.NC}`, - ); - - // Test 15: Invalid metadata format (missing equals) - await runErrorTest( - "metadata_error_invalid_format", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/list", - "--metadata", - "invalid_format_no_equals", - ); - - // Test 16: Invalid tool-meta format (missing equals) - await runErrorTest( - "metadata_error_invalid_tool_meta_format", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/call", - "--tool-name", - "echo", - "--tool-arg", - "message=test", - "--tool-metadata", - "invalid_format_no_equals", - ); - - console.log( - `\n${colors.YELLOW}=== Running Metadata Impact Tests ===${colors.NC}`, - ); - - // Test 17: Test tool-specific metadata vs general metadata precedence - await runBasicTest( - "metadata_precedence_tool_overrides_general", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/call", - "--tool-name", - "echo", - "--tool-arg", - "message=precedence test", - "--metadata", - "client=general-client", - "--tool-metadata", - "client=tool-specific-client", - ); - - // Test 18: Test metadata with resources methods - await runBasicTest( - "metadata_resources_methods", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "resources/list", - "--metadata", - "resource_client=test-resource-client", - ); - - // Test 19: Test metadata with prompts methods - await runBasicTest( - "metadata_prompts_methods", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "prompts/get", - "--prompt-name", - "simple_prompt", - "--metadata", - "prompt_client=test-prompt-client", - ); - - console.log( - `\n${colors.YELLOW}=== Running Metadata Validation Tests ===${colors.NC}`, - ); - - // Test 20: Test metadata with special characters in keys - await runBasicTest( - "metadata_special_key_characters", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/call", - "--tool-name", - "echo", - "--tool-arg", - "message=special keys test", - "--metadata", - "key-with-dashes=value1", - "key_with_underscores=value2", - "key.with.dots=value3", - ); - - console.log( - `\n${colors.YELLOW}=== Running Metadata Integration Tests ===${colors.NC}`, - ); - - // Test 21: Metadata with all MCP methods - await runBasicTest( - "metadata_integration_all_methods", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/list", - "--metadata", - "integration_test=true", - "test_phase=all_methods", - ); - - // Test 22: Complex metadata scenario - await runBasicTest( - "metadata_complex_scenario", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/call", - "--tool-name", - "echo", - "--tool-arg", - "message=complex test", - "--metadata", - "session_id=12345", - "user_id=67890", - "timestamp=2024-01-01T00:00:00Z", - "request_id=req-abc-123", - "--tool-metadata", - "tool_session=session-xyz-789", - "execution_context=test", - "priority=high", - ); - - // Test 23: Metadata parsing validation test - await runBasicTest( - "metadata_parsing_validation", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/call", - "--tool-name", - "echo", - "--tool-arg", - "message=parsing validation test", - "--metadata", - "valid_key=valid_value", - "numeric_key=123", - "boolean_key=true", - 'json_key=\'{"test":"value"}\'', - "special_key=!@#$%^&*()", - "unicode_key=🚀🎉✨", - ); - - // Print test summary - console.log(`\n${colors.YELLOW}=== Test Summary ===${colors.NC}`); - console.log(`${colors.GREEN}Passed: ${PASSED_TESTS}${colors.NC}`); - console.log(`${colors.RED}Failed: ${FAILED_TESTS}${colors.NC}`); - console.log(`${colors.ORANGE}Skipped: ${SKIPPED_TESTS}${colors.NC}`); - console.log(`Total: ${TOTAL_TESTS}`); - console.log( - `${colors.BLUE}Detailed logs saved to: ${OUTPUT_DIR}${colors.NC}`, - ); - - console.log(`\n${colors.GREEN}All metadata tests completed!${colors.NC}`); -} - -// Run all tests -runTests().catch((error) => { - console.error( - `${colors.RED}Tests failed with error: ${error.message}${colors.NC}`, - ); - process.exit(1); -}); diff --git a/cli/scripts/cli-tests.js b/cli/scripts/cli-tests.js deleted file mode 100755 index 554a5262e..000000000 --- a/cli/scripts/cli-tests.js +++ /dev/null @@ -1,935 +0,0 @@ -#!/usr/bin/env node - -// Colors for output -const colors = { - GREEN: "\x1b[32m", - YELLOW: "\x1b[33m", - RED: "\x1b[31m", - BLUE: "\x1b[34m", - ORANGE: "\x1b[33m", - NC: "\x1b[0m", // No Color -}; - -import fs from "fs"; -import path from "path"; -import { spawn } from "child_process"; -import os from "os"; -import { fileURLToPath } from "url"; - -// Get directory paths with ESM compatibility -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); - -// Track test results -let PASSED_TESTS = 0; -let FAILED_TESTS = 0; -let SKIPPED_TESTS = 0; -let TOTAL_TESTS = 0; - -console.log( - `${colors.YELLOW}=== MCP Inspector CLI Test Script ===${colors.NC}`, -); -console.log( - `${colors.BLUE}This script tests the MCP Inspector CLI's ability to handle various command line options:${colors.NC}`, -); -console.log(`${colors.BLUE}- Basic CLI mode${colors.NC}`); -console.log(`${colors.BLUE}- Environment variables (-e)${colors.NC}`); -console.log(`${colors.BLUE}- Config file (--config)${colors.NC}`); -console.log(`${colors.BLUE}- Server selection (--server)${colors.NC}`); -console.log(`${colors.BLUE}- Method selection (--method)${colors.NC}`); -console.log(`${colors.BLUE}- Resource-related options (--uri)${colors.NC}`); -console.log( - `${colors.BLUE}- Prompt-related options (--prompt-name, --prompt-args)${colors.NC}`, -); -console.log(`${colors.BLUE}- Logging options (--log-level)${colors.NC}`); -console.log( - `${colors.BLUE}- Transport types (--transport http/sse/stdio)${colors.NC}`, -); -console.log( - `${colors.BLUE}- Transport inference from URL suffixes (/mcp, /sse)${colors.NC}`, -); -console.log(`\n`); - -// Get directory paths -const SCRIPTS_DIR = __dirname; -const PROJECT_ROOT = path.join(SCRIPTS_DIR, "../../"); -const BUILD_DIR = path.resolve(SCRIPTS_DIR, "../build"); - -// Define the test server command using npx -const TEST_CMD = "npx"; -const TEST_ARGS = ["@modelcontextprotocol/server-everything"]; - -// Create output directory for test results -const OUTPUT_DIR = path.join(SCRIPTS_DIR, "test-output"); -if (!fs.existsSync(OUTPUT_DIR)) { - fs.mkdirSync(OUTPUT_DIR, { recursive: true }); -} - -// Create a temporary directory for test files -const TEMP_DIR = path.join(os.tmpdir(), "mcp-inspector-tests"); -fs.mkdirSync(TEMP_DIR, { recursive: true }); - -// Track servers for cleanup -let runningServers = []; - -process.on("exit", () => { - try { - fs.rmSync(TEMP_DIR, { recursive: true, force: true }); - } catch (err) { - console.error( - `${colors.RED}Failed to remove temp directory: ${err.message}${colors.NC}`, - ); - } - - runningServers.forEach((server) => { - try { - process.kill(-server.pid); - } catch (e) {} - }); -}); - -process.on("SIGINT", () => { - runningServers.forEach((server) => { - try { - process.kill(-server.pid); - } catch (e) {} - }); - process.exit(1); -}); - -// Use the existing sample config file -console.log( - `${colors.BLUE}Using existing sample config file: ${PROJECT_ROOT}/sample-config.json${colors.NC}`, -); -try { - const sampleConfig = fs.readFileSync( - path.join(PROJECT_ROOT, "sample-config.json"), - "utf8", - ); - console.log(sampleConfig); -} catch (error) { - console.error( - `${colors.RED}Error reading sample config: ${error.message}${colors.NC}`, - ); -} - -// Create an invalid config file for testing -const invalidConfigPath = path.join(TEMP_DIR, "invalid-config.json"); -fs.writeFileSync(invalidConfigPath, '{\n "mcpServers": {\n "invalid": {'); - -// Create config files with different transport types for testing -const sseConfigPath = path.join(TEMP_DIR, "sse-config.json"); -fs.writeFileSync( - sseConfigPath, - JSON.stringify( - { - mcpServers: { - "test-sse": { - type: "sse", - url: "http://localhost:3000/sse", - note: "Test SSE server", - }, - }, - }, - null, - 2, - ), -); - -const httpConfigPath = path.join(TEMP_DIR, "http-config.json"); -fs.writeFileSync( - httpConfigPath, - JSON.stringify( - { - mcpServers: { - "test-http": { - type: "streamable-http", - url: "http://localhost:3000/mcp", - note: "Test HTTP server", - }, - }, - }, - null, - 2, - ), -); - -const stdioConfigPath = path.join(TEMP_DIR, "stdio-config.json"); -fs.writeFileSync( - stdioConfigPath, - JSON.stringify( - { - mcpServers: { - "test-stdio": { - type: "stdio", - command: "npx", - args: ["@modelcontextprotocol/server-everything"], - env: { - TEST_ENV: "test-value", - }, - }, - }, - }, - null, - 2, - ), -); - -// Config without type field (backward compatibility) -const legacyConfigPath = path.join(TEMP_DIR, "legacy-config.json"); -fs.writeFileSync( - legacyConfigPath, - JSON.stringify( - { - mcpServers: { - "test-legacy": { - command: "npx", - args: ["@modelcontextprotocol/server-everything"], - env: { - LEGACY_ENV: "legacy-value", - }, - }, - }, - }, - null, - 2, - ), -); - -// Function to run a basic test -async function runBasicTest(testName, ...args) { - const outputFile = path.join( - OUTPUT_DIR, - `${testName.replace(/\//g, "_")}.log`, - ); - - console.log(`\n${colors.YELLOW}Testing: ${testName}${colors.NC}`); - TOTAL_TESTS++; - - // Run the command and capture output - console.log( - `${colors.BLUE}Command: node ${BUILD_DIR}/cli.js ${args.join(" ")}${colors.NC}`, - ); - - try { - // Create a write stream for the output file - const outputStream = fs.createWriteStream(outputFile); - - // Spawn the process - return new Promise((resolve) => { - const child = spawn("node", [path.join(BUILD_DIR, "cli.js"), ...args], { - stdio: ["ignore", "pipe", "pipe"], - }); - - const timeout = setTimeout(() => { - console.log(`${colors.YELLOW}Test timed out: ${testName}${colors.NC}`); - child.kill(); - }, 10000); - - // Pipe stdout and stderr to the output file - child.stdout.pipe(outputStream); - child.stderr.pipe(outputStream); - - // Also capture output for display - let output = ""; - child.stdout.on("data", (data) => { - output += data.toString(); - }); - child.stderr.on("data", (data) => { - output += data.toString(); - }); - - child.on("close", (code) => { - clearTimeout(timeout); - outputStream.end(); - - if (code === 0) { - console.log(`${colors.GREEN}✓ Test passed: ${testName}${colors.NC}`); - console.log(`${colors.BLUE}First few lines of output:${colors.NC}`); - const firstFewLines = output - .split("\n") - .slice(0, 5) - .map((line) => ` ${line}`) - .join("\n"); - console.log(firstFewLines); - PASSED_TESTS++; - resolve(true); - } else { - console.log(`${colors.RED}✗ Test failed: ${testName}${colors.NC}`); - console.log(`${colors.RED}Error output:${colors.NC}`); - console.log( - output - .split("\n") - .map((line) => ` ${line}`) - .join("\n"), - ); - FAILED_TESTS++; - - // Stop after any error is encountered - console.log( - `${colors.YELLOW}Stopping tests due to error. Please validate and fix before continuing.${colors.NC}`, - ); - process.exit(1); - } - }); - }); - } catch (error) { - console.error( - `${colors.RED}Error running test: ${error.message}${colors.NC}`, - ); - FAILED_TESTS++; - process.exit(1); - } -} - -// Function to run an error test (expected to fail) -async function runErrorTest(testName, ...args) { - const outputFile = path.join( - OUTPUT_DIR, - `${testName.replace(/\//g, "_")}.log`, - ); - - console.log(`\n${colors.YELLOW}Testing error case: ${testName}${colors.NC}`); - TOTAL_TESTS++; - - // Run the command and capture output - console.log( - `${colors.BLUE}Command: node ${BUILD_DIR}/cli.js ${args.join(" ")}${colors.NC}`, - ); - - try { - // Create a write stream for the output file - const outputStream = fs.createWriteStream(outputFile); - - // Spawn the process - return new Promise((resolve) => { - const child = spawn("node", [path.join(BUILD_DIR, "cli.js"), ...args], { - stdio: ["ignore", "pipe", "pipe"], - }); - - const timeout = setTimeout(() => { - console.log( - `${colors.YELLOW}Error test timed out: ${testName}${colors.NC}`, - ); - child.kill(); - }, 10000); - - // Pipe stdout and stderr to the output file - child.stdout.pipe(outputStream); - child.stderr.pipe(outputStream); - - // Also capture output for display - let output = ""; - child.stdout.on("data", (data) => { - output += data.toString(); - }); - child.stderr.on("data", (data) => { - output += data.toString(); - }); - - child.on("close", (code) => { - clearTimeout(timeout); - outputStream.end(); - - // For error tests, we expect a non-zero exit code - if (code !== 0) { - console.log( - `${colors.GREEN}✓ Error test passed: ${testName}${colors.NC}`, - ); - console.log(`${colors.BLUE}Error output (expected):${colors.NC}`); - const firstFewLines = output - .split("\n") - .slice(0, 5) - .map((line) => ` ${line}`) - .join("\n"); - console.log(firstFewLines); - PASSED_TESTS++; - resolve(true); - } else { - console.log( - `${colors.RED}✗ Error test failed: ${testName} (expected error but got success)${colors.NC}`, - ); - console.log(`${colors.RED}Output:${colors.NC}`); - console.log( - output - .split("\n") - .map((line) => ` ${line}`) - .join("\n"), - ); - FAILED_TESTS++; - - // Stop after any error is encountered - console.log( - `${colors.YELLOW}Stopping tests due to error. Please validate and fix before continuing.${colors.NC}`, - ); - process.exit(1); - } - }); - }); - } catch (error) { - console.error( - `${colors.RED}Error running test: ${error.message}${colors.NC}`, - ); - FAILED_TESTS++; - process.exit(1); - } -} - -// Run all tests -async function runTests() { - console.log( - `\n${colors.YELLOW}=== Running Basic CLI Mode Tests ===${colors.NC}`, - ); - - // Test 1: Basic CLI mode with method - await runBasicTest( - "basic_cli_mode", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/list", - ); - - // Test 2: CLI mode with non-existent method (should fail) - await runErrorTest( - "nonexistent_method", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "nonexistent/method", - ); - - // Test 3: CLI mode without method (should fail) - await runErrorTest("missing_method", TEST_CMD, ...TEST_ARGS, "--cli"); - - console.log( - `\n${colors.YELLOW}=== Running Environment Variable Tests ===${colors.NC}`, - ); - - // Test 4: CLI mode with environment variables - await runBasicTest( - "env_variables", - TEST_CMD, - ...TEST_ARGS, - "-e", - "KEY1=value1", - "-e", - "KEY2=value2", - "--cli", - "--method", - "tools/list", - ); - - // Test 5: CLI mode with invalid environment variable format (should fail) - await runErrorTest( - "invalid_env_format", - TEST_CMD, - ...TEST_ARGS, - "-e", - "INVALID_FORMAT", - "--cli", - "--method", - "tools/list", - ); - - // Test 5b: CLI mode with environment variable containing equals sign in value - await runBasicTest( - "env_variable_with_equals", - TEST_CMD, - ...TEST_ARGS, - "-e", - "API_KEY=abc123=xyz789==", - "--cli", - "--method", - "tools/list", - ); - - // Test 5c: CLI mode with environment variable containing base64-encoded value - await runBasicTest( - "env_variable_with_base64", - TEST_CMD, - ...TEST_ARGS, - "-e", - "JWT_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0=", - "--cli", - "--method", - "tools/list", - ); - - console.log( - `\n${colors.YELLOW}=== Running Config File Tests ===${colors.NC}`, - ); - - // Test 6: Using config file with CLI mode - await runBasicTest( - "config_file", - "--config", - path.join(PROJECT_ROOT, "sample-config.json"), - "--server", - "everything", - "--cli", - "--method", - "tools/list", - ); - - // Test 7: Using config file without server name (should fail) - await runErrorTest( - "config_without_server", - "--config", - path.join(PROJECT_ROOT, "sample-config.json"), - "--cli", - "--method", - "tools/list", - ); - - // Test 8: Using server name without config file (should fail) - await runErrorTest( - "server_without_config", - "--server", - "everything", - "--cli", - "--method", - "tools/list", - ); - - // Test 9: Using non-existent config file (should fail) - await runErrorTest( - "nonexistent_config", - "--config", - "./nonexistent-config.json", - "--server", - "everything", - "--cli", - "--method", - "tools/list", - ); - - // Test 10: Using invalid config file format (should fail) - await runErrorTest( - "invalid_config", - "--config", - invalidConfigPath, - "--server", - "everything", - "--cli", - "--method", - "tools/list", - ); - - // Test 11: Using config file with non-existent server (should fail) - await runErrorTest( - "nonexistent_server", - "--config", - path.join(PROJECT_ROOT, "sample-config.json"), - "--server", - "nonexistent", - "--cli", - "--method", - "tools/list", - ); - - console.log( - `\n${colors.YELLOW}=== Running Resource-Related Tests ===${colors.NC}`, - ); - - // Test 16: CLI mode with resource read - await runBasicTest( - "resource_read", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "resources/read", - "--uri", - "test://static/resource/1", - ); - - // Test 17: CLI mode with resource read but missing URI (should fail) - await runErrorTest( - "missing_uri", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "resources/read", - ); - - console.log( - `\n${colors.YELLOW}=== Running Prompt-Related Tests ===${colors.NC}`, - ); - - // Test 18: CLI mode with prompt get - await runBasicTest( - "prompt_get", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "prompts/get", - "--prompt-name", - "simple_prompt", - ); - - // Test 19: CLI mode with prompt get and args - await runBasicTest( - "prompt_get_with_args", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "prompts/get", - "--prompt-name", - "complex_prompt", - "--prompt-args", - "temperature=0.7", - "style=concise", - ); - - // Test 20: CLI mode with prompt get but missing prompt name (should fail) - await runErrorTest( - "missing_prompt_name", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "prompts/get", - ); - - console.log(`\n${colors.YELLOW}=== Running Logging Tests ===${colors.NC}`); - - // Test 21: CLI mode with log level - await runBasicTest( - "log_level", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "logging/setLevel", - "--log-level", - "debug", - ); - - // Test 22: CLI mode with invalid log level (should fail) - await runErrorTest( - "invalid_log_level", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "logging/setLevel", - "--log-level", - "invalid", - ); - - console.log( - `\n${colors.YELLOW}=== Running Combined Option Tests ===${colors.NC}`, - ); - - // Note about the combined options issue - console.log( - `${colors.BLUE}Testing combined options with environment variables and config file.${colors.NC}`, - ); - - // Test 23: CLI mode with config file, environment variables, and tool call - await runBasicTest( - "combined_options", - "--config", - path.join(PROJECT_ROOT, "sample-config.json"), - "--server", - "everything", - "-e", - "CLI_ENV_VAR=cli_value", - "--cli", - "--method", - "tools/list", - ); - - // Test 24: CLI mode with all possible options (that make sense together) - await runBasicTest( - "all_options", - "--config", - path.join(PROJECT_ROOT, "sample-config.json"), - "--server", - "everything", - "-e", - "CLI_ENV_VAR=cli_value", - "--cli", - "--method", - "tools/call", - "--tool-name", - "echo", - "--tool-arg", - "message=Hello", - "--log-level", - "debug", - ); - - console.log( - `\n${colors.YELLOW}=== Running Config Transport Type Tests ===${colors.NC}`, - ); - - // Test 25: Config with stdio transport type - await runBasicTest( - "config_stdio_type", - "--config", - stdioConfigPath, - "--server", - "test-stdio", - "--cli", - "--method", - "tools/list", - ); - - // Test 26: Config with SSE transport type (CLI mode) - expects connection error - await runErrorTest( - "config_sse_type_cli", - "--config", - sseConfigPath, - "--server", - "test-sse", - "--cli", - "--method", - "tools/list", - ); - - // Test 27: Config with streamable-http transport type (CLI mode) - expects connection error - await runErrorTest( - "config_http_type_cli", - "--config", - httpConfigPath, - "--server", - "test-http", - "--cli", - "--method", - "tools/list", - ); - - // Test 28: Legacy config without type field (backward compatibility) - await runBasicTest( - "config_legacy_no_type", - "--config", - legacyConfigPath, - "--server", - "test-legacy", - "--cli", - "--method", - "tools/list", - ); - - console.log( - `\n${colors.YELLOW}=== Running Default Server Tests ===${colors.NC}`, - ); - - // Create config with single server for auto-selection - const singleServerConfigPath = path.join( - TEMP_DIR, - "single-server-config.json", - ); - fs.writeFileSync( - singleServerConfigPath, - JSON.stringify( - { - mcpServers: { - "only-server": { - command: "npx", - args: ["@modelcontextprotocol/server-everything"], - }, - }, - }, - null, - 2, - ), - ); - - // Create config with default-server - const defaultServerConfigPath = path.join( - TEMP_DIR, - "default-server-config.json", - ); - fs.writeFileSync( - defaultServerConfigPath, - JSON.stringify( - { - mcpServers: { - "default-server": { - command: "npx", - args: ["@modelcontextprotocol/server-everything"], - }, - "other-server": { - command: "node", - args: ["other.js"], - }, - }, - }, - null, - 2, - ), - ); - - // Create config with multiple servers (no default) - const multiServerConfigPath = path.join(TEMP_DIR, "multi-server-config.json"); - fs.writeFileSync( - multiServerConfigPath, - JSON.stringify( - { - mcpServers: { - server1: { - command: "npx", - args: ["@modelcontextprotocol/server-everything"], - }, - server2: { - command: "node", - args: ["other.js"], - }, - }, - }, - null, - 2, - ), - ); - - // Test 29: Config with single server auto-selection - await runBasicTest( - "single_server_auto_select", - "--config", - singleServerConfigPath, - "--cli", - "--method", - "tools/list", - ); - - // Test 30: Config with default-server should now require explicit selection (multiple servers) - await runErrorTest( - "default_server_requires_explicit_selection", - "--config", - defaultServerConfigPath, - "--cli", - "--method", - "tools/list", - ); - - // Test 31: Config with multiple servers and no default (should fail) - await runErrorTest( - "multi_server_no_default", - "--config", - multiServerConfigPath, - "--cli", - "--method", - "tools/list", - ); - - console.log( - `\n${colors.YELLOW}=== Running HTTP Transport Tests ===${colors.NC}`, - ); - - console.log( - `${colors.BLUE}Starting server-everything in streamableHttp mode.${colors.NC}`, - ); - const httpServer = spawn( - "npx", - ["@modelcontextprotocol/server-everything", "streamableHttp"], - { - detached: true, - stdio: "ignore", - }, - ); - runningServers.push(httpServer); - - await new Promise((resolve) => setTimeout(resolve, 3000)); - - // Test 32: HTTP transport inferred from URL ending with /mcp - await runBasicTest( - "http_transport_inferred", - "http://127.0.0.1:3001/mcp", - "--cli", - "--method", - "tools/list", - ); - - // Test 33: HTTP transport with explicit --transport http flag - await runBasicTest( - "http_transport_with_explicit_flag", - "http://127.0.0.1:3001/mcp", - "--transport", - "http", - "--cli", - "--method", - "tools/list", - ); - - // Test 34: HTTP transport with suffix and --transport http flag - await runBasicTest( - "http_transport_with_explicit_flag_and_suffix", - "http://127.0.0.1:3001/mcp", - "--transport", - "http", - "--cli", - "--method", - "tools/list", - ); - - // Test 35: SSE transport given to HTTP server (should fail) - await runErrorTest( - "sse_transport_given_to_http_server", - "http://127.0.0.1:3001", - "--transport", - "sse", - "--cli", - "--method", - "tools/list", - ); - - // Test 36: HTTP transport without URL (should fail) - await runErrorTest( - "http_transport_without_url", - "--transport", - "http", - "--cli", - "--method", - "tools/list", - ); - - // Test 37: SSE transport without URL (should fail) - await runErrorTest( - "sse_transport_without_url", - "--transport", - "sse", - "--cli", - "--method", - "tools/list", - ); - - // Kill HTTP server - try { - process.kill(-httpServer.pid); - console.log( - `${colors.BLUE}HTTP server killed, waiting for port to be released...${colors.NC}`, - ); - } catch (e) { - console.log( - `${colors.RED}Error killing HTTP server: ${e.message}${colors.NC}`, - ); - } - - // Print test summary - console.log(`\n${colors.YELLOW}=== Test Summary ===${colors.NC}`); - console.log(`${colors.GREEN}Passed: ${PASSED_TESTS}${colors.NC}`); - console.log(`${colors.RED}Failed: ${FAILED_TESTS}${colors.NC}`); - console.log(`${colors.ORANGE}Skipped: ${SKIPPED_TESTS}${colors.NC}`); - console.log(`Total: ${TOTAL_TESTS}`); - console.log( - `${colors.BLUE}Detailed logs saved to: ${OUTPUT_DIR}${colors.NC}`, - ); - - console.log(`\n${colors.GREEN}All tests completed!${colors.NC}`); -} - -// Run all tests -runTests().catch((error) => { - console.error( - `${colors.RED}Tests failed with error: ${error.message}${colors.NC}`, - ); - process.exit(1); -}); diff --git a/cli/scripts/cli-tool-tests.js b/cli/scripts/cli-tool-tests.js deleted file mode 100644 index b06aea940..000000000 --- a/cli/scripts/cli-tool-tests.js +++ /dev/null @@ -1,614 +0,0 @@ -#!/usr/bin/env node - -// Colors for output -const colors = { - GREEN: "\x1b[32m", - YELLOW: "\x1b[33m", - RED: "\x1b[31m", - BLUE: "\x1b[34m", - ORANGE: "\x1b[33m", - NC: "\x1b[0m", // No Color -}; - -import fs from "fs"; -import path from "path"; -import { spawn } from "child_process"; -import os from "os"; -import { fileURLToPath } from "url"; - -// Get directory paths with ESM compatibility -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); - -// Track test results -let PASSED_TESTS = 0; -let FAILED_TESTS = 0; -let SKIPPED_TESTS = 0; -let TOTAL_TESTS = 0; - -console.log(`${colors.YELLOW}=== MCP Inspector CLI Tool Tests ===${colors.NC}`); -console.log( - `${colors.BLUE}This script tests the MCP Inspector CLI's tool-related functionality:${colors.NC}`, -); -console.log(`${colors.BLUE}- Tool discovery and listing${colors.NC}`); -console.log( - `${colors.BLUE}- JSON argument parsing (strings, numbers, booleans, objects, arrays)${colors.NC}`, -); -console.log(`${colors.BLUE}- Tool schema validation${colors.NC}`); -console.log( - `${colors.BLUE}- Tool execution with various argument types${colors.NC}`, -); -console.log( - `${colors.BLUE}- Error handling for invalid tools and arguments${colors.NC}`, -); -console.log(`\n`); - -// Get directory paths -const SCRIPTS_DIR = __dirname; -const PROJECT_ROOT = path.join(SCRIPTS_DIR, "../../"); -const BUILD_DIR = path.resolve(SCRIPTS_DIR, "../build"); - -// Define the test server command using npx -const TEST_CMD = "npx"; -const TEST_ARGS = ["@modelcontextprotocol/server-everything"]; - -// Create output directory for test results -const OUTPUT_DIR = path.join(SCRIPTS_DIR, "tool-test-output"); -if (!fs.existsSync(OUTPUT_DIR)) { - fs.mkdirSync(OUTPUT_DIR, { recursive: true }); -} - -// Create a temporary directory for test files -const TEMP_DIR = path.join(os.tmpdir(), "mcp-inspector-tool-tests"); -fs.mkdirSync(TEMP_DIR, { recursive: true }); - -// Track servers for cleanup -let runningServers = []; - -process.on("exit", () => { - try { - fs.rmSync(TEMP_DIR, { recursive: true, force: true }); - } catch (err) { - console.error( - `${colors.RED}Failed to remove temp directory: ${err.message}${colors.NC}`, - ); - } - - runningServers.forEach((server) => { - try { - process.kill(-server.pid); - } catch (e) {} - }); -}); - -process.on("SIGINT", () => { - runningServers.forEach((server) => { - try { - process.kill(-server.pid); - } catch (e) {} - }); - process.exit(1); -}); - -// Function to run a basic test -async function runBasicTest(testName, ...args) { - const outputFile = path.join( - OUTPUT_DIR, - `${testName.replace(/\//g, "_")}.log`, - ); - - console.log(`\n${colors.YELLOW}Testing: ${testName}${colors.NC}`); - TOTAL_TESTS++; - - // Run the command and capture output - console.log( - `${colors.BLUE}Command: node ${BUILD_DIR}/cli.js ${args.join(" ")}${colors.NC}`, - ); - - try { - // Create a write stream for the output file - const outputStream = fs.createWriteStream(outputFile); - - // Spawn the process - return new Promise((resolve) => { - const child = spawn("node", [path.join(BUILD_DIR, "cli.js"), ...args], { - stdio: ["ignore", "pipe", "pipe"], - }); - - const timeout = setTimeout(() => { - console.log(`${colors.YELLOW}Test timed out: ${testName}${colors.NC}`); - child.kill(); - }, 10000); - - // Pipe stdout and stderr to the output file - child.stdout.pipe(outputStream); - child.stderr.pipe(outputStream); - - // Also capture output for display - let output = ""; - child.stdout.on("data", (data) => { - output += data.toString(); - }); - child.stderr.on("data", (data) => { - output += data.toString(); - }); - - child.on("close", (code) => { - clearTimeout(timeout); - outputStream.end(); - - if (code === 0) { - console.log(`${colors.GREEN}✓ Test passed: ${testName}${colors.NC}`); - console.log(`${colors.BLUE}First few lines of output:${colors.NC}`); - const firstFewLines = output - .split("\n") - .slice(0, 5) - .map((line) => ` ${line}`) - .join("\n"); - console.log(firstFewLines); - PASSED_TESTS++; - resolve(true); - } else { - console.log(`${colors.RED}✗ Test failed: ${testName}${colors.NC}`); - console.log(`${colors.RED}Error output:${colors.NC}`); - console.log( - output - .split("\n") - .map((line) => ` ${line}`) - .join("\n"), - ); - FAILED_TESTS++; - - // Stop after any error is encountered - console.log( - `${colors.YELLOW}Stopping tests due to error. Please validate and fix before continuing.${colors.NC}`, - ); - process.exit(1); - } - }); - }); - } catch (error) { - console.error( - `${colors.RED}Error running test: ${error.message}${colors.NC}`, - ); - FAILED_TESTS++; - process.exit(1); - } -} - -// Function to run an error test (expected to fail) -async function runErrorTest(testName, ...args) { - const outputFile = path.join( - OUTPUT_DIR, - `${testName.replace(/\//g, "_")}.log`, - ); - - console.log(`\n${colors.YELLOW}Testing error case: ${testName}${colors.NC}`); - TOTAL_TESTS++; - - // Run the command and capture output - console.log( - `${colors.BLUE}Command: node ${BUILD_DIR}/cli.js ${args.join(" ")}${colors.NC}`, - ); - - try { - // Create a write stream for the output file - const outputStream = fs.createWriteStream(outputFile); - - // Spawn the process - return new Promise((resolve) => { - const child = spawn("node", [path.join(BUILD_DIR, "cli.js"), ...args], { - stdio: ["ignore", "pipe", "pipe"], - }); - - const timeout = setTimeout(() => { - console.log( - `${colors.YELLOW}Error test timed out: ${testName}${colors.NC}`, - ); - child.kill(); - }, 10000); - - // Pipe stdout and stderr to the output file - child.stdout.pipe(outputStream); - child.stderr.pipe(outputStream); - - // Also capture output for display - let output = ""; - child.stdout.on("data", (data) => { - output += data.toString(); - }); - child.stderr.on("data", (data) => { - output += data.toString(); - }); - - child.on("close", (code) => { - clearTimeout(timeout); - outputStream.end(); - - // For error tests, we expect a non-zero exit code - if (code !== 0) { - console.log( - `${colors.GREEN}✓ Error test passed: ${testName}${colors.NC}`, - ); - console.log(`${colors.BLUE}Error output (expected):${colors.NC}`); - const firstFewLines = output - .split("\n") - .slice(0, 5) - .map((line) => ` ${line}`) - .join("\n"); - console.log(firstFewLines); - PASSED_TESTS++; - resolve(true); - } else { - console.log( - `${colors.RED}✗ Error test failed: ${testName} (expected error but got success)${colors.NC}`, - ); - console.log(`${colors.RED}Output:${colors.NC}`); - console.log( - output - .split("\n") - .map((line) => ` ${line}`) - .join("\n"), - ); - FAILED_TESTS++; - - // Stop after any error is encountered - console.log( - `${colors.YELLOW}Stopping tests due to error. Please validate and fix before continuing.${colors.NC}`, - ); - process.exit(1); - } - }); - }); - } catch (error) { - console.error( - `${colors.RED}Error running test: ${error.message}${colors.NC}`, - ); - FAILED_TESTS++; - process.exit(1); - } -} - -// Run all tests -async function runTests() { - console.log( - `\n${colors.YELLOW}=== Running Tool Discovery Tests ===${colors.NC}`, - ); - - // Test 1: List available tools - await runBasicTest( - "tool_discovery_list", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/list", - ); - - console.log( - `\n${colors.YELLOW}=== Running JSON Argument Parsing Tests ===${colors.NC}`, - ); - - // Test 2: String arguments (backward compatibility) - await runBasicTest( - "json_args_string", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/call", - "--tool-name", - "echo", - "--tool-arg", - "message=hello world", - ); - - // Test 3: Number arguments - await runBasicTest( - "json_args_number_integer", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/call", - "--tool-name", - "add", - "--tool-arg", - "a=42", - "b=58", - ); - - // Test 4: Number arguments with decimals (using add tool with decimal numbers) - await runBasicTest( - "json_args_number_decimal", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/call", - "--tool-name", - "add", - "--tool-arg", - "a=19.99", - "b=20.01", - ); - - // Test 5: Boolean arguments - true - await runBasicTest( - "json_args_boolean_true", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/call", - "--tool-name", - "annotatedMessage", - "--tool-arg", - "messageType=success", - "includeImage=true", - ); - - // Test 6: Boolean arguments - false - await runBasicTest( - "json_args_boolean_false", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/call", - "--tool-name", - "annotatedMessage", - "--tool-arg", - "messageType=error", - "includeImage=false", - ); - - // Test 7: Null arguments (using echo with string "null") - await runBasicTest( - "json_args_null", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/call", - "--tool-name", - "echo", - "--tool-arg", - 'message="null"', - ); - - // Test 14: Multiple arguments with mixed types (using add tool) - await runBasicTest( - "json_args_multiple_mixed", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/call", - "--tool-name", - "add", - "--tool-arg", - "a=42.5", - "b=57.5", - ); - - console.log( - `\n${colors.YELLOW}=== Running JSON Parsing Edge Cases ===${colors.NC}`, - ); - - // Test 15: Invalid JSON should fall back to string - await runBasicTest( - "json_args_invalid_fallback", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/call", - "--tool-name", - "echo", - "--tool-arg", - "message={invalid json}", - ); - - // Test 16: Empty string value - await runBasicTest( - "json_args_empty_value", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/call", - "--tool-name", - "echo", - "--tool-arg", - 'message=""', - ); - - // Test 17: Special characters in strings - await runBasicTest( - "json_args_special_chars", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/call", - "--tool-name", - "echo", - "--tool-arg", - 'message="C:\\\\Users\\\\test"', - ); - - // Test 18: Unicode characters - await runBasicTest( - "json_args_unicode", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/call", - "--tool-name", - "echo", - "--tool-arg", - 'message="🚀🎉✨"', - ); - - // Test 19: Arguments with equals signs in values - await runBasicTest( - "json_args_equals_in_value", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/call", - "--tool-name", - "echo", - "--tool-arg", - "message=2+2=4", - ); - - // Test 20: Base64-like strings - await runBasicTest( - "json_args_base64_like", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/call", - "--tool-name", - "echo", - "--tool-arg", - "message=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0=", - ); - - console.log( - `\n${colors.YELLOW}=== Running Tool Error Handling Tests ===${colors.NC}`, - ); - - // Test 21: Non-existent tool - await runErrorTest( - "tool_error_nonexistent", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/call", - "--tool-name", - "nonexistent_tool", - "--tool-arg", - "message=test", - ); - - // Test 22: Missing tool name - await runErrorTest( - "tool_error_missing_name", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/call", - "--tool-arg", - "message=test", - ); - - // Test 23: Invalid tool argument format - await runErrorTest( - "tool_error_invalid_arg_format", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/call", - "--tool-name", - "echo", - "--tool-arg", - "invalid_format_no_equals", - ); - - console.log( - `\n${colors.YELLOW}=== Running Prompt JSON Argument Tests ===${colors.NC}`, - ); - - // Test 24: Prompt with JSON arguments - await runBasicTest( - "prompt_json_args_mixed", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "prompts/get", - "--prompt-name", - "complex_prompt", - "--prompt-args", - "temperature=0.7", - 'style="concise"', - 'options={"format":"json","max_tokens":100}', - ); - - // Test 25: Prompt with simple arguments - await runBasicTest( - "prompt_json_args_simple", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "prompts/get", - "--prompt-name", - "simple_prompt", - "--prompt-args", - "name=test", - "count=5", - ); - - console.log( - `\n${colors.YELLOW}=== Running Backward Compatibility Tests ===${colors.NC}`, - ); - - // Test 26: Ensure existing string-only usage still works - await runBasicTest( - "backward_compatibility_strings", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/call", - "--tool-name", - "echo", - "--tool-arg", - "message=hello", - ); - - // Test 27: Multiple string arguments (existing pattern) - using add tool - await runBasicTest( - "backward_compatibility_multiple_strings", - TEST_CMD, - ...TEST_ARGS, - "--cli", - "--method", - "tools/call", - "--tool-name", - "add", - "--tool-arg", - "a=10", - "b=20", - ); - - // Print test summary - console.log(`\n${colors.YELLOW}=== Test Summary ===${colors.NC}`); - console.log(`${colors.GREEN}Passed: ${PASSED_TESTS}${colors.NC}`); - console.log(`${colors.RED}Failed: ${FAILED_TESTS}${colors.NC}`); - console.log(`${colors.ORANGE}Skipped: ${SKIPPED_TESTS}${colors.NC}`); - console.log(`Total: ${TOTAL_TESTS}`); - console.log( - `${colors.BLUE}Detailed logs saved to: ${OUTPUT_DIR}${colors.NC}`, - ); - - console.log(`\n${colors.GREEN}All tool tests completed!${colors.NC}`); -} - -// Run all tests -runTests().catch((error) => { - console.error( - `${colors.RED}Tests failed with error: ${error.message}${colors.NC}`, - ); - process.exit(1); -}); diff --git a/cli/src/cli.ts b/cli/src/cli.ts index f4187e02d..ae07d7bc2 100644 --- a/cli/src/cli.ts +++ b/cli/src/cli.ts @@ -9,6 +9,8 @@ import { fileURLToPath } from "url"; const __dirname = dirname(fileURLToPath(import.meta.url)); +// This represents the parsed arguments produced by parseArgs() +// type Args = { command: string; args: string[]; @@ -19,6 +21,9 @@ type Args = { headers?: Record; }; +// This is only to provide typed access to the parsed program options +// This could just be defined locally in parseArgs() since that's the only place it is used +// type CliOptions = { e?: Record; config?: string; @@ -167,6 +172,36 @@ async function runCli(args: Args): Promise { } } +async function runTui(tuiArgs: string[]): Promise { + const projectRoot = resolve(__dirname, "../.."); + const tuiPath = resolve(projectRoot, "tui", "build", "tui.js"); + + const abort = new AbortController(); + + let cancelled = false; + + process.on("SIGINT", () => { + cancelled = true; + abort.abort(); + }); + + try { + // Remove --tui flag and pass everything else directly to TUI + const filteredArgs = tuiArgs.filter((arg) => arg !== "--tui"); + + await spawnPromise("node", [tuiPath, ...filteredArgs], { + env: process.env, + signal: abort.signal, + echoOutput: true, + stdio: "inherit", + }); + } catch (e) { + if (!cancelled || process.env.DEBUG) { + throw e; + } + } +} + function loadConfigFile(configPath: string, serverName: string): ServerConfig { try { const resolvedConfigPath = path.isAbsolute(configPath) @@ -267,6 +302,7 @@ function parseArgs(): Args { .option("--config ", "config file path") .option("--server ", "server name from config file") .option("--cli", "enable CLI mode") + .option("--tui", "enable TUI mode") .option("--transport ", "transport type (stdio, sse, http)") .option("--server-url ", "server URL for SSE/HTTP transport") .option( @@ -379,6 +415,15 @@ async function main(): Promise { }); try { + // For now we just pass the raw args to TUI (we'll integrate config later) + // The main issue is that Inspector only supports a single server and the TUI supports a set + // + // Check for --tui in raw argv - if present, bypass all parsing + if (process.argv.includes("--tui")) { + await runTui(process.argv.slice(2)); + return; + } + const args = parseArgs(); if (args.cli) { diff --git a/cli/src/client/connection.ts b/cli/src/client/connection.ts deleted file mode 100644 index dcbe8e518..000000000 --- a/cli/src/client/connection.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { Client } from "@modelcontextprotocol/sdk/client/index.js"; -import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js"; -import { McpResponse } from "./types.js"; - -export const validLogLevels = [ - "trace", - "debug", - "info", - "warn", - "error", -] as const; - -export type LogLevel = (typeof validLogLevels)[number]; - -export async function connect( - client: Client, - transport: Transport, -): Promise { - try { - await client.connect(transport); - - if (client.getServerCapabilities()?.logging) { - // default logging level is undefined in the spec, but the user of the - // inspector most likely wants debug. - await client.setLoggingLevel("debug"); - } - } catch (error) { - throw new Error( - `Failed to connect to MCP server: ${error instanceof Error ? error.message : String(error)}`, - ); - } -} - -export async function disconnect(transport: Transport): Promise { - try { - await transport.close(); - } catch (error) { - throw new Error( - `Failed to disconnect from MCP server: ${error instanceof Error ? error.message : String(error)}`, - ); - } -} - -// Set logging level -export async function setLoggingLevel( - client: Client, - level: LogLevel, -): Promise { - try { - const response = await client.setLoggingLevel(level as any); - return response; - } catch (error) { - throw new Error( - `Failed to set logging level: ${error instanceof Error ? error.message : String(error)}`, - ); - } -} diff --git a/cli/src/client/index.ts b/cli/src/client/index.ts deleted file mode 100644 index 095d716b2..000000000 --- a/cli/src/client/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -// Re-export everything from the client modules -export * from "./connection.js"; -export * from "./prompts.js"; -export * from "./resources.js"; -export * from "./tools.js"; -export * from "./types.js"; diff --git a/cli/src/client/prompts.ts b/cli/src/client/prompts.ts deleted file mode 100644 index e7a1cf2f2..000000000 --- a/cli/src/client/prompts.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { Client } from "@modelcontextprotocol/sdk/client/index.js"; -import { McpResponse } from "./types.js"; - -// JSON value type matching the client utils -type JsonValue = - | string - | number - | boolean - | null - | undefined - | JsonValue[] - | { [key: string]: JsonValue }; - -// List available prompts -export async function listPrompts( - client: Client, - metadata?: Record, -): Promise { - try { - const params = - metadata && Object.keys(metadata).length > 0 ? { _meta: metadata } : {}; - const response = await client.listPrompts(params); - return response; - } catch (error) { - throw new Error( - `Failed to list prompts: ${error instanceof Error ? error.message : String(error)}`, - ); - } -} - -// Get a prompt -export async function getPrompt( - client: Client, - name: string, - args?: Record, - metadata?: Record, -): Promise { - try { - // Convert all arguments to strings for prompt arguments - const stringArgs: Record = {}; - if (args) { - for (const [key, value] of Object.entries(args)) { - if (typeof value === "string") { - stringArgs[key] = value; - } else if (value === null || value === undefined) { - stringArgs[key] = String(value); - } else { - stringArgs[key] = JSON.stringify(value); - } - } - } - - const params: any = { - name, - arguments: stringArgs, - }; - - if (metadata && Object.keys(metadata).length > 0) { - params._meta = metadata; - } - - const response = await client.getPrompt(params); - - return response; - } catch (error) { - throw new Error( - `Failed to get prompt: ${error instanceof Error ? error.message : String(error)}`, - ); - } -} diff --git a/cli/src/client/resources.ts b/cli/src/client/resources.ts deleted file mode 100644 index 3e44820ca..000000000 --- a/cli/src/client/resources.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { Client } from "@modelcontextprotocol/sdk/client/index.js"; -import { McpResponse } from "./types.js"; - -// List available resources -export async function listResources( - client: Client, - metadata?: Record, -): Promise { - try { - const params = - metadata && Object.keys(metadata).length > 0 ? { _meta: metadata } : {}; - const response = await client.listResources(params); - return response; - } catch (error) { - throw new Error( - `Failed to list resources: ${error instanceof Error ? error.message : String(error)}`, - ); - } -} - -// Read a resource -export async function readResource( - client: Client, - uri: string, - metadata?: Record, -): Promise { - try { - const params: any = { uri }; - if (metadata && Object.keys(metadata).length > 0) { - params._meta = metadata; - } - const response = await client.readResource(params); - return response; - } catch (error) { - throw new Error( - `Failed to read resource ${uri}: ${error instanceof Error ? error.message : String(error)}`, - ); - } -} - -// List resource templates -export async function listResourceTemplates( - client: Client, - metadata?: Record, -): Promise { - try { - const params = - metadata && Object.keys(metadata).length > 0 ? { _meta: metadata } : {}; - const response = await client.listResourceTemplates(params); - return response; - } catch (error) { - throw new Error( - `Failed to list resource templates: ${error instanceof Error ? error.message : String(error)}`, - ); - } -} diff --git a/cli/src/client/tools.ts b/cli/src/client/tools.ts deleted file mode 100644 index 516814115..000000000 --- a/cli/src/client/tools.ts +++ /dev/null @@ -1,140 +0,0 @@ -import { Client } from "@modelcontextprotocol/sdk/client/index.js"; -import { Tool } from "@modelcontextprotocol/sdk/types.js"; -import { McpResponse } from "./types.js"; - -// JSON value type matching the client utils -type JsonValue = - | string - | number - | boolean - | null - | undefined - | JsonValue[] - | { [key: string]: JsonValue }; - -type JsonSchemaType = { - type: "string" | "number" | "integer" | "boolean" | "array" | "object"; - description?: string; - properties?: Record; - items?: JsonSchemaType; -}; - -export async function listTools( - client: Client, - metadata?: Record, -): Promise { - try { - const params = - metadata && Object.keys(metadata).length > 0 ? { _meta: metadata } : {}; - const response = await client.listTools(params); - return response; - } catch (error) { - throw new Error( - `Failed to list tools: ${error instanceof Error ? error.message : String(error)}`, - ); - } -} - -function convertParameterValue( - value: string, - schema: JsonSchemaType, -): JsonValue { - if (!value) { - return value; - } - - if (schema.type === "number" || schema.type === "integer") { - return Number(value); - } - - if (schema.type === "boolean") { - return value.toLowerCase() === "true"; - } - - if (schema.type === "object" || schema.type === "array") { - try { - return JSON.parse(value) as JsonValue; - } catch (error) { - return value; - } - } - - return value; -} - -function convertParameters( - tool: Tool, - params: Record, -): Record { - const result: Record = {}; - const properties = tool.inputSchema.properties || {}; - - for (const [key, value] of Object.entries(params)) { - const paramSchema = properties[key] as JsonSchemaType | undefined; - - if (paramSchema) { - result[key] = convertParameterValue(value, paramSchema); - } else { - // If no schema is found for this parameter, keep it as string - result[key] = value; - } - } - - return result; -} - -export async function callTool( - client: Client, - name: string, - args: Record, - generalMetadata?: Record, - toolSpecificMetadata?: Record, -): Promise { - try { - const toolsResponse = await listTools(client, generalMetadata); - const tools = toolsResponse.tools as Tool[]; - const tool = tools.find((t) => t.name === name); - - let convertedArgs: Record = args; - - if (tool) { - // Convert parameters based on the tool's schema, but only for string values - // since we now accept pre-parsed values from the CLI - const stringArgs: Record = {}; - for (const [key, value] of Object.entries(args)) { - if (typeof value === "string") { - stringArgs[key] = value; - } - } - - if (Object.keys(stringArgs).length > 0) { - const convertedStringArgs = convertParameters(tool, stringArgs); - convertedArgs = { ...args, ...convertedStringArgs }; - } - } - - // Merge general metadata with tool-specific metadata - // Tool-specific metadata takes precedence over general metadata - let mergedMetadata: Record | undefined; - if (generalMetadata || toolSpecificMetadata) { - mergedMetadata = { - ...(generalMetadata || {}), - ...(toolSpecificMetadata || {}), - }; - } - - const response = await client.callTool({ - name: name, - arguments: convertedArgs, - _meta: - mergedMetadata && Object.keys(mergedMetadata).length > 0 - ? mergedMetadata - : undefined, - }); - return response; - } catch (error) { - throw new Error( - `Failed to call tool ${name}: ${error instanceof Error ? error.message : String(error)}`, - ); - } -} diff --git a/cli/src/client/types.ts b/cli/src/client/types.ts deleted file mode 100644 index bbbe1bf4f..000000000 --- a/cli/src/client/types.ts +++ /dev/null @@ -1 +0,0 @@ -export type McpResponse = Record; diff --git a/cli/src/index.ts b/cli/src/index.ts index 45a71a052..db41cb0c9 100644 --- a/cli/src/index.ts +++ b/cli/src/index.ts @@ -1,36 +1,28 @@ #!/usr/bin/env node import * as fs from "fs"; -import { Client } from "@modelcontextprotocol/sdk/client/index.js"; import { Command } from "commander"; -import { - callTool, - connect, - disconnect, - getPrompt, - listPrompts, - listResources, - listResourceTemplates, - listTools, - LogLevel, - McpResponse, - readResource, - setLoggingLevel, - validLogLevels, -} from "./client/index.js"; +// CLI helper functions moved to InspectorClient methods +type McpResponse = Record; import { handleError } from "./error-handler.js"; -import { createTransport, TransportOptions } from "./transport.js"; import { awaitableLog } from "./utils/awaitable-log.js"; +import type { + MCPServerConfig, + StdioServerConfig, + SseServerConfig, + StreamableHttpServerConfig, +} from "@modelcontextprotocol/inspector-shared/mcp/types.js"; +import { InspectorClient } from "@modelcontextprotocol/inspector-shared/mcp/inspectorClient.js"; +import type { JsonValue } from "@modelcontextprotocol/inspector-shared/mcp/index.js"; +import { + LoggingLevelSchema, + type LoggingLevel, +} from "@modelcontextprotocol/sdk/types.js"; +import { getDefaultEnvironment } from "@modelcontextprotocol/sdk/client/stdio.js"; -// JSON value type for CLI arguments -type JsonValue = - | string - | number - | boolean - | null - | undefined - | JsonValue[] - | { [key: string]: JsonValue }; +export const validLogLevels: LoggingLevel[] = Object.values( + LoggingLevelSchema.enum, +); type Args = { target: string[]; @@ -38,7 +30,7 @@ type Args = { promptName?: string; promptArgs?: Record; uri?: string; - logLevel?: LogLevel; + logLevel?: LoggingLevel; toolName?: string; toolArg?: Record; toolMeta?: Record; @@ -47,58 +39,119 @@ type Args = { metadata?: Record; }; -function createTransportOptions( - target: string[], - transport?: "sse" | "stdio" | "http", - headers?: Record, -): TransportOptions { - if (target.length === 0) { +/** + * Converts CLI Args to MCPServerConfig format + * This will be used to create an InspectorClient + */ +function argsToMcpServerConfig(args: Args): MCPServerConfig { + if (args.target.length === 0) { throw new Error( "Target is required. Specify a URL or a command to execute.", ); } - const [command, ...commandArgs] = target; + const [firstTarget, ...targetArgs] = args.target; - if (!command) { - throw new Error("Command is required."); + if (!firstTarget) { + throw new Error("Target is required."); } - const isUrl = command.startsWith("http://") || command.startsWith("https://"); + const isUrl = + firstTarget.startsWith("http://") || firstTarget.startsWith("https://"); - if (isUrl && commandArgs.length > 0) { + // Validation: URLs cannot have additional arguments + if (isUrl && targetArgs.length > 0) { throw new Error("Arguments cannot be passed to a URL-based MCP server."); } - let transportType: "sse" | "stdio" | "http"; - if (transport) { - if (!isUrl && transport !== "stdio") { + // Validation: Transport/URL combinations + if (args.transport) { + if (!isUrl && args.transport !== "stdio") { throw new Error("Only stdio transport can be used with local commands."); } - if (isUrl && transport === "stdio") { + if (isUrl && args.transport === "stdio") { throw new Error("stdio transport cannot be used with URLs."); } - transportType = transport; - } else if (isUrl) { - const url = new URL(command); - if (url.pathname.endsWith("/mcp")) { - transportType = "http"; - } else if (url.pathname.endsWith("/sse")) { - transportType = "sse"; + } + + // Handle URL-based transports (SSE or streamable-http) + if (isUrl) { + const url = new URL(firstTarget); + + // Determine transport type + let transportType: "sse" | "streamable-http"; + if (args.transport) { + // Convert CLI's "http" to "streamable-http" + if (args.transport === "http") { + transportType = "streamable-http"; + } else if (args.transport === "sse") { + transportType = "sse"; + } else { + // Should not happen due to validation above, but default to SSE + transportType = "sse"; + } } else { - transportType = "sse"; + // Auto-detect from URL path + if (url.pathname.endsWith("/mcp")) { + transportType = "streamable-http"; + } else if (url.pathname.endsWith("/sse")) { + transportType = "sse"; + } else { + // Default to SSE if path doesn't match known patterns + transportType = "sse"; + } + } + + // Create SSE or streamable-http config + if (transportType === "sse") { + const config: SseServerConfig = { + type: "sse", + url: firstTarget, + }; + if (args.headers) { + config.headers = args.headers; + } + return config; + } else { + const config: StreamableHttpServerConfig = { + type: "streamable-http", + url: firstTarget, + }; + if (args.headers) { + config.headers = args.headers; + } + return config; } - } else { - transportType = "stdio"; } - return { - transportType, - command: isUrl ? undefined : command, - args: isUrl ? undefined : commandArgs, - url: isUrl ? command : undefined, - headers, + // Handle stdio transport (command-based) + const config: StdioServerConfig = { + type: "stdio", + command: firstTarget, }; + + if (targetArgs.length > 0) { + config.args = targetArgs; + } + + const processEnv: Record = {}; + + for (const [key, value] of Object.entries(process.env)) { + if (value !== undefined) { + processEnv[key] = value; + } + } + + const defaultEnv = getDefaultEnvironment(); + + const env: Record = { + ...defaultEnv, + ...processEnv, + }; + + config.env = env; + + return config; } async function callMethod(args: Args): Promise { @@ -111,27 +164,24 @@ async function callMethod(args: Args): Promise { }); packageJson = packageJsonData.default; - const transportOptions = createTransportOptions( - args.target, - args.transport, - args.headers, - ); - const transport = createTransport(transportOptions); - const [, name = packageJson.name] = packageJson.name.split("/"); const version = packageJson.version; const clientIdentity = { name, version }; - const client = new Client(clientIdentity); + const inspectorClient = new InspectorClient(argsToMcpServerConfig(args), { + clientIdentity, + autoFetchServerContents: false, // CLI doesn't need auto-fetching, it calls methods directly + initialLoggingLevel: "debug", // Set debug logging level for CLI + }); try { - await connect(client, transport); + await inspectorClient.connect(); let result: McpResponse; // Tools methods if (args.method === "tools/list") { - result = await listTools(client, args.metadata); + result = await inspectorClient.listTools(args.metadata); } else if (args.method === "tools/call") { if (!args.toolName) { throw new Error( @@ -139,8 +189,7 @@ async function callMethod(args: Args): Promise { ); } - result = await callTool( - client, + result = await inspectorClient.callTool( args.toolName, args.toolArg || {}, args.metadata, @@ -149,7 +198,7 @@ async function callMethod(args: Args): Promise { } // Resources methods else if (args.method === "resources/list") { - result = await listResources(client, args.metadata); + result = await inspectorClient.listResources(args.metadata); } else if (args.method === "resources/read") { if (!args.uri) { throw new Error( @@ -157,13 +206,13 @@ async function callMethod(args: Args): Promise { ); } - result = await readResource(client, args.uri, args.metadata); + result = await inspectorClient.readResource(args.uri, args.metadata); } else if (args.method === "resources/templates/list") { - result = await listResourceTemplates(client, args.metadata); + result = await inspectorClient.listResourceTemplates(args.metadata); } // Prompts methods else if (args.method === "prompts/list") { - result = await listPrompts(client, args.metadata); + result = await inspectorClient.listPrompts(args.metadata); } else if (args.method === "prompts/get") { if (!args.promptName) { throw new Error( @@ -171,8 +220,7 @@ async function callMethod(args: Args): Promise { ); } - result = await getPrompt( - client, + result = await inspectorClient.getPrompt( args.promptName, args.promptArgs || {}, args.metadata, @@ -186,7 +234,8 @@ async function callMethod(args: Args): Promise { ); } - result = await setLoggingLevel(client, args.logLevel); + await inspectorClient.setLoggingLevel(args.logLevel); + result = {}; } else { throw new Error( `Unsupported method: ${args.method}. Supported methods include: tools/list, tools/call, resources/list, resources/read, resources/templates/list, prompts/list, prompts/get, logging/setLevel`, @@ -196,7 +245,7 @@ async function callMethod(args: Args): Promise { await awaitableLog(JSON.stringify(result, null, 2)); } finally { try { - await disconnect(transport); + await inspectorClient.disconnect(); } catch (disconnectError) { throw disconnectError; } @@ -308,13 +357,13 @@ function parseArgs(): Args { "--log-level ", "Logging level (for logging/setLevel method)", (value: string) => { - if (!validLogLevels.includes(value as any)) { + if (!validLogLevels.includes(value as LoggingLevel)) { throw new Error( `Invalid log level: ${value}. Valid levels are: ${validLogLevels.join(", ")}`, ); } - return value as LogLevel; + return value as LoggingLevel; }, ) // diff --git a/cli/src/transport.ts b/cli/src/transport.ts deleted file mode 100644 index 84af393b9..000000000 --- a/cli/src/transport.ts +++ /dev/null @@ -1,95 +0,0 @@ -import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js"; -import { - getDefaultEnvironment, - StdioClientTransport, -} from "@modelcontextprotocol/sdk/client/stdio.js"; -import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"; -import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js"; -import { findActualExecutable } from "spawn-rx"; - -export type TransportOptions = { - transportType: "sse" | "stdio" | "http"; - command?: string; - args?: string[]; - url?: string; - headers?: Record; -}; - -function createStdioTransport(options: TransportOptions): Transport { - let args: string[] = []; - - if (options.args !== undefined) { - args = options.args; - } - - const processEnv: Record = {}; - - for (const [key, value] of Object.entries(process.env)) { - if (value !== undefined) { - processEnv[key] = value; - } - } - - const defaultEnv = getDefaultEnvironment(); - - const env: Record = { - ...defaultEnv, - ...processEnv, - }; - - const { cmd: actualCommand, args: actualArgs } = findActualExecutable( - options.command ?? "", - args, - ); - - return new StdioClientTransport({ - command: actualCommand, - args: actualArgs, - env, - stderr: "pipe", - }); -} - -export function createTransport(options: TransportOptions): Transport { - const { transportType } = options; - - try { - if (transportType === "stdio") { - return createStdioTransport(options); - } - - // If not STDIO, then it must be either SSE or HTTP. - if (!options.url) { - throw new Error("URL must be provided for SSE or HTTP transport types."); - } - const url = new URL(options.url); - - if (transportType === "sse") { - const transportOptions = options.headers - ? { - requestInit: { - headers: options.headers, - }, - } - : undefined; - return new SSEClientTransport(url, transportOptions); - } - - if (transportType === "http") { - const transportOptions = options.headers - ? { - requestInit: { - headers: options.headers, - }, - } - : undefined; - return new StreamableHTTPClientTransport(url, transportOptions); - } - - throw new Error(`Unsupported transport type: ${transportType}`); - } catch (error) { - throw new Error( - `Failed to create transport: ${error instanceof Error ? error.message : String(error)}`, - ); - } -} diff --git a/cli/tsconfig.json b/cli/tsconfig.json index effa34f2b..952a54ca8 100644 --- a/cli/tsconfig.json +++ b/cli/tsconfig.json @@ -13,5 +13,6 @@ "noUncheckedIndexedAccess": true }, "include": ["src/**/*"], - "exclude": ["node_modules", "packages", "**/*.spec.ts", "build"] + "exclude": ["node_modules", "packages", "**/*.spec.ts", "build"], + "references": [{ "path": "../shared" }] } diff --git a/cli/vitest.config.ts b/cli/vitest.config.ts new file mode 100644 index 000000000..9984fb11a --- /dev/null +++ b/cli/vitest.config.ts @@ -0,0 +1,10 @@ +import { defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + globals: true, + environment: "node", + include: ["**/__tests__/**/*.test.ts"], + testTimeout: 15000, // 15 seconds - CLI tests spawn subprocesses that need time + }, +}); diff --git a/client/package.json b/client/package.json index 0f55a31db..ddd6bd699 100644 --- a/client/package.json +++ b/client/package.json @@ -44,8 +44,8 @@ "lucide-react": "^0.523.0", "pkce-challenge": "^4.1.0", "prismjs": "^1.30.0", - "react": "^18.3.1", - "react-dom": "^18.3.1", + "react": "^19.2.3", + "react-dom": "^19.2.3", "react-simple-code-editor": "^0.14.1", "serve-handler": "^6.1.6", "tailwind-merge": "^2.5.3", @@ -58,8 +58,8 @@ "@types/jest": "^29.5.14", "@types/node": "^22.17.0", "@types/prismjs": "^1.26.5", - "@types/react": "^18.3.23", - "@types/react-dom": "^18.3.0", + "@types/react": "^19.2.7", + "@types/react-dom": "^19.2.3", "@types/serve-handler": "^6.1.4", "@vitejs/plugin-react": "^5.0.4", "autoprefixer": "^10.4.20", diff --git a/docs/shared-code-architecture.md b/docs/shared-code-architecture.md new file mode 100644 index 000000000..330f9730f --- /dev/null +++ b/docs/shared-code-architecture.md @@ -0,0 +1,628 @@ +# Shared Code Architecture for MCP Inspector + +## Overview + +This document describes a shared code architecture that enables code reuse across the MCP Inspector's three user interfaces: the **CLI**, **TUI** (Terminal User Interface), and **web client** (likely targeting v2). The shared codebase approach prevents the feature drift and maintenance burden that can occur when each app has a separate implementation. + +### Motivation + +Previously, the CLI and web client had no shared code, leading to: + +- **Feature drift**: Implementations diverged over time +- **Maintenance burden**: Bug fixes and features had to be implemented twice +- **Inconsistency**: Different behavior across interfaces +- **Duplication**: Similar logic implemented separately in each interface + +Adding the TUI (as-is) with yet another separate implementation seemed problematic given the above. + +The shared code architecture addresses these issues by providing a single source of truth for MCP client operations that all three interfaces can use. + +## Current Architecture + +### Project Structure + +``` +inspector/ +├── cli/ # CLI workspace (uses shared code) +├── tui/ # TUI workspace (uses shared code) +├── client/ # Web client workspace (to be migrated) +├── server/ # Proxy server workspace +├── shared/ # Shared code workspace package +│ ├── mcp/ # MCP client/server interaction +│ ├── react/ # Shared React code +│ ├── json/ # JSON utilities +│ └── test/ # Test fixtures and harness servers +└── package.json # Root workspace config +``` + +### Shared Package (`@modelcontextprotocol/inspector-shared`) + +The `shared/` directory is a **workspace package** that: + +- **Private** (`"private": true`) - internal-only, not published +- **Built separately** - compiles to `shared/build/` with TypeScript declarations +- **Referenced via package name** - workspaces import using `@modelcontextprotocol/inspector-shared/*` +- **Uses TypeScript Project References** - CLI and TUI reference shared for build ordering and type resolution +- **React peer dependency** - declares React 19.2.3 as peer dependency (consumers provide React) + +**Build Order**: Shared must be built before CLI and TUI (enforced via TypeScript Project References and CI workflows). + +## InspectorClient: The Core Shared Component + +### Overview + +`InspectorClient` (`shared/mcp/inspectorClient.ts`) is a comprehensive wrapper around the MCP SDK `Client` that manages the creation and lifecycle of the MCP client and transport. It provides: + +- **Unified Client Interface**: Single class handles all client operations +- **Client and Transport Lifecycle**: Manages creation, connection, and cleanup of MCP SDK `Client` and `Transport` instances +- **Message Tracking**: Automatically tracks all JSON-RPC messages (requests, responses, notifications) +- **Stderr Logging**: Captures and stores stderr output from stdio transports +- **Event-Driven Updates**: Uses `EventTarget` for reactive UI updates (cross-platform: works in browser and Node.js) +- **Server Data Management**: Automatically fetches and caches tools, resources, prompts, capabilities, server info, and instructions +- **State Management**: Manages connection status, message history, and server state +- **Transport Abstraction**: Works with all `Transport` types (stdio, SSE, streamable-http) +- **High-Level Methods**: Provides convenient wrappers for tools, resources, prompts, and logging + +### Key Features + +**Connection Management:** + +- `connect()` - Establishes connection and optionally fetches server data +- `disconnect()` - Closes connection and clears server state +- Connection status tracking (`disconnected`, `connecting`, `connected`, `error`) + +**Message Tracking:** + +- Tracks all JSON-RPC messages with timestamps, direction, and duration +- `MessageEntry[]` format with full request/response/notification history +- Event-driven updates (`message`, `messagesChange` events) + +**Server Data Management:** + +- Auto-fetches tools, resources, prompts (configurable via `autoFetchServerContents`) +- Caches capabilities, serverInfo, instructions +- Event-driven updates for all server data (`toolsChange`, `resourcesChange`, `promptsChange`, etc.) + +**MCP Method Wrappers:** + +- `listTools(metadata?)` - List available tools +- `callTool(name, args, generalMetadata?, toolSpecificMetadata?)` - Call a tool with automatic parameter conversion +- `listResources(metadata?)` - List available resources +- `readResource(uri, metadata?)` - Read a resource by URI +- `listResourceTemplates(metadata?)` - List resource templates +- `listPrompts(metadata?)` - List available prompts +- `getPrompt(name, args?, metadata?)` - Get a prompt with automatic argument stringification +- `setLoggingLevel(level)` - Set logging level with capability checks + +**Configurable Options:** + +- `autoFetchServerContents` - Controls whether to auto-fetch tools/resources/prompts on connect (default: `true` for TUI, `false` for CLI) +- `initialLoggingLevel` - Sets the logging level on connect if server supports logging (optional) +- `maxMessages` - Maximum number of messages to store (default: 1000) +- `maxStderrLogEvents` - Maximum number of stderr log entries to store (default: 1000) +- `pipeStderr` - Whether to pipe stderr for stdio transports (default: `true` for TUI, `false` for CLI) + +### Event System + +`InspectorClient` extends `EventTarget` for cross-platform compatibility: + +**Events with payloads:** + +- `statusChange` → `ConnectionStatus` +- `toolsChange` → `Tool[]` +- `resourcesChange` → `ResourceReference[]` +- `promptsChange` → `PromptReference[]` +- `capabilitiesChange` → `ServerCapabilities | undefined` +- `serverInfoChange` → `Implementation | undefined` +- `instructionsChange` → `string | undefined` +- `message` → `MessageEntry` +- `stderrLog` → `StderrLogEntry` +- `error` → `Error` + +**Events without payloads (signals):** + +- `connect` - Connection established +- `disconnect` - Connection closed +- `messagesChange` - Message list changed (fetch via `getMessages()`) +- `stderrLogsChange` - Stderr logs changed (fetch via `getStderrLogs()`) + +### Shared Module Structure + +**`shared/mcp/`** - MCP client/server interaction: + +- `inspectorClient.ts` - Main `InspectorClient` class +- `transport.ts` - Transport creation from `MCPServerConfig` +- `config.ts` - Config file loading (`loadMcpServersConfig`) +- `types.ts` - Shared types (`MCPServerConfig`, `MessageEntry`, `ConnectionStatus`, etc.) +- `messageTrackingTransport.ts` - Transport wrapper for message tracking +- `index.ts` - Public API exports + +**`shared/json/`** - JSON utilities: + +- `jsonUtils.ts` - JSON value types and conversion utilities (`JsonValue`, `convertParameterValue`, `convertToolParameters`, `convertPromptArguments`) + +**`shared/react/`** - Shared React code: + +- `useInspectorClient.ts` - React hook that subscribes to EventTarget events and provides reactive state (works in both TUI and web client) + +**`shared/test/`** - Test fixtures and harness servers: + +- `test-server-fixtures.ts` - Shared server configs and definitions +- `test-server-http.ts` - HTTP/SSE test server +- `test-server-stdio.ts` - Stdio test server + +## Integration History + +### Phase 1: TUI Integration (Complete) + +The TUI was integrated from the [`mcp-inspect`](https://github.com/TeamSparkAI/mcp-inspect) project as a standalone workspace. During integration, the TUI developed `InspectorClient` as a comprehensive client wrapper, providing a good foundation for code sharing. + +**Key decisions:** + +- TUI developed `InspectorClient` to wrap MCP SDK `Client` +- Organized MCP code into `tui/src/mcp/` module +- Created React hook `useInspectorClient` for reactive state management + +### Phase 2: Extract to Shared Package (Complete) + +All MCP-related code was moved from TUI to `shared/` to enable reuse: + +**Moved to `shared/mcp/`:** + +- `inspectorClient.ts` - Main client wrapper +- `transport.ts` - Transport creation +- `config.ts` - Config loading +- `types.ts` - Shared types +- `messageTrackingTransport.ts` - Message tracking wrapper + +**Moved to `shared/react/`:** + +- `useInspectorClient.ts` - React hook + +**Moved to `shared/test/`:** + +- Test fixtures and harness servers (from CLI tests) + +**Configuration:** + +- Created `shared/package.json` as workspace package +- Configured TypeScript Project References +- Set React 19.2.3 as peer dependency +- Aligned all workspaces to React 19.2.3 + +### Phase 3: CLI Migration (Complete) + +The CLI was migrated to use `InspectorClient` from the shared package: + +**Changes:** + +- Replaced direct SDK `Client` usage with `InspectorClient` +- Moved CLI helper functions (`tools.ts`, `resources.ts`, `prompts.ts`) into `InspectorClient` as methods +- Extracted JSON utilities to `shared/json/jsonUtils.ts` +- Deleted `cli/src/client/` directory +- Implemented local `argsToMcpServerConfig()` function in CLI to convert CLI arguments to `MCPServerConfig` +- CLI now uses `inspectorClient.listTools()`, `inspectorClient.callTool()`, etc. directly + +**Configuration:** + +- CLI sets `autoFetchServerContents: false` (calls methods directly) +- CLI sets `initialLoggingLevel: "debug"` for consistent logging + +## Current Usage + +### CLI Usage + +The CLI uses `InspectorClient` for all MCP operations: + +```typescript +// Convert CLI args to MCPServerConfig +const config = argsToMcpServerConfig(args); + +// Create InspectorClient +const inspectorClient = new InspectorClient(config, { + clientIdentity, + autoFetchServerContents: false, // CLI calls methods directly + initialLoggingLevel: "debug", +}); + +// Connect and use +await inspectorClient.connect(); +const result = await inspectorClient.listTools(args.metadata); +await inspectorClient.disconnect(); +``` + +### TUI Usage + +The TUI uses `InspectorClient` via the `useInspectorClient` React hook: + +```typescript +// In TUI component +const { status, messages, tools, resources, prompts, connect, disconnect } = + useInspectorClient(inspectorClient); + +// InspectorClient is created from config and managed by App.tsx +// The hook automatically subscribes to events and provides reactive state +``` + +**TUI Configuration:** + +- Sets `autoFetchServerContents: true` (default) - automatically fetches server data on connect +- Uses `useInspectorClient` hook for reactive UI updates +- `ToolTestModal` uses `inspectorClient.callTool()` directly + +**TUI Status:** + +- **Experimental**: The TUI functionality may be considered "experimental" until sufficient testing and review of features and implementation. This allows for iteration and refinement based on user feedback before committing to a stable feature set. +- **Feature Gaps**: Current feature gaps with the web UX include lack of support for OAuth, completions, elicitation, and sampling. These will be addressed in Phase 4 by extending `InspectorClient` with the required functionality. Note that some features, like MCP-UI, may not be feasible in a terminal-based interface. There is a plan for implementing OAuth from the TUI. + +**Entry Point:** +The TUI is invoked via the main `mcp-inspector` command with a `--tui` flag: + +- `mcp-inspector --tui ...` → TUI mode +- `mcp-inspector --cli ...` → CLI mode +- `mcp-inspector ...` → Web client mode (default) + +This provides a single entry point with consistent argument parsing across all three UX modes. + +## Phase 4: TUI Feature Gap Implementation (Planned) + +### Overview + +The next phase will address TUI feature gaps (OAuth, completions, elicitation, and sampling) by extending `InspectorClient` with the required functionality. This approach serves dual purposes: + +1. **TUI Feature Parity**: Brings TUI closer to feature parity with the web client +2. **InspectorClient Preparation**: Prepares `InspectorClient` for full web client integration + +When complete, `InspectorClient` will be very close to ready for full support of the v2 web client (which is currently under development). + +### Features to Implement + +**1. OAuth Support** + +- Add OAuth authentication flow support to `InspectorClient` +- TUI-specific: Browser-based OAuth flow with localhost callback server +- Web client benefit: OAuth support will be ready for v2 web client integration + +**2. Completion Support** + +- Add completion capability detection and management +- Add `handleCompletion()` method or access pattern for `completion/complete` requests +- TUI benefit: Enables autocomplete in TUI forms +- Web client benefit: Completion support ready for v2 web client + +**3. Elicitation Support** + +- Add request handler support for elicitation requests +- Add convenience methods: `setElicitationHandler()`, `setPendingRequestHandler()`, `setRootsHandler()` +- TUI benefit: Enables elicitation workflows in TUI +- Web client benefit: Request handler support ready for v2 web client + +**4. Sampling Support** + +- Add sampling capability detection and management +- Add methods or access patterns for sampling requests +- TUI benefit: Enables sampling workflows in TUI +- Web client benefit: Sampling support ready for v2 web client + +### Implementation Strategy + +As each TUI feature gap is addressed: + +1. Extend `InspectorClient` with the required functionality +2. Implement the feature in TUI using the new `InspectorClient` capabilities +3. Test the feature in TUI context +4. Document the new `InspectorClient` API + +This incremental approach ensures: + +- Features are validated in real usage (TUI) before web client integration +- `InspectorClient` API is refined based on actual needs +- Both TUI and v2 web client benefit from shared implementation + +### Relationship to Web Client Integration + +The features added in Phase 4 directly address the "Features Needed in InspectorClient for Web Client" listed in the Web Client Integration Plan. By implementing these for TUI first, we: + +- Validate the API design with real usage +- Ensure the implementation works in a React context (TUI uses React/Ink) +- Build toward full v2 web client support incrementally + +Once Phase 4 is complete, `InspectorClient` will have most of the functionality needed for v2 web client integration, with primarily adapter/wrapper work remaining. + +## Web Client Integration Plan + +### Current Web Client Architecture + +The web client currently uses `useConnection` hook (`client/src/lib/hooks/useConnection.ts`) that handles: + +1. **Connection Management** + - Connection status state (`disconnected`, `connecting`, `connected`, `error`, `error-connecting-to-proxy`) + - Direct vs. proxy connection modes + - Proxy health checking + +2. **Transport Creation** + - Creates SSE or StreamableHTTP transports directly + - Handles proxy mode (connects to proxy server endpoints) + - Handles direct mode (connects directly to MCP server) + - Manages transport options (headers, fetch wrappers, reconnection options) + +3. **OAuth Authentication** + - Browser-based OAuth flow (authorization code flow) + - OAuth token management via `InspectorOAuthClientProvider` + - Session storage for OAuth tokens + - OAuth callback handling + - Token refresh + +4. **Custom Headers** + - Custom header management (migration from legacy auth) + - Header validation + - OAuth token injection into headers + - Special header processing (`x-custom-auth-headers`) + +5. **Request/Response Tracking** + - Request history (`{ request: string, response?: string }[]`) + - History management (`pushHistory`, `clearRequestHistory`) + - Different format than InspectorClient's `MessageEntry[]` + +6. **Notification Handling** + - Notification handlers via callbacks (`onNotification`, `onStdErrNotification`) + - Multiple notification schemas (Cancelled, Logging, ResourceUpdated, etc.) + - Fallback notification handler + +7. **Request Handlers** + - Elicitation request handling (`onElicitationRequest`) + - Pending request handling (`onPendingRequest`) + - Roots request handling (`getRoots`) + +8. **Completion Support** + - Completion capability detection + - Completion state management + +9. **Progress Notifications** + - Progress notification handling + - Timeout reset on progress + +10. **Session Management** + - Session ID tracking (`mcpSessionId`) + - Protocol version tracking (`mcpProtocolVersion`) + - Response header capture + +11. **Server Information** + - Server capabilities + - Server implementation info + - Protocol version + +12. **Error Handling** + - Proxy auth errors + - OAuth errors + - Connection errors + - Retry logic + +The main `App.tsx` component manages extensive state including: + +- Resources, resource templates, resource content +- Prompts, prompt content +- Tools, tool results +- Errors per tab +- Connection configuration (command, args, sseUrl, transportType, etc.) +- OAuth configuration +- Custom headers +- Notifications +- Roots +- Environment variables +- Log level +- Active tab +- Pending requests + +### Features Needed in InspectorClient for Web Client + +To fully support the web client, `InspectorClient` needs to add support for: + +1. **Custom Headers** - Support for OAuth tokens and custom authentication headers in transport configuration +2. **Request Handlers** - Support for setting elicitation, pending request, and roots handlers +3. **Completion Support** - Methods or access patterns for `completion/complete` requests +4. **Progress Notifications** - Callback support for progress notifications and timeout reset +5. **Session Management** - Access to session ID and protocol version from transport + +### Integration Challenges + +**1. OAuth Authentication** + +- Web client uses browser-based OAuth flow (authorization code with PKCE) +- Requires browser redirects and callback handling +- **Solution**: Keep OAuth handling in web client, inject tokens via custom headers in `MCPServerConfig` + +**2. Proxy Mode** + +- Web client connects through proxy server for stdio transports +- **Solution**: Handle proxy URL construction in web client, pass final URL to `InspectorClient` + +**3. Custom Headers** + +- Web client manages custom headers (OAuth tokens, custom auth headers) +- **Solution**: Extend `MCPServerConfig` to support `headers` in `SseServerConfig` and `StreamableHttpServerConfig` + +**4. Request History Format** + +- Web client uses `{ request: string, response?: string }[]` +- `InspectorClient` uses `MessageEntry[]` (more detailed) +- **Solution**: Migrate web client to use `MessageEntry[]` format + +**5. Completion Support** + +- Web client detects and manages completion capability +- **Solution**: Use `inspectorClient.getCapabilities()?.completions` to detect support, access SDK client via `getClient()` for completion requests + +**6. Elicitation and Request Handlers** + +- Web client sets request handlers for elicitation, pending requests, roots +- **Solution**: Use `inspectorClient.getClient()` to set request handlers (minimal change) + +**7. Progress Notifications** + +- Web client handles progress notifications and timeout reset +- **Solution**: Handle progress via existing notification system (`InspectorClient` already tracks notifications) + +**8. Session Management** + +- Web client tracks session ID and protocol version +- **Solution**: Access transport via `inspectorClient.getClient()` to get session info + +### Integration Strategy + +**Phase 1: Extend InspectorClient for Web Client Needs** + +1. **Add Custom Headers Support** + - Add `headers?: Record` to `SseServerConfig` and `StreamableHttpServerConfig` in `MCPServerConfig` + - Pass headers to transport creation in `shared/mcp/transport.ts` + +2. **Add Request Handler Support** + - Add convenience methods: `setRequestHandler()`, `setElicitationHandler()`, `setRootsHandler()` + - Or document that `getClient()` can be used to set request handlers directly + - Support for elicitation requests, pending requests, and roots requests + +3. **Add Completion Support** + - Add `handleCompletion()` method or document access via `getClient()` + - Completion capability is already available via `getCapabilities()?.completions` + - Web client can use `getClient()` to call `completion/complete` directly + +4. **Add Progress Notification Support** + - Add `onProgress?: (progress: Progress) => void` to `InspectorClientOptions` + - Forward progress notifications to callback + - Support timeout reset on progress notifications + +5. **Add Session Management** + - Expose session ID and protocol version via getter methods + - Or provide access to transport for session information + +**Phase 2: Create Web-Specific Adapter** + +Create adapter function that: + +- Converts web client config to `MCPServerConfig` +- Handles proxy URL construction +- Manages OAuth token injection into headers +- Handles direct vs. proxy mode + +**Phase 3: Hybrid Integration (Recommended)** + +**Short Term:** + +- Keep `useConnection` for OAuth, proxy, and web-specific features +- Use `InspectorClient` for core MCP operations (tools, resources, prompts) via `getClient()` +- Gradually migrate state management + +**Medium Term:** + +- Use `useInspectorClient` hook for state management +- Keep OAuth/proxy handling in web-specific wrapper +- Migrate request history to `MessageEntry[]` format + +**Long Term:** + +- Replace `useConnection` with `useInspectorClient` + web-specific wrapper +- Remove duplicate transport creation +- Remove duplicate server data fetching + +### Benefits of Web Client Integration + +1. **Code Reuse**: Share MCP client logic across all three interfaces, including the shared React hook (`useInspectorClient`) between TUI and web client +2. **Consistency**: Same behavior across CLI, TUI, and web client +3. **Maintainability**: Single source of truth for MCP operations +4. **Features**: Web client gets message tracking, stderr logging, event-driven updates +5. **Type Safety**: Shared types ensure consistency +6. **Testing**: Shared code is tested once, works everywhere + +### Implementation Steps + +1. **Extend `MCPServerConfig`** to support custom headers +2. **Create adapter function** to convert web client config to `MCPServerConfig` +3. **Use `InspectorClient`** for tools/resources/prompts operations (via `getClient()` initially) +4. **Gradually migrate** state management to `useInspectorClient` +5. **Eventually replace** `useConnection` with `useInspectorClient` + web-specific wrapper + +## Technical Details + +### TypeScript Project References + +The shared package uses TypeScript Project References for build orchestration: + +**`shared/tsconfig.json`:** + +```json +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "declarationMap": true + } +} +``` + +**`cli/tsconfig.json` and `tui/tsconfig.json`:** + +```json +{ + "references": [{ "path": "../shared" }] +} +``` + +This ensures: + +- Shared builds first (required for type resolution) +- Type checking across workspace boundaries +- Correct build ordering in CI + +### Build Process + +**Root `package.json` build script:** + +```json +{ + "scripts": { + "build": "npm run build-shared && npm run build-server && npm run build-client && npm run build-cli && npm run build-tui", + "build-shared": "cd shared && npm run build" + } +} +``` + +**CI Workflow:** + +- Build shared package first +- Then build dependent workspaces (CLI, TUI) +- TypeScript Project References enforce this ordering + +### Module Resolution + +Workspaces import using package name: + +```typescript +import { InspectorClient } from "@modelcontextprotocol/inspector-shared/mcp/inspectorClient.js"; +import { useInspectorClient } from "@modelcontextprotocol/inspector-shared/react/useInspectorClient.js"; +``` + +npm workspaces automatically resolve package names to the workspace package. + +## Summary + +The shared code architecture provides: + +- **Single source of truth** for MCP client operations via `InspectorClient` +- **Code reuse** across CLI, TUI, and (planned) web client +- **Consistent behavior** across all interfaces +- **Reduced maintenance burden** - fix once, works everywhere +- **Type safety** through shared types +- **Event-driven updates** via EventTarget (cross-platform compatible) + +**Current Status:** + +- ✅ Phase 1: TUI integrated and using shared code +- ✅ Phase 2: Shared package created and configured +- ✅ Phase 3: CLI migrated to use shared code +- 🔄 Phase 4: TUI feature gap implementation (planned) +- 🔄 Phase 5: v2 web client integration (planned) + +**Next Steps:** + +1. **Phase 4**: Implement TUI feature gaps (OAuth, completions, elicitation, sampling) by extending `InspectorClient` +2. **Phase 5**: Integrate `InspectorClient` with v2 web client (once Phase 4 is complete and v2 web client is ready) diff --git a/package-lock.json b/package-lock.json index 758c0ea9e..9e9f19236 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,13 +11,15 @@ "workspaces": [ "client", "server", - "cli" + "cli", + "tui", + "shared" ], "dependencies": { "@modelcontextprotocol/inspector-cli": "^0.18.0", "@modelcontextprotocol/inspector-client": "^0.18.0", "@modelcontextprotocol/inspector-server": "^0.18.0", - "@modelcontextprotocol/sdk": "^1.24.3", + "@modelcontextprotocol/sdk": "^1.25.2", "concurrently": "^9.2.0", "node-fetch": "^3.3.2", "open": "^10.2.0", @@ -51,19 +53,53 @@ "version": "0.18.0", "license": "MIT", "dependencies": { - "@modelcontextprotocol/sdk": "^1.24.3", + "@modelcontextprotocol/inspector-shared": "*", + "@modelcontextprotocol/sdk": "^1.25.2", "commander": "^13.1.0", + "express": "^5.2.1", "spawn-rx": "^5.1.2" }, "bin": { "mcp-inspector-cli": "build/cli.js" }, - "devDependencies": {} + "devDependencies": { + "@types/express": "^5.0.6", + "tsx": "^4.7.0", + "vitest": "^4.0.17" + } + }, + "cli/node_modules/@types/express": { + "version": "5.0.6", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^5.0.0", + "@types/serve-static": "^2" + } + }, + "cli/node_modules/@types/express-serve-static-core": { + "version": "5.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*", + "@types/send": "*" + } + }, + "cli/node_modules/@types/serve-static": { + "version": "2.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/http-errors": "*", + "@types/node": "*" + } }, "cli/node_modules/commander": { "version": "13.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-13.1.0.tgz", - "integrity": "sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw==", "license": "MIT", "engines": { "node": ">=18" @@ -74,7 +110,7 @@ "version": "0.18.0", "license": "MIT", "dependencies": { - "@modelcontextprotocol/sdk": "^1.24.3", + "@modelcontextprotocol/sdk": "^1.25.2", "@radix-ui/react-checkbox": "^1.1.4", "@radix-ui/react-dialog": "^1.1.3", "@radix-ui/react-icons": "^1.3.0", @@ -93,8 +129,8 @@ "lucide-react": "^0.523.0", "pkce-challenge": "^4.1.0", "prismjs": "^1.30.0", - "react": "^18.3.1", - "react-dom": "^18.3.1", + "react": "^19.2.3", + "react-dom": "^19.2.3", "react-simple-code-editor": "^0.14.1", "serve-handler": "^6.1.6", "tailwind-merge": "^2.5.3", @@ -110,8 +146,8 @@ "@types/jest": "^29.5.14", "@types/node": "^22.17.0", "@types/prismjs": "^1.26.5", - "@types/react": "^18.3.23", - "@types/react-dom": "^18.3.0", + "@types/react": "^19.2.7", + "@types/react-dom": "^19.2.3", "@types/serve-handler": "^6.1.4", "@vitejs/plugin-react": "^5.0.4", "autoprefixer": "^10.4.20", @@ -132,10 +168,44 @@ "vite": "^7.1.11" } }, + "client/node_modules/@types/jsdom": { + "version": "20.0.1", + "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-20.0.1.tgz", + "integrity": "sha512-d0r18sZPmMQr1eG35u12FZfhIXNrnsPU/g5wvRKCUf/tOGilKKwYMYGqh33BNR6ba+2gkHw1EUiHoN3mn7E5IQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/tough-cookie": "*", + "parse5": "^7.0.0" + } + }, + "client/node_modules/@types/react-dom": { + "version": "19.2.3", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@types/react": "^19.2.0" + } + }, + "client/node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, "client/node_modules/jest-environment-jsdom": { "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-29.7.0.tgz", - "integrity": "sha512-k9iQbsf9OyOfdzWH8HDmrRT0gSIcX+FLNW7IQq94tFX0gynPwqDTW0Ho6iMVNjGz/nb+l/vW3dWM2bbLLpkbXA==", "dev": true, "license": "MIT", "dependencies": { @@ -160,6 +230,61 @@ } } }, + "client/node_modules/jsdom": { + "version": "20.0.3", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-20.0.3.tgz", + "integrity": "sha512-SYhBvTh89tTfCD/CRdSOm13mOBa42iTaTyfyEWBdKcGdPxPtLFBXuHR8XHb33YNYaP+lLbmSvBTsnoesCNJEsQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "abab": "^2.0.6", + "acorn": "^8.8.1", + "acorn-globals": "^7.0.0", + "cssom": "^0.5.0", + "cssstyle": "^2.3.0", + "data-urls": "^3.0.2", + "decimal.js": "^10.4.2", + "domexception": "^4.0.0", + "escodegen": "^2.0.0", + "form-data": "^4.0.0", + "html-encoding-sniffer": "^3.0.0", + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.1", + "is-potential-custom-element-name": "^1.0.1", + "nwsapi": "^2.2.2", + "parse5": "^7.1.1", + "saxes": "^6.0.0", + "symbol-tree": "^3.2.4", + "tough-cookie": "^4.1.2", + "w3c-xmlserializer": "^4.0.0", + "webidl-conversions": "^7.0.0", + "whatwg-encoding": "^2.0.0", + "whatwg-mimetype": "^3.0.0", + "whatwg-url": "^11.0.0", + "ws": "^8.11.0", + "xml-name-validator": "^4.0.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "canvas": "^2.5.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "client/node_modules/pkce-challenge": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-4.1.0.tgz", + "integrity": "sha512-ZBmhE1C9LcPoH9XZSdwiPtbPHZROwAnMy+kIFQVrnMCxY4Cudlz3gBOpzilgc0jOgRaiT3sIWfpMomW2ar2orQ==", + "license": "MIT", + "engines": { + "node": ">=16.20.0" + } + }, "node_modules/@adobe/css-tools": { "version": "4.4.4", "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.4.4.tgz", @@ -167,6 +292,31 @@ "dev": true, "license": "MIT" }, + "node_modules/@alcalzone/ansi-tokenize": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@alcalzone/ansi-tokenize/-/ansi-tokenize-0.2.3.tgz", + "integrity": "sha512-jsElTJ0sQ4wHRz+C45tfect76BwbTbgkgKByOzpCN9xG61N5V6u/glvg1CsNJhq2xJIFpKHSwG3D2wPPuEYOrQ==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.2.1", + "is-fullwidth-code-point": "^5.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@alcalzone/ansi-tokenize/node_modules/ansi-styles": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, "node_modules/@alloc/quick-lru": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz", @@ -204,13 +354,13 @@ "peer": true }, "node_modules/@babel/code-frame": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", - "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.28.6.tgz", + "integrity": "sha512-JYgintcMjRiCvS8mMECzaEn+m3PfoQiyqukOMCCVQtoJGYJw8j/8LBJEiqkHLkfwCcs74E3pbAUFNg7d9VNJ+Q==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-validator-identifier": "^7.27.1", + "@babel/helper-validator-identifier": "^7.28.5", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" }, @@ -219,9 +369,9 @@ } }, "node_modules/@babel/compat-data": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.28.5.tgz", - "integrity": "sha512-6uFXyCayocRbqhZOB+6XcuZbkMNimwfVGFji8CTZnCzOHVGvDqzvitu1re2AU5LROliz7eQPhB8CpAMvnx9EjA==", + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.28.6.tgz", + "integrity": "sha512-2lfu57JtzctfIrcGMz992hyLlByuzgIk58+hhGCxjKZ3rWI82NnVLjXcaTqkI2NvlcvOskZaiZ5kjUALo3Lpxg==", "dev": true, "license": "MIT", "engines": { @@ -229,21 +379,21 @@ } }, "node_modules/@babel/core": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.28.5.tgz", - "integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==", + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.28.6.tgz", + "integrity": "sha512-H3mcG6ZDLTlYfaSNi0iOKkigqMFvkTKlGUYlD8GW7nNOYRrevuA46iTypPyv+06V3fEmvvazfntkBU34L0azAw==", "dev": true, "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.27.1", - "@babel/generator": "^7.28.5", - "@babel/helper-compilation-targets": "^7.27.2", - "@babel/helper-module-transforms": "^7.28.3", - "@babel/helpers": "^7.28.4", - "@babel/parser": "^7.28.5", - "@babel/template": "^7.27.2", - "@babel/traverse": "^7.28.5", - "@babel/types": "^7.28.5", + "@babel/code-frame": "^7.28.6", + "@babel/generator": "^7.28.6", + "@babel/helper-compilation-targets": "^7.28.6", + "@babel/helper-module-transforms": "^7.28.6", + "@babel/helpers": "^7.28.6", + "@babel/parser": "^7.28.6", + "@babel/template": "^7.28.6", + "@babel/traverse": "^7.28.6", + "@babel/types": "^7.28.6", "@jridgewell/remapping": "^2.3.5", "convert-source-map": "^2.0.0", "debug": "^4.1.0", @@ -260,14 +410,14 @@ } }, "node_modules/@babel/generator": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.28.5.tgz", - "integrity": "sha512-3EwLFhZ38J4VyIP6WNtt2kUdW9dokXA9Cr4IVIFHuCpZ3H8/YFOl5JjZHisrn1fATPBmKKqXzDFvh9fUwHz6CQ==", + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.28.6.tgz", + "integrity": "sha512-lOoVRwADj8hjf7al89tvQ2a1lf53Z+7tiXMgpZJL3maQPDxh0DgLMN62B2MKUOFcoodBHLMbDM6WAbKgNy5Suw==", "dev": true, "license": "MIT", "dependencies": { - "@babel/parser": "^7.28.5", - "@babel/types": "^7.28.5", + "@babel/parser": "^7.28.6", + "@babel/types": "^7.28.6", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" @@ -277,13 +427,13 @@ } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.27.2", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.2.tgz", - "integrity": "sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ==", + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.28.6.tgz", + "integrity": "sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/compat-data": "^7.27.2", + "@babel/compat-data": "^7.28.6", "@babel/helper-validator-option": "^7.27.1", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", @@ -304,29 +454,29 @@ } }, "node_modules/@babel/helper-module-imports": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.27.1.tgz", - "integrity": "sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w==", + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.28.6.tgz", + "integrity": "sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw==", "dev": true, "license": "MIT", "dependencies": { - "@babel/traverse": "^7.27.1", - "@babel/types": "^7.27.1" + "@babel/traverse": "^7.28.6", + "@babel/types": "^7.28.6" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.28.3", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.3.tgz", - "integrity": "sha512-gytXUbs8k2sXS9PnQptz5o0QnpLL51SwASIORY6XaBKF88nsOT0Zw9szLqlSGQDP/4TljBAD5y98p2U1fqkdsw==", + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.6.tgz", + "integrity": "sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-module-imports": "^7.27.1", - "@babel/helper-validator-identifier": "^7.27.1", - "@babel/traverse": "^7.28.3" + "@babel/helper-module-imports": "^7.28.6", + "@babel/helper-validator-identifier": "^7.28.5", + "@babel/traverse": "^7.28.6" }, "engines": { "node": ">=6.9.0" @@ -336,9 +486,9 @@ } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.27.1.tgz", - "integrity": "sha512-1gn1Up5YXka3YYAHGKpbideQ5Yjf1tDa9qYcgysz+cNCXukyLl6DjPXhD3VRwSb8c0J9tA4b2+rHEZtc6R0tlw==", + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.28.6.tgz", + "integrity": "sha512-S9gzZ/bz83GRysI7gAD4wPT/AI3uCnY+9xn+Mx/KPs2JwHJIz1W8PZkg2cqyt3RNOBM8ejcXhV6y8Og7ly/Dug==", "dev": true, "license": "MIT", "engines": { @@ -376,27 +526,27 @@ } }, "node_modules/@babel/helpers": { - "version": "7.28.4", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.28.4.tgz", - "integrity": "sha512-HFN59MmQXGHVyYadKLVumYsA9dBFun/ldYxipEjzA4196jpLZd8UjEEBLkbEkvfYreDqJhZxYAWFPtrfhNpj4w==", + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.28.6.tgz", + "integrity": "sha512-xOBvwq86HHdB7WUDTfKfT/Vuxh7gElQ+Sfti2Cy6yIWNW05P8iUslOVcZ4/sKbE+/jQaukQAdz/gf3724kYdqw==", "dev": true, "license": "MIT", "dependencies": { - "@babel/template": "^7.27.2", - "@babel/types": "^7.28.4" + "@babel/template": "^7.28.6", + "@babel/types": "^7.28.6" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/parser": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.28.5.tgz", - "integrity": "sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ==", + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.28.6.tgz", + "integrity": "sha512-TeR9zWR18BvbfPmGbLampPMW+uW1NZnJlRuuHso8i87QZNq2JRF9i6RgxRqtEq+wQGsS19NNTWr2duhnE49mfQ==", "dev": true, "license": "MIT", "dependencies": { - "@babel/types": "^7.28.5" + "@babel/types": "^7.28.6" }, "bin": { "parser": "bin/babel-parser.js" @@ -461,13 +611,13 @@ } }, "node_modules/@babel/plugin-syntax-import-attributes": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.27.1.tgz", - "integrity": "sha512-oFT0FrKHgF53f4vOsZGi2Hh3I35PfSmVs4IBFLFj4dnafP+hIWDLg3VyKmUHfLoLHlyxY4C7DGtmHuJgn+IGww==", + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.28.6.tgz", + "integrity": "sha512-jiLC0ma9XkQT3TKJ9uYvlakm66Pamywo+qwL+oL8HJOvc6TWdZXVfhqJr8CCzbSGUAbDOzlGHJC1U+vRfLQDvw==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" + "@babel/helper-plugin-utils": "^7.28.6" }, "engines": { "node": ">=6.9.0" @@ -503,13 +653,13 @@ } }, "node_modules/@babel/plugin-syntax-jsx": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.27.1.tgz", - "integrity": "sha512-y8YTNIeKoyhGd9O0Jiyzyyqk8gdjnumGTQPsz0xOZOQ2RmkVJeZ1vmmfIvFEKqucBG6axJGBZDE/7iI5suUI/w==", + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.28.6.tgz", + "integrity": "sha512-wgEmr06G6sIpqr8YDwA2dSRTE3bJ+V0IfpzfSY3Lfgd7YWOaAdlykvJi13ZKBt8cZHfgH1IXN+CL656W3uUa4w==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" + "@babel/helper-plugin-utils": "^7.28.6" }, "engines": { "node": ">=6.9.0" @@ -629,13 +779,13 @@ } }, "node_modules/@babel/plugin-syntax-typescript": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.27.1.tgz", - "integrity": "sha512-xfYCBMxveHrRMnAWl1ZlPXOZjzkN82THFvLhQhFXFt81Z5HnN+EtUkZhv/zcKpmT3fzmWZB0ywiBrbC3vogbwQ==", + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.28.6.tgz", + "integrity": "sha512-+nDNmQye7nlnuuHDboPbGm00Vqg3oO8niRRL27/4LYHUsHYh0zJ1xWOz0uRwNFmM1Avzk8wZbc6rdiYhomzv/A==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" + "@babel/helper-plugin-utils": "^7.28.6" }, "engines": { "node": ">=6.9.0" @@ -677,9 +827,9 @@ } }, "node_modules/@babel/runtime": { - "version": "7.28.4", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.4.tgz", - "integrity": "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ==", + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.6.tgz", + "integrity": "sha512-05WQkdpL9COIMz4LjTxGpPNCdlpyimKppYNoJ5Di5EUObifl8t4tuLuUBBZEpoLYOmfvIWrsp9fCl0HoPRVTdA==", "dev": true, "license": "MIT", "engines": { @@ -687,33 +837,33 @@ } }, "node_modules/@babel/template": { - "version": "7.27.2", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.2.tgz", - "integrity": "sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw==", + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.28.6.tgz", + "integrity": "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ==", "dev": true, "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.27.1", - "@babel/parser": "^7.27.2", - "@babel/types": "^7.27.1" + "@babel/code-frame": "^7.28.6", + "@babel/parser": "^7.28.6", + "@babel/types": "^7.28.6" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.28.5.tgz", - "integrity": "sha512-TCCj4t55U90khlYkVV/0TfkJkAkUg3jZFA3Neb7unZT8CPok7iiRfaX0F+WnqWqt7OxhOn0uBKXCw4lbL8W0aQ==", + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.28.6.tgz", + "integrity": "sha512-fgWX62k02qtjqdSNTAGxmKYY/7FSL9WAS1o2Hu5+I5m9T0yxZzr4cnrfXQ/MX0rIifthCSs6FKTlzYbJcPtMNg==", "dev": true, "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.27.1", - "@babel/generator": "^7.28.5", + "@babel/code-frame": "^7.28.6", + "@babel/generator": "^7.28.6", "@babel/helper-globals": "^7.28.0", - "@babel/parser": "^7.28.5", - "@babel/template": "^7.27.2", - "@babel/types": "^7.28.5", + "@babel/parser": "^7.28.6", + "@babel/template": "^7.28.6", + "@babel/types": "^7.28.6", "debug": "^4.3.1" }, "engines": { @@ -721,9 +871,9 @@ } }, "node_modules/@babel/types": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.28.5.tgz", - "integrity": "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA==", + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.28.6.tgz", + "integrity": "sha512-0ZrskXVEHSWIqZM/sQZ4EV3jZJXRkio/WCxaqKZP1g//CEWEPSfeZFcms4XeKBCHU0ZKnIkdJeU/kF+eRp5lBg==", "dev": true, "license": "MIT", "dependencies": { @@ -884,9 +1034,9 @@ } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", - "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.2.tgz", + "integrity": "sha512-GZMB+a0mOMZs4MpDbj8RJp4cw+w1WV5NYD6xzgvzUJ5Ek2jerwfO2eADyI6ExDSUED+1X8aMbegahsJi+8mgpw==", "cpu": [ "ppc64" ], @@ -901,9 +1051,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz", - "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.2.tgz", + "integrity": "sha512-DVNI8jlPa7Ujbr1yjU2PfUSRtAUZPG9I1RwW4F4xFB1Imiu2on0ADiI/c3td+KmDtVKNbi+nffGDQMfcIMkwIA==", "cpu": [ "arm" ], @@ -918,9 +1068,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz", - "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.2.tgz", + "integrity": "sha512-pvz8ZZ7ot/RBphf8fv60ljmaoydPU12VuXHImtAs0XhLLw+EXBi2BLe3OYSBslR4rryHvweW5gmkKFwTiFy6KA==", "cpu": [ "arm64" ], @@ -935,9 +1085,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz", - "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.2.tgz", + "integrity": "sha512-z8Ank4Byh4TJJOh4wpz8g2vDy75zFL0TlZlkUkEwYXuPSgX8yzep596n6mT7905kA9uHZsf/o2OJZubl2l3M7A==", "cpu": [ "x64" ], @@ -952,9 +1102,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz", - "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.2.tgz", + "integrity": "sha512-davCD2Zc80nzDVRwXTcQP/28fiJbcOwvdolL0sOiOsbwBa72kegmVU0Wrh1MYrbuCL98Omp5dVhQFWRKR2ZAlg==", "cpu": [ "arm64" ], @@ -969,9 +1119,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz", - "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.2.tgz", + "integrity": "sha512-ZxtijOmlQCBWGwbVmwOF/UCzuGIbUkqB1faQRf5akQmxRJ1ujusWsb3CVfk/9iZKr2L5SMU5wPBi1UWbvL+VQA==", "cpu": [ "x64" ], @@ -986,9 +1136,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz", - "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.2.tgz", + "integrity": "sha512-lS/9CN+rgqQ9czogxlMcBMGd+l8Q3Nj1MFQwBZJyoEKI50XGxwuzznYdwcav6lpOGv5BqaZXqvBSiB/kJ5op+g==", "cpu": [ "arm64" ], @@ -1003,9 +1153,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz", - "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.2.tgz", + "integrity": "sha512-tAfqtNYb4YgPnJlEFu4c212HYjQWSO/w/h/lQaBK7RbwGIkBOuNKQI9tqWzx7Wtp7bTPaGC6MJvWI608P3wXYA==", "cpu": [ "x64" ], @@ -1020,9 +1170,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz", - "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.2.tgz", + "integrity": "sha512-vWfq4GaIMP9AIe4yj1ZUW18RDhx6EPQKjwe7n8BbIecFtCQG4CfHGaHuh7fdfq+y3LIA2vGS/o9ZBGVxIDi9hw==", "cpu": [ "arm" ], @@ -1037,9 +1187,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz", - "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.2.tgz", + "integrity": "sha512-hYxN8pr66NsCCiRFkHUAsxylNOcAQaxSSkHMMjcpx0si13t1LHFphxJZUiGwojB1a/Hd5OiPIqDdXONia6bhTw==", "cpu": [ "arm64" ], @@ -1054,9 +1204,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz", - "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.2.tgz", + "integrity": "sha512-MJt5BRRSScPDwG2hLelYhAAKh9imjHK5+NE/tvnRLbIqUWa+0E9N4WNMjmp/kXXPHZGqPLxggwVhz7QP8CTR8w==", "cpu": [ "ia32" ], @@ -1071,9 +1221,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz", - "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.2.tgz", + "integrity": "sha512-lugyF1atnAT463aO6KPshVCJK5NgRnU4yb3FUumyVz+cGvZbontBgzeGFO1nF+dPueHD367a2ZXe1NtUkAjOtg==", "cpu": [ "loong64" ], @@ -1088,9 +1238,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz", - "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.2.tgz", + "integrity": "sha512-nlP2I6ArEBewvJ2gjrrkESEZkB5mIoaTswuqNFRv/WYd+ATtUpe9Y09RnJvgvdag7he0OWgEZWhviS1OTOKixw==", "cpu": [ "mips64el" ], @@ -1105,9 +1255,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz", - "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.2.tgz", + "integrity": "sha512-C92gnpey7tUQONqg1n6dKVbx3vphKtTHJaNG2Ok9lGwbZil6DrfyecMsp9CrmXGQJmZ7iiVXvvZH6Ml5hL6XdQ==", "cpu": [ "ppc64" ], @@ -1122,9 +1272,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz", - "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.2.tgz", + "integrity": "sha512-B5BOmojNtUyN8AXlK0QJyvjEZkWwy/FKvakkTDCziX95AowLZKR6aCDhG7LeF7uMCXEJqwa8Bejz5LTPYm8AvA==", "cpu": [ "riscv64" ], @@ -1139,9 +1289,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz", - "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.2.tgz", + "integrity": "sha512-p4bm9+wsPwup5Z8f4EpfN63qNagQ47Ua2znaqGH6bqLlmJ4bx97Y9JdqxgGZ6Y8xVTixUnEkoKSHcpRlDnNr5w==", "cpu": [ "s390x" ], @@ -1156,9 +1306,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz", - "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.2.tgz", + "integrity": "sha512-uwp2Tip5aPmH+NRUwTcfLb+W32WXjpFejTIOWZFw/v7/KnpCDKG66u4DLcurQpiYTiYwQ9B7KOeMJvLCu/OvbA==", "cpu": [ "x64" ], @@ -1173,9 +1323,9 @@ } }, "node_modules/@esbuild/netbsd-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz", - "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.2.tgz", + "integrity": "sha512-Kj6DiBlwXrPsCRDeRvGAUb/LNrBASrfqAIok+xB0LxK8CHqxZ037viF13ugfsIpePH93mX7xfJp97cyDuTZ3cw==", "cpu": [ "arm64" ], @@ -1190,9 +1340,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz", - "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.2.tgz", + "integrity": "sha512-HwGDZ0VLVBY3Y+Nw0JexZy9o/nUAWq9MlV7cahpaXKW6TOzfVno3y3/M8Ga8u8Yr7GldLOov27xiCnqRZf0tCA==", "cpu": [ "x64" ], @@ -1207,9 +1357,9 @@ } }, "node_modules/@esbuild/openbsd-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz", - "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.2.tgz", + "integrity": "sha512-DNIHH2BPQ5551A7oSHD0CKbwIA/Ox7+78/AWkbS5QoRzaqlev2uFayfSxq68EkonB+IKjiuxBFoV8ESJy8bOHA==", "cpu": [ "arm64" ], @@ -1224,9 +1374,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz", - "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.2.tgz", + "integrity": "sha512-/it7w9Nb7+0KFIzjalNJVR5bOzA9Vay+yIPLVHfIQYG/j+j9VTH84aNB8ExGKPU4AzfaEvN9/V4HV+F+vo8OEg==", "cpu": [ "x64" ], @@ -1241,9 +1391,9 @@ } }, "node_modules/@esbuild/openharmony-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz", - "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.2.tgz", + "integrity": "sha512-LRBbCmiU51IXfeXk59csuX/aSaToeG7w48nMwA6049Y4J4+VbWALAuXcs+qcD04rHDuSCSRKdmY63sruDS5qag==", "cpu": [ "arm64" ], @@ -1258,9 +1408,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz", - "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.2.tgz", + "integrity": "sha512-kMtx1yqJHTmqaqHPAzKCAkDaKsffmXkPHThSfRwZGyuqyIeBvf08KSsYXl+abf5HDAPMJIPnbBfXvP2ZC2TfHg==", "cpu": [ "x64" ], @@ -1275,9 +1425,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz", - "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.2.tgz", + "integrity": "sha512-Yaf78O/B3Kkh+nKABUF++bvJv5Ijoy9AN1ww904rOXZFLWVc5OLOfL56W+C8F9xn5JQZa3UX6m+IktJnIb1Jjg==", "cpu": [ "arm64" ], @@ -1292,9 +1442,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz", - "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.2.tgz", + "integrity": "sha512-Iuws0kxo4yusk7sw70Xa2E2imZU5HoixzxfGCdxwBdhiDgt9vX9VUCBhqcwY7/uh//78A1hMkkROMJq9l27oLQ==", "cpu": [ "ia32" ], @@ -1309,9 +1459,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz", - "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.2.tgz", + "integrity": "sha512-sRdU18mcKf7F+YgheI/zGf5alZatMUTKj/jNS6l744f9u3WFu4v7twcUI9vu4mknF4Y9aDlblIie0IM+5xxaqQ==", "cpu": [ "x64" ], @@ -1326,9 +1476,9 @@ } }, "node_modules/@eslint-community/eslint-utils": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.0.tgz", - "integrity": "sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g==", + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz", + "integrity": "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==", "dev": true, "license": "MIT", "dependencies": { @@ -1432,6 +1582,23 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/@eslint/eslintrc/node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, "node_modules/@eslint/eslintrc/node_modules/globals": { "version": "14.0.0", "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", @@ -1521,9 +1688,9 @@ "license": "MIT" }, "node_modules/@hono/node-server": { - "version": "1.19.7", - "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-1.19.7.tgz", - "integrity": "sha512-vUcD0uauS7EU2caukW8z5lJKtoGMokxNbJtBiwHgpqxEXokaHCBkQUmCHhjFB1VUTWdqj25QoMkMKzgjq+uhrw==", + "version": "1.19.9", + "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-1.19.9.tgz", + "integrity": "sha512-vHL6w3ecZsky+8P5MD+eFfaGTyCeOHUIFYMGpQGbrBTSmNNoxv0if69rEZ5giu36weC5saFuznL411gRX7bJDw==", "license": "MIT", "engines": { "node": ">=18.14.1" @@ -1941,9 +2108,9 @@ } }, "node_modules/@jest/environment-jsdom-abstract/node_modules/@sinclair/typebox": { - "version": "0.34.41", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.34.41.tgz", - "integrity": "sha512-6gS8pZzSXdyRHTIqoqSVknxolr1kzfy4/CeDnrzsVz8TTIWUbOBr6gnzOmTYJ3eXQNh4IYHIGi5aIL7sOZ2G/g==", + "version": "0.34.47", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.34.47.tgz", + "integrity": "sha512-ZGIBQ+XDvO5JQku9wmwtabcVTHJsgSWAHYtVuM9pBNNR5E88v6Jcj/llpmsjivig5X8A8HHOb4/mbEKPS5EvAw==", "dev": true, "license": "MIT", "peer": true @@ -1959,19 +2126,6 @@ "@sinonjs/commons": "^3.0.1" } }, - "node_modules/@jest/environment-jsdom-abstract/node_modules/@types/jsdom": { - "version": "21.1.7", - "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-21.1.7.tgz", - "integrity": "sha512-yOriVnggzrnQ3a9OKOCxaVuSug3w3/SbOj5i7VwXWZEyUNl3bLF9V3MfxGbZKuwqJOQyRfqXyROBB1CoZLFWzA==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "@types/node": "*", - "@types/tough-cookie": "*", - "parse5": "^7.0.0" - } - }, "node_modules/@jest/environment-jsdom-abstract/node_modules/ansi-styles": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", @@ -2394,6 +2548,14 @@ "resolved": "server", "link": true }, + "node_modules/@modelcontextprotocol/inspector-shared": { + "resolved": "shared", + "link": true + }, + "node_modules/@modelcontextprotocol/inspector-tui": { + "resolved": "tui", + "link": true + }, "node_modules/@modelcontextprotocol/sdk": { "version": "1.25.2", "resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.25.2.tgz", @@ -2433,37 +2595,6 @@ } } }, - "node_modules/@modelcontextprotocol/sdk/node_modules/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/@modelcontextprotocol/sdk/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "license": "MIT" - }, - "node_modules/@modelcontextprotocol/sdk/node_modules/pkce-challenge": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-5.0.1.tgz", - "integrity": "sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ==", - "license": "MIT", - "engines": { - "node": ">=16.20.0" - } - }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -3470,9 +3601,9 @@ "license": "MIT" }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.53.3.tgz", - "integrity": "sha512-mRSi+4cBjrRLoaal2PnqH82Wqyb+d3HsPUN/W+WslCXsZsyHa9ZeQQX/pQsZaVIWDkPcpV6jJ+3KLbTbgnwv8w==", + "version": "4.55.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.55.2.tgz", + "integrity": "sha512-21J6xzayjy3O6NdnlO6aXi/urvSRjm6nCI6+nF6ra2YofKruGixN9kfT+dt55HVNwfDmpDHJcaS3JuP/boNnlA==", "cpu": [ "arm" ], @@ -3484,9 +3615,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.53.3.tgz", - "integrity": "sha512-CbDGaMpdE9sh7sCmTrTUyllhrg65t6SwhjlMJsLr+J8YjFuPmCEjbBSx4Z/e4SmDyH3aB5hGaJUP2ltV/vcs4w==", + "version": "4.55.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.55.2.tgz", + "integrity": "sha512-eXBg7ibkNUZ+sTwbFiDKou0BAckeV6kIigK7y5Ko4mB/5A1KLhuzEKovsmfvsL8mQorkoincMFGnQuIT92SKqA==", "cpu": [ "arm64" ], @@ -3498,9 +3629,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.53.3.tgz", - "integrity": "sha512-Nr7SlQeqIBpOV6BHHGZgYBuSdanCXuw09hon14MGOLGmXAFYjx1wNvquVPmpZnl0tLjg25dEdr4IQ6GgyToCUA==", + "version": "4.55.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.55.2.tgz", + "integrity": "sha512-UCbaTklREjrc5U47ypLulAgg4njaqfOVLU18VrCrI+6E5MQjuG0lSWaqLlAJwsD7NpFV249XgB0Bi37Zh5Sz4g==", "cpu": [ "arm64" ], @@ -3512,9 +3643,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.53.3.tgz", - "integrity": "sha512-DZ8N4CSNfl965CmPktJ8oBnfYr3F8dTTNBQkRlffnUarJ2ohudQD17sZBa097J8xhQ26AwhHJ5mvUyQW8ddTsQ==", + "version": "4.55.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.55.2.tgz", + "integrity": "sha512-dP67MA0cCMHFT2g5XyjtpVOtp7y4UyUxN3dhLdt11at5cPKnSm4lY+EhwNvDXIMzAMIo2KU+mc9wxaAQJTn7sQ==", "cpu": [ "x64" ], @@ -3526,9 +3657,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.53.3.tgz", - "integrity": "sha512-yMTrCrK92aGyi7GuDNtGn2sNW+Gdb4vErx4t3Gv/Tr+1zRb8ax4z8GWVRfr3Jw8zJWvpGHNpss3vVlbF58DZ4w==", + "version": "4.55.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.55.2.tgz", + "integrity": "sha512-WDUPLUwfYV9G1yxNRJdXcvISW15mpvod1Wv3ok+Ws93w1HjIVmCIFxsG2DquO+3usMNCpJQ0wqO+3GhFdl6Fow==", "cpu": [ "arm64" ], @@ -3540,9 +3671,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.53.3.tgz", - "integrity": "sha512-lMfF8X7QhdQzseM6XaX0vbno2m3hlyZFhwcndRMw8fbAGUGL3WFMBdK0hbUBIUYcEcMhVLr1SIamDeuLBnXS+Q==", + "version": "4.55.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.55.2.tgz", + "integrity": "sha512-Ng95wtHVEulRwn7R0tMrlUuiLVL/HXA8Lt/MYVpy88+s5ikpntzZba1qEulTuPnPIZuOPcW9wNEiqvZxZmgmqQ==", "cpu": [ "x64" ], @@ -3554,9 +3685,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.53.3.tgz", - "integrity": "sha512-k9oD15soC/Ln6d2Wv/JOFPzZXIAIFLp6B+i14KhxAfnq76ajt0EhYc5YPeX6W1xJkAdItcVT+JhKl1QZh44/qw==", + "version": "4.55.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.55.2.tgz", + "integrity": "sha512-AEXMESUDWWGqD6LwO/HkqCZgUE1VCJ1OhbvYGsfqX2Y6w5quSXuyoy/Fg3nRqiwro+cJYFxiw5v4kB2ZDLhxrw==", "cpu": [ "arm" ], @@ -3568,9 +3699,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.53.3.tgz", - "integrity": "sha512-vTNlKq+N6CK/8UktsrFuc+/7NlEYVxgaEgRXVUVK258Z5ymho29skzW1sutgYjqNnquGwVUObAaxae8rZ6YMhg==", + "version": "4.55.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.55.2.tgz", + "integrity": "sha512-ZV7EljjBDwBBBSv570VWj0hiNTdHt9uGznDtznBB4Caj3ch5rgD4I2K1GQrtbvJ/QiB+663lLgOdcADMNVC29Q==", "cpu": [ "arm" ], @@ -3582,9 +3713,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.53.3.tgz", - "integrity": "sha512-RGrFLWgMhSxRs/EWJMIFM1O5Mzuz3Xy3/mnxJp/5cVhZ2XoCAxJnmNsEyeMJtpK+wu0FJFWz+QF4mjCA7AUQ3w==", + "version": "4.55.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.55.2.tgz", + "integrity": "sha512-uvjwc8NtQVPAJtq4Tt7Q49FOodjfbf6NpqXyW/rjXoV+iZ3EJAHLNAnKT5UJBc6ffQVgmXTUL2ifYiLABlGFqA==", "cpu": [ "arm64" ], @@ -3596,9 +3727,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.53.3.tgz", - "integrity": "sha512-kASyvfBEWYPEwe0Qv4nfu6pNkITLTb32p4yTgzFCocHnJLAHs+9LjUu9ONIhvfT/5lv4YS5muBHyuV84epBo/A==", + "version": "4.55.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.55.2.tgz", + "integrity": "sha512-s3KoWVNnye9mm/2WpOZ3JeUiediUVw6AvY/H7jNA6qgKA2V2aM25lMkVarTDfiicn/DLq3O0a81jncXszoyCFA==", "cpu": [ "arm64" ], @@ -3610,9 +3741,23 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.53.3.tgz", - "integrity": "sha512-JiuKcp2teLJwQ7vkJ95EwESWkNRFJD7TQgYmCnrPtlu50b4XvT5MOmurWNrCj3IFdyjBQ5p9vnrX4JM6I8OE7g==", + "version": "4.55.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.55.2.tgz", + "integrity": "sha512-gi21faacK+J8aVSyAUptML9VQN26JRxe484IbF+h3hpG+sNVoMXPduhREz2CcYr5my0NE3MjVvQ5bMKX71pfVA==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.55.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.55.2.tgz", + "integrity": "sha512-qSlWiXnVaS/ceqXNfnoFZh4IiCA0EwvCivivTGbEu1qv2o+WTHpn1zNmCTAoOG5QaVr2/yhCoLScQtc/7RxshA==", "cpu": [ "loong64" ], @@ -3624,9 +3769,23 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.53.3.tgz", - "integrity": "sha512-EoGSa8nd6d3T7zLuqdojxC20oBfNT8nexBbB/rkxgKj5T5vhpAQKKnD+h3UkoMuTyXkP5jTjK/ccNRmQrPNDuw==", + "version": "4.55.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.55.2.tgz", + "integrity": "sha512-rPyuLFNoF1B0+wolH277E780NUKf+KoEDb3OyoLbAO18BbeKi++YN6gC/zuJoPPDlQRL3fIxHxCxVEWiem2yXw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.55.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.55.2.tgz", + "integrity": "sha512-g+0ZLMook31iWV4PvqKU0i9E78gaZgYpSrYPed/4Bu+nGTgfOPtfs1h11tSSRPXSjC5EzLTjV/1A7L2Vr8pJoQ==", "cpu": [ "ppc64" ], @@ -3638,9 +3797,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.53.3.tgz", - "integrity": "sha512-4s+Wped2IHXHPnAEbIB0YWBv7SDohqxobiiPA1FIWZpX+w9o2i4LezzH/NkFUl8LRci/8udci6cLq+jJQlh+0g==", + "version": "4.55.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.55.2.tgz", + "integrity": "sha512-i+sGeRGsjKZcQRh3BRfpLsM3LX3bi4AoEVqmGDyc50L6KfYsN45wVCSz70iQMwPWr3E5opSiLOwsC9WB4/1pqg==", "cpu": [ "riscv64" ], @@ -3652,9 +3811,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.53.3.tgz", - "integrity": "sha512-68k2g7+0vs2u9CxDt5ktXTngsxOQkSEV/xBbwlqYcUrAVh6P9EgMZvFsnHy4SEiUl46Xf0IObWVbMvPrr2gw8A==", + "version": "4.55.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.55.2.tgz", + "integrity": "sha512-C1vLcKc4MfFV6I0aWsC7B2Y9QcsiEcvKkfxprwkPfLaN8hQf0/fKHwSF2lcYzA9g4imqnhic729VB9Fo70HO3Q==", "cpu": [ "riscv64" ], @@ -3666,9 +3825,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.53.3.tgz", - "integrity": "sha512-VYsFMpULAz87ZW6BVYw3I6sWesGpsP9OPcyKe8ofdg9LHxSbRMd7zrVrr5xi/3kMZtpWL/wC+UIJWJYVX5uTKg==", + "version": "4.55.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.55.2.tgz", + "integrity": "sha512-68gHUK/howpQjh7g7hlD9DvTTt4sNLp1Bb+Yzw2Ki0xvscm2cOdCLZNJNhd2jW8lsTPrHAHuF751BygifW4bkQ==", "cpu": [ "s390x" ], @@ -3680,9 +3839,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.53.3.tgz", - "integrity": "sha512-3EhFi1FU6YL8HTUJZ51imGJWEX//ajQPfqWLI3BQq4TlvHy4X0MOr5q3D2Zof/ka0d5FNdPwZXm3Yyib/UEd+w==", + "version": "4.55.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.55.2.tgz", + "integrity": "sha512-1e30XAuaBP1MAizaOBApsgeGZge2/Byd6wV4a8oa6jPdHELbRHBiw7wvo4dp7Ie2PE8TZT4pj9RLGZv9N4qwlw==", "cpu": [ "x64" ], @@ -3694,9 +3853,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.53.3.tgz", - "integrity": "sha512-eoROhjcc6HbZCJr+tvVT8X4fW3/5g/WkGvvmwz/88sDtSJzO7r/blvoBDgISDiCjDRZmHpwud7h+6Q9JxFwq1Q==", + "version": "4.55.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.55.2.tgz", + "integrity": "sha512-4BJucJBGbuGnH6q7kpPqGJGzZnYrpAzRd60HQSt3OpX/6/YVgSsJnNzR8Ot74io50SeVT4CtCWe/RYIAymFPwA==", "cpu": [ "x64" ], @@ -3707,10 +3866,24 @@ "linux" ] }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.55.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.55.2.tgz", + "integrity": "sha512-cT2MmXySMo58ENv8p6/O6wI/h/gLnD3D6JoajwXFZH6X9jz4hARqUhWpGuQhOgLNXscfZYRQMJvZDtWNzMAIDw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.53.3.tgz", - "integrity": "sha512-OueLAWgrNSPGAdUdIjSWXw+u/02BRTcnfw9PN41D2vq/JSEPnJnVuBgw18VkN8wcd4fjUs+jFHVM4t9+kBSNLw==", + "version": "4.55.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.55.2.tgz", + "integrity": "sha512-sZnyUgGkuzIXaK3jNMPmUIyJrxu/PjmATQrocpGA1WbCPX8H5tfGgRSuYtqBYAvLuIGp8SPRb1O4d1Fkb5fXaQ==", "cpu": [ "arm64" ], @@ -3722,9 +3895,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.53.3.tgz", - "integrity": "sha512-GOFuKpsxR/whszbF/bzydebLiXIHSgsEUp6M0JI8dWvi+fFa1TD6YQa4aSZHtpmh2/uAlj/Dy+nmby3TJ3pkTw==", + "version": "4.55.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.55.2.tgz", + "integrity": "sha512-sDpFbenhmWjNcEbBcoTV0PWvW5rPJFvu+P7XoTY0YLGRupgLbFY0XPfwIbJOObzO7QgkRDANh65RjhPmgSaAjQ==", "cpu": [ "arm64" ], @@ -3736,9 +3909,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.53.3.tgz", - "integrity": "sha512-iah+THLcBJdpfZ1TstDFbKNznlzoxa8fmnFYK4V67HvmuNYkVdAywJSoteUszvBQ9/HqN2+9AZghbajMsFT+oA==", + "version": "4.55.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.55.2.tgz", + "integrity": "sha512-GvJ03TqqaweWCigtKQVBErw2bEhu1tyfNQbarwr94wCGnczA9HF8wqEe3U/Lfu6EdeNP0p6R+APeHVwEqVxpUQ==", "cpu": [ "ia32" ], @@ -3750,9 +3923,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.53.3.tgz", - "integrity": "sha512-J9QDiOIZlZLdcot5NXEepDkstocktoVjkaKUtqzgzpt2yWjGlbYiKyp05rWwk4nypbYUNoFAztEgixoLaSETkg==", + "version": "4.55.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.55.2.tgz", + "integrity": "sha512-KvXsBvp13oZz9JGe5NYS7FNizLe99Ny+W8ETsuCyjXiKdiGrcz2/J/N8qxZ/RSwivqjQguug07NLHqrIHrqfYw==", "cpu": [ "x64" ], @@ -3764,9 +3937,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.53.3.tgz", - "integrity": "sha512-UhTd8u31dXadv0MopwGgNOBpUVROFKWVQgAg5N1ESyCz8AuBcMqm4AuTjrwgQKGDfoFuz02EuMRHQIw/frmYKQ==", + "version": "4.55.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.55.2.tgz", + "integrity": "sha512-xNO+fksQhsAckRtDSPWaMeT1uIM+JrDRXlerpnWNXhn1TdB3YZ6uKBMBTKP0eX9XtYEP978hHk1f8332i2AW8Q==", "cpu": [ "x64" ], @@ -3804,6 +3977,13 @@ "@sinonjs/commons": "^3.0.0" } }, + "node_modules/@standard-schema/spec": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", + "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==", + "dev": true, + "license": "MIT" + }, "node_modules/@testing-library/dom": { "version": "10.4.1", "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.1.tgz", @@ -3853,9 +4033,9 @@ "license": "MIT" }, "node_modules/@testing-library/react": { - "version": "16.3.0", - "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-16.3.0.tgz", - "integrity": "sha512-kFSyxiEDwv1WLl2fgsq6pPBbw5aWKrsY2/noi1Id0TK0UParSF62oFQFGHXIyaG4pp2tEub/Zlel+fjjZILDsw==", + "version": "16.3.2", + "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-16.3.2.tgz", + "integrity": "sha512-XU5/SytQM+ykqMnAnvB2umaJNIOsLF3PVv//1Ew4CTcpz0/BRyy/af40qqrt7SjKpDdT1saBMc42CUok5gaw+g==", "dev": true, "license": "MIT", "dependencies": { @@ -3978,6 +4158,17 @@ "@types/node": "*" } }, + "node_modules/@types/chai": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", + "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/deep-eql": "*", + "assertion-error": "^2.0.1" + } + }, "node_modules/@types/connect": { "version": "3.4.38", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", @@ -3998,6 +4189,13 @@ "@types/node": "*" } }, + "node_modules/@types/deep-eql": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", + "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/estree": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", @@ -4019,9 +4217,9 @@ } }, "node_modules/@types/express-serve-static-core": { - "version": "4.19.7", - "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.7.tgz", - "integrity": "sha512-FvPtiIf1LfhzsaIXhv/PHan/2FeQBbtBDtfX2QfvPxdUelMDEckK08SM6nqo1MIZY3RUlfA+HV8+hFUSio78qg==", + "version": "4.19.8", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.8.tgz", + "integrity": "sha512-02S5fmqeoKzVZCHPZid4b8JH2eM5HzQLZWN2FohQEy/0eXTq8VXZfSN6Pcr3F6N9R/vNrj7cpgbhjie6m/1tCA==", "dev": true, "license": "MIT", "dependencies": { @@ -4122,11 +4320,12 @@ "license": "MIT" }, "node_modules/@types/jsdom": { - "version": "20.0.1", - "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-20.0.1.tgz", - "integrity": "sha512-d0r18sZPmMQr1eG35u12FZfhIXNrnsPU/g5wvRKCUf/tOGilKKwYMYGqh33BNR6ba+2gkHw1EUiHoN3mn7E5IQ==", - "dev": true, + "version": "21.1.7", + "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-21.1.7.tgz", + "integrity": "sha512-yOriVnggzrnQ3a9OKOCxaVuSug3w3/SbOj5i7VwXWZEyUNl3bLF9V3MfxGbZKuwqJOQyRfqXyROBB1CoZLFWzA==", + "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@types/node": "*", "@types/tough-cookie": "*", @@ -4148,9 +4347,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.19.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.2.tgz", - "integrity": "sha512-LPM2G3Syo1GLzXLGJAKdqoU35XvrWzGJ21/7sgZTUpbkBaOasTj8tjwn6w+hCkqaa1TfJ/w67rJSwYItlJ2mYw==", + "version": "22.19.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.7.tgz", + "integrity": "sha512-MciR4AKGHWl7xwxkBa6xUGxQJ4VBOmPTF7sL+iGzuahOFaO0jHCsuEfS80pan1ef4gWId1oWOweIhrDEYLuaOw==", "license": "MIT", "dependencies": { "undici-types": "~6.21.0" @@ -4163,13 +4362,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/prop-types": { - "version": "15.7.15", - "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz", - "integrity": "sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==", - "devOptional": true, - "license": "MIT" - }, "node_modules/@types/qs": { "version": "6.14.0", "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.14.0.tgz", @@ -4185,26 +4377,15 @@ "license": "MIT" }, "node_modules/@types/react": { - "version": "18.3.27", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.27.tgz", - "integrity": "sha512-cisd7gxkzjBKU2GgdYrTdtQx1SORymWyaAFhaxQPK9bYO9ot3Y5OikQRvY0VYQtvwjeQnizCINJAenh/V7MK2w==", + "version": "19.2.8", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.8.tgz", + "integrity": "sha512-3MbSL37jEchWZz2p2mjntRZtPt837ij10ApxKfgmXCTuHWagYg7iA5bqPw6C8BMPfwidlvfPI/fxOc42HLhcyg==", "devOptional": true, "license": "MIT", "dependencies": { - "@types/prop-types": "*", "csstype": "^3.2.2" } }, - "node_modules/@types/react-dom": { - "version": "18.3.7", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.7.tgz", - "integrity": "sha512-MEe3UeoENYVFXzoXEWsvcpg6ZvlrFNlOQ7EOsvhI3CfAXwzPfO8Qwuxd40nepsYKqyyVQnTdEfv68q91yLcKrQ==", - "devOptional": true, - "license": "MIT", - "peerDependencies": { - "@types/react": "^18.0.0" - } - }, "node_modules/@types/send": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@types/send/-/send-1.2.1.tgz", @@ -4297,20 +4478,20 @@ "license": "MIT" }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.49.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.49.0.tgz", - "integrity": "sha512-JXij0vzIaTtCwu6SxTh8qBc66kmf1xs7pI4UOiMDFVct6q86G0Zs7KRcEoJgY3Cav3x5Tq0MF5jwgpgLqgKG3A==", + "version": "8.53.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.53.1.tgz", + "integrity": "sha512-cFYYFZ+oQFi6hUnBTbLRXfTJiaQtYE3t4O692agbBl+2Zy+eqSKWtPjhPXJu1G7j4RLjKgeJPDdq3EqOwmX5Ag==", "dev": true, "license": "MIT", "dependencies": { - "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.49.0", - "@typescript-eslint/type-utils": "8.49.0", - "@typescript-eslint/utils": "8.49.0", - "@typescript-eslint/visitor-keys": "8.49.0", - "ignore": "^7.0.0", + "@eslint-community/regexpp": "^4.12.2", + "@typescript-eslint/scope-manager": "8.53.1", + "@typescript-eslint/type-utils": "8.53.1", + "@typescript-eslint/utils": "8.53.1", + "@typescript-eslint/visitor-keys": "8.53.1", + "ignore": "^7.0.5", "natural-compare": "^1.4.0", - "ts-api-utils": "^2.1.0" + "ts-api-utils": "^2.4.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -4320,7 +4501,7 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^8.49.0", + "@typescript-eslint/parser": "^8.53.1", "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <6.0.0" } @@ -4336,17 +4517,17 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "8.49.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.49.0.tgz", - "integrity": "sha512-N9lBGA9o9aqb1hVMc9hzySbhKibHmB+N3IpoShyV6HyQYRGIhlrO5rQgttypi+yEeKsKI4idxC8Jw6gXKD4THA==", + "version": "8.53.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.53.1.tgz", + "integrity": "sha512-nm3cvFN9SqZGXjmw5bZ6cGmvJSyJPn0wU9gHAZZHDnZl2wF9PhHv78Xf06E0MaNk4zLVHL8hb2/c32XvyJOLQg==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/scope-manager": "8.49.0", - "@typescript-eslint/types": "8.49.0", - "@typescript-eslint/typescript-estree": "8.49.0", - "@typescript-eslint/visitor-keys": "8.49.0", - "debug": "^4.3.4" + "@typescript-eslint/scope-manager": "8.53.1", + "@typescript-eslint/types": "8.53.1", + "@typescript-eslint/typescript-estree": "8.53.1", + "@typescript-eslint/visitor-keys": "8.53.1", + "debug": "^4.4.3" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -4361,15 +4542,15 @@ } }, "node_modules/@typescript-eslint/project-service": { - "version": "8.49.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.49.0.tgz", - "integrity": "sha512-/wJN0/DKkmRUMXjZUXYZpD1NEQzQAAn9QWfGwo+Ai8gnzqH7tvqS7oNVdTjKqOcPyVIdZdyCMoqN66Ia789e7g==", + "version": "8.53.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.53.1.tgz", + "integrity": "sha512-WYC4FB5Ra0xidsmlPb+1SsnaSKPmS3gsjIARwbEkHkoWloQmuzcfypljaJcR78uyLA1h8sHdWWPHSLDI+MtNog==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/tsconfig-utils": "^8.49.0", - "@typescript-eslint/types": "^8.49.0", - "debug": "^4.3.4" + "@typescript-eslint/tsconfig-utils": "^8.53.1", + "@typescript-eslint/types": "^8.53.1", + "debug": "^4.4.3" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -4383,14 +4564,14 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.49.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.49.0.tgz", - "integrity": "sha512-npgS3zi+/30KSOkXNs0LQXtsg9ekZ8OISAOLGWA/ZOEn0ZH74Ginfl7foziV8DT+D98WfQ5Kopwqb/PZOaIJGg==", + "version": "8.53.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.53.1.tgz", + "integrity": "sha512-Lu23yw1uJMFY8cUeq7JlrizAgeQvWugNQzJp8C3x8Eo5Jw5Q2ykMdiiTB9vBVOOUBysMzmRRmUfwFrZuI2C4SQ==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.49.0", - "@typescript-eslint/visitor-keys": "8.49.0" + "@typescript-eslint/types": "8.53.1", + "@typescript-eslint/visitor-keys": "8.53.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -4401,9 +4582,9 @@ } }, "node_modules/@typescript-eslint/tsconfig-utils": { - "version": "8.49.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.49.0.tgz", - "integrity": "sha512-8prixNi1/6nawsRYxet4YOhnbW+W9FK/bQPxsGB1D3ZrDzbJ5FXw5XmzxZv82X3B+ZccuSxo/X8q9nQ+mFecWA==", + "version": "8.53.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.53.1.tgz", + "integrity": "sha512-qfvLXS6F6b1y43pnf0pPbXJ+YoXIC7HKg0UGZ27uMIemKMKA6XH2DTxsEDdpdN29D+vHV07x/pnlPNVLhdhWiA==", "dev": true, "license": "MIT", "engines": { @@ -4418,17 +4599,17 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.49.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.49.0.tgz", - "integrity": "sha512-KTExJfQ+svY8I10P4HdxKzWsvtVnsuCifU5MvXrRwoP2KOlNZ9ADNEWWsQTJgMxLzS5VLQKDjkCT/YzgsnqmZg==", + "version": "8.53.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.53.1.tgz", + "integrity": "sha512-MOrdtNvyhy0rHyv0ENzub1d4wQYKb2NmIqG7qEqPWFW7Mpy2jzFC3pQ2yKDvirZB7jypm5uGjF2Qqs6OIqu47w==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.49.0", - "@typescript-eslint/typescript-estree": "8.49.0", - "@typescript-eslint/utils": "8.49.0", - "debug": "^4.3.4", - "ts-api-utils": "^2.1.0" + "@typescript-eslint/types": "8.53.1", + "@typescript-eslint/typescript-estree": "8.53.1", + "@typescript-eslint/utils": "8.53.1", + "debug": "^4.4.3", + "ts-api-utils": "^2.4.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -4443,9 +4624,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "8.49.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.49.0.tgz", - "integrity": "sha512-e9k/fneezorUo6WShlQpMxXh8/8wfyc+biu6tnAqA81oWrEic0k21RHzP9uqqpyBBeBKu4T+Bsjy9/b8u7obXQ==", + "version": "8.53.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.53.1.tgz", + "integrity": "sha512-jr/swrr2aRmUAUjW5/zQHbMaui//vQlsZcJKijZf3M26bnmLj8LyZUpj8/Rd6uzaek06OWsqdofN/Thenm5O8A==", "dev": true, "license": "MIT", "engines": { @@ -4457,21 +4638,21 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.49.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.49.0.tgz", - "integrity": "sha512-jrLdRuAbPfPIdYNppHJ/D0wN+wwNfJ32YTAm10eJVsFmrVpXQnDWBn8niCSMlWjvml8jsce5E/O+86IQtTbJWA==", + "version": "8.53.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.53.1.tgz", + "integrity": "sha512-RGlVipGhQAG4GxV1s34O91cxQ/vWiHJTDHbXRr0li2q/BGg3RR/7NM8QDWgkEgrwQYCvmJV9ichIwyoKCQ+DTg==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/project-service": "8.49.0", - "@typescript-eslint/tsconfig-utils": "8.49.0", - "@typescript-eslint/types": "8.49.0", - "@typescript-eslint/visitor-keys": "8.49.0", - "debug": "^4.3.4", - "minimatch": "^9.0.4", - "semver": "^7.6.0", + "@typescript-eslint/project-service": "8.53.1", + "@typescript-eslint/tsconfig-utils": "8.53.1", + "@typescript-eslint/types": "8.53.1", + "@typescript-eslint/visitor-keys": "8.53.1", + "debug": "^4.4.3", + "minimatch": "^9.0.5", + "semver": "^7.7.3", "tinyglobby": "^0.2.15", - "ts-api-utils": "^2.1.0" + "ts-api-utils": "^2.4.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -4524,16 +4705,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.49.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.49.0.tgz", - "integrity": "sha512-N3W7rJw7Rw+z1tRsHZbK395TWSYvufBXumYtEGzypgMUthlg0/hmCImeA8hgO2d2G4pd7ftpxxul2J8OdtdaFA==", + "version": "8.53.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.53.1.tgz", + "integrity": "sha512-c4bMvGVWW4hv6JmDUEG7fSYlWOl3II2I4ylt0NM+seinYQlZMQIaKaXIIVJWt9Ofh6whrpM+EdDQXKXjNovvrg==", "dev": true, "license": "MIT", "dependencies": { - "@eslint-community/eslint-utils": "^4.7.0", - "@typescript-eslint/scope-manager": "8.49.0", - "@typescript-eslint/types": "8.49.0", - "@typescript-eslint/typescript-estree": "8.49.0" + "@eslint-community/eslint-utils": "^4.9.1", + "@typescript-eslint/scope-manager": "8.53.1", + "@typescript-eslint/types": "8.53.1", + "@typescript-eslint/typescript-estree": "8.53.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -4548,13 +4729,13 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.49.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.49.0.tgz", - "integrity": "sha512-LlKaciDe3GmZFphXIc79THF/YYBugZ7FS1pO581E/edlVVNbZKDy93evqmrfQ9/Y4uN0vVhX4iuchq26mK/iiA==", + "version": "8.53.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.53.1.tgz", + "integrity": "sha512-oy+wV7xDKFPRyNggmXuZQSBzvoLnpmJs+GhzRhPjrxl2b/jIlyjVokzm47CZCDUdXKr2zd7ZLodPfOBpOPyPlg==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.49.0", + "@typescript-eslint/types": "8.53.1", "eslint-visitor-keys": "^4.2.1" }, "engines": { @@ -4586,6 +4767,117 @@ "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" } }, + "node_modules/@vitest/expect": { + "version": "4.0.17", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.0.17.tgz", + "integrity": "sha512-mEoqP3RqhKlbmUmntNDDCJeTDavDR+fVYkSOw8qRwJFaW/0/5zA9zFeTrHqNtcmwh6j26yMmwx2PqUDPzt5ZAQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@standard-schema/spec": "^1.0.0", + "@types/chai": "^5.2.2", + "@vitest/spy": "4.0.17", + "@vitest/utils": "4.0.17", + "chai": "^6.2.1", + "tinyrainbow": "^3.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/mocker": { + "version": "4.0.17", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.0.17.tgz", + "integrity": "sha512-+ZtQhLA3lDh1tI2wxe3yMsGzbp7uuJSWBM1iTIKCbppWTSBN09PUC+L+fyNlQApQoR+Ps8twt2pbSSXg2fQVEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/spy": "4.0.17", + "estree-walker": "^3.0.3", + "magic-string": "^0.30.21" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9", + "vite": "^6.0.0 || ^7.0.0-0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/@vitest/pretty-format": { + "version": "4.0.17", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.0.17.tgz", + "integrity": "sha512-Ah3VAYmjcEdHg6+MwFE17qyLqBHZ+ni2ScKCiW2XrlSBV4H3Z7vYfPfz7CWQ33gyu76oc0Ai36+kgLU3rfF4nw==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyrainbow": "^3.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner": { + "version": "4.0.17", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.0.17.tgz", + "integrity": "sha512-JmuQyf8aMWoo/LmNFppdpkfRVHJcsgzkbCA+/Bk7VfNH7RE6Ut2qxegeyx2j3ojtJtKIbIGy3h+KxGfYfk28YQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/utils": "4.0.17", + "pathe": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/snapshot": { + "version": "4.0.17", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.0.17.tgz", + "integrity": "sha512-npPelD7oyL+YQM2gbIYvlavlMVWUfNNGZPcu0aEUQXt7FXTuqhmgiYupPnAanhKvyP6Srs2pIbWo30K0RbDtRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "4.0.17", + "magic-string": "^0.30.21", + "pathe": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/spy": { + "version": "4.0.17", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.0.17.tgz", + "integrity": "sha512-I1bQo8QaP6tZlTomQNWKJE6ym4SHf3oLS7ceNjozxxgzavRAgZDc06T7kD8gb9bXKEgcLNt00Z+kZO6KaJ62Ew==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils": { + "version": "4.0.17", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.0.17.tgz", + "integrity": "sha512-RG6iy+IzQpa9SB8HAFHJ9Y+pTzI+h8553MrciN9eC6TFBErqrQaTas4vG+MVj8S4uKk8uTT2p0vgZPnTdxd96w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "4.0.17", + "tinyrainbow": "^3.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, "node_modules/abab": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", @@ -4666,15 +4958,15 @@ } }, "node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "license": "MIT", "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" }, "funding": { "type": "github", @@ -4698,23 +4990,7 @@ } } }, - "node_modules/ajv-formats/node_modules/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/ajv-formats/node_modules/json-schema-traverse": { + "node_modules/ajv/node_modules/json-schema-traverse": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", @@ -4817,6 +5093,25 @@ "dequal": "^2.0.3" } }, + "node_modules/arr-rotate": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/arr-rotate/-/arr-rotate-1.0.0.tgz", + "integrity": "sha512-yOzOZcR9Tn7enTF66bqKorGGH0F36vcPaSWg8fO0c0UYb3LX3VMXj5ZxEqQLNOecAhlRJ7wYZja5i4jTlnbIfQ==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -4824,10 +5119,22 @@ "dev": true, "license": "MIT" }, + "node_modules/auto-bind": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/auto-bind/-/auto-bind-5.0.1.tgz", + "integrity": "sha512-ooviqdwwgfIfNmDwo94wlshcdzfO64XV0Cg6oDsDYBJfITDz1EngD2z7DkbvCWn+XIMsIqW27sEVF6qcpJrRcg==", + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/autoprefixer": { - "version": "10.4.22", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.22.tgz", - "integrity": "sha512-ARe0v/t9gO28Bznv6GgqARmVqcWOV3mfgUPn9becPHMiD3o9BwlRgaeccZnwTpZ7Zwqrm+c1sUSsMxIzQzc8Xg==", + "version": "10.4.23", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.23.tgz", + "integrity": "sha512-YYTXSFulfwytnjAPlw8QHncHJmlvFKtczb8InXaAx9Q0LbfDnfEYDE55omerIJKihhmU61Ft+cAOSzQVaBUmeA==", "dev": true, "funding": [ { @@ -4845,10 +5152,9 @@ ], "license": "MIT", "dependencies": { - "browserslist": "^4.27.0", - "caniuse-lite": "^1.0.30001754", + "browserslist": "^4.28.1", + "caniuse-lite": "^1.0.30001760", "fraction.js": "^5.3.4", - "normalize-range": "^0.1.2", "picocolors": "^1.1.1", "postcss-value-parser": "^4.2.0" }, @@ -4985,9 +5291,9 @@ "license": "MIT" }, "node_modules/baseline-browser-mapping": { - "version": "2.9.7", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.7.tgz", - "integrity": "sha512-k9xFKplee6KIio3IDbwj+uaCLpqzOwakOgmqzPezM0sFJlFKcg30vk2wOiAJtkTSfx0SSQDSe8q+mWA/fSH5Zg==", + "version": "2.9.15", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.15.tgz", + "integrity": "sha512-kX8h7K2srmDyYnXRIppo4AH/wYgzWVCs+eKr3RusRSQ5PvRYoEFmR/I0PbdTjKFAoKqp5+kbxnNTFO9jOfSVJg==", "dev": true, "license": "Apache-2.0", "bin": { @@ -5008,9 +5314,9 @@ } }, "node_modules/body-parser": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.1.tgz", - "integrity": "sha512-nfDwkulwiZYQIGwxdy0RUmowMhKcFVcYXUU7m4QlKYim1rUtg83xm2yjZ40QjDuc291AJjjeSc9b++AWHSgSHw==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.2.tgz", + "integrity": "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA==", "license": "MIT", "dependencies": { "bytes": "^3.1.2", @@ -5019,7 +5325,7 @@ "http-errors": "^2.0.0", "iconv-lite": "^0.7.0", "on-finished": "^2.4.1", - "qs": "^6.14.0", + "qs": "^6.14.1", "raw-body": "^3.0.1", "type-is": "^2.0.1" }, @@ -5202,9 +5508,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001760", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001760.tgz", - "integrity": "sha512-7AAMPcueWELt1p3mi13HR/LHH0TJLT11cnwDJEs3xA4+CK/PLKeO9Kl1oru24htkyUKtkGCvAx4ohB0Ttry8Dw==", + "version": "1.0.30001765", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001765.tgz", + "integrity": "sha512-LWcNtSyZrakjECqmpP4qdg0MMGdN368D7X8XvvAqOcqMv0RxnlqVKZl2V6/mBR68oYMxOZPLw/gO7DuisMHUvQ==", "dev": true, "funding": [ { @@ -5222,6 +5528,16 @@ ], "license": "CC-BY-4.0" }, + "node_modules/chai": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/chai/-/chai-6.2.2.tgz", + "integrity": "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -5238,6 +5554,18 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "node_modules/chalk/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/char-regex": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", @@ -5321,6 +5649,18 @@ "url": "https://polar.sh/cva" } }, + "node_modules/cli-boxes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-3.0.0.tgz", + "integrity": "sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/cli-cursor": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-5.0.0.tgz", @@ -5341,7 +5681,6 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-5.1.1.tgz", "integrity": "sha512-SroPvNHxUnk+vIW/dOSfNqdy1sPEFkrTk6TUtqLCnBlo3N7TNYYkzzN7uSD6+jVjrdO4+p8nH7JzH6cIvUem6A==", - "dev": true, "license": "MIT", "dependencies": { "slice-ansi": "^7.1.0", @@ -5444,6 +5783,18 @@ "node": ">= 0.12.0" } }, + "node_modules/code-excerpt": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/code-excerpt/-/code-excerpt-4.0.0.tgz", + "integrity": "sha512-xxodCmBen3iy2i0WtAK8FlFNrRzjUqjRsMfho58xT/wvZU1YTM3fCnRjcy1gJPMepaRlgm/0e6w8SpWHpn3/cA==", + "license": "MIT", + "dependencies": { + "convert-to-spaces": "^2.0.1" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, "node_modules/collect-v8-coverage": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.3.tgz", @@ -5529,21 +5880,6 @@ "url": "https://github.com/open-cli-tools/concurrently?sponsor=1" } }, - "node_modules/concurrently/node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" - } - }, "node_modules/content-disposition": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.1.tgz", @@ -5573,6 +5909,15 @@ "dev": true, "license": "MIT" }, + "node_modules/convert-to-spaces": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/convert-to-spaces/-/convert-to-spaces-2.0.1.tgz", + "integrity": "sha512-rcQ1bsQO9799wq24uE5AM2tAILy4gXGIK/njFWcVQkGNZ96edlpY+A7bjwvzjYvLDyzmG1MmMLZhpcsb+klNMQ==", + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, "node_modules/cookie": { "version": "0.7.2", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", @@ -5749,9 +6094,9 @@ "license": "MIT" }, "node_modules/dedent": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.7.0.tgz", - "integrity": "sha512-HGFtf8yhuhGhqO07SV79tRp+br4MnbdjeVxotpn1QBl30pcLLCQjX5b2295ll0fv8RKDKsmWYrl05usHM9CewQ==", + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.7.1.tgz", + "integrity": "sha512-9JmrhGZpOlEgOLdQgSm0zxFaYoQon408V1v49aqTWuXENVlnCuY9JBZcXZiCsZQWDjTm5Qf/nIvAy77mXDAjEg==", "dev": true, "license": "MIT", "peerDependencies": { @@ -5992,7 +6337,6 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/environment/-/environment-1.1.0.tgz", "integrity": "sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q==", - "dev": true, "license": "MIT", "engines": { "node": ">=18" @@ -6029,6 +6373,13 @@ "node": ">= 0.4" } }, + "node_modules/es-module-lexer": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz", + "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==", + "dev": true, + "license": "MIT" + }, "node_modules/es-object-atoms": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", @@ -6057,10 +6408,20 @@ "node": ">= 0.4" } }, + "node_modules/es-toolkit": { + "version": "1.44.0", + "resolved": "https://registry.npmjs.org/es-toolkit/-/es-toolkit-1.44.0.tgz", + "integrity": "sha512-6penXeZalaV88MM3cGkFZZfOoLGWshWWfdy0tWw/RlVVyhvMaWSBTOvXNeiW3e5FwdS5ePW0LGEu17zT139ktg==", + "license": "MIT", + "workspaces": [ + "docs", + "benchmarks" + ] + }, "node_modules/esbuild": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz", - "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.2.tgz", + "integrity": "sha512-HyNQImnsOC7X9PMNaCIeAm4ISCQXs5a5YasTXVliKv4uuBo1dKrG0A+uQS8M5eXjVMnLg3WgXaKvprHlFJQffw==", "dev": true, "hasInstallScript": true, "license": "MIT", @@ -6071,32 +6432,32 @@ "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.25.12", - "@esbuild/android-arm": "0.25.12", - "@esbuild/android-arm64": "0.25.12", - "@esbuild/android-x64": "0.25.12", - "@esbuild/darwin-arm64": "0.25.12", - "@esbuild/darwin-x64": "0.25.12", - "@esbuild/freebsd-arm64": "0.25.12", - "@esbuild/freebsd-x64": "0.25.12", - "@esbuild/linux-arm": "0.25.12", - "@esbuild/linux-arm64": "0.25.12", - "@esbuild/linux-ia32": "0.25.12", - "@esbuild/linux-loong64": "0.25.12", - "@esbuild/linux-mips64el": "0.25.12", - "@esbuild/linux-ppc64": "0.25.12", - "@esbuild/linux-riscv64": "0.25.12", - "@esbuild/linux-s390x": "0.25.12", - "@esbuild/linux-x64": "0.25.12", - "@esbuild/netbsd-arm64": "0.25.12", - "@esbuild/netbsd-x64": "0.25.12", - "@esbuild/openbsd-arm64": "0.25.12", - "@esbuild/openbsd-x64": "0.25.12", - "@esbuild/openharmony-arm64": "0.25.12", - "@esbuild/sunos-x64": "0.25.12", - "@esbuild/win32-arm64": "0.25.12", - "@esbuild/win32-ia32": "0.25.12", - "@esbuild/win32-x64": "0.25.12" + "@esbuild/aix-ppc64": "0.27.2", + "@esbuild/android-arm": "0.27.2", + "@esbuild/android-arm64": "0.27.2", + "@esbuild/android-x64": "0.27.2", + "@esbuild/darwin-arm64": "0.27.2", + "@esbuild/darwin-x64": "0.27.2", + "@esbuild/freebsd-arm64": "0.27.2", + "@esbuild/freebsd-x64": "0.27.2", + "@esbuild/linux-arm": "0.27.2", + "@esbuild/linux-arm64": "0.27.2", + "@esbuild/linux-ia32": "0.27.2", + "@esbuild/linux-loong64": "0.27.2", + "@esbuild/linux-mips64el": "0.27.2", + "@esbuild/linux-ppc64": "0.27.2", + "@esbuild/linux-riscv64": "0.27.2", + "@esbuild/linux-s390x": "0.27.2", + "@esbuild/linux-x64": "0.27.2", + "@esbuild/netbsd-arm64": "0.27.2", + "@esbuild/netbsd-x64": "0.27.2", + "@esbuild/openbsd-arm64": "0.27.2", + "@esbuild/openbsd-x64": "0.27.2", + "@esbuild/openharmony-arm64": "0.27.2", + "@esbuild/sunos-x64": "0.27.2", + "@esbuild/win32-arm64": "0.27.2", + "@esbuild/win32-ia32": "0.27.2", + "@esbuild/win32-x64": "0.27.2" } }, "node_modules/escalade": { @@ -6223,9 +6584,9 @@ } }, "node_modules/eslint-plugin-react-refresh": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.24.tgz", - "integrity": "sha512-nLHIW7TEq3aLrEYWpVaJ1dRgFR+wLDPN8e8FpYAql/bMV2oBEfC37K0gLEGgv9fy66juNShSMV8OkTqzltcG/w==", + "version": "0.4.26", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.26.tgz", + "integrity": "sha512-1RETEylht2O6FM/MvgnyvT+8K21wLqDNg4qD51Zj3guhjt433XbnnkVttHMyaVyAFD03QSV4LPS5iE3VQmO7XQ==", "dev": true, "license": "MIT", "peerDependencies": { @@ -6262,6 +6623,23 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint/node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, "node_modules/espree": { "version": "10.4.0", "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz", @@ -6295,9 +6673,9 @@ } }, "node_modules/esquery": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", - "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz", + "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==", "dev": true, "license": "BSD-3-Clause", "dependencies": { @@ -6330,6 +6708,16 @@ "node": ">=4.0" } }, + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, "node_modules/esutils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", @@ -6350,9 +6738,9 @@ } }, "node_modules/eventemitter3": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", - "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz", + "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==", "dev": true, "license": "MIT" }, @@ -6427,6 +6815,16 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/expect-type": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.3.0.tgz", + "integrity": "sha512-knvyeauYhqjOYvQ66MznSMs83wmHrCycNEN6Ao+2AeYEfxUIkuiVxdEa1qlGEPK+We3n0THiDciYSsCcgW/DoA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/express": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz", @@ -6551,9 +6949,9 @@ "license": "BSD-3-Clause" }, "node_modules/fastq": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", - "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz", + "integrity": "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==", "dev": true, "license": "ISC", "dependencies": { @@ -6593,6 +6991,34 @@ "node": "^12.20 || >= 14.13" } }, + "node_modules/figures": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-5.0.0.tgz", + "integrity": "sha512-ej8ksPF4x6e5wvK9yevct0UCXh8TTFlWGVLlgjZuoBH1HwjIfKE/IdL5mq89sFA7zELi1VhKpmtDnrs7zWyeyg==", + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^5.0.0", + "is-unicode-supported": "^1.2.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/figures/node_modules/escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/file-entry-cache": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", @@ -6784,6 +7210,16 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, + "node_modules/fullscreen-ink": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/fullscreen-ink/-/fullscreen-ink-0.1.0.tgz", + "integrity": "sha512-GkyPG5Y8YxRT6i1Q8mZ0BCMSpgQjdBY+C39DnCUMswBpSypTk0G80rAYs6FoEp6Da2gzAwygXbJbju6GahbrFQ==", + "license": "MIT", + "dependencies": { + "ink": ">=4.4.1", + "react": ">=18.2.0" + } + }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", @@ -6816,7 +7252,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.4.0.tgz", "integrity": "sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q==", - "dev": true, "license": "MIT", "engines": { "node": ">=18" @@ -7046,9 +7481,9 @@ } }, "node_modules/hono": { - "version": "4.11.3", - "resolved": "https://registry.npmjs.org/hono/-/hono-4.11.3.tgz", - "integrity": "sha512-PmQi306+M/ct/m5s66Hrg+adPnkD5jiO6IjA7WhWw0gSBSo1EcRegwuI1deZ+wd5pzCGynCcn2DprnE4/yEV4w==", + "version": "4.11.4", + "resolved": "https://registry.npmjs.org/hono/-/hono-4.11.4.tgz", + "integrity": "sha512-U7tt8JsyrxSRKspfhtLET79pU8K+tInj5QZXs1jSugO1Vq5dFj3kmZsRldo29mTBfcjDRVRXrEZ6LS63Cog9ZA==", "license": "MIT", "peer": true, "engines": { @@ -7151,9 +7586,9 @@ } }, "node_modules/iconv-lite": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.1.tgz", - "integrity": "sha512-2Tth85cXwGFHfvRgZWszZSvdo+0Xsqmw8k8ZwxScfcBneNUraK+dxRxRm24nszx80Y0TVio8kKLt5sLE7ZCLlw==", + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz", + "integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==", "license": "MIT", "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" @@ -7251,9 +7686,150 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "license": "ISC" }, - "node_modules/ipaddr.js": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "node_modules/ink": { + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/ink/-/ink-6.6.0.tgz", + "integrity": "sha512-QDt6FgJxgmSxAelcOvOHUvFxbIUjVpCH5bx+Slvc5m7IEcpGt3dYwbz/L+oRnqEGeRvwy1tineKK4ect3nW1vQ==", + "license": "MIT", + "dependencies": { + "@alcalzone/ansi-tokenize": "^0.2.1", + "ansi-escapes": "^7.2.0", + "ansi-styles": "^6.2.1", + "auto-bind": "^5.0.1", + "chalk": "^5.6.0", + "cli-boxes": "^3.0.0", + "cli-cursor": "^4.0.0", + "cli-truncate": "^5.1.1", + "code-excerpt": "^4.0.0", + "es-toolkit": "^1.39.10", + "indent-string": "^5.0.0", + "is-in-ci": "^2.0.0", + "patch-console": "^2.0.0", + "react-reconciler": "^0.33.0", + "signal-exit": "^3.0.7", + "slice-ansi": "^7.1.0", + "stack-utils": "^2.0.6", + "string-width": "^8.1.0", + "type-fest": "^4.27.0", + "widest-line": "^5.0.0", + "wrap-ansi": "^9.0.0", + "ws": "^8.18.0", + "yoga-layout": "~3.2.1" + }, + "engines": { + "node": ">=20" + }, + "peerDependencies": { + "@types/react": ">=19.0.0", + "react": ">=19.0.0", + "react-devtools-core": "^6.1.2" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "react-devtools-core": { + "optional": true + } + } + }, + "node_modules/ink/node_modules/ansi-escapes": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-7.2.0.tgz", + "integrity": "sha512-g6LhBsl+GBPRWGWsBtutpzBYuIIdBkLEvad5C/va/74Db018+5TZiyA26cZJAr3Rft5lprVqOIPxf5Vid6tqAw==", + "license": "MIT", + "dependencies": { + "environment": "^1.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ink/node_modules/ansi-styles": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/ink/node_modules/chalk": { + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz", + "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==", + "license": "MIT", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/ink/node_modules/cli-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-4.0.0.tgz", + "integrity": "sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==", + "license": "MIT", + "dependencies": { + "restore-cursor": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ink/node_modules/indent-string": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", + "integrity": "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ink/node_modules/restore-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz", + "integrity": "sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==", + "license": "MIT", + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ink/node_modules/type-fest": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz", + "integrity": "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", "license": "MIT", "engines": { @@ -7325,7 +7901,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-5.1.0.tgz", "integrity": "sha512-5XHYaSyiqADb4RnZ1Bdad6cPp8Toise4TzEjcOYDHZkTCbKgiUl7WTUCpNWHuxmDt91wnsZBc9xinNzopv3JMQ==", - "dev": true, "license": "MIT", "dependencies": { "get-east-asian-width": "^1.3.1" @@ -7360,6 +7935,21 @@ "node": ">=0.10.0" } }, + "node_modules/is-in-ci": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-in-ci/-/is-in-ci-2.0.0.tgz", + "integrity": "sha512-cFeerHriAnhrQSbpAxL37W1wcJKUUX07HyLWZCW1URJT/ra3GyUTzBgUnh24TMVfNTV2Hij2HLxkPHFZfOZy5w==", + "license": "MIT", + "bin": { + "is-in-ci": "cli.js" + }, + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-inside-container": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", @@ -7414,6 +8004,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-unicode-supported": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz", + "integrity": "sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-wsl": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz", @@ -7490,6 +8092,19 @@ "node": ">=10" } }, + "node_modules/istanbul-lib-report/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/istanbul-lib-source-maps": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", @@ -7956,9 +8571,9 @@ } }, "node_modules/jest-environment-jsdom/node_modules/@sinclair/typebox": { - "version": "0.34.41", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.34.41.tgz", - "integrity": "sha512-6gS8pZzSXdyRHTIqoqSVknxolr1kzfy4/CeDnrzsVz8TTIWUbOBr6gnzOmTYJ3eXQNh4IYHIGi5aIL7sOZ2G/g==", + "version": "0.34.47", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.34.47.tgz", + "integrity": "sha512-ZGIBQ+XDvO5JQku9wmwtabcVTHJsgSWAHYtVuM9pBNNR5E88v6Jcj/llpmsjivig5X8A8HHOb4/mbEKPS5EvAw==", "dev": true, "license": "MIT", "peer": true @@ -7974,30 +8589,6 @@ "@sinonjs/commons": "^3.0.1" } }, - "node_modules/jest-environment-jsdom/node_modules/@types/jsdom": { - "version": "21.1.7", - "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-21.1.7.tgz", - "integrity": "sha512-yOriVnggzrnQ3a9OKOCxaVuSug3w3/SbOj5i7VwXWZEyUNl3bLF9V3MfxGbZKuwqJOQyRfqXyROBB1CoZLFWzA==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "@types/node": "*", - "@types/tough-cookie": "*", - "parse5": "^7.0.0" - } - }, - "node_modules/jest-environment-jsdom/node_modules/agent-base": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", - "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", - "dev": true, - "license": "MIT", - "peer": true, - "engines": { - "node": ">= 14" - } - }, "node_modules/jest-environment-jsdom/node_modules/ansi-styles": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", @@ -8029,94 +8620,6 @@ "node": ">=8" } }, - "node_modules/jest-environment-jsdom/node_modules/cssstyle": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-4.6.0.tgz", - "integrity": "sha512-2z+rWdzbbSZv6/rhtvzvqeZQHrBaqgogqt85sqFNbabZOuFbCVFb8kPeEtZjiKkbrm395irpNKiYeFeLiQnFPg==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "@asamuzakjp/css-color": "^3.2.0", - "rrweb-cssom": "^0.8.0" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/jest-environment-jsdom/node_modules/data-urls": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-5.0.0.tgz", - "integrity": "sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "whatwg-mimetype": "^4.0.0", - "whatwg-url": "^14.0.0" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/jest-environment-jsdom/node_modules/html-encoding-sniffer": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz", - "integrity": "sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "whatwg-encoding": "^3.1.1" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/jest-environment-jsdom/node_modules/http-proxy-agent": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", - "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "agent-base": "^7.1.0", - "debug": "^4.3.4" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/jest-environment-jsdom/node_modules/https-proxy-agent": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", - "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "agent-base": "^7.1.2", - "debug": "4" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/jest-environment-jsdom/node_modules/iconv-lite": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", - "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/jest-environment-jsdom/node_modules/jest-message-util": { "version": "30.2.0", "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-30.2.0.tgz", @@ -8174,65 +8677,24 @@ "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, - "node_modules/jest-environment-jsdom/node_modules/jsdom": { - "version": "26.1.0", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-26.1.0.tgz", - "integrity": "sha512-Cvc9WUhxSMEo4McES3P7oK3QaXldCfNWp7pl2NNeiIFlCoLr3kfq9kb1fxftiwk1FLV7CvpvDfonxtzUDeSOPg==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "cssstyle": "^4.2.1", - "data-urls": "^5.0.0", - "decimal.js": "^10.5.0", - "html-encoding-sniffer": "^4.0.0", - "http-proxy-agent": "^7.0.2", - "https-proxy-agent": "^7.0.6", - "is-potential-custom-element-name": "^1.0.1", - "nwsapi": "^2.2.16", - "parse5": "^7.2.1", - "rrweb-cssom": "^0.8.0", - "saxes": "^6.0.0", - "symbol-tree": "^3.2.4", - "tough-cookie": "^5.1.1", - "w3c-xmlserializer": "^5.0.0", - "webidl-conversions": "^7.0.0", - "whatwg-encoding": "^3.1.1", - "whatwg-mimetype": "^4.0.0", - "whatwg-url": "^14.1.1", - "ws": "^8.18.0", - "xml-name-validator": "^5.0.0" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "canvas": "^3.0.0" - }, - "peerDependenciesMeta": { - "canvas": { - "optional": true - } - } - }, - "node_modules/jest-environment-jsdom/node_modules/picomatch": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", - "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", - "dev": true, - "license": "MIT", - "peer": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/jest-environment-jsdom/node_modules/pretty-format": { - "version": "30.2.0", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-30.2.0.tgz", - "integrity": "sha512-9uBdv/B4EefsuAL+pWqueZyZS2Ba+LxfFeQ9DN14HU4bN8bhaxKdkpjpB6fs9+pSjIBu+FXQHImEg8j/Lw0+vA==", + "node_modules/jest-environment-jsdom/node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/jest-environment-jsdom/node_modules/pretty-format": { + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-30.2.0.tgz", + "integrity": "sha512-9uBdv/B4EefsuAL+pWqueZyZS2Ba+LxfFeQ9DN14HU4bN8bhaxKdkpjpB6fs9+pSjIBu+FXQHImEg8j/Lw0+vA==", "dev": true, "license": "MIT", "peer": true, @@ -8253,99 +8715,6 @@ "license": "MIT", "peer": true }, - "node_modules/jest-environment-jsdom/node_modules/tough-cookie": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-5.1.2.tgz", - "integrity": "sha512-FVDYdxtnj0G6Qm/DhNPSb8Ju59ULcup3tuJxkFb5K8Bv2pUXILbf0xZWU8PX8Ov19OXljbUyveOFwRMwkXzO+A==", - "dev": true, - "license": "BSD-3-Clause", - "peer": true, - "dependencies": { - "tldts": "^6.1.32" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/jest-environment-jsdom/node_modules/tr46": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.1.1.tgz", - "integrity": "sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "punycode": "^2.3.1" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/jest-environment-jsdom/node_modules/w3c-xmlserializer": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", - "integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "xml-name-validator": "^5.0.0" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/jest-environment-jsdom/node_modules/whatwg-encoding": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", - "integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "iconv-lite": "0.6.3" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/jest-environment-jsdom/node_modules/whatwg-mimetype": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz", - "integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==", - "dev": true, - "license": "MIT", - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/jest-environment-jsdom/node_modules/whatwg-url": { - "version": "14.2.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.2.0.tgz", - "integrity": "sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "tr46": "^5.1.0", - "webidl-conversions": "^7.0.0" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/jest-environment-jsdom/node_modules/xml-name-validator": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", - "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", - "dev": true, - "license": "Apache-2.0", - "peer": true, - "engines": { - "node": ">=18" - } - }, "node_modules/jest-environment-node": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.7.0.tgz", @@ -8914,22 +9283,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-worker/node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" - } - }, "node_modules/jiti": { "version": "1.21.7", "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.7.tgz", @@ -8953,6 +9306,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true, "license": "MIT" }, "node_modules/js-yaml": { @@ -8969,44 +9323,39 @@ } }, "node_modules/jsdom": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-20.0.3.tgz", - "integrity": "sha512-SYhBvTh89tTfCD/CRdSOm13mOBa42iTaTyfyEWBdKcGdPxPtLFBXuHR8XHb33YNYaP+lLbmSvBTsnoesCNJEsQ==", + "version": "26.1.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-26.1.0.tgz", + "integrity": "sha512-Cvc9WUhxSMEo4McES3P7oK3QaXldCfNWp7pl2NNeiIFlCoLr3kfq9kb1fxftiwk1FLV7CvpvDfonxtzUDeSOPg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { - "abab": "^2.0.6", - "acorn": "^8.8.1", - "acorn-globals": "^7.0.0", - "cssom": "^0.5.0", - "cssstyle": "^2.3.0", - "data-urls": "^3.0.2", - "decimal.js": "^10.4.2", - "domexception": "^4.0.0", - "escodegen": "^2.0.0", - "form-data": "^4.0.0", - "html-encoding-sniffer": "^3.0.0", - "http-proxy-agent": "^5.0.0", - "https-proxy-agent": "^5.0.1", + "cssstyle": "^4.2.1", + "data-urls": "^5.0.0", + "decimal.js": "^10.5.0", + "html-encoding-sniffer": "^4.0.0", + "http-proxy-agent": "^7.0.2", + "https-proxy-agent": "^7.0.6", "is-potential-custom-element-name": "^1.0.1", - "nwsapi": "^2.2.2", - "parse5": "^7.1.1", + "nwsapi": "^2.2.16", + "parse5": "^7.2.1", + "rrweb-cssom": "^0.8.0", "saxes": "^6.0.0", "symbol-tree": "^3.2.4", - "tough-cookie": "^4.1.2", - "w3c-xmlserializer": "^4.0.0", + "tough-cookie": "^5.1.1", + "w3c-xmlserializer": "^5.0.0", "webidl-conversions": "^7.0.0", - "whatwg-encoding": "^2.0.0", - "whatwg-mimetype": "^3.0.0", - "whatwg-url": "^11.0.0", - "ws": "^8.11.0", - "xml-name-validator": "^4.0.0" + "whatwg-encoding": "^3.1.1", + "whatwg-mimetype": "^4.0.0", + "whatwg-url": "^14.1.1", + "ws": "^8.18.0", + "xml-name-validator": "^5.0.0" }, "engines": { - "node": ">=14" + "node": ">=18" }, "peerDependencies": { - "canvas": "^2.5.0" + "canvas": "^3.0.0" }, "peerDependenciesMeta": { "canvas": { @@ -9014,38 +9363,231 @@ } } }, - "node_modules/jsesc": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", - "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "node_modules/jsdom/node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", "dev": true, "license": "MIT", - "bin": { - "jsesc": "bin/jsesc" - }, + "peer": true, "engines": { - "node": ">=6" + "node": ">= 14" } }, - "node_modules/json-buffer": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", - "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "node_modules/jsdom/node_modules/cssstyle": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-4.6.0.tgz", + "integrity": "sha512-2z+rWdzbbSZv6/rhtvzvqeZQHrBaqgogqt85sqFNbabZOuFbCVFb8kPeEtZjiKkbrm395irpNKiYeFeLiQnFPg==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true, + "dependencies": { + "@asamuzakjp/css-color": "^3.2.0", + "rrweb-cssom": "^0.8.0" + }, + "engines": { + "node": ">=18" + } }, - "node_modules/json-parse-even-better-errors": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "node_modules/jsdom/node_modules/data-urls": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-5.0.0.tgz", + "integrity": "sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true, + "dependencies": { + "whatwg-mimetype": "^4.0.0", + "whatwg-url": "^14.0.0" + }, + "engines": { + "node": ">=18" + } }, - "node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "license": "MIT" + "node_modules/jsdom/node_modules/html-encoding-sniffer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz", + "integrity": "sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "whatwg-encoding": "^3.1.1" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/jsdom/node_modules/http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/jsdom/node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/jsdom/node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/jsdom/node_modules/tough-cookie": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-5.1.2.tgz", + "integrity": "sha512-FVDYdxtnj0G6Qm/DhNPSb8Ju59ULcup3tuJxkFb5K8Bv2pUXILbf0xZWU8PX8Ov19OXljbUyveOFwRMwkXzO+A==", + "dev": true, + "license": "BSD-3-Clause", + "peer": true, + "dependencies": { + "tldts": "^6.1.32" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/jsdom/node_modules/tr46": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.1.1.tgz", + "integrity": "sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "punycode": "^2.3.1" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/jsdom/node_modules/w3c-xmlserializer": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", + "integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/jsdom/node_modules/whatwg-encoding": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", + "integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==", + "deprecated": "Use @exodus/bytes instead for a more spec-conformant and faster implementation", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "iconv-lite": "0.6.3" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/jsdom/node_modules/whatwg-mimetype": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz", + "integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/jsdom/node_modules/whatwg-url": { + "version": "14.2.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.2.0.tgz", + "integrity": "sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "tr46": "^5.1.0", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/jsdom/node_modules/xml-name-validator": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", + "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", + "dev": true, + "license": "Apache-2.0", + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "dev": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "license": "MIT" }, "node_modules/json-schema-typed": { "version": "8.0.2", @@ -9196,6 +9738,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/lodash.isequal": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", + "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==", + "deprecated": "This package is deprecated. Use require('node:util').isDeepStrictEqual instead.", + "license": "MIT" + }, "node_modules/lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", @@ -9275,18 +9824,6 @@ "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, - "node_modules/loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "license": "MIT", - "dependencies": { - "js-tokens": "^3.0.0 || ^4.0.0" - }, - "bin": { - "loose-envify": "cli.js" - } - }, "node_modules/lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", @@ -9317,6 +9854,16 @@ "lz-string": "bin/bin.js" } }, + "node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, "node_modules/make-dir": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", @@ -9452,7 +9999,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -9648,16 +10194,6 @@ "node": ">=0.10.0" } }, - "node_modules/normalize-range": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz", - "integrity": "sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/npm-run-path": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", @@ -9709,6 +10245,17 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/obug": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.1.tgz", + "integrity": "sha512-uTqF9MuPraAQ+IsnPf366RG4cP9RtUi7MLO1N3KEc+wb0a6yKpeL0lmk2IB1jY5KHPAlTc6T/JRdC/YqxHNwkQ==", + "dev": true, + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT" + }, "node_modules/on-finished": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", @@ -9734,7 +10281,6 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, "license": "MIT", "dependencies": { "mimic-fn": "^2.1.0" @@ -9885,6 +10431,15 @@ "node": ">= 0.8" } }, + "node_modules/patch-console": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/patch-console/-/patch-console-2.0.0.tgz", + "integrity": "sha512-0YNdUceMdaQwoKce1gatDScmMo5pu/tfABfnzEqeG0gtTmd7mh/WcwgUjtAeOU7N8nFFlbQBnFK2gXW5fGvmMA==", + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -9964,6 +10519,13 @@ "url": "https://opencollective.com/express" } }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -10018,9 +10580,9 @@ } }, "node_modules/pkce-challenge": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-4.1.0.tgz", - "integrity": "sha512-ZBmhE1C9LcPoH9XZSdwiPtbPHZROwAnMy+kIFQVrnMCxY4Cudlz3gBOpzilgc0jOgRaiT3sIWfpMomW2ar2orQ==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-5.0.1.tgz", + "integrity": "sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ==", "license": "MIT", "engines": { "node": ">=16.20.0" @@ -10316,9 +10878,9 @@ } }, "node_modules/prettier": { - "version": "3.7.4", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.7.4.tgz", - "integrity": "sha512-v6UNi1+3hSlVvv8fSaoUbggEM5VErKmmpGA7Pl3HF8V6uKY7rvClBOJlH6yNwQtfTueNkGVpOv/mtWL9L4bgRA==", + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.0.tgz", + "integrity": "sha512-yEPsovQfpxYfgWNhCfECjG5AQaO+K3dp6XERmOepyPDVqcJm+bjyCVO3pmU+nAPe0N5dDvekfGezt/EIiRe1TA==", "dev": true, "license": "MIT", "bin": { @@ -10504,28 +11066,24 @@ } }, "node_modules/react": { - "version": "18.3.1", - "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", - "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", + "version": "19.2.3", + "resolved": "https://registry.npmjs.org/react/-/react-19.2.3.tgz", + "integrity": "sha512-Ku/hhYbVjOQnXDZFv2+RibmLFGwFdeeKHFcOTlrt7xplBnya5OGn/hIRDsqDiSUcfORsDC7MPxwork8jBwsIWA==", "license": "MIT", - "dependencies": { - "loose-envify": "^1.1.0" - }, "engines": { "node": ">=0.10.0" } }, "node_modules/react-dom": { - "version": "18.3.1", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", - "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", + "version": "19.2.3", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.3.tgz", + "integrity": "sha512-yELu4WmLPw5Mr/lmeEpox5rw3RETacE++JgHqQzd2dg+YbJuat3jH4ingc+WPZhxaoFzdv9y33G+F7Nl5O0GBg==", "license": "MIT", "dependencies": { - "loose-envify": "^1.1.0", - "scheduler": "^0.23.2" + "scheduler": "^0.27.0" }, "peerDependencies": { - "react": "^18.3.1" + "react": "^19.2.3" } }, "node_modules/react-is": { @@ -10536,6 +11094,21 @@ "license": "MIT", "peer": true }, + "node_modules/react-reconciler": { + "version": "0.33.0", + "resolved": "https://registry.npmjs.org/react-reconciler/-/react-reconciler-0.33.0.tgz", + "integrity": "sha512-KetWRytFv1epdpJc3J4G75I4WrplZE5jOL7Yq0p34+OVOKF4Se7WrdIdVC45XsSSmUTlht2FM/fM1FZb1mfQeA==", + "license": "MIT", + "dependencies": { + "scheduler": "^0.27.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "peerDependencies": { + "react": "^19.2.0" + } + }, "node_modules/react-refresh": { "version": "0.18.0", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.18.0.tgz", @@ -10880,9 +11453,9 @@ } }, "node_modules/rollup": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.53.3.tgz", - "integrity": "sha512-w8GmOxZfBmKknvdXU1sdM9NHcoQejwF/4mNgj2JuEEdRaHwwF12K7e9eXn1nLZ07ad+du76mkVsyeb2rKGllsA==", + "version": "4.55.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.55.2.tgz", + "integrity": "sha512-PggGy4dhwx5qaW+CKBilA/98Ql9keyfnb7lh4SR6shQ91QQQi1ORJ1v4UinkdP2i87OBs9AQFooQylcrrRfIcg==", "dev": true, "license": "MIT", "dependencies": { @@ -10896,28 +11469,31 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.53.3", - "@rollup/rollup-android-arm64": "4.53.3", - "@rollup/rollup-darwin-arm64": "4.53.3", - "@rollup/rollup-darwin-x64": "4.53.3", - "@rollup/rollup-freebsd-arm64": "4.53.3", - "@rollup/rollup-freebsd-x64": "4.53.3", - "@rollup/rollup-linux-arm-gnueabihf": "4.53.3", - "@rollup/rollup-linux-arm-musleabihf": "4.53.3", - "@rollup/rollup-linux-arm64-gnu": "4.53.3", - "@rollup/rollup-linux-arm64-musl": "4.53.3", - "@rollup/rollup-linux-loong64-gnu": "4.53.3", - "@rollup/rollup-linux-ppc64-gnu": "4.53.3", - "@rollup/rollup-linux-riscv64-gnu": "4.53.3", - "@rollup/rollup-linux-riscv64-musl": "4.53.3", - "@rollup/rollup-linux-s390x-gnu": "4.53.3", - "@rollup/rollup-linux-x64-gnu": "4.53.3", - "@rollup/rollup-linux-x64-musl": "4.53.3", - "@rollup/rollup-openharmony-arm64": "4.53.3", - "@rollup/rollup-win32-arm64-msvc": "4.53.3", - "@rollup/rollup-win32-ia32-msvc": "4.53.3", - "@rollup/rollup-win32-x64-gnu": "4.53.3", - "@rollup/rollup-win32-x64-msvc": "4.53.3", + "@rollup/rollup-android-arm-eabi": "4.55.2", + "@rollup/rollup-android-arm64": "4.55.2", + "@rollup/rollup-darwin-arm64": "4.55.2", + "@rollup/rollup-darwin-x64": "4.55.2", + "@rollup/rollup-freebsd-arm64": "4.55.2", + "@rollup/rollup-freebsd-x64": "4.55.2", + "@rollup/rollup-linux-arm-gnueabihf": "4.55.2", + "@rollup/rollup-linux-arm-musleabihf": "4.55.2", + "@rollup/rollup-linux-arm64-gnu": "4.55.2", + "@rollup/rollup-linux-arm64-musl": "4.55.2", + "@rollup/rollup-linux-loong64-gnu": "4.55.2", + "@rollup/rollup-linux-loong64-musl": "4.55.2", + "@rollup/rollup-linux-ppc64-gnu": "4.55.2", + "@rollup/rollup-linux-ppc64-musl": "4.55.2", + "@rollup/rollup-linux-riscv64-gnu": "4.55.2", + "@rollup/rollup-linux-riscv64-musl": "4.55.2", + "@rollup/rollup-linux-s390x-gnu": "4.55.2", + "@rollup/rollup-linux-x64-gnu": "4.55.2", + "@rollup/rollup-linux-x64-musl": "4.55.2", + "@rollup/rollup-openbsd-x64": "4.55.2", + "@rollup/rollup-openharmony-arm64": "4.55.2", + "@rollup/rollup-win32-arm64-msvc": "4.55.2", + "@rollup/rollup-win32-ia32-msvc": "4.55.2", + "@rollup/rollup-win32-x64-gnu": "4.55.2", + "@rollup/rollup-win32-x64-msvc": "4.55.2", "fsevents": "~2.3.2" } }, @@ -11010,13 +11586,10 @@ } }, "node_modules/scheduler": { - "version": "0.23.2", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", - "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", - "license": "MIT", - "dependencies": { - "loose-envify": "^1.1.0" - } + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", + "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==", + "license": "MIT" }, "node_modules/semver": { "version": "6.3.1", @@ -11029,25 +11602,29 @@ } }, "node_modules/send": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/send/-/send-1.2.0.tgz", - "integrity": "sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz", + "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==", "license": "MIT", "dependencies": { - "debug": "^4.3.5", + "debug": "^4.4.3", "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "etag": "^1.8.1", "fresh": "^2.0.0", - "http-errors": "^2.0.0", - "mime-types": "^3.0.1", + "http-errors": "^2.0.1", + "mime-types": "^3.0.2", "ms": "^2.1.3", "on-finished": "^2.4.1", "range-parser": "^1.2.1", - "statuses": "^2.0.1" + "statuses": "^2.0.2" }, "engines": { "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/serve-handler": { @@ -11120,9 +11697,9 @@ } }, "node_modules/serve-static": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.0.tgz", - "integrity": "sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz", + "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==", "license": "MIT", "dependencies": { "encodeurl": "^2.0.0", @@ -11132,6 +11709,10 @@ }, "engines": { "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/setprototypeof": { @@ -11245,11 +11826,17 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true, + "license": "ISC" + }, "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true, "license": "ISC" }, "node_modules/sisteransi": { @@ -11273,7 +11860,6 @@ "version": "7.1.2", "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-7.1.2.tgz", "integrity": "sha512-iOBWFgUX7caIZiuutICxVgX1SdxwAVFFKwt1EvMYYec/NWO5meOJ6K5uQxhrYBdQJne4KxiqZc+KptFOWFSI9w==", - "dev": true, "license": "MIT", "dependencies": { "ansi-styles": "^6.2.1", @@ -11290,7 +11876,6 @@ "version": "6.2.3", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", - "dev": true, "license": "MIT", "engines": { "node": ">=12" @@ -11351,7 +11936,6 @@ "version": "2.0.6", "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", - "dev": true, "license": "MIT", "dependencies": { "escape-string-regexp": "^2.0.0" @@ -11364,12 +11948,18 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", - "dev": true, "license": "MIT", "engines": { "node": ">=8" } }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true, + "license": "MIT" + }, "node_modules/statuses": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", @@ -11379,6 +11969,13 @@ "node": ">= 0.8" } }, + "node_modules/std-env": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.10.0.tgz", + "integrity": "sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==", + "dev": true, + "license": "MIT" + }, "node_modules/string-argv": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz", @@ -11407,7 +12004,6 @@ "version": "8.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-8.1.0.tgz", "integrity": "sha512-Kxl3KJGb/gxkaUMOjRsQ8IrXiGW75O4E3RPjFIINOVH8AMl2SQ/yWdTzWwF3FevIX9LcMAjJW+GRwAlAbTSXdg==", - "dev": true, "license": "MIT", "dependencies": { "get-east-asian-width": "^1.3.0", @@ -11424,7 +12020,6 @@ "version": "6.2.2", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", - "dev": true, "license": "MIT", "engines": { "node": ">=12" @@ -11437,7 +12032,6 @@ "version": "7.1.2", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", - "dev": true, "license": "MIT", "dependencies": { "ansi-regex": "^6.0.1" @@ -11541,15 +12135,18 @@ } }, "node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, "engines": { - "node": ">=8" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" } }, "node_modules/supports-preserve-symlinks-flag": { @@ -11668,6 +12265,23 @@ "node": ">=0.8" } }, + "node_modules/tinybench": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", + "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyexec": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.0.2.tgz", + "integrity": "sha512-W/KYk+NFhkmsYpuHq5JykngiOCnxeVL8v8dFnqxSD8qEEdRfXk1SDM6JzNqcERbcGYj9tMrDQBYV9cjgnunFIg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/tinyglobby": { "version": "0.2.15", "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", @@ -11716,6 +12330,16 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/tinyrainbow": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.0.3.tgz", + "integrity": "sha512-PSkbLUoxOFRzJYjjxHJt9xro7D+iilgMX/C9lawzVuYiIdcihh9DXmVibBe8lmcFrRi/VzlPjBxbN7rH24q8/Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/tldts": { "version": "6.1.86", "resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.86.tgz", @@ -11806,9 +12430,9 @@ } }, "node_modules/ts-api-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz", - "integrity": "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.4.0.tgz", + "integrity": "sha512-3TaVTaAv2gTiMB35i3FiGJaRfwb3Pyn/j3m/bfAvGe8FB7CF6u+LMYqYlDh7reQf7UNvoTvdfAqHGmPGOSsPmA==", "dev": true, "license": "MIT", "engines": { @@ -11935,532 +12559,48 @@ "peerDependencies": { "@swc/core": ">=1.2.50", "@swc/wasm": ">=1.2.50", - "@types/node": "*", - "typescript": ">=2.7" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "@swc/wasm": { - "optional": true - } - } - }, - "node_modules/ts-node/node_modules/arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "license": "MIT" - }, - "node_modules/tslib": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", - "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", - "license": "0BSD" - }, - "node_modules/tsx": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.21.0.tgz", - "integrity": "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==", - "dev": true, - "license": "MIT", - "dependencies": { - "esbuild": "~0.27.0", - "get-tsconfig": "^4.7.5" - }, - "bin": { - "tsx": "dist/cli.mjs" - }, - "engines": { - "node": ">=18.0.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.3" - } - }, - "node_modules/tsx/node_modules/@esbuild/aix-ppc64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.1.tgz", - "integrity": "sha512-HHB50pdsBX6k47S4u5g/CaLjqS3qwaOVE5ILsq64jyzgMhLuCuZ8rGzM9yhsAjfjkbgUPMzZEPa7DAp7yz6vuA==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/android-arm": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.1.tgz", - "integrity": "sha512-kFqa6/UcaTbGm/NncN9kzVOODjhZW8e+FRdSeypWe6j33gzclHtwlANs26JrupOntlcWmB0u8+8HZo8s7thHvg==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/android-arm64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.1.tgz", - "integrity": "sha512-45fuKmAJpxnQWixOGCrS+ro4Uvb4Re9+UTieUY2f8AEc+t7d4AaZ6eUJ3Hva7dtrxAAWHtlEFsXFMAgNnGU9uQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/android-x64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.1.tgz", - "integrity": "sha512-LBEpOz0BsgMEeHgenf5aqmn/lLNTFXVfoWMUox8CtWWYK9X4jmQzWjoGoNb8lmAYml/tQ/Ysvm8q7szu7BoxRQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/darwin-arm64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.1.tgz", - "integrity": "sha512-veg7fL8eMSCVKL7IW4pxb54QERtedFDfY/ASrumK/SbFsXnRazxY4YykN/THYqFnFwJ0aVjiUrVG2PwcdAEqQQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/darwin-x64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.1.tgz", - "integrity": "sha512-+3ELd+nTzhfWb07Vol7EZ+5PTbJ/u74nC6iv4/lwIU99Ip5uuY6QoIf0Hn4m2HoV0qcnRivN3KSqc+FyCHjoVQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/freebsd-arm64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.1.tgz", - "integrity": "sha512-/8Rfgns4XD9XOSXlzUDepG8PX+AVWHliYlUkFI3K3GB6tqbdjYqdhcb4BKRd7C0BhZSoaCxhv8kTcBrcZWP+xg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/freebsd-x64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.1.tgz", - "integrity": "sha512-GITpD8dK9C+r+5yRT/UKVT36h/DQLOHdwGVwwoHidlnA168oD3uxA878XloXebK4Ul3gDBBIvEdL7go9gCUFzQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-arm": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.1.tgz", - "integrity": "sha512-ieMID0JRZY/ZeCrsFQ3Y3NlHNCqIhTprJfDgSB3/lv5jJZ8FX3hqPyXWhe+gvS5ARMBJ242PM+VNz/ctNj//eA==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-arm64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.1.tgz", - "integrity": "sha512-W9//kCrh/6in9rWIBdKaMtuTTzNj6jSeG/haWBADqLLa9P8O5YSRDzgD5y9QBok4AYlzS6ARHifAb75V6G670Q==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-ia32": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.1.tgz", - "integrity": "sha512-VIUV4z8GD8rtSVMfAj1aXFahsi/+tcoXXNYmXgzISL+KB381vbSTNdeZHHHIYqFyXcoEhu9n5cT+05tRv13rlw==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-loong64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.1.tgz", - "integrity": "sha512-l4rfiiJRN7sTNI//ff65zJ9z8U+k6zcCg0LALU5iEWzY+a1mVZ8iWC1k5EsNKThZ7XCQ6YWtsZ8EWYm7r1UEsg==", - "cpu": [ - "loong64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-mips64el": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.1.tgz", - "integrity": "sha512-U0bEuAOLvO/DWFdygTHWY8C067FXz+UbzKgxYhXC0fDieFa0kDIra1FAhsAARRJbvEyso8aAqvPdNxzWuStBnA==", - "cpu": [ - "mips64el" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-ppc64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.1.tgz", - "integrity": "sha512-NzdQ/Xwu6vPSf/GkdmRNsOfIeSGnh7muundsWItmBsVpMoNPVpM61qNzAVY3pZ1glzzAxLR40UyYM23eaDDbYQ==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-riscv64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.1.tgz", - "integrity": "sha512-7zlw8p3IApcsN7mFw0O1Z1PyEk6PlKMu18roImfl3iQHTnr/yAfYv6s4hXPidbDoI2Q0pW+5xeoM4eTCC0UdrQ==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-s390x": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.1.tgz", - "integrity": "sha512-cGj5wli+G+nkVQdZo3+7FDKC25Uh4ZVwOAK6A06Hsvgr8WqBBuOy/1s+PUEd/6Je+vjfm6stX0kmib5b/O2Ykw==", - "cpu": [ - "s390x" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-x64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.1.tgz", - "integrity": "sha512-z3H/HYI9MM0HTv3hQZ81f+AKb+yEoCRlUby1F80vbQ5XdzEMyY/9iNlAmhqiBKw4MJXwfgsh7ERGEOhrM1niMA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/netbsd-arm64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.1.tgz", - "integrity": "sha512-wzC24DxAvk8Em01YmVXyjl96Mr+ecTPyOuADAvjGg+fyBpGmxmcr2E5ttf7Im8D0sXZihpxzO1isus8MdjMCXQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/netbsd-x64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.1.tgz", - "integrity": "sha512-1YQ8ybGi2yIXswu6eNzJsrYIGFpnlzEWRl6iR5gMgmsrR0FcNoV1m9k9sc3PuP5rUBLshOZylc9nqSgymI+TYg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/openbsd-arm64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.1.tgz", - "integrity": "sha512-5Z+DzLCrq5wmU7RDaMDe2DVXMRm2tTDvX2KU14JJVBN2CT/qov7XVix85QoJqHltpvAOZUAc3ndU56HSMWrv8g==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/openbsd-x64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.1.tgz", - "integrity": "sha512-Q73ENzIdPF5jap4wqLtsfh8YbYSZ8Q0wnxplOlZUOyZy7B4ZKW8DXGWgTCZmF8VWD7Tciwv5F4NsRf6vYlZtqg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/openharmony-arm64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.1.tgz", - "integrity": "sha512-ajbHrGM/XiK+sXM0JzEbJAen+0E+JMQZ2l4RR4VFwvV9JEERx+oxtgkpoKv1SevhjavK2z2ReHk32pjzktWbGg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openharmony" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/sunos-x64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.1.tgz", - "integrity": "sha512-IPUW+y4VIjuDVn+OMzHc5FV4GubIwPnsz6ubkvN8cuhEqH81NovB53IUlrlBkPMEPxvNnf79MGBoz8rZ2iW8HA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/win32-arm64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.1.tgz", - "integrity": "sha512-RIVRWiljWA6CdVu8zkWcRmGP7iRRIIwvhDKem8UMBjPql2TXM5PkDVvvrzMtj1V+WFPB4K7zkIGM7VzRtFkjdg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } } }, - "node_modules/tsx/node_modules/@esbuild/win32-ia32": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.1.tgz", - "integrity": "sha512-2BR5M8CPbptC1AK5JbJT1fWrHLvejwZidKx3UMSF0ecHMa+smhi16drIrCEggkgviBwLYd5nwrFLSl5Kho96RQ==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } + "node_modules/ts-node/node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "license": "MIT" }, - "node_modules/tsx/node_modules/@esbuild/win32-x64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.1.tgz", - "integrity": "sha512-d5X6RMYv6taIymSk8JBP+nxv8DQAMY6A51GPgusqLdK9wBz5wWIXy1KjTck6HnjE9hqJzJRdk+1p/t5soSbCtw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" }, - "node_modules/tsx/node_modules/esbuild": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.1.tgz", - "integrity": "sha512-yY35KZckJJuVVPXpvjgxiCuVEJT67F6zDeVTv4rizyPrfGBUpZQsvmxnN+C371c2esD/hNMjj4tpBhuueLN7aA==", + "node_modules/tsx": { + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.21.0.tgz", + "integrity": "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==", "dev": true, - "hasInstallScript": true, "license": "MIT", + "dependencies": { + "esbuild": "~0.27.0", + "get-tsconfig": "^4.7.5" + }, "bin": { - "esbuild": "bin/esbuild" + "tsx": "dist/cli.mjs" }, "engines": { - "node": ">=18" + "node": ">=18.0.0" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.27.1", - "@esbuild/android-arm": "0.27.1", - "@esbuild/android-arm64": "0.27.1", - "@esbuild/android-x64": "0.27.1", - "@esbuild/darwin-arm64": "0.27.1", - "@esbuild/darwin-x64": "0.27.1", - "@esbuild/freebsd-arm64": "0.27.1", - "@esbuild/freebsd-x64": "0.27.1", - "@esbuild/linux-arm": "0.27.1", - "@esbuild/linux-arm64": "0.27.1", - "@esbuild/linux-ia32": "0.27.1", - "@esbuild/linux-loong64": "0.27.1", - "@esbuild/linux-mips64el": "0.27.1", - "@esbuild/linux-ppc64": "0.27.1", - "@esbuild/linux-riscv64": "0.27.1", - "@esbuild/linux-s390x": "0.27.1", - "@esbuild/linux-x64": "0.27.1", - "@esbuild/netbsd-arm64": "0.27.1", - "@esbuild/netbsd-x64": "0.27.1", - "@esbuild/openbsd-arm64": "0.27.1", - "@esbuild/openbsd-x64": "0.27.1", - "@esbuild/openharmony-arm64": "0.27.1", - "@esbuild/sunos-x64": "0.27.1", - "@esbuild/win32-arm64": "0.27.1", - "@esbuild/win32-ia32": "0.27.1", - "@esbuild/win32-x64": "0.27.1" + "fsevents": "~2.3.3" } }, "node_modules/type-check": { @@ -12527,16 +12667,16 @@ } }, "node_modules/typescript-eslint": { - "version": "8.49.0", - "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.49.0.tgz", - "integrity": "sha512-zRSVH1WXD0uXczCXw+nsdjGPUdx4dfrs5VQoHnUWmv1U3oNlAKv4FUNdLDhVUg+gYn+a5hUESqch//Rv5wVhrg==", + "version": "8.53.1", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.53.1.tgz", + "integrity": "sha512-gB+EVQfP5RDElh9ittfXlhZJdjSU4jUSTyE2+ia8CYyNvet4ElfaLlAIqDvQV9JPknKx0jQH1racTYe/4LaLSg==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/eslint-plugin": "8.49.0", - "@typescript-eslint/parser": "8.49.0", - "@typescript-eslint/typescript-estree": "8.49.0", - "@typescript-eslint/utils": "8.49.0" + "@typescript-eslint/eslint-plugin": "8.53.1", + "@typescript-eslint/parser": "8.53.1", + "@typescript-eslint/typescript-estree": "8.53.1", + "@typescript-eslint/utils": "8.53.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -12590,9 +12730,9 @@ } }, "node_modules/update-browserslist-db": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.2.tgz", - "integrity": "sha512-E85pfNzMQ9jpKkA7+TJAi4TJN+tBCuWh5rUcS/sv6cFi+1q9LYDwDI5dpUL0u/73EElyQ8d3TEaeW4sPedBqYA==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", + "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==", "dev": true, "funding": [ { @@ -12721,13 +12861,13 @@ } }, "node_modules/vite": { - "version": "7.2.7", - "resolved": "https://registry.npmjs.org/vite/-/vite-7.2.7.tgz", - "integrity": "sha512-ITcnkFeR3+fI8P1wMgItjGrR10170d8auB4EpMLPqmx6uxElH3a/hHGQabSHKdqd4FXWO1nFIp9rRn7JQ34ACQ==", + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.1.tgz", + "integrity": "sha512-w+N7Hifpc3gRjZ63vYBXA56dvvRlNWRczTdmCBBa+CotUzAPf5b7YMdMR/8CQoeYE5LX3W4wj6RYTgonm1b9DA==", "dev": true, "license": "MIT", "dependencies": { - "esbuild": "^0.25.0", + "esbuild": "^0.27.0", "fdir": "^6.5.0", "picomatch": "^4.0.3", "postcss": "^8.5.6", @@ -12826,6 +12966,97 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/vitest": { + "version": "4.0.17", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.0.17.tgz", + "integrity": "sha512-FQMeF0DJdWY0iOnbv466n/0BudNdKj1l5jYgl5JVTwjSsZSlqyXFt/9+1sEyhR6CLowbZpV7O1sCHrzBhucKKg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/expect": "4.0.17", + "@vitest/mocker": "4.0.17", + "@vitest/pretty-format": "4.0.17", + "@vitest/runner": "4.0.17", + "@vitest/snapshot": "4.0.17", + "@vitest/spy": "4.0.17", + "@vitest/utils": "4.0.17", + "es-module-lexer": "^1.7.0", + "expect-type": "^1.2.2", + "magic-string": "^0.30.21", + "obug": "^2.1.1", + "pathe": "^2.0.3", + "picomatch": "^4.0.3", + "std-env": "^3.10.0", + "tinybench": "^2.9.0", + "tinyexec": "^1.0.2", + "tinyglobby": "^0.2.15", + "tinyrainbow": "^3.0.3", + "vite": "^6.0.0 || ^7.0.0", + "why-is-node-running": "^2.3.0" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^20.0.0 || ^22.0.0 || >=24.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@opentelemetry/api": "^1.9.0", + "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0", + "@vitest/browser-playwright": "4.0.17", + "@vitest/browser-preview": "4.0.17", + "@vitest/browser-webdriverio": "4.0.17", + "@vitest/ui": "4.0.17", + "happy-dom": "*", + "jsdom": "*" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@opentelemetry/api": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser-playwright": { + "optional": true + }, + "@vitest/browser-preview": { + "optional": true + }, + "@vitest/browser-webdriverio": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + } + } + }, + "node_modules/vitest/node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/w3c-xmlserializer": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz", @@ -12872,6 +13103,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz", "integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==", + "deprecated": "Use @exodus/bytes instead for a more spec-conformant and faster implementation", "dev": true, "license": "MIT", "dependencies": { @@ -12933,6 +13165,88 @@ "node": ">= 8" } }, + "node_modules/why-is-node-running": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", + "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/widest-line": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-5.0.0.tgz", + "integrity": "sha512-c9bZp7b5YtRj2wOe6dlj32MK+Bx/M/d+9VB2SHM1OtsUHR0aV0tdP6DWh/iMt0kWi1t5g1Iudu6hQRNd1A4PVA==", + "license": "MIT", + "dependencies": { + "string-width": "^7.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/widest-line/node_modules/ansi-regex": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", + "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/widest-line/node_modules/emoji-regex": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz", + "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==", + "license": "MIT" + }, + "node_modules/widest-line/node_modules/string-width": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/widest-line/node_modules/strip-ansi": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", + "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, "node_modules/word-wrap": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", @@ -12954,7 +13268,6 @@ "version": "9.0.2", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.2.tgz", "integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==", - "dev": true, "license": "MIT", "dependencies": { "ansi-styles": "^6.2.1", @@ -12972,7 +13285,6 @@ "version": "6.2.2", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", - "dev": true, "license": "MIT", "engines": { "node": ">=12" @@ -12985,7 +13297,6 @@ "version": "6.2.3", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", - "dev": true, "license": "MIT", "engines": { "node": ">=12" @@ -12998,14 +13309,12 @@ "version": "10.6.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz", "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==", - "dev": true, "license": "MIT" }, "node_modules/wrap-ansi/node_modules/string-width": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", - "dev": true, "license": "MIT", "dependencies": { "emoji-regex": "^10.3.0", @@ -13023,7 +13332,6 @@ "version": "7.1.2", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", - "dev": true, "license": "MIT", "dependencies": { "ansi-regex": "^6.0.1" @@ -13056,9 +13364,9 @@ } }, "node_modules/ws": { - "version": "8.18.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz", - "integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==", + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.19.0.tgz", + "integrity": "sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg==", "license": "MIT", "engines": { "node": ">=10.0.0" @@ -13212,6 +13520,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/yoga-layout": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/yoga-layout/-/yoga-layout-3.2.1.tgz", + "integrity": "sha512-0LPOt3AxKqMdFBZA3HBAt/t/8vIKq7VaQYbuA8WxCgung+p9TVyKRYdpvCb80HcdTN2NkbIKbhNwKUfm3tQywQ==", + "license": "MIT" + }, "node_modules/zod": { "version": "3.25.76", "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", @@ -13222,9 +13536,9 @@ } }, "node_modules/zod-to-json-schema": { - "version": "3.25.0", - "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.25.0.tgz", - "integrity": "sha512-HvWtU2UG41LALjajJrML6uQejQhNJx+JBO9IflpSja4R03iNWfKXrj6W2h7ljuLyc1nKS+9yDyL/9tD1U/yBnQ==", + "version": "3.25.1", + "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.25.1.tgz", + "integrity": "sha512-pM/SU9d3YAggzi6MtR4h7ruuQlqKtad8e9S0fmxcMi+ueAK5Korys/aWcV9LIIHTVbj01NdzxcnXSN+O74ZIVA==", "license": "ISC", "peerDependencies": { "zod": "^3.25 || ^4" @@ -13235,7 +13549,7 @@ "version": "0.18.0", "license": "MIT", "dependencies": { - "@modelcontextprotocol/sdk": "^1.24.3", + "@modelcontextprotocol/sdk": "^1.25.2", "cors": "^2.8.5", "express": "^5.1.0", "shell-quote": "^1.8.3", @@ -13254,6 +13568,125 @@ "tsx": "^4.19.0", "typescript": "^5.6.2" } + }, + "shared": { + "name": "@modelcontextprotocol/inspector-shared", + "version": "0.18.0", + "devDependencies": { + "@types/react": "^19.2.7", + "react": "^19.2.3", + "typescript": "^5.4.2" + }, + "peerDependencies": { + "react": "^19.2.3" + } + }, + "tui": { + "name": "@modelcontextprotocol/inspector-tui", + "version": "0.18.0", + "license": "MIT", + "dependencies": { + "@modelcontextprotocol/inspector-shared": "*", + "@modelcontextprotocol/sdk": "^1.25.2", + "fullscreen-ink": "^0.1.0", + "ink": "^6.6.0", + "ink-form": "^2.0.1", + "ink-scroll-view": "^0.3.5", + "react": "^19.2.3" + }, + "bin": { + "mcp-inspector-tui": "build/tui.js" + }, + "devDependencies": { + "@types/node": "^25.0.3", + "@types/react": "^19.2.7", + "tsx": "^4.21.0", + "typescript": "^5.9.3" + } + }, + "tui/node_modules/@types/node": { + "version": "25.0.9", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~7.16.0" + } + }, + "tui/node_modules/chalk": { + "version": "5.6.2", + "license": "MIT", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "tui/node_modules/ink-form": { + "version": "2.0.1", + "license": "MIT", + "dependencies": { + "ink-select-input": "^5.0.0", + "ink-text-input": "^6.0.0" + }, + "peerDependencies": { + "ink": ">=4", + "react": ">=18" + } + }, + "tui/node_modules/ink-form/node_modules/ink-select-input": { + "version": "5.0.0", + "license": "MIT", + "dependencies": { + "arr-rotate": "^1.0.0", + "figures": "^5.0.0", + "lodash.isequal": "^4.5.0" + }, + "engines": { + "node": ">=14.16" + }, + "peerDependencies": { + "ink": "^4.0.0", + "react": "^18.0.0" + } + }, + "tui/node_modules/ink-scroll-view": { + "version": "0.3.5", + "license": "MIT", + "peerDependencies": { + "ink": ">=6", + "react": ">=19" + } + }, + "tui/node_modules/ink-text-input": { + "version": "6.0.0", + "license": "MIT", + "dependencies": { + "chalk": "^5.3.0", + "type-fest": "^4.18.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "ink": ">=5", + "react": ">=18" + } + }, + "tui/node_modules/type-fest": { + "version": "4.41.0", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "tui/node_modules/undici-types": { + "version": "7.16.0", + "dev": true, + "license": "MIT" } } } diff --git a/package.json b/package.json index 07f84843c..f59ae8def 100644 --- a/package.json +++ b/package.json @@ -14,18 +14,23 @@ "client/bin", "client/dist", "server/build", - "cli/build" + "cli/build", + "tui/build" ], "workspaces": [ "client", "server", - "cli" + "cli", + "tui", + "shared" ], "scripts": { - "build": "npm run build-server && npm run build-client && npm run build-cli", + "build": "npm run build-shared && npm run build-server && npm run build-client && npm run build-cli && npm run build-tui", + "build-shared": "cd shared && npm run build", "build-server": "cd server && npm run build", "build-client": "cd client && npm run build", "build-cli": "cd cli && npm run build", + "build-tui": "cd tui && npm run build", "clean": "rimraf ./node_modules ./client/node_modules ./cli/node_modules ./build ./client/dist ./server/build ./cli/build ./package-lock.json && npm install", "dev": "node client/bin/start.js --dev", "dev:windows": "node client/bin/start.js --dev", diff --git a/scripts/check-version-consistency.js b/scripts/check-version-consistency.js index 379931dea..c08e3d902 100755 --- a/scripts/check-version-consistency.js +++ b/scripts/check-version-consistency.js @@ -21,6 +21,7 @@ const packagePaths = [ "client/package.json", "server/package.json", "cli/package.json", + "tui/package.json", ]; const versions = new Map(); @@ -135,6 +136,7 @@ if (!fs.existsSync(lockPath)) { { path: "client", name: "@modelcontextprotocol/inspector-client" }, { path: "server", name: "@modelcontextprotocol/inspector-server" }, { path: "cli", name: "@modelcontextprotocol/inspector-cli" }, + { path: "tui", name: "@modelcontextprotocol/inspector-tui" }, ]; workspacePackages.forEach(({ path, name }) => { diff --git a/scripts/update-version.js b/scripts/update-version.js index 91b69f3bf..b2934ab31 100755 --- a/scripts/update-version.js +++ b/scripts/update-version.js @@ -40,6 +40,7 @@ const packagePaths = [ "client/package.json", "server/package.json", "cli/package.json", + "tui/package.json", ]; const updatedFiles = []; diff --git a/shared/json/jsonUtils.ts b/shared/json/jsonUtils.ts new file mode 100644 index 000000000..2fdd0853a --- /dev/null +++ b/shared/json/jsonUtils.ts @@ -0,0 +1,101 @@ +import type { Tool } from "@modelcontextprotocol/sdk/types.js"; + +/** + * JSON value type used across the inspector project + */ +export type JsonValue = + | string + | number + | boolean + | null + | undefined + | JsonValue[] + | { [key: string]: JsonValue }; + +/** + * Simple schema type for parameter conversion + */ +type ParameterSchema = { + type?: string; +}; + +/** + * Convert a string parameter value to the appropriate JSON type based on schema + * @param value String value to convert + * @param schema Schema type information + * @returns Converted JSON value + */ +export function convertParameterValue( + value: string, + schema: ParameterSchema, +): JsonValue { + if (!value) { + return value; + } + + if (schema.type === "number" || schema.type === "integer") { + return Number(value); + } + + if (schema.type === "boolean") { + return value.toLowerCase() === "true"; + } + + if (schema.type === "object" || schema.type === "array") { + try { + return JSON.parse(value) as JsonValue; + } catch (error) { + return value; + } + } + + return value; +} + +/** + * Convert string parameters to JSON values based on tool schema + * @param tool Tool definition with input schema + * @param params String parameters to convert + * @returns Converted parameters as JSON values + */ +export function convertToolParameters( + tool: Tool, + params: Record, +): Record { + const result: Record = {}; + const properties = tool.inputSchema?.properties || {}; + + for (const [key, value] of Object.entries(params)) { + const paramSchema = properties[key] as ParameterSchema | undefined; + + if (paramSchema) { + result[key] = convertParameterValue(value, paramSchema); + } else { + // If no schema is found for this parameter, keep it as string + result[key] = value; + } + } + + return result; +} + +/** + * Convert prompt arguments (JsonValue) to strings for prompt API + * @param args Prompt arguments as JsonValue + * @returns String arguments for prompt API + */ +export function convertPromptArguments( + args: Record, +): Record { + const stringArgs: Record = {}; + for (const [key, value] of Object.entries(args)) { + if (typeof value === "string") { + stringArgs[key] = value; + } else if (value === null || value === undefined) { + stringArgs[key] = String(value); + } else { + stringArgs[key] = JSON.stringify(value); + } + } + return stringArgs; +} diff --git a/shared/mcp/config.ts b/shared/mcp/config.ts new file mode 100644 index 000000000..84b5fcd7f --- /dev/null +++ b/shared/mcp/config.ts @@ -0,0 +1,149 @@ +import { readFileSync } from "fs"; +import { resolve } from "path"; +import type { + MCPConfig, + MCPServerConfig, + StdioServerConfig, + SseServerConfig, + StreamableHttpServerConfig, +} from "./types.js"; + +/** + * Loads and validates an MCP servers configuration file + * @param configPath - Path to the config file (relative to process.cwd() or absolute) + * @returns The parsed MCPConfig + * @throws Error if the file cannot be loaded, parsed, or is invalid + */ +export function loadMcpServersConfig(configPath: string): MCPConfig { + try { + const resolvedPath = resolve(process.cwd(), configPath); + const configContent = readFileSync(resolvedPath, "utf-8"); + const config = JSON.parse(configContent) as MCPConfig; + + if (!config.mcpServers) { + throw new Error("Configuration file must contain an mcpServers element"); + } + + return config; + } catch (error) { + if (error instanceof Error) { + throw new Error(`Error loading configuration: ${error.message}`); + } + throw new Error("Error loading configuration: Unknown error"); + } +} + +/** + * Converts CLI arguments to MCPServerConfig format. + * Handles all CLI-specific logic including: + * - Detecting if target is a URL or command + * - Validating transport/URL combinations + * - Auto-detecting transport type from URL path + * - Converting CLI's "http" transport to "streamable-http" + * + * @param args - CLI arguments object with target (URL or command), transport, and headers + * @returns MCPServerConfig suitable for creating an InspectorClient + * @throws Error if arguments are invalid (e.g., args with URLs, stdio with URLs, etc.) + */ +export function argsToMcpServerConfig(args: { + target: string[]; + transport?: "sse" | "stdio" | "http"; + headers?: Record; + env?: Record; +}): MCPServerConfig { + if (args.target.length === 0) { + throw new Error( + "Target is required. Specify a URL or a command to execute.", + ); + } + + const [firstTarget, ...targetArgs] = args.target; + + if (!firstTarget) { + throw new Error("Target is required."); + } + + const isUrl = + firstTarget.startsWith("http://") || firstTarget.startsWith("https://"); + + // Validation: URLs cannot have additional arguments + if (isUrl && targetArgs.length > 0) { + throw new Error("Arguments cannot be passed to a URL-based MCP server."); + } + + // Validation: Transport/URL combinations + if (args.transport) { + if (!isUrl && args.transport !== "stdio") { + throw new Error("Only stdio transport can be used with local commands."); + } + if (isUrl && args.transport === "stdio") { + throw new Error("stdio transport cannot be used with URLs."); + } + } + + // Handle URL-based transports (SSE or streamable-http) + if (isUrl) { + const url = new URL(firstTarget); + + // Determine transport type + let transportType: "sse" | "streamable-http"; + if (args.transport) { + // Convert CLI's "http" to "streamable-http" + if (args.transport === "http") { + transportType = "streamable-http"; + } else if (args.transport === "sse") { + transportType = "sse"; + } else { + // Should not happen due to validation above, but default to SSE + transportType = "sse"; + } + } else { + // Auto-detect from URL path + if (url.pathname.endsWith("/mcp")) { + transportType = "streamable-http"; + } else if (url.pathname.endsWith("/sse")) { + transportType = "sse"; + } else { + // Default to SSE if path doesn't match known patterns + transportType = "sse"; + } + } + + // Create SSE or streamable-http config + if (transportType === "sse") { + const config: SseServerConfig = { + type: "sse", + url: firstTarget, + }; + if (args.headers) { + config.headers = args.headers; + } + return config; + } else { + const config: StreamableHttpServerConfig = { + type: "streamable-http", + url: firstTarget, + }; + if (args.headers) { + config.headers = args.headers; + } + return config; + } + } + + // Handle stdio transport (command-based) + const config: StdioServerConfig = { + type: "stdio", + command: firstTarget, + }; + + if (targetArgs.length > 0) { + config.args = targetArgs; + } + + if (args.env && Object.keys(args.env).length > 0) { + config.env = args.env; + } + + return config; +} diff --git a/shared/mcp/index.ts b/shared/mcp/index.ts new file mode 100644 index 000000000..a44e81f5b --- /dev/null +++ b/shared/mcp/index.ts @@ -0,0 +1,27 @@ +// Main MCP client module +// Re-exports the primary API for MCP client/server interaction + +export { InspectorClient } from "./inspectorClient.js"; +export type { InspectorClientOptions } from "./inspectorClient.js"; + +export { loadMcpServersConfig, argsToMcpServerConfig } from "./config.js"; + +// Re-export types used by consumers +export type { + // Config types + MCPConfig, + MCPServerConfig, + // Connection and state types (used by components and hooks) + ConnectionStatus, + StderrLogEntry, + MessageEntry, + ServerState, +} from "./types.js"; + +// Re-export JSON utilities +export type { JsonValue } from "../json/jsonUtils.js"; +export { + convertParameterValue, + convertToolParameters, + convertPromptArguments, +} from "../json/jsonUtils.js"; diff --git a/shared/mcp/inspectorClient.ts b/shared/mcp/inspectorClient.ts new file mode 100644 index 000000000..a53172d7c --- /dev/null +++ b/shared/mcp/inspectorClient.ts @@ -0,0 +1,758 @@ +import { Client } from "@modelcontextprotocol/sdk/client/index.js"; +import type { + MCPServerConfig, + StderrLogEntry, + ConnectionStatus, + MessageEntry, +} from "./types.js"; +import { + createTransport, + type CreateTransportOptions, + getServerType as getServerTypeFromConfig, + type ServerType, +} from "./transport.js"; +import { + MessageTrackingTransport, + type MessageTrackingCallbacks, +} from "./messageTrackingTransport.js"; +import type { + JSONRPCRequest, + JSONRPCNotification, + JSONRPCResultResponse, + JSONRPCErrorResponse, + ServerCapabilities, + Implementation, + LoggingLevel, + Tool, +} from "@modelcontextprotocol/sdk/types.js"; +import { + type JsonValue, + convertToolParameters, + convertPromptArguments, +} from "../json/jsonUtils.js"; +export interface InspectorClientOptions { + /** + * Client identity (name and version) + */ + clientIdentity?: { + name: string; + version: string; + }; + /** + * Maximum number of messages to store (0 = unlimited, but not recommended) + */ + maxMessages?: number; + + /** + * Maximum number of stderr log entries to store (0 = unlimited, but not recommended) + */ + maxStderrLogEvents?: number; + + /** + * Whether to pipe stderr for stdio transports (default: true for TUI, false for CLI) + */ + pipeStderr?: boolean; + + /** + * Whether to automatically fetch server contents (tools, resources, prompts) on connect + * (default: true for backward compatibility with TUI) + */ + autoFetchServerContents?: boolean; + + /** + * Initial logging level to set after connection (if server supports logging) + * If not provided, logging level will not be set automatically + */ + initialLoggingLevel?: LoggingLevel; +} + +/** + * InspectorClient wraps an MCP Client and provides: + * - Message tracking and storage + * - Stderr log tracking and storage (for stdio transports) + * - EventTarget interface for React hooks (cross-platform: works in browser and Node.js) + * - Access to client functionality (prompts, resources, tools) + */ +export class InspectorClient extends EventTarget { + private client: Client | null = null; + private transport: any = null; + private baseTransport: any = null; + private messages: MessageEntry[] = []; + private stderrLogs: StderrLogEntry[] = []; + private maxMessages: number; + private maxStderrLogEvents: number; + private autoFetchServerContents: boolean; + private initialLoggingLevel?: LoggingLevel; + private status: ConnectionStatus = "disconnected"; + // Server data + private tools: any[] = []; + private resources: any[] = []; + private prompts: any[] = []; + private capabilities?: ServerCapabilities; + private serverInfo?: Implementation; + private instructions?: string; + + constructor( + private transportConfig: MCPServerConfig, + options: InspectorClientOptions = {}, + ) { + super(); + this.maxMessages = options.maxMessages ?? 1000; + this.maxStderrLogEvents = options.maxStderrLogEvents ?? 1000; + this.autoFetchServerContents = options.autoFetchServerContents ?? true; + this.initialLoggingLevel = options.initialLoggingLevel; + + // Set up message tracking callbacks + const messageTracking: MessageTrackingCallbacks = { + trackRequest: (message: JSONRPCRequest) => { + const entry: MessageEntry = { + id: `${Date.now()}-${Math.random()}`, + timestamp: new Date(), + direction: "request", + message, + }; + this.addMessage(entry); + }, + trackResponse: ( + message: JSONRPCResultResponse | JSONRPCErrorResponse, + ) => { + const messageId = message.id; + // Find the matching request by message ID + const requestEntry = this.messages.find( + (e) => + e.direction === "request" && + "id" in e.message && + e.message.id === messageId, + ); + + if (requestEntry) { + // Update the request entry with the response + this.updateMessageResponse(requestEntry, message); + } else { + // No matching request found, create orphaned response entry + const entry: MessageEntry = { + id: `${Date.now()}-${Math.random()}`, + timestamp: new Date(), + direction: "response", + message, + }; + this.addMessage(entry); + } + }, + trackNotification: (message: JSONRPCNotification) => { + const entry: MessageEntry = { + id: `${Date.now()}-${Math.random()}`, + timestamp: new Date(), + direction: "notification", + message, + }; + this.addMessage(entry); + }, + }; + + // Create transport with stderr logging if needed + const transportOptions: CreateTransportOptions = { + pipeStderr: options.pipeStderr ?? false, + onStderr: (entry: StderrLogEntry) => { + this.addStderrLog(entry); + }, + }; + + const { transport: baseTransport } = createTransport( + transportConfig, + transportOptions, + ); + + // Store base transport for event listeners (always listen to actual transport, not wrapper) + this.baseTransport = baseTransport; + + // Wrap with MessageTrackingTransport if we're tracking messages + this.transport = + this.maxMessages > 0 + ? new MessageTrackingTransport(baseTransport, messageTracking) + : baseTransport; + + // Set up transport event listeners on base transport to track disconnections + this.baseTransport.onclose = () => { + if (this.status !== "disconnected") { + this.status = "disconnected"; + this.dispatchEvent( + new CustomEvent("statusChange", { detail: this.status }), + ); + this.dispatchEvent(new Event("disconnect")); + } + }; + + this.baseTransport.onerror = (error: Error) => { + this.status = "error"; + this.dispatchEvent( + new CustomEvent("statusChange", { detail: this.status }), + ); + this.dispatchEvent(new CustomEvent("error", { detail: error })); + }; + + this.client = new Client( + options.clientIdentity ?? { + name: "@modelcontextprotocol/inspector", + version: "0.18.0", + }, + ); + } + + /** + * Connect to the MCP server + */ + async connect(): Promise { + if (!this.client || !this.transport) { + throw new Error("Client or transport not initialized"); + } + + // If already connected, return early + if (this.status === "connected") { + return; + } + + try { + this.status = "connecting"; + this.dispatchEvent( + new CustomEvent("statusChange", { detail: this.status }), + ); + + // Clear message history on connect (start fresh for new session) + // Don't clear stderrLogs - they persist across reconnects + this.messages = []; + this.dispatchEvent(new Event("messagesChange")); + + await this.client.connect(this.transport); + this.status = "connected"; + this.dispatchEvent( + new CustomEvent("statusChange", { detail: this.status }), + ); + this.dispatchEvent(new Event("connect")); + + // Always fetch server info (capabilities, serverInfo, instructions) - this is just cached data from initialize + await this.fetchServerInfo(); + + // Set initial logging level if configured and server supports it + if (this.initialLoggingLevel && this.capabilities?.logging) { + await this.client.setLoggingLevel(this.initialLoggingLevel); + } + + // Auto-fetch server contents (tools, resources, prompts) if enabled + if (this.autoFetchServerContents) { + await this.fetchServerContents(); + } + } catch (error) { + this.status = "error"; + this.dispatchEvent( + new CustomEvent("statusChange", { detail: this.status }), + ); + this.dispatchEvent(new CustomEvent("error", { detail: error })); + throw error; + } + } + + /** + * Disconnect from the MCP server + */ + async disconnect(): Promise { + if (this.client) { + try { + await this.client.close(); + } catch (error) { + // Ignore errors on close + } + } + // Update status - transport onclose handler will also fire and clear state + // But we also do it here in case disconnect() is called directly + if (this.status !== "disconnected") { + this.status = "disconnected"; + this.dispatchEvent( + new CustomEvent("statusChange", { detail: this.status }), + ); + this.dispatchEvent(new Event("disconnect")); + } + + // Clear server state (tools, resources, prompts) on disconnect + // These are only valid when connected + this.tools = []; + this.resources = []; + this.prompts = []; + this.capabilities = undefined; + this.serverInfo = undefined; + this.instructions = undefined; + this.dispatchEvent(new CustomEvent("toolsChange", { detail: this.tools })); + this.dispatchEvent( + new CustomEvent("resourcesChange", { detail: this.resources }), + ); + this.dispatchEvent( + new CustomEvent("promptsChange", { detail: this.prompts }), + ); + this.dispatchEvent( + new CustomEvent("capabilitiesChange", { detail: this.capabilities }), + ); + this.dispatchEvent( + new CustomEvent("serverInfoChange", { detail: this.serverInfo }), + ); + this.dispatchEvent( + new CustomEvent("instructionsChange", { detail: this.instructions }), + ); + } + + /** + * Get the underlying MCP Client + */ + getClient(): Client { + if (!this.client) { + throw new Error("Client not initialized"); + } + return this.client; + } + + /** + * Get all messages + */ + getMessages(): MessageEntry[] { + return [...this.messages]; + } + + /** + * Get all stderr logs + */ + getStderrLogs(): StderrLogEntry[] { + return [...this.stderrLogs]; + } + + /** + * Get the current connection status + */ + getStatus(): ConnectionStatus { + return this.status; + } + + /** + * Get the MCP server configuration used to create this client + */ + getTransportConfig(): MCPServerConfig { + return this.transportConfig; + } + + /** + * Get the server type (stdio, sse, or streamable-http) + */ + getServerType(): ServerType { + return getServerTypeFromConfig(this.transportConfig); + } + + /** + * Get all tools + */ + getTools(): any[] { + return [...this.tools]; + } + + /** + * Get all resources + */ + getResources(): any[] { + return [...this.resources]; + } + + /** + * Get all prompts + */ + getPrompts(): any[] { + return [...this.prompts]; + } + + /** + * Get server capabilities + */ + getCapabilities(): ServerCapabilities | undefined { + return this.capabilities; + } + + /** + * Get server info (name, version) + */ + getServerInfo(): Implementation | undefined { + return this.serverInfo; + } + + /** + * Get server instructions + */ + getInstructions(): string | undefined { + return this.instructions; + } + + /** + * Set the logging level for the MCP server + * @param level Logging level to set + * @throws Error if client is not connected or server doesn't support logging + */ + async setLoggingLevel(level: LoggingLevel): Promise { + if (!this.client) { + throw new Error("Client is not connected"); + } + if (!this.capabilities?.logging) { + throw new Error("Server does not support logging"); + } + await this.client.setLoggingLevel(level); + } + + /** + * List available tools + * @param metadata Optional metadata to include in the request + * @returns Response containing tools array + */ + async listTools( + metadata?: Record, + ): Promise> { + if (!this.client) { + throw new Error("Client is not connected"); + } + try { + const params = + metadata && Object.keys(metadata).length > 0 ? { _meta: metadata } : {}; + const response = await this.client.listTools(params); + return response; + } catch (error) { + throw new Error( + `Failed to list tools: ${error instanceof Error ? error.message : String(error)}`, + ); + } + } + + /** + * Call a tool by name + * @param name Tool name + * @param args Tool arguments + * @param generalMetadata Optional general metadata + * @param toolSpecificMetadata Optional tool-specific metadata (takes precedence over general) + * @returns Tool call response + */ + async callTool( + name: string, + args: Record, + generalMetadata?: Record, + toolSpecificMetadata?: Record, + ): Promise> { + if (!this.client) { + throw new Error("Client is not connected"); + } + try { + const toolsResponse = await this.listTools(generalMetadata); + const tools = (toolsResponse.tools as Tool[]) || []; + const tool = tools.find((t) => t.name === name); + + let convertedArgs: Record = args; + + if (tool) { + // Convert parameters based on the tool's schema, but only for string values + // since we now accept pre-parsed values from the CLI + const stringArgs: Record = {}; + for (const [key, value] of Object.entries(args)) { + if (typeof value === "string") { + stringArgs[key] = value; + } + } + + if (Object.keys(stringArgs).length > 0) { + const convertedStringArgs = convertToolParameters(tool, stringArgs); + convertedArgs = { ...args, ...convertedStringArgs }; + } + } + + // Merge general metadata with tool-specific metadata + // Tool-specific metadata takes precedence over general metadata + let mergedMetadata: Record | undefined; + if (generalMetadata || toolSpecificMetadata) { + mergedMetadata = { + ...(generalMetadata || {}), + ...(toolSpecificMetadata || {}), + }; + } + + const response = await this.client.callTool({ + name: name, + arguments: convertedArgs, + _meta: + mergedMetadata && Object.keys(mergedMetadata).length > 0 + ? mergedMetadata + : undefined, + }); + return response; + } catch (error) { + throw new Error( + `Failed to call tool ${name}: ${error instanceof Error ? error.message : String(error)}`, + ); + } + } + + /** + * List available resources + * @param metadata Optional metadata to include in the request + * @returns Response containing resources array + */ + async listResources( + metadata?: Record, + ): Promise> { + if (!this.client) { + throw new Error("Client is not connected"); + } + try { + const params = + metadata && Object.keys(metadata).length > 0 ? { _meta: metadata } : {}; + const response = await this.client.listResources(params); + return response; + } catch (error) { + throw new Error( + `Failed to list resources: ${error instanceof Error ? error.message : String(error)}`, + ); + } + } + + /** + * Read a resource by URI + * @param uri Resource URI + * @param metadata Optional metadata to include in the request + * @returns Resource content + */ + async readResource( + uri: string, + metadata?: Record, + ): Promise> { + if (!this.client) { + throw new Error("Client is not connected"); + } + try { + const params: any = { uri }; + if (metadata && Object.keys(metadata).length > 0) { + params._meta = metadata; + } + const response = await this.client.readResource(params); + return response; + } catch (error) { + throw new Error( + `Failed to read resource ${uri}: ${error instanceof Error ? error.message : String(error)}`, + ); + } + } + + /** + * List resource templates + * @param metadata Optional metadata to include in the request + * @returns Response containing resource templates array + */ + async listResourceTemplates( + metadata?: Record, + ): Promise> { + if (!this.client) { + throw new Error("Client is not connected"); + } + try { + const params = + metadata && Object.keys(metadata).length > 0 ? { _meta: metadata } : {}; + const response = await this.client.listResourceTemplates(params); + return response; + } catch (error) { + throw new Error( + `Failed to list resource templates: ${error instanceof Error ? error.message : String(error)}`, + ); + } + } + + /** + * List available prompts + * @param metadata Optional metadata to include in the request + * @returns Response containing prompts array + */ + async listPrompts( + metadata?: Record, + ): Promise> { + if (!this.client) { + throw new Error("Client is not connected"); + } + try { + const params = + metadata && Object.keys(metadata).length > 0 ? { _meta: metadata } : {}; + const response = await this.client.listPrompts(params); + return response; + } catch (error) { + throw new Error( + `Failed to list prompts: ${error instanceof Error ? error.message : String(error)}`, + ); + } + } + + /** + * Get a prompt by name + * @param name Prompt name + * @param args Optional prompt arguments + * @param metadata Optional metadata to include in the request + * @returns Prompt content + */ + async getPrompt( + name: string, + args?: Record, + metadata?: Record, + ): Promise> { + if (!this.client) { + throw new Error("Client is not connected"); + } + try { + // Convert all arguments to strings for prompt arguments + const stringArgs = args ? convertPromptArguments(args) : {}; + + const params: any = { + name, + arguments: stringArgs, + }; + + if (metadata && Object.keys(metadata).length > 0) { + params._meta = metadata; + } + + const response = await this.client.getPrompt(params); + + return response; + } catch (error) { + throw new Error( + `Failed to get prompt: ${error instanceof Error ? error.message : String(error)}`, + ); + } + } + + /** + * Fetch server info (capabilities, serverInfo, instructions) from cached initialize response + * This does not send any additional MCP requests - it just reads cached data + * Always called on connect + */ + private async fetchServerInfo(): Promise { + if (!this.client) { + return; + } + + try { + // Get server capabilities (cached from initialize response) + this.capabilities = this.client.getServerCapabilities(); + this.dispatchEvent( + new CustomEvent("capabilitiesChange", { detail: this.capabilities }), + ); + + // Get server info (name, version) and instructions (cached from initialize response) + this.serverInfo = this.client.getServerVersion(); + this.instructions = this.client.getInstructions(); + this.dispatchEvent( + new CustomEvent("serverInfoChange", { detail: this.serverInfo }), + ); + if (this.instructions !== undefined) { + this.dispatchEvent( + new CustomEvent("instructionsChange", { detail: this.instructions }), + ); + } + } catch (error) { + // Ignore errors in fetching server info + } + } + + /** + * Fetch server contents (tools, resources, prompts) by sending MCP requests + * This is only called when autoFetchServerContents is enabled + * TODO: Add support for listChanged notifications to auto-refresh when server data changes + */ + private async fetchServerContents(): Promise { + if (!this.client) { + return; + } + + try { + // Query resources, prompts, and tools based on capabilities + if (this.capabilities?.resources) { + try { + const result = await this.client.listResources(); + this.resources = result.resources || []; + this.dispatchEvent( + new CustomEvent("resourcesChange", { detail: this.resources }), + ); + } catch (err) { + // Ignore errors, just leave empty + this.resources = []; + this.dispatchEvent( + new CustomEvent("resourcesChange", { detail: this.resources }), + ); + } + } + + if (this.capabilities?.prompts) { + try { + const result = await this.client.listPrompts(); + this.prompts = result.prompts || []; + this.dispatchEvent( + new CustomEvent("promptsChange", { detail: this.prompts }), + ); + } catch (err) { + // Ignore errors, just leave empty + this.prompts = []; + this.dispatchEvent( + new CustomEvent("promptsChange", { detail: this.prompts }), + ); + } + } + + if (this.capabilities?.tools) { + try { + const result = await this.client.listTools(); + this.tools = result.tools || []; + this.dispatchEvent( + new CustomEvent("toolsChange", { detail: this.tools }), + ); + } catch (err) { + // Ignore errors, just leave empty + this.tools = []; + this.dispatchEvent( + new CustomEvent("toolsChange", { detail: this.tools }), + ); + } + } + } catch (error) { + // Ignore errors in fetching server contents + } + } + + private addMessage(entry: MessageEntry): void { + if (this.maxMessages > 0 && this.messages.length >= this.maxMessages) { + // Remove oldest message + this.messages.shift(); + } + this.messages.push(entry); + this.dispatchEvent(new CustomEvent("message", { detail: entry })); + this.dispatchEvent(new Event("messagesChange")); + } + + private updateMessageResponse( + requestEntry: MessageEntry, + response: JSONRPCResultResponse | JSONRPCErrorResponse, + ): void { + const duration = Date.now() - requestEntry.timestamp.getTime(); + // Update the entry in place (mutate the object directly) + requestEntry.response = response; + requestEntry.duration = duration; + this.dispatchEvent(new CustomEvent("message", { detail: requestEntry })); + this.dispatchEvent(new Event("messagesChange")); + } + + private addStderrLog(entry: StderrLogEntry): void { + if ( + this.maxStderrLogEvents > 0 && + this.stderrLogs.length >= this.maxStderrLogEvents + ) { + // Remove oldest stderr log + this.stderrLogs.shift(); + } + this.stderrLogs.push(entry); + this.dispatchEvent(new CustomEvent("stderrLog", { detail: entry })); + this.dispatchEvent(new Event("stderrLogsChange")); + } +} diff --git a/shared/mcp/messageTrackingTransport.ts b/shared/mcp/messageTrackingTransport.ts new file mode 100644 index 000000000..8c42319b1 --- /dev/null +++ b/shared/mcp/messageTrackingTransport.ts @@ -0,0 +1,120 @@ +import type { + Transport, + TransportSendOptions, +} from "@modelcontextprotocol/sdk/shared/transport.js"; +import type { + JSONRPCMessage, + MessageExtraInfo, +} from "@modelcontextprotocol/sdk/types.js"; +import type { + JSONRPCRequest, + JSONRPCNotification, + JSONRPCResultResponse, + JSONRPCErrorResponse, +} from "@modelcontextprotocol/sdk/types.js"; + +export interface MessageTrackingCallbacks { + trackRequest?: (message: JSONRPCRequest) => void; + trackResponse?: ( + message: JSONRPCResultResponse | JSONRPCErrorResponse, + ) => void; + trackNotification?: (message: JSONRPCNotification) => void; +} + +// Transport wrapper that intercepts all messages for tracking +export class MessageTrackingTransport implements Transport { + constructor( + private baseTransport: Transport, + private callbacks: MessageTrackingCallbacks, + ) {} + + async start(): Promise { + return this.baseTransport.start(); + } + + async send( + message: JSONRPCMessage, + options?: TransportSendOptions, + ): Promise { + // Track outgoing requests (only requests have a method and are sent by the client) + if ("method" in message && "id" in message) { + this.callbacks.trackRequest?.(message as JSONRPCRequest); + } + return this.baseTransport.send(message, options); + } + + async close(): Promise { + return this.baseTransport.close(); + } + + get onclose(): (() => void) | undefined { + return this.baseTransport.onclose; + } + + set onclose(handler: (() => void) | undefined) { + this.baseTransport.onclose = handler; + } + + get onerror(): ((error: Error) => void) | undefined { + return this.baseTransport.onerror; + } + + set onerror(handler: ((error: Error) => void) | undefined) { + this.baseTransport.onerror = handler; + } + + get onmessage(): + | ((message: T, extra?: MessageExtraInfo) => void) + | undefined { + return this.baseTransport.onmessage; + } + + set onmessage( + handler: + | (( + message: T, + extra?: MessageExtraInfo, + ) => void) + | undefined, + ) { + if (handler) { + // Wrap the handler to track incoming messages + this.baseTransport.onmessage = ( + message: T, + extra?: MessageExtraInfo, + ) => { + // Track incoming messages + if ( + "id" in message && + message.id !== null && + message.id !== undefined + ) { + // Check if it's a response (has 'result' or 'error' property) + if ("result" in message || "error" in message) { + this.callbacks.trackResponse?.( + message as JSONRPCResultResponse | JSONRPCErrorResponse, + ); + } else if ("method" in message) { + // This is a request coming from the server + this.callbacks.trackRequest?.(message as JSONRPCRequest); + } + } else if ("method" in message) { + // Notification (no ID, has method) + this.callbacks.trackNotification?.(message as JSONRPCNotification); + } + // Call the original handler + handler(message, extra); + }; + } else { + this.baseTransport.onmessage = undefined; + } + } + + get sessionId(): string | undefined { + return this.baseTransport.sessionId; + } + + get setProtocolVersion(): ((version: string) => void) | undefined { + return this.baseTransport.setProtocolVersion; + } +} diff --git a/shared/mcp/transport.ts b/shared/mcp/transport.ts new file mode 100644 index 000000000..93cd44612 --- /dev/null +++ b/shared/mcp/transport.ts @@ -0,0 +1,127 @@ +import type { + MCPServerConfig, + StdioServerConfig, + SseServerConfig, + StreamableHttpServerConfig, + StderrLogEntry, +} from "./types.js"; +import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js"; +import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js"; +import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"; +import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js"; + +export type ServerType = "stdio" | "sse" | "streamable-http"; + +export function getServerType(config: MCPServerConfig): ServerType { + // If type is not present, default to stdio + if (!("type" in config) || config.type === undefined) { + return "stdio"; + } + + // If type is present, validate it matches one of the valid values + const type = config.type; + if (type === "stdio") { + return "stdio"; + } + if (type === "sse") { + return "sse"; + } + if (type === "streamable-http") { + return "streamable-http"; + } + + // If type is present but doesn't match any valid value, throw error + throw new Error( + `Invalid server type: ${type}. Valid types are: stdio, sse, streamable-http`, + ); +} + +export interface CreateTransportOptions { + /** + * Optional callback to handle stderr logs from stdio transports + */ + onStderr?: (entry: StderrLogEntry) => void; + + /** + * Whether to pipe stderr for stdio transports (default: true for TUI, false for CLI) + */ + pipeStderr?: boolean; +} + +export interface CreateTransportResult { + transport: Transport; +} + +/** + * Creates the appropriate transport for an MCP server configuration + */ +export function createTransport( + config: MCPServerConfig, + options: CreateTransportOptions = {}, +): CreateTransportResult { + const serverType = getServerType(config); + const { onStderr, pipeStderr = false } = options; + + if (serverType === "stdio") { + const stdioConfig = config as StdioServerConfig; + const transport = new StdioClientTransport({ + command: stdioConfig.command, + args: stdioConfig.args || [], + env: stdioConfig.env, + cwd: stdioConfig.cwd, + stderr: pipeStderr ? "pipe" : undefined, + }); + + // Set up stderr listener if requested + if (pipeStderr && transport.stderr && onStderr) { + transport.stderr.on("data", (data: Buffer) => { + const logEntry = data.toString().trim(); + if (logEntry) { + onStderr({ + timestamp: new Date(), + message: logEntry, + }); + } + }); + } + + return { transport: transport }; + } else if (serverType === "sse") { + const sseConfig = config as SseServerConfig; + const url = new URL(sseConfig.url); + + // Merge headers and requestInit + const eventSourceInit: Record = { + ...sseConfig.eventSourceInit, + ...(sseConfig.headers && { headers: sseConfig.headers }), + }; + + const requestInit: RequestInit = { + ...sseConfig.requestInit, + ...(sseConfig.headers && { headers: sseConfig.headers }), + }; + + const transport = new SSEClientTransport(url, { + eventSourceInit, + requestInit, + }); + + return { transport }; + } else { + // streamable-http + const httpConfig = config as StreamableHttpServerConfig; + const url = new URL(httpConfig.url); + + // Merge headers and requestInit + const requestInit: RequestInit = { + ...httpConfig.requestInit, + ...(httpConfig.headers && { headers: httpConfig.headers }), + }; + + const transport = new StreamableHTTPClientTransport(url, { + requestInit, + }); + + return { transport }; + } +} diff --git a/shared/mcp/types.ts b/shared/mcp/types.ts new file mode 100644 index 000000000..dbb1ee488 --- /dev/null +++ b/shared/mcp/types.ts @@ -0,0 +1,79 @@ +// Stdio transport config +export interface StdioServerConfig { + type?: "stdio"; + command: string; + args?: string[]; + env?: Record; + cwd?: string; +} + +// SSE transport config +export interface SseServerConfig { + type: "sse"; + url: string; + headers?: Record; + eventSourceInit?: Record; + requestInit?: Record; +} + +// StreamableHTTP transport config +export interface StreamableHttpServerConfig { + type: "streamable-http"; + url: string; + headers?: Record; + requestInit?: Record; +} + +export type MCPServerConfig = + | StdioServerConfig + | SseServerConfig + | StreamableHttpServerConfig; + +export interface MCPConfig { + mcpServers: Record; +} + +export type ConnectionStatus = + | "disconnected" + | "connecting" + | "connected" + | "error"; + +export interface StderrLogEntry { + timestamp: Date; + message: string; +} + +import type { + ServerCapabilities, + Implementation, + JSONRPCRequest, + JSONRPCNotification, + JSONRPCResultResponse, + JSONRPCErrorResponse, +} from "@modelcontextprotocol/sdk/types.js"; + +export interface MessageEntry { + id: string; + timestamp: Date; + direction: "request" | "response" | "notification"; + message: + | JSONRPCRequest + | JSONRPCNotification + | JSONRPCResultResponse + | JSONRPCErrorResponse; + response?: JSONRPCResultResponse | JSONRPCErrorResponse; + duration?: number; // Time between request and response in ms +} + +export interface ServerState { + status: ConnectionStatus; + error: string | null; + capabilities?: ServerCapabilities; + serverInfo?: Implementation; + instructions?: string; + resources: any[]; + prompts: any[]; + tools: any[]; + stderrLogs: StderrLogEntry[]; +} diff --git a/shared/package.json b/shared/package.json new file mode 100644 index 000000000..dec11634f --- /dev/null +++ b/shared/package.json @@ -0,0 +1,29 @@ +{ + "name": "@modelcontextprotocol/inspector-shared", + "version": "0.18.0", + "private": true, + "type": "module", + "main": "./build/mcp/index.js", + "types": "./build/mcp/index.d.ts", + "exports": { + ".": "./build/mcp/index.js", + "./mcp/*": "./build/mcp/*", + "./react/*": "./build/react/*", + "./test/*": "./build/test/*", + "./json/*": "./build/json/*" + }, + "files": [ + "build" + ], + "scripts": { + "build": "tsc" + }, + "peerDependencies": { + "react": "^19.2.3" + }, + "devDependencies": { + "@types/react": "^19.2.7", + "react": "^19.2.3", + "typescript": "^5.4.2" + } +} diff --git a/shared/react/useInspectorClient.ts b/shared/react/useInspectorClient.ts new file mode 100644 index 000000000..cf48ffd13 --- /dev/null +++ b/shared/react/useInspectorClient.ts @@ -0,0 +1,205 @@ +import { useState, useEffect, useCallback } from "react"; +import { InspectorClient } from "../mcp/index.js"; +import type { + ConnectionStatus, + StderrLogEntry, + MessageEntry, +} from "../mcp/index.js"; +import type { Client } from "@modelcontextprotocol/sdk/client/index.js"; +import type { + ServerCapabilities, + Implementation, + Tool, + ResourceReference, + PromptReference, +} from "@modelcontextprotocol/sdk/types.js"; + +export interface UseInspectorClientResult { + status: ConnectionStatus; + messages: MessageEntry[]; + stderrLogs: StderrLogEntry[]; + tools: any[]; + resources: any[]; + prompts: any[]; + capabilities?: ServerCapabilities; + serverInfo?: Implementation; + instructions?: string; + client: Client | null; + connect: () => Promise; + disconnect: () => Promise; +} + +/** + * React hook that subscribes to InspectorClient events and provides reactive state + */ +export function useInspectorClient( + inspectorClient: InspectorClient | null, +): UseInspectorClientResult { + const [status, setStatus] = useState( + inspectorClient?.getStatus() ?? "disconnected", + ); + const [messages, setMessages] = useState( + inspectorClient?.getMessages() ?? [], + ); + const [stderrLogs, setStderrLogs] = useState( + inspectorClient?.getStderrLogs() ?? [], + ); + const [tools, setTools] = useState(inspectorClient?.getTools() ?? []); + const [resources, setResources] = useState( + inspectorClient?.getResources() ?? [], + ); + const [prompts, setPrompts] = useState( + inspectorClient?.getPrompts() ?? [], + ); + const [capabilities, setCapabilities] = useState< + ServerCapabilities | undefined + >(inspectorClient?.getCapabilities()); + const [serverInfo, setServerInfo] = useState( + inspectorClient?.getServerInfo(), + ); + const [instructions, setInstructions] = useState( + inspectorClient?.getInstructions(), + ); + + // Subscribe to all InspectorClient events + useEffect(() => { + if (!inspectorClient) { + setStatus("disconnected"); + setMessages([]); + setStderrLogs([]); + setTools([]); + setResources([]); + setPrompts([]); + setCapabilities(undefined); + setServerInfo(undefined); + setInstructions(undefined); + return; + } + + // Initial state + setStatus(inspectorClient.getStatus()); + setMessages(inspectorClient.getMessages()); + setStderrLogs(inspectorClient.getStderrLogs()); + setTools(inspectorClient.getTools()); + setResources(inspectorClient.getResources()); + setPrompts(inspectorClient.getPrompts()); + setCapabilities(inspectorClient.getCapabilities()); + setServerInfo(inspectorClient.getServerInfo()); + setInstructions(inspectorClient.getInstructions()); + + // Event handlers + // Note: We use event payloads when available for efficiency, with explicit type casting + // since EventTarget doesn't provide compile-time type safety + const onStatusChange = (event: Event) => { + const customEvent = event as CustomEvent; + setStatus(customEvent.detail); + }; + + const onMessagesChange = () => { + // messagesChange doesn't include payload, so we fetch + setMessages(inspectorClient.getMessages()); + }; + + const onStderrLogsChange = () => { + // stderrLogsChange doesn't include payload, so we fetch + setStderrLogs(inspectorClient.getStderrLogs()); + }; + + const onToolsChange = (event: Event) => { + const customEvent = event as CustomEvent; + setTools(customEvent.detail); + }; + + const onResourcesChange = (event: Event) => { + const customEvent = event as CustomEvent; + setResources(customEvent.detail); + }; + + const onPromptsChange = (event: Event) => { + const customEvent = event as CustomEvent; + setPrompts(customEvent.detail); + }; + + const onCapabilitiesChange = (event: Event) => { + const customEvent = event as CustomEvent; + setCapabilities(customEvent.detail); + }; + + const onServerInfoChange = (event: Event) => { + const customEvent = event as CustomEvent; + setServerInfo(customEvent.detail); + }; + + const onInstructionsChange = (event: Event) => { + const customEvent = event as CustomEvent; + setInstructions(customEvent.detail); + }; + + // Subscribe to events + inspectorClient.addEventListener("statusChange", onStatusChange); + inspectorClient.addEventListener("messagesChange", onMessagesChange); + inspectorClient.addEventListener("stderrLogsChange", onStderrLogsChange); + inspectorClient.addEventListener("toolsChange", onToolsChange); + inspectorClient.addEventListener("resourcesChange", onResourcesChange); + inspectorClient.addEventListener("promptsChange", onPromptsChange); + inspectorClient.addEventListener( + "capabilitiesChange", + onCapabilitiesChange, + ); + inspectorClient.addEventListener("serverInfoChange", onServerInfoChange); + inspectorClient.addEventListener( + "instructionsChange", + onInstructionsChange, + ); + + // Cleanup + return () => { + inspectorClient.removeEventListener("statusChange", onStatusChange); + inspectorClient.removeEventListener("messagesChange", onMessagesChange); + inspectorClient.removeEventListener( + "stderrLogsChange", + onStderrLogsChange, + ); + inspectorClient.removeEventListener("toolsChange", onToolsChange); + inspectorClient.removeEventListener("resourcesChange", onResourcesChange); + inspectorClient.removeEventListener("promptsChange", onPromptsChange); + inspectorClient.removeEventListener( + "capabilitiesChange", + onCapabilitiesChange, + ); + inspectorClient.removeEventListener( + "serverInfoChange", + onServerInfoChange, + ); + inspectorClient.removeEventListener( + "instructionsChange", + onInstructionsChange, + ); + }; + }, [inspectorClient]); + + const connect = useCallback(async () => { + if (!inspectorClient) return; + await inspectorClient.connect(); + }, [inspectorClient]); + + const disconnect = useCallback(async () => { + if (!inspectorClient) return; + await inspectorClient.disconnect(); + }, [inspectorClient]); + + return { + status, + messages, + stderrLogs, + tools, + resources, + prompts, + capabilities, + serverInfo, + instructions, + client: inspectorClient?.getClient() ?? null, + connect, + disconnect, + }; +} diff --git a/shared/test/test-server-fixtures.ts b/shared/test/test-server-fixtures.ts new file mode 100644 index 000000000..d92d79ae0 --- /dev/null +++ b/shared/test/test-server-fixtures.ts @@ -0,0 +1,267 @@ +/** + * Shared types and test fixtures for composable MCP test servers + */ + +import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; +import type { Implementation } from "@modelcontextprotocol/sdk/types.js"; +import * as z from "zod/v4"; +import { ZodRawShapeCompat } from "@modelcontextprotocol/sdk/server/zod-compat.js"; + +type ToolInputSchema = ZodRawShapeCompat; + +export interface ToolDefinition { + name: string; + description: string; + inputSchema?: ToolInputSchema; + handler: (params: Record) => Promise; +} + +export interface ResourceDefinition { + uri: string; + name: string; + description?: string; + mimeType?: string; + text?: string; +} + +type PromptArgsSchema = ZodRawShapeCompat; + +export interface PromptDefinition { + name: string; + description?: string; + argsSchema?: PromptArgsSchema; +} + +// This allows us to compose tests servers using the metadata and features we want in a given scenario +export interface ServerConfig { + serverInfo: Implementation; // Server metadata (name, version, etc.) - required + tools?: ToolDefinition[]; // Tools to register (optional, empty array means no tools, but tools capability is still advertised) + resources?: ResourceDefinition[]; // Resources to register (optional, empty array means no resources, but resources capability is still advertised) + prompts?: PromptDefinition[]; // Prompts to register (optional, empty array means no prompts, but prompts capability is still advertised) + logging?: boolean; // Whether to advertise logging capability (default: false) +} + +/** + * Create an "echo" tool that echoes back the input message + */ +export function createEchoTool(): ToolDefinition { + return { + name: "echo", + description: "Echo back the input message", + inputSchema: { + message: z.string().describe("Message to echo back"), + }, + handler: async (params: Record) => { + return { message: `Echo: ${params.message as string}` }; + }, + }; +} + +/** + * Create an "add" tool that adds two numbers together + */ +export function createAddTool(): ToolDefinition { + return { + name: "add", + description: "Add two numbers together", + inputSchema: { + a: z.number().describe("First number"), + b: z.number().describe("Second number"), + }, + handler: async (params: Record) => { + const a = params.a as number; + const b = params.b as number; + return { result: a + b }; + }, + }; +} + +/** + * Create a "get-sum" tool that returns the sum of two numbers (alias for add) + */ +export function createGetSumTool(): ToolDefinition { + return { + name: "get-sum", + description: "Get the sum of two numbers", + inputSchema: { + a: z.number().describe("First number"), + b: z.number().describe("Second number"), + }, + handler: async (params: Record) => { + const a = params.a as number; + const b = params.b as number; + return { result: a + b }; + }, + }; +} + +/** + * Create a "get-annotated-message" tool that returns a message with optional image + */ +export function createGetAnnotatedMessageTool(): ToolDefinition { + return { + name: "get-annotated-message", + description: "Get an annotated message", + inputSchema: { + messageType: z + .enum(["success", "error", "warning", "info"]) + .describe("Type of message"), + includeImage: z + .boolean() + .optional() + .describe("Whether to include an image"), + }, + handler: async (params: Record) => { + const messageType = params.messageType as string; + const includeImage = params.includeImage as boolean | undefined; + const message = `This is a ${messageType} message`; + const content: Array< + | { type: "text"; text: string } + | { type: "image"; data: string; mimeType: string } + > = [ + { + type: "text", + text: message, + }, + ]; + + if (includeImage) { + content.push({ + type: "image", + data: "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==", // 1x1 transparent PNG + mimeType: "image/png", + }); + } + + return { content }; + }, + }; +} + +/** + * Create a "simple-prompt" prompt definition + */ +export function createSimplePrompt(): PromptDefinition { + return { + name: "simple-prompt", + description: "A simple prompt for testing", + }; +} + +/** + * Create an "args-prompt" prompt that accepts arguments + */ +export function createArgsPrompt(): PromptDefinition { + return { + name: "args-prompt", + description: "A prompt that accepts arguments for testing", + argsSchema: { + city: z.string().describe("City name"), + state: z.string().describe("State name"), + }, + }; +} + +/** + * Create an "architecture" resource definition + */ +export function createArchitectureResource(): ResourceDefinition { + return { + name: "architecture", + uri: "demo://resource/static/document/architecture.md", + description: "Architecture documentation", + mimeType: "text/markdown", + text: `# Architecture Documentation + +This is a test resource for the MCP test server. + +## Overview + +This resource is used for testing resource reading functionality in the CLI. + +## Sections + +- Introduction +- Design +- Implementation +- Testing + +## Notes + +This is a static resource provided by the test MCP server. +`, + }; +} + +/** + * Create a "test-cwd" resource that exposes the current working directory (generally useful when testing with the stdio test server) + */ +export function createTestCwdResource(): ResourceDefinition { + return { + name: "test-cwd", + uri: "test://cwd", + description: "Current working directory of the test server", + mimeType: "text/plain", + text: process.cwd(), + }; +} + +/** + * Create a "test-env" resource that exposes environment variables (generally useful when testing with the stdio test server) + */ +export function createTestEnvResource(): ResourceDefinition { + return { + name: "test-env", + uri: "test://env", + description: "Environment variables available to the test server", + mimeType: "application/json", + text: JSON.stringify(process.env, null, 2), + }; +} + +/** + * Create a "test-argv" resource that exposes command-line arguments (generally useful when testing with the stdio test server) + */ +export function createTestArgvResource(): ResourceDefinition { + return { + name: "test-argv", + uri: "test://argv", + description: "Command-line arguments the test server was started with", + mimeType: "application/json", + text: JSON.stringify(process.argv, null, 2), + }; +} + +/** + * Create minimal server info for test servers + */ +export function createTestServerInfo( + name: string = "test-server", + version: string = "1.0.0", +): Implementation { + return { + name, + version, + }; +} + +/** + * Get default server config with common test tools, prompts, and resources + */ +export function getDefaultServerConfig(): ServerConfig { + return { + serverInfo: createTestServerInfo("test-mcp-server", "1.0.0"), + tools: [ + createEchoTool(), + createGetSumTool(), + createGetAnnotatedMessageTool(), + ], + prompts: [createSimplePrompt(), createArgsPrompt()], + resources: [ + createArchitectureResource(), + createTestCwdResource(), + createTestEnvResource(), + createTestArgvResource(), + ], + }; +} diff --git a/shared/test/test-server-http.ts b/shared/test/test-server-http.ts new file mode 100644 index 000000000..5c42cc4b1 --- /dev/null +++ b/shared/test/test-server-http.ts @@ -0,0 +1,449 @@ +import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; +import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js"; +import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js"; +import { SetLevelRequestSchema } from "@modelcontextprotocol/sdk/types.js"; +import type { Request, Response } from "express"; +import express from "express"; +import { createServer as createHttpServer, Server as HttpServer } from "http"; +import { createServer as createNetServer } from "net"; +import * as z from "zod/v4"; +import type { ServerConfig } from "./test-server-fixtures.js"; + +export interface RecordedRequest { + method: string; + params?: any; + headers?: Record; + metadata?: Record; + response: any; + timestamp: number; +} + +/** + * Find an available port starting from the given port + */ +async function findAvailablePort(startPort: number): Promise { + return new Promise((resolve, reject) => { + const server = createNetServer(); + server.listen(startPort, () => { + const port = (server.address() as { port: number })?.port; + server.close(() => resolve(port || startPort)); + }); + server.on("error", (err: NodeJS.ErrnoException) => { + if (err.code === "EADDRINUSE") { + // Try next port + findAvailablePort(startPort + 1) + .then(resolve) + .catch(reject); + } else { + reject(err); + } + }); + }); +} + +/** + * Extract headers from Express request + */ +function extractHeaders(req: Request): Record { + const headers: Record = {}; + for (const [key, value] of Object.entries(req.headers)) { + if (typeof value === "string") { + headers[key] = value; + } else if (Array.isArray(value) && value.length > 0) { + headers[key] = value[value.length - 1]; + } + } + return headers; +} + +// With this test server, your test can hold an instance and you can get the server's recorded message history at any time. +// +export class TestServerHttp { + private mcpServer: McpServer; + private config: ServerConfig; + private recordedRequests: RecordedRequest[] = []; + private httpServer?: HttpServer; + private transport?: StreamableHTTPServerTransport | SSEServerTransport; + private url?: string; + private currentRequestHeaders?: Record; + private currentLogLevel: string | null = null; + + constructor(config: ServerConfig) { + this.config = config; + const capabilities: { + tools?: {}; + resources?: {}; + prompts?: {}; + logging?: {}; + } = {}; + + // Only include capabilities for features that are present in config + if (config.tools !== undefined) { + capabilities.tools = {}; + } + if (config.resources !== undefined) { + capabilities.resources = {}; + } + if (config.prompts !== undefined) { + capabilities.prompts = {}; + } + if (config.logging === true) { + capabilities.logging = {}; + } + + this.mcpServer = new McpServer(config.serverInfo, { + capabilities, + }); + + this.setupHandlers(); + if (config.logging === true) { + this.setupLoggingHandler(); + } + } + + private setupHandlers() { + // Set up tools + if (this.config.tools && this.config.tools.length > 0) { + for (const tool of this.config.tools) { + this.mcpServer.registerTool( + tool.name, + { + description: tool.description, + inputSchema: tool.inputSchema, + }, + async (args) => { + const result = await tool.handler(args as Record); + return { + content: [{ type: "text", text: JSON.stringify(result) }], + }; + }, + ); + } + } + + // Set up resources + if (this.config.resources && this.config.resources.length > 0) { + for (const resource of this.config.resources) { + this.mcpServer.registerResource( + resource.name, + resource.uri, + { + description: resource.description, + mimeType: resource.mimeType, + }, + async () => { + return { + contents: [ + { + uri: resource.uri, + mimeType: resource.mimeType || "text/plain", + text: resource.text || "", + }, + ], + }; + }, + ); + } + } + + // Set up prompts + if (this.config.prompts && this.config.prompts.length > 0) { + for (const prompt of this.config.prompts) { + this.mcpServer.registerPrompt( + prompt.name, + { + description: prompt.description, + argsSchema: prompt.argsSchema, + }, + async (args) => { + // Return a simple prompt response + return { + messages: [ + { + role: "user", + content: { + type: "text", + text: `Prompt: ${prompt.name}${args ? ` with args: ${JSON.stringify(args)}` : ""}`, + }, + }, + ], + }; + }, + ); + } + } + } + + private setupLoggingHandler() { + // Intercept logging/setLevel requests to track the level + this.mcpServer.server.setRequestHandler( + SetLevelRequestSchema, + async (request) => { + this.currentLogLevel = request.params.level; + // Return empty result as per MCP spec + return {}; + }, + ); + } + + /** + * Start the server with the specified transport + */ + async start( + transport: "http" | "sse", + requestedPort?: number, + ): Promise { + const port = requestedPort + ? await findAvailablePort(requestedPort) + : await findAvailablePort(transport === "http" ? 3001 : 3000); + + this.url = `http://localhost:${port}`; + + if (transport === "http") { + return this.startHttp(port); + } else { + return this.startSse(port); + } + } + + private async startHttp(port: number): Promise { + const app = express(); + app.use(express.json()); + + // Create HTTP server + this.httpServer = createHttpServer(app); + + // Create StreamableHTTP transport + this.transport = new StreamableHTTPServerTransport({}); + + // Set up Express route to handle MCP requests + app.post("/mcp", async (req: Request, res: Response) => { + // Capture headers for this request + this.currentRequestHeaders = extractHeaders(req); + + try { + await (this.transport as StreamableHTTPServerTransport).handleRequest( + req, + res, + req.body, + ); + } catch (error) { + res.status(500).json({ + error: error instanceof Error ? error.message : String(error), + }); + } + }); + + // Handle GET requests for SSE stream - return 405 to indicate SSE is not supported + // The StreamableHTTPClientTransport will treat 405 as acceptable and continue without SSE + app.get("/mcp", (req: Request, res: Response) => { + res.status(405).send("Method Not Allowed"); + }); + + // Intercept messages to record them + const originalOnMessage = this.transport.onmessage; + this.transport.onmessage = async (message) => { + const timestamp = Date.now(); + const method = + "method" in message && typeof message.method === "string" + ? message.method + : "unknown"; + const params = "params" in message ? message.params : undefined; + + try { + // Extract metadata from params if present + const metadata = + params && typeof params === "object" && "_meta" in params + ? ((params as any)._meta as Record) + : undefined; + + // Let the server handle the message + if (originalOnMessage) { + await originalOnMessage.call(this.transport, message); + } + + // Record successful request (response will be sent by transport) + // Note: We can't easily capture the response here, so we'll record + // that the request was processed + this.recordedRequests.push({ + method, + params, + headers: { ...this.currentRequestHeaders }, + metadata: metadata ? { ...metadata } : undefined, + response: { processed: true }, + timestamp, + }); + } catch (error) { + // Extract metadata from params if present + const metadata = + params && typeof params === "object" && "_meta" in params + ? ((params as any)._meta as Record) + : undefined; + + // Record error + this.recordedRequests.push({ + method, + params, + headers: { ...this.currentRequestHeaders }, + metadata: metadata ? { ...metadata } : undefined, + response: { + error: error instanceof Error ? error.message : String(error), + }, + timestamp, + }); + throw error; + } + }; + + // Connect transport to server + await this.mcpServer.connect(this.transport); + + // Start listening + return new Promise((resolve, reject) => { + this.httpServer!.listen(port, () => { + resolve(port); + }); + this.httpServer!.on("error", reject); + }); + } + + private async startSse(port: number): Promise { + const app = express(); + app.use(express.json()); + + // Create HTTP server + this.httpServer = createHttpServer(app); + + // For SSE, we need to set up an Express route that creates the transport per request + // This is a simplified version - SSE transport is created per connection + app.get("/mcp", async (req: Request, res: Response) => { + this.currentRequestHeaders = extractHeaders(req); + const sseTransport = new SSEServerTransport("/mcp", res); + + // Intercept messages + const originalOnMessage = sseTransport.onmessage; + sseTransport.onmessage = async (message) => { + const timestamp = Date.now(); + const method = + "method" in message && typeof message.method === "string" + ? message.method + : "unknown"; + const params = "params" in message ? message.params : undefined; + + try { + // Extract metadata from params if present + const metadata = + params && typeof params === "object" && "_meta" in params + ? ((params as any)._meta as Record) + : undefined; + + if (originalOnMessage) { + await originalOnMessage.call(sseTransport, message); + } + + this.recordedRequests.push({ + method, + params, + headers: { ...this.currentRequestHeaders }, + metadata: metadata ? { ...metadata } : undefined, + response: { processed: true }, + timestamp, + }); + } catch (error) { + // Extract metadata from params if present + const metadata = + params && typeof params === "object" && "_meta" in params + ? ((params as any)._meta as Record) + : undefined; + + this.recordedRequests.push({ + method, + params, + headers: { ...this.currentRequestHeaders }, + metadata: metadata ? { ...metadata } : undefined, + response: { + error: error instanceof Error ? error.message : String(error), + }, + timestamp, + }); + throw error; + } + }; + + await this.mcpServer.connect(sseTransport); + await sseTransport.start(); + }); + + // Note: SSE transport is created per request, so we don't store a single instance + this.transport = undefined; + + // Start listening + return new Promise((resolve, reject) => { + this.httpServer!.listen(port, () => { + resolve(port); + }); + this.httpServer!.on("error", reject); + }); + } + + /** + * Stop the server + */ + async stop(): Promise { + await this.mcpServer.close(); + + if (this.transport) { + await this.transport.close(); + this.transport = undefined; + } + + if (this.httpServer) { + return new Promise((resolve) => { + // Force close all connections + this.httpServer!.closeAllConnections?.(); + this.httpServer!.close(() => { + this.httpServer = undefined; + resolve(); + }); + }); + } + } + + /** + * Get all recorded requests + */ + getRecordedRequests(): RecordedRequest[] { + return [...this.recordedRequests]; + } + + /** + * Clear recorded requests + */ + clearRecordings(): void { + this.recordedRequests = []; + } + + /** + * Get the server URL + */ + getUrl(): string { + if (!this.url) { + throw new Error("Server not started"); + } + return this.url; + } + + /** + * Get the most recent log level that was set + */ + getCurrentLogLevel(): string | null { + return this.currentLogLevel; + } +} + +/** + * Create an HTTP/SSE MCP test server + */ +export function createTestServerHttp(config: ServerConfig): TestServerHttp { + return new TestServerHttp(config); +} diff --git a/shared/test/test-server-stdio.ts b/shared/test/test-server-stdio.ts new file mode 100644 index 000000000..b720a21f8 --- /dev/null +++ b/shared/test/test-server-stdio.ts @@ -0,0 +1,241 @@ +#!/usr/bin/env node + +/** + * Test MCP server for stdio transport testing + * Can be used programmatically or run as a standalone executable + */ + +import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; +import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; +import * as z from "zod/v4"; +import path from "path"; +import { fileURLToPath } from "url"; +import { dirname } from "path"; +import type { + ServerConfig, + ToolDefinition, + PromptDefinition, + ResourceDefinition, +} from "./test-server-fixtures.js"; +import { getDefaultServerConfig } from "./test-server-fixtures.js"; + +const __dirname = dirname(fileURLToPath(import.meta.url)); + +export class TestServerStdio { + private mcpServer: McpServer; + private config: ServerConfig; + private transport?: StdioServerTransport; + + constructor(config: ServerConfig) { + this.config = config; + const capabilities: { + tools?: {}; + resources?: {}; + prompts?: {}; + logging?: {}; + } = {}; + + // Only include capabilities for features that are present in config + if (config.tools !== undefined) { + capabilities.tools = {}; + } + if (config.resources !== undefined) { + capabilities.resources = {}; + } + if (config.prompts !== undefined) { + capabilities.prompts = {}; + } + if (config.logging === true) { + capabilities.logging = {}; + } + + this.mcpServer = new McpServer(config.serverInfo, { + capabilities, + }); + + this.setupHandlers(); + } + + private setupHandlers() { + // Set up tools + if (this.config.tools && this.config.tools.length > 0) { + for (const tool of this.config.tools) { + this.mcpServer.registerTool( + tool.name, + { + description: tool.description, + inputSchema: tool.inputSchema, + }, + async (args) => { + const result = await tool.handler(args as Record); + // If handler returns content array directly (like get-annotated-message), use it + if (result && Array.isArray(result.content)) { + return { content: result.content }; + } + // If handler returns message (like echo), format it + if (result && typeof result.message === "string") { + return { + content: [ + { + type: "text", + text: result.message, + }, + ], + }; + } + // Otherwise, stringify the result + return { + content: [ + { + type: "text", + text: JSON.stringify(result), + }, + ], + }; + }, + ); + } + } + + // Set up resources + if (this.config.resources && this.config.resources.length > 0) { + for (const resource of this.config.resources) { + this.mcpServer.registerResource( + resource.name, + resource.uri, + { + description: resource.description, + mimeType: resource.mimeType, + }, + async () => { + // For dynamic resources, get fresh text + let text = resource.text; + if (resource.name === "test-cwd") { + text = process.cwd(); + } else if (resource.name === "test-env") { + text = JSON.stringify(process.env, null, 2); + } else if (resource.name === "test-argv") { + text = JSON.stringify(process.argv, null, 2); + } + + return { + contents: [ + { + uri: resource.uri, + mimeType: resource.mimeType || "text/plain", + text: text || "", + }, + ], + }; + }, + ); + } + } + + // Set up prompts + if (this.config.prompts && this.config.prompts.length > 0) { + for (const prompt of this.config.prompts) { + this.mcpServer.registerPrompt( + prompt.name, + { + description: prompt.description, + argsSchema: prompt.argsSchema, + }, + async (args) => { + if (prompt.name === "args-prompt" && args) { + const city = (args as any).city as string; + const state = (args as any).state as string; + return { + messages: [ + { + role: "user", + content: { + type: "text", + text: `This is a prompt with arguments: city=${city}, state=${state}`, + }, + }, + ], + }; + } else { + return { + messages: [ + { + role: "user", + content: { + type: "text", + text: "This is a simple prompt for testing purposes.", + }, + }, + ], + }; + } + }, + ); + } + } + } + + /** + * Start the server with stdio transport + */ + async start(): Promise { + this.transport = new StdioServerTransport(); + await this.mcpServer.connect(this.transport); + } + + /** + * Stop the server + */ + async stop(): Promise { + await this.mcpServer.close(); + if (this.transport) { + await this.transport.close(); + this.transport = undefined; + } + } +} + +/** + * Create a stdio MCP test server + */ +export function createTestServerStdio(config: ServerConfig): TestServerStdio { + return new TestServerStdio(config); +} + +/** + * Get the path to the test MCP server script + */ +export function getTestMcpServerPath(): string { + return path.resolve(__dirname, "test-server-stdio.ts"); +} + +/** + * Get the command and args to run the test MCP server + */ +export function getTestMcpServerCommand(): { command: string; args: string[] } { + return { + command: "tsx", + args: [getTestMcpServerPath()], + }; +} + +// If run as a standalone script, start with default config +// Check if this file is being executed directly (not imported) +const isMainModule = + import.meta.url.endsWith(process.argv[1]) || + process.argv[1]?.endsWith("test-server-stdio.ts") || + process.argv[1]?.endsWith("test-server-stdio.js"); + +if (isMainModule) { + const server = new TestServerStdio(getDefaultServerConfig()); + server + .start() + .then(() => { + // Server is now running and listening on stdio + // Keep the process alive + }) + .catch((error) => { + console.error("Failed to start test MCP server:", error); + process.exit(1); + }); +} diff --git a/shared/tsconfig.json b/shared/tsconfig.json new file mode 100644 index 000000000..ad92161ff --- /dev/null +++ b/shared/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "outDir": "./build", + "rootDir": ".", + "composite": true, + "declaration": true, + "declarationMap": true, + "sourceMap": true, + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "noUncheckedIndexedAccess": true + }, + "include": ["mcp/**/*.ts", "react/**/*.ts", "react/**/*.tsx", "json/**/*.ts"], + "exclude": ["node_modules", "build"] +} diff --git a/tui/package.json b/tui/package.json new file mode 100644 index 000000000..c4a768a6b --- /dev/null +++ b/tui/package.json @@ -0,0 +1,39 @@ +{ + "name": "@modelcontextprotocol/inspector-tui", + "version": "0.18.0", + "description": "Terminal User Interface (TUI) for the Model Context Protocol inspector", + "license": "MIT", + "author": { + "name": "Bob Dickinson (TeamSpark AI)", + "email": "bob@teamspark.ai" + }, + "homepage": "https://modelcontextprotocol.io", + "bugs": "https://github.com/modelcontextprotocol/inspector/issues", + "type": "module", + "main": "build/tui.js", + "bin": { + "mcp-inspector-tui": "./build/tui.js" + }, + "files": [ + "build" + ], + "scripts": { + "build": "tsc", + "dev": "NODE_PATH=../node_modules:./node_modules:$NODE_PATH tsx tui.tsx" + }, + "dependencies": { + "@modelcontextprotocol/inspector-shared": "*", + "@modelcontextprotocol/sdk": "^1.25.2", + "fullscreen-ink": "^0.1.0", + "ink": "^6.6.0", + "ink-form": "^2.0.1", + "ink-scroll-view": "^0.3.5", + "react": "^19.2.3" + }, + "devDependencies": { + "@types/node": "^25.0.3", + "@types/react": "^19.2.7", + "tsx": "^4.21.0", + "typescript": "^5.9.3" + } +} diff --git a/tui/src/App.tsx b/tui/src/App.tsx new file mode 100644 index 000000000..68499e56a --- /dev/null +++ b/tui/src/App.tsx @@ -0,0 +1,927 @@ +import React, { useState, useMemo, useEffect, useCallback } from "react"; +import { Box, Text, useInput, useApp, type Key } from "ink"; +import { readFileSync } from "fs"; +import { fileURLToPath } from "url"; +import { dirname, join } from "path"; +import type { MessageEntry } from "@modelcontextprotocol/inspector-shared/mcp/index.js"; +import { loadMcpServersConfig } from "@modelcontextprotocol/inspector-shared/mcp/index.js"; +import { InspectorClient } from "@modelcontextprotocol/inspector-shared/mcp/index.js"; +import { useInspectorClient } from "@modelcontextprotocol/inspector-shared/react/useInspectorClient.js"; +import { Tabs, type TabType, tabs as tabList } from "./components/Tabs.js"; +import { InfoTab } from "./components/InfoTab.js"; +import { ResourcesTab } from "./components/ResourcesTab.js"; +import { PromptsTab } from "./components/PromptsTab.js"; +import { ToolsTab } from "./components/ToolsTab.js"; +import { NotificationsTab } from "./components/NotificationsTab.js"; +import { HistoryTab } from "./components/HistoryTab.js"; +import { ToolTestModal } from "./components/ToolTestModal.js"; +import { DetailsModal } from "./components/DetailsModal.js"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +// Read package.json to get project info +// Strategy: Try multiple paths to handle both local dev and global install +// - Local dev (tsx): __dirname = src/, package.json is one level up +// - Global install: __dirname = dist/src/, package.json is two levels up +let packagePath: string; +let packageJson: { name: string; description: string; version: string }; + +try { + // Try two levels up first (global install case) + packagePath = join(__dirname, "..", "..", "package.json"); + packageJson = JSON.parse(readFileSync(packagePath, "utf-8")) as { + name: string; + description: string; + version: string; + }; +} catch { + // Fall back to one level up (local dev case) + packagePath = join(__dirname, "..", "package.json"); + packageJson = JSON.parse(readFileSync(packagePath, "utf-8")) as { + name: string; + description: string; + version: string; + }; +} + +// Focus management types +type FocusArea = + | "serverList" + | "tabs" + // Used by Resources/Prompts/Tools - list pane + | "tabContentList" + // Used by Resources/Prompts/Tools - details pane + | "tabContentDetails" + // Used only when activeTab === 'messages' + | "messagesList" + | "messagesDetail"; + +interface AppProps { + configFile: string; +} + +function App({ configFile }: AppProps) { + const { exit } = useApp(); + + const [selectedServer, setSelectedServer] = useState(null); + const [activeTab, setActiveTab] = useState("info"); + const [focus, setFocus] = useState("serverList"); + const [tabCounts, setTabCounts] = useState<{ + info?: number; + resources?: number; + prompts?: number; + tools?: number; + messages?: number; + logging?: number; + }>({}); + + // Tool test modal state + const [toolTestModal, setToolTestModal] = useState<{ + tool: any; + inspectorClient: InspectorClient | null; + } | null>(null); + + // Details modal state + const [detailsModal, setDetailsModal] = useState<{ + title: string; + content: React.ReactNode; + } | null>(null); + + // InspectorClient instances for each server + const [inspectorClients, setInspectorClients] = useState< + Record + >({}); + const [dimensions, setDimensions] = useState({ + width: process.stdout.columns || 80, + height: process.stdout.rows || 24, + }); + + useEffect(() => { + const updateDimensions = () => { + setDimensions({ + width: process.stdout.columns || 80, + height: process.stdout.rows || 24, + }); + }; + + process.stdout.on("resize", updateDimensions); + return () => { + process.stdout.off("resize", updateDimensions); + }; + }, []); + + // Parse MCP configuration + const mcpConfig = useMemo(() => { + try { + return loadMcpServersConfig(configFile); + } catch (error) { + if (error instanceof Error) { + console.error(error.message); + } else { + console.error("Error loading configuration: Unknown error"); + } + process.exit(1); + } + }, [configFile]); + + const serverNames = Object.keys(mcpConfig.mcpServers); + const selectedServerConfig = selectedServer + ? mcpConfig.mcpServers[selectedServer] + : null; + + // Create InspectorClient instances for each server on mount + useEffect(() => { + const newClients: Record = {}; + for (const serverName of serverNames) { + if (!(serverName in inspectorClients)) { + const serverConfig = mcpConfig.mcpServers[serverName]; + newClients[serverName] = new InspectorClient(serverConfig, { + maxMessages: 1000, + maxStderrLogEvents: 1000, + pipeStderr: true, + }); + } + } + if (Object.keys(newClients).length > 0) { + setInspectorClients((prev) => ({ ...prev, ...newClients })); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + + // Cleanup: disconnect all clients on unmount + useEffect(() => { + return () => { + Object.values(inspectorClients).forEach((client) => { + client.disconnect().catch(() => { + // Ignore errors during cleanup + }); + }); + }; + }, [inspectorClients]); + + // Preselect the first server on mount + useEffect(() => { + if (serverNames.length > 0 && selectedServer === null) { + setSelectedServer(serverNames[0]); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + + // Get InspectorClient for selected server + const selectedInspectorClient = useMemo( + () => (selectedServer ? inspectorClients[selectedServer] : null), + [selectedServer, inspectorClients], + ); + + // Use the hook to get reactive state from InspectorClient + const { + status: inspectorStatus, + messages: inspectorMessages, + stderrLogs: inspectorStderrLogs, + tools: inspectorTools, + resources: inspectorResources, + prompts: inspectorPrompts, + capabilities: inspectorCapabilities, + serverInfo: inspectorServerInfo, + instructions: inspectorInstructions, + client: inspectorClient, + connect: connectInspector, + disconnect: disconnectInspector, + } = useInspectorClient(selectedInspectorClient); + + // Connect handler - InspectorClient now handles fetching server data automatically + const handleConnect = useCallback(async () => { + if (!selectedServer || !selectedInspectorClient) return; + + try { + await connectInspector(); + // InspectorClient automatically fetches server data (capabilities, tools, resources, prompts, etc.) + // on connect, so we don't need to do anything here + } catch (error) { + // Error handling is done by InspectorClient and will be reflected in status + } + }, [selectedServer, selectedInspectorClient, connectInspector]); + + // Disconnect handler + const handleDisconnect = useCallback(async () => { + if (!selectedServer) return; + await disconnectInspector(); + // InspectorClient will update status automatically, and data is preserved + }, [selectedServer, disconnectInspector]); + + // Build current server state from InspectorClient data + const currentServerState = useMemo(() => { + if (!selectedServer) return null; + return { + status: inspectorStatus, + error: null, // InspectorClient doesn't track error in state, only emits error events + capabilities: inspectorCapabilities, + serverInfo: inspectorServerInfo, + instructions: inspectorInstructions, + resources: inspectorResources, + prompts: inspectorPrompts, + tools: inspectorTools, + stderrLogs: inspectorStderrLogs, // InspectorClient manages this + }; + }, [ + selectedServer, + inspectorStatus, + inspectorCapabilities, + inspectorServerInfo, + inspectorInstructions, + inspectorResources, + inspectorPrompts, + inspectorTools, + inspectorStderrLogs, + ]); + + // Helper functions to render details modal content + const renderResourceDetails = (resource: any) => ( + <> + {resource.description && ( + <> + {resource.description.split("\n").map((line: string, idx: number) => ( + + {line} + + ))} + + )} + {resource.uri && ( + + URI: + + {resource.uri} + + + )} + {resource.mimeType && ( + + MIME Type: + + {resource.mimeType} + + + )} + + Full JSON: + + {JSON.stringify(resource, null, 2)} + + + + ); + + const renderPromptDetails = (prompt: any) => ( + <> + {prompt.description && ( + <> + {prompt.description.split("\n").map((line: string, idx: number) => ( + + {line} + + ))} + + )} + {prompt.arguments && prompt.arguments.length > 0 && ( + <> + + Arguments: + + {prompt.arguments.map((arg: any, idx: number) => ( + + + - {arg.name}: {arg.description || arg.type || "string"} + + + ))} + + )} + + Full JSON: + + {JSON.stringify(prompt, null, 2)} + + + + ); + + const renderToolDetails = (tool: any) => ( + <> + {tool.description && ( + <> + {tool.description.split("\n").map((line: string, idx: number) => ( + + {line} + + ))} + + )} + {tool.inputSchema && ( + + Input Schema: + + {JSON.stringify(tool.inputSchema, null, 2)} + + + )} + + Full JSON: + + {JSON.stringify(tool, null, 2)} + + + + ); + + const renderMessageDetails = (message: MessageEntry) => ( + <> + + Direction: {message.direction} + + {message.duration !== undefined && ( + + Duration: {message.duration}ms + + )} + {message.direction === "request" ? ( + <> + + Request: + + {JSON.stringify(message.message, null, 2)} + + + {message.response && ( + + Response: + + + {JSON.stringify(message.response, null, 2)} + + + + )} + + ) : ( + + + {message.direction === "response" ? "Response:" : "Notification:"} + + + {JSON.stringify(message.message, null, 2)} + + + )} + + ); + + // Update tab counts when selected server changes or InspectorClient state changes + // Just reflect InspectorClient state - don't try to be clever + useEffect(() => { + if (!selectedServer) { + return; + } + + setTabCounts({ + resources: inspectorResources.length || 0, + prompts: inspectorPrompts.length || 0, + tools: inspectorTools.length || 0, + messages: inspectorMessages.length || 0, + logging: inspectorStderrLogs.length || 0, + }); + }, [ + selectedServer, + inspectorResources, + inspectorPrompts, + inspectorTools, + inspectorMessages, + inspectorStderrLogs, + ]); + + // Keep focus state consistent when switching tabs + useEffect(() => { + if (activeTab === "messages") { + if (focus === "tabContentList" || focus === "tabContentDetails") { + setFocus("messagesList"); + } + } else { + if (focus === "messagesList" || focus === "messagesDetail") { + setFocus("tabContentList"); + } + } + }, [activeTab]); // intentionally not depending on focus to avoid loops + + // Switch away from logging tab if server is not stdio + useEffect(() => { + if (activeTab === "logging" && selectedServer) { + const client = inspectorClients[selectedServer]; + if (client && client.getServerType() !== "stdio") { + setActiveTab("info"); + } + } + }, [selectedServer, activeTab, inspectorClients]); + + useInput((input: string, key: Key) => { + // Don't process input when modal is open + if (toolTestModal || detailsModal) { + return; + } + + if (key.ctrl && input === "c") { + exit(); + } + + // Exit accelerators + if (key.escape) { + exit(); + } + + // Tab switching with accelerator keys (first character of tab name) + const tabAccelerators: Record = Object.fromEntries( + tabList.map( + (tab: { id: TabType; label: string; accelerator: string }) => [ + tab.accelerator, + tab.id, + ], + ), + ); + if (tabAccelerators[input.toLowerCase()]) { + setActiveTab(tabAccelerators[input.toLowerCase()]); + setFocus("tabs"); + } else if (key.tab && !key.shift) { + // Flat focus order: servers -> tabs -> list -> details -> wrap to servers + const focusOrder: FocusArea[] = + activeTab === "messages" + ? ["serverList", "tabs", "messagesList", "messagesDetail"] + : ["serverList", "tabs", "tabContentList", "tabContentDetails"]; + const currentIndex = focusOrder.indexOf(focus); + const nextIndex = (currentIndex + 1) % focusOrder.length; + setFocus(focusOrder[nextIndex]); + } else if (key.tab && key.shift) { + // Reverse order: servers <- tabs <- list <- details <- wrap to servers + const focusOrder: FocusArea[] = + activeTab === "messages" + ? ["serverList", "tabs", "messagesList", "messagesDetail"] + : ["serverList", "tabs", "tabContentList", "tabContentDetails"]; + const currentIndex = focusOrder.indexOf(focus); + const prevIndex = + currentIndex > 0 ? currentIndex - 1 : focusOrder.length - 1; + setFocus(focusOrder[prevIndex]); + } else if (key.upArrow || key.downArrow) { + // Arrow keys only work in the focused pane + if (focus === "serverList") { + // Arrow key navigation for server list + if (key.upArrow) { + if (selectedServer === null) { + setSelectedServer(serverNames[serverNames.length - 1] || null); + } else { + const currentIndex = serverNames.indexOf(selectedServer); + const newIndex = + currentIndex > 0 ? currentIndex - 1 : serverNames.length - 1; + setSelectedServer(serverNames[newIndex] || null); + } + } else if (key.downArrow) { + if (selectedServer === null) { + setSelectedServer(serverNames[0] || null); + } else { + const currentIndex = serverNames.indexOf(selectedServer); + const newIndex = + currentIndex < serverNames.length - 1 ? currentIndex + 1 : 0; + setSelectedServer(serverNames[newIndex] || null); + } + } + return; // Handled, don't let other handlers process + } + // If focus is on tabs, tabContentList, tabContentDetails, messagesList, or messagesDetail, + // arrow keys will be handled by those components - don't do anything here + } else if (focus === "tabs" && (key.leftArrow || key.rightArrow)) { + // Left/Right arrows switch tabs when tabs are focused + const tabs: TabType[] = [ + "info", + "resources", + "prompts", + "tools", + "messages", + "logging", + ]; + const currentIndex = tabs.indexOf(activeTab); + if (key.leftArrow) { + const newIndex = currentIndex > 0 ? currentIndex - 1 : tabs.length - 1; + setActiveTab(tabs[newIndex]); + } else if (key.rightArrow) { + const newIndex = currentIndex < tabs.length - 1 ? currentIndex + 1 : 0; + setActiveTab(tabs[newIndex]); + } + } + + // Accelerator keys for connect/disconnect (work from anywhere) + if (selectedServer) { + if ( + input.toLowerCase() === "c" && + (inspectorStatus === "disconnected" || inspectorStatus === "error") + ) { + handleConnect(); + } else if ( + input.toLowerCase() === "d" && + (inspectorStatus === "connected" || inspectorStatus === "connecting") + ) { + handleDisconnect(); + } + } + }); + + // Calculate layout dimensions + const headerHeight = 1; + const tabsHeight = 1; + // Server details will be flexible - calculate remaining space for content + const availableHeight = dimensions.height - headerHeight - tabsHeight; + // Reserve space for server details (will grow as needed, but we'll use flexGrow) + const serverDetailsMinHeight = 3; + const contentHeight = availableHeight - serverDetailsMinHeight; + const serverListWidth = Math.floor(dimensions.width * 0.3); + const contentWidth = dimensions.width - serverListWidth; + + const getStatusColor = (status: string) => { + switch (status) { + case "connected": + return "green"; + case "connecting": + return "yellow"; + case "error": + return "red"; + default: + return "gray"; + } + }; + + const getStatusSymbol = (status: string) => { + switch (status) { + case "connected": + return "●"; + case "connecting": + return "◐"; + case "error": + return "✗"; + default: + return "○"; + } + }; + + return ( + + {/* Header row across the top */} + + + + {packageJson.name} + + - {packageJson.description} + + v{packageJson.version} + + + {/* Main content area */} + + {/* Left column - Server list */} + + + + MCP Servers + + + + {serverNames.map((serverName) => { + const isSelected = selectedServer === serverName; + return ( + + + {isSelected ? "▶ " : " "} + {serverName} + + + ); + })} + + + {/* Fixed footer */} + + + ESC to exit + + + + + {/* Right column - Server details, Tabs and content */} + + {/* Server Details - Flexible height */} + + + + + {selectedServer} + + + {currentServerState && ( + <> + + {getStatusSymbol(currentServerState.status)}{" "} + {currentServerState.status} + + + {(currentServerState?.status === "disconnected" || + currentServerState?.status === "error") && ( + + [Connect] + + )} + {(currentServerState?.status === "connected" || + currentServerState?.status === "connecting") && ( + + [Disconnect] + + )} + + )} + + + + + + {/* Tabs */} + + + {/* Tab Content */} + + {activeTab === "info" && ( + + )} + {activeTab === "resources" && + currentServerState?.status === "connected" && + inspectorClient ? ( + + setTabCounts((prev) => ({ ...prev, resources: count })) + } + focusedPane={ + focus === "tabContentDetails" + ? "details" + : focus === "tabContentList" + ? "list" + : null + } + onViewDetails={(resource) => + setDetailsModal({ + title: `Resource: ${resource.name || resource.uri || "Unknown"}`, + content: renderResourceDetails(resource), + }) + } + modalOpen={!!(toolTestModal || detailsModal)} + /> + ) : activeTab === "prompts" && + currentServerState?.status === "connected" && + inspectorClient ? ( + + setTabCounts((prev) => ({ ...prev, prompts: count })) + } + focusedPane={ + focus === "tabContentDetails" + ? "details" + : focus === "tabContentList" + ? "list" + : null + } + onViewDetails={(prompt) => + setDetailsModal({ + title: `Prompt: ${prompt.name || "Unknown"}`, + content: renderPromptDetails(prompt), + }) + } + modalOpen={!!(toolTestModal || detailsModal)} + /> + ) : activeTab === "tools" && + currentServerState?.status === "connected" && + inspectorClient ? ( + + setTabCounts((prev) => ({ ...prev, tools: count })) + } + focusedPane={ + focus === "tabContentDetails" + ? "details" + : focus === "tabContentList" + ? "list" + : null + } + onTestTool={(tool) => + setToolTestModal({ + tool, + inspectorClient: selectedInspectorClient, + }) + } + onViewDetails={(tool) => + setDetailsModal({ + title: `Tool: ${tool.name || "Unknown"}`, + content: renderToolDetails(tool), + }) + } + modalOpen={!!(toolTestModal || detailsModal)} + /> + ) : activeTab === "messages" && selectedInspectorClient ? ( + + setTabCounts((prev) => ({ ...prev, messages: count })) + } + focusedPane={ + focus === "messagesDetail" + ? "details" + : focus === "messagesList" + ? "messages" + : null + } + modalOpen={!!(toolTestModal || detailsModal)} + onViewDetails={(message) => { + const label = + message.direction === "request" && + "method" in message.message + ? message.message.method + : message.direction === "response" + ? "Response" + : message.direction === "notification" && + "method" in message.message + ? message.message.method + : "Message"; + setDetailsModal({ + title: `Message: ${label}`, + content: renderMessageDetails(message), + }); + }} + /> + ) : activeTab === "logging" && selectedInspectorClient ? ( + + setTabCounts((prev) => ({ ...prev, logging: count })) + } + focused={ + focus === "tabContentList" || focus === "tabContentDetails" + } + /> + ) : activeTab !== "info" && selectedServer ? ( + + Server not connected + + ) : null} + + + + + {/* Tool Test Modal - rendered at App level for full screen overlay */} + {toolTestModal && ( + setToolTestModal(null)} + /> + )} + + {/* Details Modal - rendered at App level for full screen overlay */} + {detailsModal && ( + setDetailsModal(null)} + /> + )} + + ); +} + +export default App; diff --git a/tui/src/components/DetailsModal.tsx b/tui/src/components/DetailsModal.tsx new file mode 100644 index 000000000..e01b555d3 --- /dev/null +++ b/tui/src/components/DetailsModal.tsx @@ -0,0 +1,102 @@ +import React, { useRef } from "react"; +import { Box, Text, useInput, type Key } from "ink"; +import { ScrollView, type ScrollViewRef } from "ink-scroll-view"; + +interface DetailsModalProps { + title: string; + content: React.ReactNode; + width: number; + height: number; + onClose: () => void; +} + +export function DetailsModal({ + title, + content, + width, + height, + onClose, +}: DetailsModalProps) { + const scrollViewRef = useRef(null); + + // Use full terminal dimensions + const [terminalDimensions, setTerminalDimensions] = React.useState({ + width: process.stdout.columns || width, + height: process.stdout.rows || height, + }); + + React.useEffect(() => { + const updateDimensions = () => { + setTerminalDimensions({ + width: process.stdout.columns || width, + height: process.stdout.rows || height, + }); + }; + process.stdout.on("resize", updateDimensions); + updateDimensions(); + return () => { + process.stdout.off("resize", updateDimensions); + }; + }, [width, height]); + + // Handle escape to close and scrolling + useInput( + (input: string, key: Key) => { + if (key.escape) { + onClose(); + } else if (key.downArrow) { + scrollViewRef.current?.scrollBy(1); + } else if (key.upArrow) { + scrollViewRef.current?.scrollBy(-1); + } else if (key.pageDown) { + const viewportHeight = scrollViewRef.current?.getViewportHeight() || 1; + scrollViewRef.current?.scrollBy(viewportHeight); + } else if (key.pageUp) { + const viewportHeight = scrollViewRef.current?.getViewportHeight() || 1; + scrollViewRef.current?.scrollBy(-viewportHeight); + } + }, + { isActive: true }, + ); + + // Calculate modal dimensions - use almost full screen + const modalWidth = terminalDimensions.width - 2; + const modalHeight = terminalDimensions.height - 2; + + return ( + + {/* Modal Content */} + + {/* Header */} + + + {title} + + + (Press ESC to close) + + + {/* Content Area */} + + {content} + + + + ); +} diff --git a/tui/src/components/HistoryTab.tsx b/tui/src/components/HistoryTab.tsx new file mode 100644 index 000000000..899eb1323 --- /dev/null +++ b/tui/src/components/HistoryTab.tsx @@ -0,0 +1,356 @@ +import React, { useState, useMemo, useEffect, useRef } from "react"; +import { Box, Text, useInput, type Key } from "ink"; +import { ScrollView, type ScrollViewRef } from "ink-scroll-view"; +import type { MessageEntry } from "@modelcontextprotocol/inspector-shared/mcp/index.js"; + +interface HistoryTabProps { + serverName: string | null; + messages: MessageEntry[]; + width: number; + height: number; + onCountChange?: (count: number) => void; + focusedPane?: "messages" | "details" | null; + onViewDetails?: (message: MessageEntry) => void; + modalOpen?: boolean; +} + +export function HistoryTab({ + serverName, + messages, + width, + height, + onCountChange, + focusedPane = null, + onViewDetails, + modalOpen = false, +}: HistoryTabProps) { + const [selectedIndex, setSelectedIndex] = useState(0); + const [leftScrollOffset, setLeftScrollOffset] = useState(0); + const scrollViewRef = useRef(null); + + // Calculate visible area for left pane (accounting for header) + const leftPaneHeight = height - 2; // Subtract header space + const visibleMessages = messages.slice( + leftScrollOffset, + leftScrollOffset + leftPaneHeight, + ); + + const selectedMessage = messages[selectedIndex] || null; + + // Handle arrow key navigation and scrolling when focused + useInput( + (input: string, key: Key) => { + if (focusedPane === "messages") { + if (key.upArrow) { + if (selectedIndex > 0) { + const newIndex = selectedIndex - 1; + setSelectedIndex(newIndex); + // Auto-scroll if selection goes above visible area + if (newIndex < leftScrollOffset) { + setLeftScrollOffset(newIndex); + } + } + } else if (key.downArrow) { + if (selectedIndex < messages.length - 1) { + const newIndex = selectedIndex + 1; + setSelectedIndex(newIndex); + // Auto-scroll if selection goes below visible area + if (newIndex >= leftScrollOffset + leftPaneHeight) { + setLeftScrollOffset(Math.max(0, newIndex - leftPaneHeight + 1)); + } + } + } else if (key.pageUp) { + setLeftScrollOffset(Math.max(0, leftScrollOffset - leftPaneHeight)); + setSelectedIndex(Math.max(0, selectedIndex - leftPaneHeight)); + } else if (key.pageDown) { + const maxScroll = Math.max(0, messages.length - leftPaneHeight); + setLeftScrollOffset( + Math.min(maxScroll, leftScrollOffset + leftPaneHeight), + ); + setSelectedIndex( + Math.min(messages.length - 1, selectedIndex + leftPaneHeight), + ); + } + return; + } + + // details scrolling (only when details pane is focused) + if (focusedPane === "details") { + // Handle '+' key to view in full screen modal + if (input === "+" && selectedMessage && onViewDetails) { + onViewDetails(selectedMessage); + return; + } + + if (key.upArrow) { + scrollViewRef.current?.scrollBy(-1); + } else if (key.downArrow) { + scrollViewRef.current?.scrollBy(1); + } else if (key.pageUp) { + const viewportHeight = + scrollViewRef.current?.getViewportHeight() || 1; + scrollViewRef.current?.scrollBy(-viewportHeight); + } else if (key.pageDown) { + const viewportHeight = + scrollViewRef.current?.getViewportHeight() || 1; + scrollViewRef.current?.scrollBy(viewportHeight); + } + } + }, + { isActive: !modalOpen && focusedPane !== undefined }, + ); + + // Update count when messages change + React.useEffect(() => { + onCountChange?.(messages.length); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [messages.length]); + + // Reset selection when messages change + useEffect(() => { + if (selectedIndex >= messages.length) { + setSelectedIndex(Math.max(0, messages.length - 1)); + } + }, [messages.length, selectedIndex]); + + // Reset scroll when message selection changes + useEffect(() => { + scrollViewRef.current?.scrollTo(0); + }, [selectedIndex]); + + const listWidth = Math.floor(width * 0.4); + const detailWidth = width - listWidth; + + return ( + + {/* Left column - Messages list */} + + + + Messages ({messages.length}) + + + + {/* Messages list */} + {messages.length === 0 ? ( + + No messages + + ) : ( + + {visibleMessages.map((msg, visibleIndex) => { + const actualIndex = leftScrollOffset + visibleIndex; + const isSelected = actualIndex === selectedIndex; + let label: string; + if (msg.direction === "request" && "method" in msg.message) { + label = msg.message.method; + } else if (msg.direction === "response") { + if ("result" in msg.message) { + label = "Response (result)"; + } else if ("error" in msg.message) { + label = `Response (error: ${msg.message.error.code})`; + } else { + label = "Response"; + } + } else if ( + msg.direction === "notification" && + "method" in msg.message + ) { + label = msg.message.method; + } else { + label = "Unknown"; + } + const direction = + msg.direction === "request" + ? "→" + : msg.direction === "response" + ? "←" + : "•"; + const hasResponse = msg.response !== undefined; + + return ( + + + {isSelected ? "▶ " : " "} + {direction} {label} + {hasResponse + ? " ✓" + : msg.direction === "request" + ? " ..." + : ""} + + + ); + })} + + )} + + + {/* Right column - Message details */} + + {selectedMessage ? ( + <> + {/* Fixed method caption only */} + + + {selectedMessage.direction === "request" && + "method" in selectedMessage.message + ? selectedMessage.message.method + : selectedMessage.direction === "response" + ? "Response" + : selectedMessage.direction === "notification" && + "method" in selectedMessage.message + ? selectedMessage.message.method + : "Message"} + + + {selectedMessage.timestamp.toLocaleTimeString()} + + + + {/* Scrollable content area */} + + {/* Metadata */} + + Direction: {selectedMessage.direction} + {selectedMessage.duration !== undefined && ( + + Duration: {selectedMessage.duration}ms + + )} + + + {selectedMessage.direction === "request" ? ( + <> + {/* Request label */} + + Request: + + + {/* Request content */} + {JSON.stringify(selectedMessage.message, null, 2) + .split("\n") + .map((line: string, idx: number) => ( + + {line} + + ))} + + {/* Response section */} + {selectedMessage.response ? ( + <> + + Response: + + {JSON.stringify(selectedMessage.response, null, 2) + .split("\n") + .map((line: string, idx: number) => ( + + {line} + + ))} + + ) : ( + + + Waiting for response... + + + )} + + ) : ( + <> + {/* Response or notification label */} + + + {selectedMessage.direction === "response" + ? "Response:" + : "Notification:"} + + + + {/* Message content */} + {JSON.stringify(selectedMessage.message, null, 2) + .split("\n") + .map((line: string, idx: number) => ( + + {line} + + ))} + + )} + + + {/* Fixed footer - only show when details pane is focused */} + {focusedPane === "details" && ( + + + ↑/↓ to scroll, + to zoom + + + )} + + ) : ( + + Select a message to view details + + )} + + + ); +} diff --git a/tui/src/components/InfoTab.tsx b/tui/src/components/InfoTab.tsx new file mode 100644 index 000000000..381324643 --- /dev/null +++ b/tui/src/components/InfoTab.tsx @@ -0,0 +1,233 @@ +import React, { useRef } from "react"; +import { Box, Text, useInput, type Key } from "ink"; +import { ScrollView, type ScrollViewRef } from "ink-scroll-view"; +import type { + MCPServerConfig, + ServerState, +} from "@modelcontextprotocol/inspector-shared/mcp/index.js"; + +interface InfoTabProps { + serverName: string | null; + serverConfig: MCPServerConfig | null; + serverState: ServerState | null; + width: number; + height: number; + focused?: boolean; +} + +export function InfoTab({ + serverName, + serverConfig, + serverState, + width, + height, + focused = false, +}: InfoTabProps) { + const scrollViewRef = useRef(null); + + // Handle keyboard input for scrolling + useInput( + (input: string, key: Key) => { + if (focused) { + if (key.upArrow) { + scrollViewRef.current?.scrollBy(-1); + } else if (key.downArrow) { + scrollViewRef.current?.scrollBy(1); + } else if (key.pageUp) { + const viewportHeight = + scrollViewRef.current?.getViewportHeight() || 1; + scrollViewRef.current?.scrollBy(-viewportHeight); + } else if (key.pageDown) { + const viewportHeight = + scrollViewRef.current?.getViewportHeight() || 1; + scrollViewRef.current?.scrollBy(viewportHeight); + } + } + }, + { isActive: focused }, + ); + + return ( + + + + Info + + + + {serverName ? ( + <> + {/* Scrollable content area - takes remaining space */} + + + {/* Server Configuration */} + + Server Configuration + + {serverConfig ? ( + + {serverConfig.type === undefined || + serverConfig.type === "stdio" ? ( + <> + Type: stdio + + Command: {(serverConfig as any).command} + + {(serverConfig as any).args && + (serverConfig as any).args.length > 0 && ( + + Args: + {(serverConfig as any).args.map( + (arg: string, idx: number) => ( + + {arg} + + ), + )} + + )} + {(serverConfig as any).env && + Object.keys((serverConfig as any).env).length > 0 && ( + + + Env:{" "} + {Object.entries((serverConfig as any).env) + .map(([k, v]) => `${k}=${v}`) + .join(", ")} + + + )} + {(serverConfig as any).cwd && ( + + CWD: {(serverConfig as any).cwd} + + )} + + ) : serverConfig.type === "sse" ? ( + <> + Type: sse + URL: {(serverConfig as any).url} + {(serverConfig as any).headers && + Object.keys((serverConfig as any).headers).length > + 0 && ( + + + Headers:{" "} + {Object.entries((serverConfig as any).headers) + .map(([k, v]) => `${k}=${v}`) + .join(", ")} + + + )} + + ) : ( + <> + Type: streamable-http + URL: {(serverConfig as any).url} + {(serverConfig as any).headers && + Object.keys((serverConfig as any).headers).length > + 0 && ( + + + Headers:{" "} + {Object.entries((serverConfig as any).headers) + .map(([k, v]) => `${k}=${v}`) + .join(", ")} + + + )} + + )} + + ) : ( + + No configuration available + + )} + + {/* Server Info */} + {serverState && + serverState.status === "connected" && + serverState.serverInfo && ( + <> + + Server Information + + + {serverState.serverInfo.name && ( + + Name: {serverState.serverInfo.name} + + )} + {serverState.serverInfo.version && ( + + + Version: {serverState.serverInfo.version} + + + )} + {serverState.instructions && ( + + Instructions: + + {serverState.instructions} + + + )} + + + )} + + {serverState && serverState.status === "error" && ( + + + Error + + {serverState.error && ( + + {serverState.error} + + )} + + )} + + {serverState && serverState.status === "disconnected" && ( + + Server not connected + + )} + + + + {/* Fixed keyboard help footer at bottom - only show when focused */} + {focused && ( + + + ↑/↓ to scroll, + to zoom + + + )} + + ) : null} + + ); +} diff --git a/tui/src/components/NotificationsTab.tsx b/tui/src/components/NotificationsTab.tsx new file mode 100644 index 000000000..f25de1b24 --- /dev/null +++ b/tui/src/components/NotificationsTab.tsx @@ -0,0 +1,87 @@ +import React, { useEffect, useRef } from "react"; +import { Box, Text, useInput, type Key } from "ink"; +import { ScrollView, type ScrollViewRef } from "ink-scroll-view"; +import type { Client } from "@modelcontextprotocol/sdk/client/index.js"; +import type { StderrLogEntry } from "@modelcontextprotocol/inspector-shared/mcp/index.js"; + +interface NotificationsTabProps { + client: Client | null; + stderrLogs: StderrLogEntry[]; + width: number; + height: number; + onCountChange?: (count: number) => void; + focused?: boolean; +} + +export function NotificationsTab({ + client, + stderrLogs, + width, + height, + onCountChange, + focused = false, +}: NotificationsTabProps) { + const scrollViewRef = useRef(null); + const onCountChangeRef = useRef(onCountChange); + + // Update ref when callback changes + useEffect(() => { + onCountChangeRef.current = onCountChange; + }, [onCountChange]); + + useEffect(() => { + onCountChangeRef.current?.(stderrLogs.length); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [stderrLogs.length]); + + // Handle keyboard input for scrolling + useInput( + (input: string, key: Key) => { + if (focused) { + if (key.upArrow) { + scrollViewRef.current?.scrollBy(-1); + } else if (key.downArrow) { + scrollViewRef.current?.scrollBy(1); + } else if (key.pageUp) { + const viewportHeight = + scrollViewRef.current?.getViewportHeight() || 1; + scrollViewRef.current?.scrollBy(-viewportHeight); + } else if (key.pageDown) { + const viewportHeight = + scrollViewRef.current?.getViewportHeight() || 1; + scrollViewRef.current?.scrollBy(viewportHeight); + } + } + }, + { isActive: focused }, + ); + + return ( + + + + Logging ({stderrLogs.length}) + + + {stderrLogs.length === 0 ? ( + + No stderr output yet + + ) : ( + + {stderrLogs.map((log, index) => ( + + [{log.timestamp.toLocaleTimeString()}] + {log.message} + + ))} + + )} + + ); +} diff --git a/tui/src/components/PromptsTab.tsx b/tui/src/components/PromptsTab.tsx new file mode 100644 index 000000000..5a2180ae6 --- /dev/null +++ b/tui/src/components/PromptsTab.tsx @@ -0,0 +1,223 @@ +import React, { useState, useEffect, useRef } from "react"; +import { Box, Text, useInput, type Key } from "ink"; +import { ScrollView, type ScrollViewRef } from "ink-scroll-view"; +import type { Client } from "@modelcontextprotocol/sdk/client/index.js"; + +interface PromptsTabProps { + prompts: any[]; + client: Client | null; + width: number; + height: number; + onCountChange?: (count: number) => void; + focusedPane?: "list" | "details" | null; + onViewDetails?: (prompt: any) => void; + modalOpen?: boolean; +} + +export function PromptsTab({ + prompts, + client, + width, + height, + onCountChange, + focusedPane = null, + onViewDetails, + modalOpen = false, +}: PromptsTabProps) { + const [selectedIndex, setSelectedIndex] = useState(0); + const [error, setError] = useState(null); + const scrollViewRef = useRef(null); + + // Handle arrow key navigation when focused + useInput( + (input: string, key: Key) => { + if (focusedPane === "list") { + // Navigate the list + if (key.upArrow && selectedIndex > 0) { + setSelectedIndex(selectedIndex - 1); + } else if (key.downArrow && selectedIndex < prompts.length - 1) { + setSelectedIndex(selectedIndex + 1); + } + return; + } + + if (focusedPane === "details") { + // Handle '+' key to view in full screen modal + if (input === "+" && selectedPrompt && onViewDetails) { + onViewDetails(selectedPrompt); + return; + } + + // Scroll the details pane using ink-scroll-view + if (key.upArrow) { + scrollViewRef.current?.scrollBy(-1); + } else if (key.downArrow) { + scrollViewRef.current?.scrollBy(1); + } else if (key.pageUp) { + const viewportHeight = + scrollViewRef.current?.getViewportHeight() || 1; + scrollViewRef.current?.scrollBy(-viewportHeight); + } else if (key.pageDown) { + const viewportHeight = + scrollViewRef.current?.getViewportHeight() || 1; + scrollViewRef.current?.scrollBy(viewportHeight); + } + } + }, + { + isActive: + !modalOpen && (focusedPane === "list" || focusedPane === "details"), + }, + ); + + // Reset scroll when selection changes + useEffect(() => { + scrollViewRef.current?.scrollTo(0); + }, [selectedIndex]); + + // Reset selected index when prompts array changes (different server) + useEffect(() => { + setSelectedIndex(0); + }, [prompts]); + + const selectedPrompt = prompts[selectedIndex] || null; + + const listWidth = Math.floor(width * 0.4); + const detailWidth = width - listWidth; + + return ( + + {/* Prompts List */} + + + + Prompts ({prompts.length}) + + + {error ? ( + + {error} + + ) : prompts.length === 0 ? ( + + No prompts available + + ) : ( + + {prompts.map((prompt, index) => { + const isSelected = index === selectedIndex; + return ( + + + {isSelected ? "▶ " : " "} + {prompt.name || `Prompt ${index + 1}`} + + + ); + })} + + )} + + + {/* Prompt Details */} + + {selectedPrompt ? ( + <> + {/* Fixed header */} + + + {selectedPrompt.name} + + + + {/* Scrollable content area - direct ScrollView with height prop like NotificationsTab */} + + {/* Description */} + {selectedPrompt.description && ( + <> + {selectedPrompt.description + .split("\n") + .map((line: string, idx: number) => ( + + {line} + + ))} + + )} + + {/* Arguments */} + {selectedPrompt.arguments && + selectedPrompt.arguments.length > 0 && ( + <> + + Arguments: + + {selectedPrompt.arguments.map((arg: any, idx: number) => ( + + + - {arg.name}:{" "} + {arg.description || arg.type || "string"} + + + ))} + + )} + + + {/* Fixed footer - only show when details pane is focused */} + {focusedPane === "details" && ( + + + ↑/↓ to scroll, + to zoom + + + )} + + ) : ( + + Select a prompt to view details + + )} + + + ); +} diff --git a/tui/src/components/ResourcesTab.tsx b/tui/src/components/ResourcesTab.tsx new file mode 100644 index 000000000..28f3f15c4 --- /dev/null +++ b/tui/src/components/ResourcesTab.tsx @@ -0,0 +1,214 @@ +import React, { useState, useEffect, useRef } from "react"; +import { Box, Text, useInput, type Key } from "ink"; +import { ScrollView, type ScrollViewRef } from "ink-scroll-view"; +import type { Client } from "@modelcontextprotocol/sdk/client/index.js"; + +interface ResourcesTabProps { + resources: any[]; + client: Client | null; + width: number; + height: number; + onCountChange?: (count: number) => void; + focusedPane?: "list" | "details" | null; + onViewDetails?: (resource: any) => void; + modalOpen?: boolean; +} + +export function ResourcesTab({ + resources, + client, + width, + height, + onCountChange, + focusedPane = null, + onViewDetails, + modalOpen = false, +}: ResourcesTabProps) { + const [selectedIndex, setSelectedIndex] = useState(0); + const [error, setError] = useState(null); + const scrollViewRef = useRef(null); + + // Handle arrow key navigation when focused + useInput( + (input: string, key: Key) => { + if (focusedPane === "list") { + // Navigate the list + if (key.upArrow && selectedIndex > 0) { + setSelectedIndex(selectedIndex - 1); + } else if (key.downArrow && selectedIndex < resources.length - 1) { + setSelectedIndex(selectedIndex + 1); + } + return; + } + + if (focusedPane === "details") { + // Handle '+' key to view in full screen modal + if (input === "+" && selectedResource && onViewDetails) { + onViewDetails(selectedResource); + return; + } + + // Scroll the details pane using ink-scroll-view + if (key.upArrow) { + scrollViewRef.current?.scrollBy(-1); + } else if (key.downArrow) { + scrollViewRef.current?.scrollBy(1); + } else if (key.pageUp) { + const viewportHeight = + scrollViewRef.current?.getViewportHeight() || 1; + scrollViewRef.current?.scrollBy(-viewportHeight); + } else if (key.pageDown) { + const viewportHeight = + scrollViewRef.current?.getViewportHeight() || 1; + scrollViewRef.current?.scrollBy(viewportHeight); + } + } + }, + { + isActive: + !modalOpen && (focusedPane === "list" || focusedPane === "details"), + }, + ); + + // Reset scroll when selection changes + useEffect(() => { + scrollViewRef.current?.scrollTo(0); + }, [selectedIndex]); + + // Reset selected index when resources array changes (different server) + useEffect(() => { + setSelectedIndex(0); + }, [resources]); + + const selectedResource = resources[selectedIndex] || null; + + const listWidth = Math.floor(width * 0.4); + const detailWidth = width - listWidth; + + return ( + + {/* Resources List */} + + + + Resources ({resources.length}) + + + {error ? ( + + {error} + + ) : resources.length === 0 ? ( + + No resources available + + ) : ( + + {resources.map((resource, index) => { + const isSelected = index === selectedIndex; + return ( + + + {isSelected ? "▶ " : " "} + {resource.name || resource.uri || `Resource ${index + 1}`} + + + ); + })} + + )} + + + {/* Resource Details */} + + {selectedResource ? ( + <> + {/* Fixed header */} + + + {selectedResource.name || selectedResource.uri} + + + + {/* Scrollable content area - direct ScrollView with height prop like NotificationsTab */} + + {/* Description */} + {selectedResource.description && ( + <> + {selectedResource.description + .split("\n") + .map((line: string, idx: number) => ( + + {line} + + ))} + + )} + + {/* URI */} + {selectedResource.uri && ( + + URI: {selectedResource.uri} + + )} + + {/* MIME Type */} + {selectedResource.mimeType && ( + + MIME Type: {selectedResource.mimeType} + + )} + + + {/* Fixed footer - only show when details pane is focused */} + {focusedPane === "details" && ( + + + ↑/↓ to scroll, + to zoom + + + )} + + ) : ( + + Select a resource to view details + + )} + + + ); +} diff --git a/tui/src/components/Tabs.tsx b/tui/src/components/Tabs.tsx new file mode 100644 index 000000000..681037221 --- /dev/null +++ b/tui/src/components/Tabs.tsx @@ -0,0 +1,88 @@ +import React from "react"; +import { Box, Text } from "ink"; + +export type TabType = + | "info" + | "resources" + | "prompts" + | "tools" + | "messages" + | "logging"; + +interface TabsProps { + activeTab: TabType; + onTabChange: (tab: TabType) => void; + width: number; + counts?: { + info?: number; + resources?: number; + prompts?: number; + tools?: number; + messages?: number; + logging?: number; + }; + focused?: boolean; + showLogging?: boolean; +} + +export const tabs: { id: TabType; label: string; accelerator: string }[] = [ + { id: "info", label: "Info", accelerator: "i" }, + { id: "resources", label: "Resources", accelerator: "r" }, + { id: "prompts", label: "Prompts", accelerator: "p" }, + { id: "tools", label: "Tools", accelerator: "t" }, + { id: "messages", label: "Messages", accelerator: "m" }, + { id: "logging", label: "Logging", accelerator: "l" }, +]; + +export function Tabs({ + activeTab, + onTabChange, + width, + counts = {}, + focused = false, + showLogging = true, +}: TabsProps) { + const visibleTabs = showLogging + ? tabs + : tabs.filter((tab) => tab.id !== "logging"); + + return ( + + {visibleTabs.map((tab) => { + const isActive = activeTab === tab.id; + const count = counts[tab.id]; + const countText = count !== undefined ? ` (${count})` : ""; + const firstChar = tab.label[0]; + const restOfLabel = tab.label.slice(1); + + return ( + + + {isActive ? "▶ " : " "} + {firstChar} + {restOfLabel} + {countText} + + + ); + })} + + ); +} diff --git a/tui/src/components/ToolTestModal.tsx b/tui/src/components/ToolTestModal.tsx new file mode 100644 index 000000000..7f08304ee --- /dev/null +++ b/tui/src/components/ToolTestModal.tsx @@ -0,0 +1,269 @@ +import React, { useState, useEffect } from "react"; +import { Box, Text, useInput, type Key } from "ink"; +import { Form } from "ink-form"; +import { InspectorClient } from "@modelcontextprotocol/inspector-shared/mcp/index.js"; +import { schemaToForm } from "../utils/schemaToForm.js"; +import { ScrollView, type ScrollViewRef } from "ink-scroll-view"; + +interface ToolTestModalProps { + tool: any; + inspectorClient: InspectorClient | null; + width: number; + height: number; + onClose: () => void; +} + +type ModalState = "form" | "loading" | "results"; + +interface ToolResult { + input: any; + output: any; + error?: string; + errorDetails?: any; + duration: number; +} + +export function ToolTestModal({ + tool, + inspectorClient, + width, + height, + onClose, +}: ToolTestModalProps) { + const [state, setState] = useState("form"); + const [result, setResult] = useState(null); + const scrollViewRef = React.useRef(null); + + // Use full terminal dimensions instead of passed dimensions + const [terminalDimensions, setTerminalDimensions] = React.useState({ + width: process.stdout.columns || width, + height: process.stdout.rows || height, + }); + + React.useEffect(() => { + const updateDimensions = () => { + setTerminalDimensions({ + width: process.stdout.columns || width, + height: process.stdout.rows || height, + }); + }; + process.stdout.on("resize", updateDimensions); + updateDimensions(); + return () => { + process.stdout.off("resize", updateDimensions); + }; + }, [width, height]); + + const formStructure = tool?.inputSchema + ? schemaToForm(tool.inputSchema, tool.name || "Unknown Tool") + : { + title: `Test Tool: ${tool?.name || "Unknown"}`, + sections: [{ title: "Parameters", fields: [] }], + }; + + // Reset state when modal closes + React.useEffect(() => { + return () => { + // Cleanup: reset state when component unmounts + setState("form"); + setResult(null); + }; + }, []); + + // Handle all input when modal is open - prevents input from reaching underlying components + // When in form mode, only handle escape (form handles its own input) + // When in results mode, handle scrolling keys + useInput( + (input: string, key: Key) => { + // Always handle escape to close modal + if (key.escape) { + setState("form"); + setResult(null); + onClose(); + return; + } + + if (state === "form") { + // In form mode, let the form handle all other input + // Don't process anything else - this prevents input from reaching underlying components + return; + } + + if (state === "results") { + // Allow scrolling in results view + if (key.downArrow) { + scrollViewRef.current?.scrollBy(1); + } else if (key.upArrow) { + scrollViewRef.current?.scrollBy(-1); + } else if (key.pageDown) { + const viewportHeight = + scrollViewRef.current?.getViewportHeight() || 1; + scrollViewRef.current?.scrollBy(viewportHeight); + } else if (key.pageUp) { + const viewportHeight = + scrollViewRef.current?.getViewportHeight() || 1; + scrollViewRef.current?.scrollBy(-viewportHeight); + } + } + }, + { isActive: true }, + ); + + const handleFormSubmit = async (values: Record) => { + if (!inspectorClient || !tool) return; + + setState("loading"); + const startTime = Date.now(); + + try { + // Use InspectorClient.callTool() which handles parameter conversion and metadata + const response = await inspectorClient.callTool(tool.name, values); + + const duration = Date.now() - startTime; + + // InspectorClient.callTool() returns Record + // Check for error indicators in the response + const isError = "isError" in response && response.isError === true; + const output = isError + ? { error: true, content: response.content } + : response.structuredContent || response.content || response; + + setResult({ + input: values, + output: isError ? null : output, + error: isError ? "Tool returned an error" : undefined, + errorDetails: isError ? output : undefined, + duration, + }); + setState("results"); + } catch (error) { + const duration = Date.now() - startTime; + const errorObj = + error instanceof Error + ? { message: error.message, name: error.name, stack: error.stack } + : { error: String(error) }; + + setResult({ + input: values, + output: null, + error: error instanceof Error ? error.message : "Unknown error", + errorDetails: errorObj, + duration, + }); + setState("results"); + } + }; + + // Calculate modal dimensions - use almost full screen + const modalWidth = terminalDimensions.width - 2; + const modalHeight = terminalDimensions.height - 2; + + return ( + + {/* Modal Content */} + + {/* Header */} + + + {formStructure.title} + + + (Press ESC to close) + + + {/* Content Area */} + + {state === "form" && ( + +
+ + )} + + {state === "loading" && ( + + Calling tool... + + )} + + {state === "results" && result && ( + + + {/* Timing */} + + + Duration: {result.duration}ms + + + + {/* Input */} + + + Input: + + + + {JSON.stringify(result.input, null, 2)} + + + + + {/* Output or Error */} + {result.error ? ( + + + Error: + + + {result.error} + + {result.errorDetails && ( + <> + + + Error Details: + + + + + {JSON.stringify(result.errorDetails, null, 2)} + + + + )} + + ) : ( + + + Output: + + + + {JSON.stringify(result.output, null, 2)} + + + + )} + + + )} + + + + ); +} diff --git a/tui/src/components/ToolsTab.tsx b/tui/src/components/ToolsTab.tsx new file mode 100644 index 000000000..cb8da53d5 --- /dev/null +++ b/tui/src/components/ToolsTab.tsx @@ -0,0 +1,252 @@ +import React, { useState, useEffect, useRef } from "react"; +import { Box, Text, useInput, type Key } from "ink"; +import { ScrollView, type ScrollViewRef } from "ink-scroll-view"; +import type { Client } from "@modelcontextprotocol/sdk/client/index.js"; + +interface ToolsTabProps { + tools: any[]; + client: Client | null; + width: number; + height: number; + onCountChange?: (count: number) => void; + focusedPane?: "list" | "details" | null; + onTestTool?: (tool: any) => void; + onViewDetails?: (tool: any) => void; + modalOpen?: boolean; +} + +export function ToolsTab({ + tools, + client, + width, + height, + onCountChange, + focusedPane = null, + onTestTool, + onViewDetails, + modalOpen = false, +}: ToolsTabProps) { + const [selectedIndex, setSelectedIndex] = useState(0); + const [error, setError] = useState(null); + const scrollViewRef = useRef(null); + + const listWidth = Math.floor(width * 0.4); + const detailWidth = width - listWidth; + + // Handle arrow key navigation when focused + useInput( + (input: string, key: Key) => { + // Handle Enter key to test tool (works from both list and details) + if (key.return && selectedTool && client && onTestTool) { + onTestTool(selectedTool); + return; + } + + if (focusedPane === "list") { + // Navigate the list + if (key.upArrow && selectedIndex > 0) { + setSelectedIndex(selectedIndex - 1); + } else if (key.downArrow && selectedIndex < tools.length - 1) { + setSelectedIndex(selectedIndex + 1); + } + return; + } + + if (focusedPane === "details") { + // Handle '+' key to view in full screen modal + if (input === "+" && selectedTool && onViewDetails) { + onViewDetails(selectedTool); + return; + } + + // Scroll the details pane using ink-scroll-view + if (key.upArrow) { + scrollViewRef.current?.scrollBy(-1); + } else if (key.downArrow) { + scrollViewRef.current?.scrollBy(1); + } else if (key.pageUp) { + const viewportHeight = + scrollViewRef.current?.getViewportHeight() || 1; + scrollViewRef.current?.scrollBy(-viewportHeight); + } else if (key.pageDown) { + const viewportHeight = + scrollViewRef.current?.getViewportHeight() || 1; + scrollViewRef.current?.scrollBy(viewportHeight); + } + } + }, + { + isActive: + !modalOpen && (focusedPane === "list" || focusedPane === "details"), + }, + ); + + // Helper to calculate content lines for a tool + const calculateToolContentLines = (tool: any): number => { + let lines = 1; // Name + if (tool.description) lines += tool.description.split("\n").length + 1; + if (tool.inputSchema) { + const schemaStr = JSON.stringify(tool.inputSchema, null, 2); + lines += schemaStr.split("\n").length + 2; // +2 for "Input Schema:" label + } + return lines; + }; + + // Reset scroll when selection changes + useEffect(() => { + scrollViewRef.current?.scrollTo(0); + }, [selectedIndex]); + + // Reset selected index when tools array changes (different server) + useEffect(() => { + setSelectedIndex(0); + }, [tools]); + + const selectedTool = tools[selectedIndex] || null; + + return ( + + {/* Tools List */} + + + + Tools ({tools.length}) + + + {error ? ( + + {error} + + ) : tools.length === 0 ? ( + + No tools available + + ) : ( + + {tools.map((tool, index) => { + const isSelected = index === selectedIndex; + return ( + + + {isSelected ? "▶ " : " "} + {tool.name || `Tool ${index + 1}`} + + + ); + })} + + )} + + + {/* Tool Details */} + + {selectedTool ? ( + <> + {/* Fixed header */} + + + {selectedTool.name} + + {client && ( + + + [Enter to Test] + + + )} + + + {/* Scrollable content area - direct ScrollView with height prop like NotificationsTab */} + + {/* Description */} + {selectedTool.description && ( + <> + {selectedTool.description + .split("\n") + .map((line: string, idx: number) => ( + + {line} + + ))} + + )} + + {/* Input Schema */} + {selectedTool.inputSchema && ( + <> + + Input Schema: + + {JSON.stringify(selectedTool.inputSchema, null, 2) + .split("\n") + .map((line: string, idx: number) => ( + + {line} + + ))} + + )} + + + {/* Fixed footer - only show when details pane is focused */} + {focusedPane === "details" && ( + + + ↑/↓ to scroll, + to zoom + + + )} + + ) : ( + + Select a tool to view details + + )} + + + ); +} diff --git a/tui/src/utils/schemaToForm.ts b/tui/src/utils/schemaToForm.ts new file mode 100644 index 000000000..245ae2ab7 --- /dev/null +++ b/tui/src/utils/schemaToForm.ts @@ -0,0 +1,116 @@ +/** + * Converts JSON Schema to ink-form format + */ + +import type { FormStructure, FormSection, FormField } from "ink-form"; + +/** + * Converts a JSON Schema to ink-form structure + */ +export function schemaToForm(schema: any, toolName: string): FormStructure { + const fields: FormField[] = []; + + if (!schema || !schema.properties) { + return { + title: `Test Tool: ${toolName}`, + sections: [{ title: "Parameters", fields: [] }], + }; + } + + const properties = schema.properties || {}; + const required = schema.required || []; + + for (const [key, prop] of Object.entries(properties)) { + const property = prop as any; + const baseField = { + name: key, + label: property.title || key, + required: required.includes(key), + }; + + let field: FormField; + + // Handle enum -> select + if (property.enum) { + if (property.type === "array" && property.items?.enum) { + // For array of enums, we'll use select but handle it differently + // Note: ink-form doesn't have multiselect, so we'll use select + field = { + type: "select", + ...baseField, + options: property.items.enum.map((val: any) => ({ + label: String(val), + value: String(val), + })), + } as FormField; + } else { + // Single select + field = { + type: "select", + ...baseField, + options: property.enum.map((val: any) => ({ + label: String(val), + value: String(val), + })), + } as FormField; + } + } else { + // Map JSON Schema types to ink-form types + switch (property.type) { + case "string": + field = { + type: "string", + ...baseField, + } as FormField; + break; + case "integer": + field = { + type: "integer", + ...baseField, + ...(property.minimum !== undefined && { min: property.minimum }), + ...(property.maximum !== undefined && { max: property.maximum }), + } as FormField; + break; + case "number": + field = { + type: "float", + ...baseField, + ...(property.minimum !== undefined && { min: property.minimum }), + ...(property.maximum !== undefined && { max: property.maximum }), + } as FormField; + break; + case "boolean": + field = { + type: "boolean", + ...baseField, + } as FormField; + break; + default: + // Default to string for unknown types + field = { + type: "string", + ...baseField, + } as FormField; + } + } + + // Set initial value from default + if (property.default !== undefined) { + (field as any).initialValue = property.default; + } + + fields.push(field); + } + + const sections: FormSection[] = [ + { + title: "Parameters", + fields, + }, + ]; + + return { + title: `Test Tool: ${toolName}`, + sections, + }; +} diff --git a/tui/test-config.json b/tui/test-config.json new file mode 100644 index 000000000..0738f3328 --- /dev/null +++ b/tui/test-config.json @@ -0,0 +1 @@ +{ "servers": [] } diff --git a/tui/tsconfig.json b/tui/tsconfig.json new file mode 100644 index 000000000..c18f3bbb2 --- /dev/null +++ b/tui/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "Node16", + "moduleResolution": "node16", + "jsx": "react-jsx", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "outDir": "./build", + "rootDir": "." + }, + "include": ["src/**/*", "tui.tsx"], + "exclude": ["node_modules", "build"], + "references": [{ "path": "../shared" }] +} diff --git a/tui/tui.tsx b/tui/tui.tsx new file mode 100755 index 000000000..adf2678d4 --- /dev/null +++ b/tui/tui.tsx @@ -0,0 +1,68 @@ +#!/usr/bin/env node + +import { render } from "ink"; +import App from "./src/App.js"; + +export async function runTui(): Promise { + const args = process.argv.slice(2); + + const configFile = args[0]; + + if (!configFile) { + console.error("Usage: mcp-inspector-tui "); + process.exit(1); + } + + // Intercept stdout.write to filter out \x1b[3J (Erase Saved Lines) + // This prevents Ink's clearTerminal from clearing scrollback on macOS Terminal + // We can't access Ink's internal instance to prevent clearTerminal from being called, + // so we filter the escape code instead + const originalWrite = process.stdout.write.bind(process.stdout); + process.stdout.write = function ( + chunk: any, + encoding?: any, + cb?: any, + ): boolean { + if (typeof chunk === "string") { + // Only process if the escape code is present (minimize overhead) + if (chunk.includes("\x1b[3J")) { + chunk = chunk.replace(/\x1b\[3J/g, ""); + } + } else if (Buffer.isBuffer(chunk)) { + // Only process if the escape code is present (minimize overhead) + if (chunk.includes("\x1b[3J")) { + let str = chunk.toString("utf8"); + str = str.replace(/\x1b\[3J/g, ""); + chunk = Buffer.from(str, "utf8"); + } + } + return originalWrite(chunk, encoding, cb); + }; + + // Enter alternate screen buffer before rendering + if (process.stdout.isTTY) { + process.stdout.write("\x1b[?1049h"); + } + + // Render the app + const instance = render(); + + // Wait for exit, then switch back from alternate screen + try { + await instance.waitUntilExit(); + // Unmount has completed - clearTerminal was patched to not include \x1b[3J + // Switch back from alternate screen + if (process.stdout.isTTY) { + process.stdout.write("\x1b[?1049l"); + } + process.exit(0); + } catch (error: unknown) { + if (process.stdout.isTTY) { + process.stdout.write("\x1b[?1049l"); + } + console.error("Error:", error); + process.exit(1); + } +} + +runTui();