Postman集合测试服务

一个基于MCP协议的服务器,支持通过Newman运行Postman集合,为LLM提供标准化的API测试执行和结果分析服务。

  • by Gechmind
  • 本地部署
  • 更新于
在 GitHub 查看 gechmind/mcp-postman

使用说明

邮递员MCP服务器

一个MCP(模型上下文协议)服务器,可以使用Newman运行Postman集合。该服务器允许LLM执行API测试,并通过标准化接口获得详细结果。

特性

  • 使用Newman运行Postman收藏
  • 支持环境文件
  • 支持全局变量
  • 详细的测试结果包括:
    • 总体成功/失败状态
    • 测试总结(总计、通过、失败)
    • 详细的故障信息
    • 执行时间

安装

通过Smithery安装

通过以下方式自动安装克劳德桌面版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"]
    }
  }
}

可用工具

运行集合

运行Postman集合并返回测试结果。

参数:

  • collection (必填):邮递员收藏的路径或URL
  • environment (可选):环境文件的路径或URL
  • globals (可选):全局文件的路径或URL
  • iterationCount (可选):要运行的迭代次数

示例响应:

{
  "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集合,并告诉我是否通过了所有测试”

克劳德将:

  1. 使用跑步收集工具
  2. 分析测试结果
  3. 提供人性化的执行摘要

发展

项目结构

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

贡献

  1. 分叉存储库
  2. 创建功能分支(git checkout -b feature/amazing-feature)
  3. 提交您的更改(git commit -m 'Add some amazing feature')
  4. 推到分支(git push origin feature/amazing-feature)
  5. 打开拉取请求

许可证

国际协调委员会