名称: mcp-scripts 描述: MCP脚本规则 用户可调用: 否
MCP脚本规则
当处理 scripts/ 目录中的文件时:
做
- 对所有参数使用CLI参数(argparse)
- 在文件顶部包含USAGE文档字符串
- 使用
call_mcp_tool("server__tool", params)模式 - 优雅地处理错误并提供信息性消息
- 将结果打印到stdout供Claude处理
不要做
- 在脚本中硬编码参数
- 编辑脚本来更改参数(改用CLI参数)
- 直接从servers/导入(使用runtime.mcp_client)
工具命名
工具ID使用双下划线: serverName__toolName
示例:
morph__warpgrep_codebase_searchast-grep__ast_grepperplexity__perplexity_ask
测试
测试方法: uv run python -m runtime.harness scripts/<script>.py --help