From 1e399b70554bbadba70ae224fb3d3c55c6b6b89d Mon Sep 17 00:00:00 2001 From: Felix Weinberger Date: Tue, 5 Aug 2025 14:08:26 +0100 Subject: [PATCH] prettier --- README.md | 5 +++++ cli/scripts/cli-tests.js | 14 ++++++++++---- cli/src/cli.ts | 10 ++++------ client/bin/start.js | 7 +------ client/e2e/cli-arguments.spec.ts | 10 +++++++--- 5 files changed, 27 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 932c337d..69eada69 100644 --- a/README.md +++ b/README.md @@ -239,6 +239,7 @@ Example server configuration file: The inspector automatically detects the transport type from your config file. You can specify different transport types: **STDIO (default):** + ```json { "mcpServers": { @@ -252,6 +253,7 @@ The inspector automatically detects the transport type from your config file. Yo ``` **SSE (Server-Sent Events):** + ```json { "mcpServers": { @@ -264,6 +266,7 @@ The inspector automatically detects the transport type from your config file. Yo ``` **Streamable HTTP:** + ```json { "mcpServers": { @@ -280,12 +283,14 @@ The inspector automatically detects the transport type from your config file. Yo You can launch the inspector without specifying a server name if your config has: 1. **A single server** - automatically selected: + ```bash # Automatically uses "my-server" if it's the only one npx @modelcontextprotocol/inspector --config config.json ``` 2. **A server named "default-server"** - automatically selected: + ```json { "mcpServers": { diff --git a/cli/scripts/cli-tests.js b/cli/scripts/cli-tests.js index 87981dd8..e737756f 100755 --- a/cli/scripts/cli-tests.js +++ b/cli/scripts/cli-tests.js @@ -785,7 +785,10 @@ async function runTests() { ); // Create config with single server for auto-selection - const singleServerConfigPath = path.join(TEMP_DIR, "single-server-config.json"); + const singleServerConfigPath = path.join( + TEMP_DIR, + "single-server-config.json", + ); fs.writeFileSync( singleServerConfigPath, JSON.stringify( @@ -803,7 +806,10 @@ async function runTests() { ); // Create config with default-server - const defaultServerConfigPath = path.join(TEMP_DIR, "default-server-config.json"); + const defaultServerConfigPath = path.join( + TEMP_DIR, + "default-server-config.json", + ); fs.writeFileSync( defaultServerConfigPath, JSON.stringify( @@ -831,11 +837,11 @@ async function runTests() { JSON.stringify( { mcpServers: { - "server1": { + server1: { command: "npx", args: ["@modelcontextprotocol/server-everything"], }, - "server2": { + server2: { command: "node", args: ["other.js"], }, diff --git a/cli/src/cli.ts b/cli/src/cli.ts index cf8662e5..09c99d51 100644 --- a/cli/src/cli.ts +++ b/cli/src/cli.ts @@ -222,9 +222,7 @@ function parseArgs(): Args { // Validate config and server options if (!options.config && options.server) { - throw new Error( - "--server requires --config to be specified", - ); + throw new Error("--server requires --config to be specified"); } // If config is provided without server, try to auto-select @@ -233,11 +231,11 @@ function parseArgs(): Args { path.isAbsolute(options.config) ? options.config : path.resolve(process.cwd(), options.config), - "utf8" + "utf8", ); const parsedConfig = JSON.parse(configContent); const servers = Object.keys(parsedConfig.mcpServers || {}); - + if (servers.includes("default-server")) { // Use default-server if it exists options.server = "default-server"; @@ -249,7 +247,7 @@ function parseArgs(): Args { } else { // Multiple servers, no default-server throw new Error( - `Multiple servers found in config file. Please specify one with --server.\nAvailable servers: ${servers.join(", ")}` + `Multiple servers found in config file. Please specify one with --server.\nAvailable servers: ${servers.join(", ")}`, ); } } diff --git a/client/bin/start.js b/client/bin/start.js index ddf3fac3..e0496cde 100755 --- a/client/bin/start.js +++ b/client/bin/start.js @@ -13,12 +13,7 @@ function delay(ms) { return new Promise((resolve) => setTimeout(resolve, ms, true)); } -function getClientUrl( - port, - authDisabled, - sessionToken, - serverPort, -) { +function getClientUrl(port, authDisabled, sessionToken, serverPort) { const host = process.env.HOST || "localhost"; const baseUrl = `http://${host}:${port}`; diff --git a/client/e2e/cli-arguments.spec.ts b/client/e2e/cli-arguments.spec.ts index 3376a6d7..a4dcdcce 100644 --- a/client/e2e/cli-arguments.spec.ts +++ b/client/e2e/cli-arguments.spec.ts @@ -7,7 +7,9 @@ test.describe("CLI Arguments @cli", () => { page, }) => { // Simulate: npx . --transport sse --server-url http://localhost:3000/sse - await page.goto("http://localhost:6274/?transport=sse&serverUrl=http://localhost:3000/sse"); + await page.goto( + "http://localhost:6274/?transport=sse&serverUrl=http://localhost:3000/sse", + ); // Wait for the Transport Type dropdown to be visible const selectTrigger = page.getByLabel("Transport Type"); @@ -26,7 +28,9 @@ test.describe("CLI Arguments @cli", () => { page, }) => { // Simulate config with streamable-http transport - await page.goto("http://localhost:6274/?transport=streamable-http&serverUrl=http://localhost:3000/mcp"); + await page.goto( + "http://localhost:6274/?transport=streamable-http&serverUrl=http://localhost:3000/mcp", + ); // Wait for the Transport Type dropdown to be visible const selectTrigger = page.getByLabel("Transport Type"); @@ -58,4 +62,4 @@ test.describe("CLI Arguments @cli", () => { await expect(page.locator("#command-input")).toBeVisible(); await expect(page.locator("#arguments-input")).toBeVisible(); }); -}); \ No newline at end of file +});