Postman Mcp 服务器
概览
什么是 MCP Postman?
MCP Postman 是一个服务器,旨在使用 Newman 运行 Postman 集合,Newman 是一个用于 Postman 的命令行集合运行器。这个工具允许开发者通过直接从命令行执行集合来自动化他们的 API 测试工作流程,使其更容易集成到 CI/CD 管道中。
MCP Postman 的特点
- 无缝集成:轻松与现有的 Postman 集成,允许快速设置和执行。
- 命令行界面:利用 Newman 运行集合,为自动化提供强大的 CLI。
- 可定制报告:生成详细的测试结果报告,帮助开发者快速识别问题。
- 环境支持:支持多个环境,允许灵活的测试场景。
- 公共仓库:在 GitHub 上可用,促进社区的协作和贡献。
如何使用 MCP Postman
-
安装:首先,确保你的机器上安装了 Node.js。然后,使用 npm 全局安装 Newman:
npm install -g newman -
克隆仓库:从 GitHub 克隆 MCP Postman 仓库:
git clone https://github.com/shannonlal/mcp-postman.git -
运行集合:导航到克隆的目录,并使用 Newman 运行你的 Postman 集合:
newman run your-collection.json -
查看报告:运行集合后,查看生成的报告以分析结果。
常见问题解答
什么是 Newman?
Newman 是一个命令行工具,允许你直接从终端运行 Postman 集合。它对于自动化 API 测试和将其集成到 CI/CD 管道中至关重要。
我可以使用 MCP Postman 进行自动化测试吗?
是的,MCP Postman 专门设计用于使用 Postman 集合进行 API 的自动化测试,非常适合持续集成和部署工作流程。
MCP Postman 是开源的吗?
是的,MCP Postman 是一个开源项目,托管在 GitHub 上,允许开发者贡献和改进该工具。
我如何为 MCP Postman 贡献?
你可以通过分叉仓库、进行更改并在 GitHub 上提交拉取请求来贡献。请确保遵循仓库中提供的贡献指南。
我在哪里可以找到有关 MCP Postman 的更多信息?
有关更多信息,你可以访问 MCP Postman GitHub 仓库,在这里你可以找到文档、问题和社区讨论。
详情
Postman MCP Server
An MCP (Model Context Protocol) server that enables running Postman collections using Newman. This server allows LLMs to execute API tests and get detailed results through a standardized interface.
<a href="https://glama.ai/mcp/servers/qfx34b2s2v"><img width="380" height="200" src="https://glama.ai/mcp/servers/qfx34b2s2v/badge" alt="Postman Server MCP server" /></a>
Features
- Run Postman collections using Newman
- Support for environment files
- Support for global variables
- Detailed test results including:
- Overall success/failure status
- Test summary (total, passed, failed)
- Detailed failure information
- Execution timings
Installation
Installing via Smithery
To install Postman Runner for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install mcp-postman --client claude
Manual Installation
### Clone the repository
git clone <repository-url>
cd mcp-postman
### Install dependencies
pnpm install
### Build the project
pnpm build
Usage
Configuration
Add the server to your Claude desktop configuration file at ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"postman-runner": {
"command": "node",
"args": ["/absolute/path/to/mcp-postman/build/index.js"]
}
}
}
Available Tools
run-collection
Runs a Postman collection and returns the test results.
Parameters:
collection(required): Path or URL to the Postman collectionenvironment(optional): Path or URL to environment fileglobals(optional): Path or URL to globals fileiterationCount(optional): Number of iterations to run
Example Response:
{
"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
}
}
Example Usage in Claude
You can use the server in Claude by asking it to run a Postman collection:
"Run the Postman collection at /path/to/collection.json and tell me if all tests passed"
Claude will:
- Use the run-collection tool
- Analyze the test results
- Provide a human-friendly summary of the execution
Development
Project Structure
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
Running Tests
### Run tests
pnpm test
### Run tests with coverage
pnpm test:coverage
Building
### Build the project
pnpm build
### Clean build artifacts
pnpm clean
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
ISC
Server配置
{
"mcpServers": {
"mcp-postman": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/metorial/mcp-container--shannonlal--mcp-postman--mcp-postman",
"node ./build/index.js"
],
"env": {}
}
}
}