关于 Postman MCP Server
Postman MCP Server 是一个 MCP 服务,使用 Newman 运行 Postman 集合,让 LLM 能够执行 API 测试并获取结构化结果。适合需要在对话中自动执行接口测试的开发者。
主要功能
- 01使用 Newman 运行 Postman 集合
- 02支持环境文件与全局变量
- 03返回测试通过、失败数量与失败详情
- 04包含各请求的执行耗时
适用场景
- 01让 LLM 执行 API 测试并汇总结果
- 02检查接口测试是否全部通过
MCP 相关
该项目是 MCP 服务,通过 run-collection 工具向 MCP 客户端暴露 Postman 集合的执行能力,并返回结构化测试结果。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
工具
还没有获取到工具列表
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
Postman MCP 服务
一个 MCP(Model Context Protocol)服务,可使用 Newman 运行 Postman 集合。此服务允许大模型通过标准化接口执行 API 测试并获取详细结果。
AI Agent 列表
功能
- 使用 Newman 运行 Postman 集合
- 支持环境文件
- 支持全局变量
- 提供详细的测试结果,包括:
- 总体成功/失败状态
- 测试摘要(总数、通过数、失败数)
- 详细的失败信息
- 执行耗时
安装
通过 Smithery 安装
通过 Smithery 自动为 Claude Desktop 安装 Postman Runner:
npx -y @smithery/cli install mcp-postman --client claude
手动安装
# Clone the repository
git clone <repository-url>
cd mcp-postman
# Install dependencies
pnpm install
# Build the project
pnpm build
用法
配置
将服务添加到 Claude 桌面应用的配置文件 ~/Library/Application Support/Claude/claude_desktop_config.json 中:
{
"mcpServers": {
"postman-runner": {
"command": "node",
"args": ["/absolute/path/to/mcp-postman/build/index.js"]
}
}
}
可用工具
run-collection
运行 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 中的用法示例
你可以在 Claude 中要求它运行 Postman 集合:
“运行路径为 /path/to/collection.json 的 Postman 集合,并告诉我是否所有测试都通过了”
Claude 将会:
- 使用 run-collection 工具
- 分析测试结果
- 提供易于理解的执行摘要
开发
项目结构
src/
├── index.ts # Entry point
├── server/
│ ├── server.ts # MCP Server implementation
│ └── types.ts # Type definitions
└── newman/
└── runner.ts # Newman runner implementation
test/
├── server.test.ts # Server tests
├── newman-runner.test.ts # Runner tests
└── fixtures/ # Test fixtures
└── sample-collection.json
运行测试
# Run tests
pnpm test
# Run tests with coverage
pnpm test:coverage
构建
# Build the project
pnpm build
# Clean build artifacts
pnpm clean
贡献
- Fork 此仓库
- 创建功能分支(
git checkout -b feature/amazing-feature) - 提交更改(
git commit -m 'Add some amazing feature') - 推送到分支(
git push origin feature/amazing-feature) - 发起 Pull Request
许可证
ISC
评论
支持 Markdown
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。
