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
伺服器配置
{
"mcpServers": {
"mcp-postman": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/metorial/mcp-container--shannonlal--mcp-postman--mcp-postman",
"node ./build/index.js"
],
"env": {}
}
}
}