k6-MCP 服务器添加福利群:解决AI开发者的「MCP实战痛点」一个用于运行 k6 负载测试的模型上下文协议(MCP)服务器实现。
在开始之前,请确保已安装以下内容:
git clone https://github.com/qainsights/k6-mcp-server.git

uv pip install -r requirements.txt
.env 文件:K6_BIN=/path/to/k6 # 可选:默认为系统 PATH 中的 'k6'

test.js):import http from "k6/http";
import { sleep } from "k6";
export default function () {
http.get("http://test.k6.io");
sleep(1);
}

{
"mcpServers": {
"k6": {
"command": "/path/to/bin/uv",
"args": [
"--directory",
"/path/to/k6-mcp-server",
"run",
"k6_server.py"
]
}
}
}

run k6 test for hello.js。k6 mcp 服务器将利用以下工具之一启动测试。execute_k6_test:使用默认选项运行测试(30 秒持续时间,10 个 VUs)execute_k6_test_with_options:使用自定义持续时间和 VUs 运行测试
execute_k6_test(
script_file: str,
duration: str = "30s", # 可选
vus: int = 10 # 可选
)

execute_k6_test_with_options(
script_file: str,
duration: str,
vus: int
)

欢迎贡献!请随时提交 Pull Request。
本项目采用 MIT 许可证 - 详情请参阅 LICENSE 文件。