MCP 脚本运行器是一个用于运行脚本的工具,通过简单配置即可快速启动脚本,支持多种环境设置和工具添加。
mise install python@3.13 && mise use python@3.13 -gbrew install uv克隆项目仓库:
git clone https://github.com/ktrysmt/mcp-script-runner
cd ./mcp-script-runner
uv sync
并在 mcp 配置中添加 mcp.json,如下所示:
{
"mcpServers": {
"mcp-script-runner": {
"command": "uv",
"args": [
"--directory",
"/path/to/mcp-script-runner",
"run",
"main.py"
]
}
}
}
更改命令目录:
{
"mcpServers": {
"mcp-script-runner": {
"command": "uv",
"args": [
"--directory",
"/path/to/mcp-script-runner",
"run",
"main.py"
],
"env": {
"COMMAND_DIRECTORY": "/path/to/your/dir"
}
}
}
}
使用 dotenv:
cd ./mcp-script-runner
$EDITOR .env
cd ./mcp-script-runner
$EDITOR ./commands/command_name.sh
然后重新加载 mcp。
⚠️ 重要提示
- 由于文件是直接执行的,不要忘记在每个文件中包含 shebang。
- 执行权限对于文件是必需的(尽管有一个调整权限的过程)。
- 这仅适用于本地使用,并且只有您理解的脚本才应放置在此处。