Model Context Protocol 的 CLI 检查工具
https://github.com/user-attachments/assets/4cd113e9-f097-4c9d-b391-045c5f213183
npx @wong2/mcp-cli
这将使用 Claude Desktop 的配置文件。
npx @wong2/mcp-cli -c config.json
配置文件的格式与 Claude Desktop 的配置文件相同。
npx @wong2/mcp-cli npx <package-name> <args>
npx @wong2/mcp-cli node path/to/server/index.js args...
npx @wong2/mcp-cli --url http://localhost:8000/mcp
npx @wong2/mcp-cli --sse http://localhost:8000/sse
运行特定的工具、资源或提示,不进行交互式提示:
npx @wong2/mcp-cli [--config config.json] <command> <server-name>:<target> [--args '{}']
示例:
# 调用无参数的工具
npx @wong2/mcp-cli -c config.json call-tool filesystem:list_files
# 调用带有参数的工具
npx @wong2/mcp-cli -c config.json call-tool filesystem:read_file --args '{"path": "package.json"}'
# 读取资源
npx @wong2/mcp-cli -c config.json read-resource filesystem:file://system/etc/hosts
# 使用提示
npx @wong2/mcp-cli -c config.json get-prompt filesystem:create_summary --args '{"text": "Hello world"}'
此模式适用于脚本编写和自动化,因为它绕过了所有交互式提示并直接执行指定的基本操作。
npx @wong2/mcp-cli purge