这是一个使用 Newman 运行 Postman 集合的 MCP(模型上下文协议)服务器。该服务器允许 LLM 通过标准化接口执行 API 测试并获取详细的测试结果。
<a href="https://glama.ai/mcp/servers/qfx34b2s2v"><img width="380" height="200" src="https://gips2.baidu.com/it/u=1918564499,3869127785&fm=3081&app=3081&f=PNG?w=760&h=400" alt="Postman Server MCP 服务器" /></a>
要通过 Smithery 自动安装 Postman Runner for Claude Desktop,请运行以下命令:
npx -y @smithery/cli install mcp-postman --client claude
# 克隆仓库
git clone <repository-url>
cd mcp-postman
# 安装依赖
pnpm install
# 构建项目
pnpm build
在 ~/Library/Application Support/Claude/claude_desktop_config.json 文件中添加服务器配置:
{
"mcpServers": {
"postman-runner": {
"command": "node",
"args": ["/绝对路径/to/mcp-postman/build/index.js"]
}
}
}
运行一个 Postman 集合并返回测试结果。
参数:
collection(必需):指向 Postman 集合的路径或 URLenvironment(可选):指向环境文件的路径或 URLglobals(可选):指向全局变量文件的路径或 URLiterationCount(可选):运行的迭代次数示例响应:
{
"success": true,
"summary": {
"total": 5,
"failed": 0,
"passed": 5
},
"failures": [],
"timings": {
"started": "2024-03-14T10:00:00.000Z",
"completed": "2024-03-14T10:00:01.000Z",
"duration": 1000
}
}
您可以在 Claude 中请求运行一个 Postman 集合:
"运行位于 /path/to/collection.json 的 Postman 集合,并告诉我所有测试是否都通过了"
Claude 将会:
src/
├── index.ts # 入口点
├── server/
│ ├── server.ts # MCP 服务器实现
│ └── types.ts # 类型定义
└── newman/
└── runner.ts # Newman 运行器实现
test/
├── server.test.ts # 服务器测试
├── newman-runner.test.ts # 运行器测试
└── fixtures/ # 测试固定数据
└── sample-collection.json
# 运行测试
pnpm test
# 运行带有覆盖率的测试
pnpm test:coverage
# 构建项目
pnpm build
# 清理构建产物
pnpm clean
git checkout -b feature/amazing-feature)git commit -m '添加一些惊人的功能')git push origin feature/amazing-feature)ISC