mcp-postman
by: shannonlal
MCP Server for running Postman Collections with Newman
πOverview
Purpose: The Postman MCP Server aims to facilitate the execution of Postman collections via the Newman tool, allowing for API testing and detailed reporting through a standardized interface.
Overview: The Postman MCP Server serves as a powerful integration point for running Postman collections. It provides a streamlined way for language models (LLMs) to perform API tests, returning comprehensive results that help developers verify their systems.
Key Features:
-
Run Postman collections using Newman: Simplifies the execution of API tests utilizing established Postman frameworks.
-
Support for environment files: Allows for dynamic testing by applying different settings depending on the context.
-
Support for global variables: Facilitates the use of common variables across multiple tests, enhancing efficiency.
-
Detailed test results: Offers insights through an overall success/failure status, complete test summaries, detailed failure information, and execution timings, ensuring thorough analysis of test outcomes.
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.
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