Skip to content

Commit 8971add

Browse files
authored
Merge branch 'main' into update-dependencies
2 parents 07a43c9 + 0ef91d2 commit 8971add

File tree

17 files changed

+1010
-95
lines changed

17 files changed

+1010
-95
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ client/tsconfig.app.tsbuildinfo
99
client/tsconfig.node.tsbuildinfo
1010
cli/build
1111
test-output
12+
tool-test-output
1213
# symlinked by `npm run link:sdk`:
1314
sdk
1415
client/playwright-report/
1516
client/results.json
1617
client/test-results/
18+
client/e2e/test-results/
1719
mcp.json

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ server/build
33
CODE_OF_CONDUCT.md
44
SECURITY.md
55
mcp.json
6+
.claude/settings.local.json

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,9 @@ npx @modelcontextprotocol/inspector --cli node build/index.js --method tools/lis
395395
# Call a specific tool
396396
npx @modelcontextprotocol/inspector --cli node build/index.js --method tools/call --tool-name mytool --tool-arg key=value --tool-arg another=value2
397397

398+
# Call a tool with JSON arguments
399+
npx @modelcontextprotocol/inspector --cli node build/index.js --method tools/call --tool-name mytool --tool-arg 'options={"format": "json", "max_tokens": 100}'
400+
398401
# List available resources
399402
npx @modelcontextprotocol/inspector --cli node build/index.js --method resources/list
400403

@@ -407,6 +410,9 @@ npx @modelcontextprotocol/inspector --cli https://my-mcp-server.example.com
407410
# Connect to a remote MCP server (with Streamable HTTP transport)
408411
npx @modelcontextprotocol/inspector --cli https://my-mcp-server.example.com --transport http --method tools/list
409412

413+
# Connect to a remote MCP server (with custom headers)
414+
npx @modelcontextprotocol/inspector --cli https://my-mcp-server.example.com --transport http --method tools/list --header "X-API-Key: your-api-key"
415+
410416
# Call a tool on a remote server
411417
npx @modelcontextprotocol/inspector --cli https://my-mcp-server.example.com --method tools/call --tool-name remotetool --tool-arg param=value
412418

cli/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
"scripts": {
1818
"build": "tsc",
1919
"postbuild": "node scripts/make-executable.js",
20-
"test": "node scripts/cli-tests.js"
20+
"test": "node scripts/cli-tests.js && node scripts/cli-tool-tests.js",
21+
"test:cli": "node scripts/cli-tests.js",
22+
"test:cli-tools": "node scripts/cli-tool-tests.js"
2123
},
2224
"devDependencies": {},
2325
"dependencies": {

cli/scripts/cli-tests.js

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ console.log(`${colors.BLUE}- Environment variables (-e)${colors.NC}`);
3737
console.log(`${colors.BLUE}- Config file (--config)${colors.NC}`);
3838
console.log(`${colors.BLUE}- Server selection (--server)${colors.NC}`);
3939
console.log(`${colors.BLUE}- Method selection (--method)${colors.NC}`);
40-
console.log(
41-
`${colors.BLUE}- Tool-related options (--tool-name, --tool-arg)${colors.NC}`,
42-
);
4340
console.log(`${colors.BLUE}- Resource-related options (--uri)${colors.NC}`);
4441
console.log(
4542
`${colors.BLUE}- Prompt-related options (--prompt-name, --prompt-args)${colors.NC}`,
@@ -533,65 +530,6 @@ async function runTests() {
533530
"tools/list",
534531
);
535532

536-
console.log(
537-
`\n${colors.YELLOW}=== Running Tool-Related Tests ===${colors.NC}`,
538-
);
539-
540-
// Test 12: CLI mode with tool call
541-
await runBasicTest(
542-
"tool_call",
543-
TEST_CMD,
544-
...TEST_ARGS,
545-
"--cli",
546-
"--method",
547-
"tools/call",
548-
"--tool-name",
549-
"echo",
550-
"--tool-arg",
551-
"message=Hello",
552-
);
553-
554-
// Test 13: CLI mode with tool call but missing tool name (should fail)
555-
await runErrorTest(
556-
"missing_tool_name",
557-
TEST_CMD,
558-
...TEST_ARGS,
559-
"--cli",
560-
"--method",
561-
"tools/call",
562-
"--tool-arg",
563-
"message=Hello",
564-
);
565-
566-
// Test 14: CLI mode with tool call but invalid tool args format (should fail)
567-
await runErrorTest(
568-
"invalid_tool_args",
569-
TEST_CMD,
570-
...TEST_ARGS,
571-
"--cli",
572-
"--method",
573-
"tools/call",
574-
"--tool-name",
575-
"echo",
576-
"--tool-arg",
577-
"invalid_format",
578-
);
579-
580-
// Test 15: CLI mode with multiple tool args
581-
await runBasicTest(
582-
"multiple_tool_args",
583-
TEST_CMD,
584-
...TEST_ARGS,
585-
"--cli",
586-
"--method",
587-
"tools/call",
588-
"--tool-name",
589-
"add",
590-
"--tool-arg",
591-
"a=1",
592-
"b=2",
593-
);
594-
595533
console.log(
596534
`\n${colors.YELLOW}=== Running Resource-Related Tests ===${colors.NC}`,
597535
);

0 commit comments

Comments
 (0)