mcp-scripts
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMCP Script Rules
MCP 脚本规则
When working with files in :
scripts/在目录下处理文件时:
scripts/DO
应当遵循
- Use CLI arguments for all parameters (argparse)
- Include USAGE docstring at top of file
- Use pattern
call_mcp_tool("server__tool", params) - Handle errors gracefully with informative messages
- Print results to stdout for Claude to process
- 为所有参数使用CLI参数(argparse)
- 在文件顶部包含USAGE文档字符串
- 使用格式
call_mcp_tool("server__tool", params) - 优雅地处理错误并给出信息丰富的提示
- 将结果打印到stdout以便Claude处理
DON'T
禁止事项
- Hardcode parameters in the script
- Edit scripts to change parameters (use CLI args instead)
- Import from servers/ directly (use runtime.mcp_client)
- 在脚本中硬编码参数
- 通过编辑脚本修改参数(改用CLI参数)
- 直接从servers/导入(使用runtime.mcp_client)
Tool Naming
工具命名
Tool IDs use double underscore:
serverName__toolNameExamples:
morph__warpgrep_codebase_searchast-grep__ast_grepperplexity__perplexity_ask
工具ID使用双下划线:
serverName__toolName示例:
morph__warpgrep_codebase_searchast-grep__ast_grepperplexity__perplexity_ask
Testing
测试
Test with:
uv run python -m runtime.harness scripts/<script>.py --help使用以下命令测试:
uv run python -m runtime.harness scripts/<script>.py --help