Postman MCP Server
by shannonlal
- prompts
Detailed Implementation Plan for Postman MCP Server
1. Project Setup & Dependencies
Regular Dependencies
{
"dependencies": {
"@modelcontextprotocol/sdk": "^latest",
"newman": "^latest",
"zod": "^latest"
}
}
Dev Dependencies
{
"devDependencies": {
"typescript": "^latest",
"vitest": "^latest",
"@types/node": "^latest",
"@types/newman": "^latest",
"ts-node": "^latest",
"prettier": "^latest",
"eslint": "^latest",
"eslint-config-prettier": "^latest"
}
}
2. Project Structure
/postman-mcp-server
├── package.json
├── tsconfig.json
├── vitest.config.ts
├── src/
│ ├── index.ts # Main entry point
│ ├── server/
│ │ ├── server.ts # MCP Server implementation
│ │ └── types.ts # Type definitions
│ ├── newman/
│ │ ├── runner.ts # Newman runner implementation
│ │ └── types.ts # Newman types
│ └── utils/
│ └── result-formatter.ts # Format Newman results
└── test/
├── server.test.ts # Server tests
├── newman-runner.test.ts # Newman runner tests
└── fixtures/ # Test fixtures
├── sample-collection.json
└── sample-environment.json
3. Key File Implementation Plans
src/index.ts
// Main entry point
// - Initialize MCP Server
// - Connect transport
// - Handle errors
src/server/types.ts
// Define interfaces for:
interface CollectionRunRequest {
collection: string;
environment?: string;
globals?: string;
iterationCount?: number;
}
interface TestResult {
success: boolean;
summary: TestSummary;
failures: TestFailure[];
timings: TestTimings;
}
src/server/server.ts
// Implement:
// 1. MCP Server setup
// 2. Tool registration
// 3. Request handling
// 4. Error handling
src/newman/runner.ts
// Implement:
// 1. Newman run configuration
// 2. Result collection
// 3. Error handling
// 4. Resource cleanup
src/utils/result-formatter.ts
// Implement:
// 1. Newman result parsing
// 2. MCP response formatting
// 3. Error formatting 4. Testing Strategy
Unit Tests (vitest.config.ts)
// Configure:
// - Test environment
// - Coverage reporting
// - Test matching patterns
Test Files
test/server.test.ts
// Test cases for:
// 1. Server initialization
// 2. Tool registration
// 3. Request handling
// 4. Error scenarios
test/newman-runner.test.ts
// Test cases for:
// 1. Collection running
// 2. Result parsing
// 3. Error handling
// 4. Resource cleanup 5. Configuration Files
tsconfig.json
{
"compilerOptions": {
"target": "ES2022",
"module": "Node16",
"outDir": "./build",
"strict": true,
"esModuleInterop": true
}
} 6. Implementation Phases
Phase 1: Basic Setup
Project structure creation
Dependency installation
Configuration files
Phase 2: Core Implementation
Newman runner implementation
Result formatter
Basic error handling
Phase 3: MCP Server
Server setup
Tool registration
Request handling
Phase 4: Testing
Unit test implementation
Integration tests
Test fixtures
Phase 5: Documentation & Polish
API documentation
Usage examples
Error handling improvements 7. Testing Scenarios
Server Tests
Server initialization
Tool registration
Request validation
Error handling
Newman Runner Tests
Collection execution
Environment handling
Result parsing
Error scenarios
Integration Tests