diff --git a/.gitignore b/.gitignore index a7eee74a..dc813f96 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ client/tsconfig.node.tsbuildinfo cli/build test-output tool-test-output +pkgInfo.json # symlinked by `npm run link:sdk`: sdk client/playwright-report/ diff --git a/cli/README.md b/cli/README.md new file mode 100644 index 00000000..2f2b8f1f --- /dev/null +++ b/cli/README.md @@ -0,0 +1,30 @@ +# MCP Inspector CLI + +CLI for the Model Context Protocol inspector. + +## Development + +For development and testing purposes, you can run the CLI locally after building: + +```bash +# Build the CLI +npm run build + +# Connect to a remote MCP server (with Streamable HTTP transport) +npm run dev -- --cli https://my-mcp-server.example.com --transport http --method tools/list + +# Connect to a remote MCP server (with custom headers) +npm run dev -- --cli https://my-mcp-server.example.com --transport http --method tools/list --header "X-API-Key: your-api-key" + +# Call a tool on a remote server +npm run dev -- --cli https://my-mcp-server.example.com --method tools/call --tool-name remotetool --tool-arg param=value + +# List resources from a remote server +npm run dev -- --cli https://my-mcp-server.example.com --method resources/list +``` + +**Note:** The `npm run dev` command is only for development and testing. For production use, install the package globally or use `npx @modelcontextprotocol/inspector`. + +## Production Usage + +See the main [Inspector README](../README.md) for production usage instructions. diff --git a/cli/package.json b/cli/package.json index ddeb3b93..37ec228f 100644 --- a/cli/package.json +++ b/cli/package.json @@ -15,12 +15,14 @@ "build" ], "scripts": { + "prebuild": "jq '{version, name, description}' package.json > ./src/pkgInfo.json", "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:cli-headers": "node scripts/cli-header-tests.js", + "dev": "node build/cli.js" }, "devDependencies": {}, "dependencies": { diff --git a/cli/src/index.ts b/cli/src/index.ts index a7c5896d..b0d25bd7 100644 --- a/cli/src/index.ts +++ b/cli/src/index.ts @@ -31,7 +31,7 @@ type JsonValue = | JsonValue[] | { [key: string]: JsonValue }; -import packageJson from "../package.json" with { type: "json" }; +import packageJson from "./pkgInfo.json" with { type: "json" }; type Args = { target: string[];