返回市场
MCP邮递员服务器

MCP邮递员服务器

作者:shannonlal83 星标更新:2025-03-25

项目介绍

Postman MCP 服务器

smithery 徽章

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

MCP Postman 服务器演示

<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>

特性

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

安装

通过 Smithery 安装

要通过 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"]
    }
  }
}

可用工具

run-collection

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

参数:

  • collection(必需):指向 Postman 集合的路径或 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 集合,并告诉我所有测试是否都通过了"

Claude 将会:

  1. 使用 run-collection 工具
  2. 分析测试结果
  3. 提供执行的人类友好的摘要

开发

项目结构

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

贡献

  1. 分叉仓库
  2. 创建您的功能分支 (git checkout -b feature/amazing-feature)
  3. 提交更改 (git commit -m '添加一些惊人的功能')
  4. 推送到分支 (git push origin feature/amazing-feature)
  5. 打开拉取请求

许可证

ISC