Skip to content

Commit 1e399b7

Browse files
prettier
1 parent 3a4f3bc commit 1e399b7

File tree

5 files changed

+27
-19
lines changed

5 files changed

+27
-19
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ Example server configuration file:
239239
The inspector automatically detects the transport type from your config file. You can specify different transport types:
240240

241241
**STDIO (default):**
242+
242243
```json
243244
{
244245
"mcpServers": {
@@ -252,6 +253,7 @@ The inspector automatically detects the transport type from your config file. Yo
252253
```
253254

254255
**SSE (Server-Sent Events):**
256+
255257
```json
256258
{
257259
"mcpServers": {
@@ -264,6 +266,7 @@ The inspector automatically detects the transport type from your config file. Yo
264266
```
265267

266268
**Streamable HTTP:**
269+
267270
```json
268271
{
269272
"mcpServers": {
@@ -280,12 +283,14 @@ The inspector automatically detects the transport type from your config file. Yo
280283
You can launch the inspector without specifying a server name if your config has:
281284

282285
1. **A single server** - automatically selected:
286+
283287
```bash
284288
# Automatically uses "my-server" if it's the only one
285289
npx @modelcontextprotocol/inspector --config config.json
286290
```
287291

288292
2. **A server named "default-server"** - automatically selected:
293+
289294
```json
290295
{
291296
"mcpServers": {

cli/scripts/cli-tests.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,10 @@ async function runTests() {
785785
);
786786

787787
// Create config with single server for auto-selection
788-
const singleServerConfigPath = path.join(TEMP_DIR, "single-server-config.json");
788+
const singleServerConfigPath = path.join(
789+
TEMP_DIR,
790+
"single-server-config.json",
791+
);
789792
fs.writeFileSync(
790793
singleServerConfigPath,
791794
JSON.stringify(
@@ -803,7 +806,10 @@ async function runTests() {
803806
);
804807

805808
// Create config with default-server
806-
const defaultServerConfigPath = path.join(TEMP_DIR, "default-server-config.json");
809+
const defaultServerConfigPath = path.join(
810+
TEMP_DIR,
811+
"default-server-config.json",
812+
);
807813
fs.writeFileSync(
808814
defaultServerConfigPath,
809815
JSON.stringify(
@@ -831,11 +837,11 @@ async function runTests() {
831837
JSON.stringify(
832838
{
833839
mcpServers: {
834-
"server1": {
840+
server1: {
835841
command: "npx",
836842
args: ["@modelcontextprotocol/server-everything"],
837843
},
838-
"server2": {
844+
server2: {
839845
command: "node",
840846
args: ["other.js"],
841847
},

cli/src/cli.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,7 @@ function parseArgs(): Args {
222222

223223
// Validate config and server options
224224
if (!options.config && options.server) {
225-
throw new Error(
226-
"--server requires --config to be specified",
227-
);
225+
throw new Error("--server requires --config to be specified");
228226
}
229227

230228
// If config is provided without server, try to auto-select
@@ -233,11 +231,11 @@ function parseArgs(): Args {
233231
path.isAbsolute(options.config)
234232
? options.config
235233
: path.resolve(process.cwd(), options.config),
236-
"utf8"
234+
"utf8",
237235
);
238236
const parsedConfig = JSON.parse(configContent);
239237
const servers = Object.keys(parsedConfig.mcpServers || {});
240-
238+
241239
if (servers.includes("default-server")) {
242240
// Use default-server if it exists
243241
options.server = "default-server";
@@ -249,7 +247,7 @@ function parseArgs(): Args {
249247
} else {
250248
// Multiple servers, no default-server
251249
throw new Error(
252-
`Multiple servers found in config file. Please specify one with --server.\nAvailable servers: ${servers.join(", ")}`
250+
`Multiple servers found in config file. Please specify one with --server.\nAvailable servers: ${servers.join(", ")}`,
253251
);
254252
}
255253
}

client/bin/start.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,7 @@ function delay(ms) {
1313
return new Promise((resolve) => setTimeout(resolve, ms, true));
1414
}
1515

16-
function getClientUrl(
17-
port,
18-
authDisabled,
19-
sessionToken,
20-
serverPort,
21-
) {
16+
function getClientUrl(port, authDisabled, sessionToken, serverPort) {
2217
const host = process.env.HOST || "localhost";
2318
const baseUrl = `http://${host}:${port}`;
2419

client/e2e/cli-arguments.spec.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ test.describe("CLI Arguments @cli", () => {
77
page,
88
}) => {
99
// Simulate: npx . --transport sse --server-url http://localhost:3000/sse
10-
await page.goto("http://localhost:6274/?transport=sse&serverUrl=http://localhost:3000/sse");
10+
await page.goto(
11+
"http://localhost:6274/?transport=sse&serverUrl=http://localhost:3000/sse",
12+
);
1113

1214
// Wait for the Transport Type dropdown to be visible
1315
const selectTrigger = page.getByLabel("Transport Type");
@@ -26,7 +28,9 @@ test.describe("CLI Arguments @cli", () => {
2628
page,
2729
}) => {
2830
// Simulate config with streamable-http transport
29-
await page.goto("http://localhost:6274/?transport=streamable-http&serverUrl=http://localhost:3000/mcp");
31+
await page.goto(
32+
"http://localhost:6274/?transport=streamable-http&serverUrl=http://localhost:3000/mcp",
33+
);
3034

3135
// Wait for the Transport Type dropdown to be visible
3236
const selectTrigger = page.getByLabel("Transport Type");
@@ -58,4 +62,4 @@ test.describe("CLI Arguments @cli", () => {
5862
await expect(page.locator("#command-input")).toBeVisible();
5963
await expect(page.locator("#arguments-input")).toBeVisible();
6064
});
61-
});
65+
});

0 commit comments

Comments
 (0)