API Tester
About
This MCP Server accepts swagger/postman documents as input. It then generates API & Load test scenarios, executes the tests and generates the execution report.
Details
- Author
- kirti676
- Categories
- Developer Tools, API
Jump to
2. π§set_env_vars- Configure Authentication & Environment
Set environment variables with automatic validation and guidance
{ "variables": {}, // Dictionary of custom environment variables (optional) "baseUrl": null, // API base URL (optional) "auth_bearer": null, // Bearer/JWT token (optional) "auth_apikey": null, // API key (optional) "auth_basic": null, // Base64 encoded credentials (optional) "auth_username": null, // Username for basic auth (optional) "auth_password": null // Password for basic auth (optional) }
π§ Environment Variables (set_env_vars)
π ALL PARAMETERS ARE OPTIONAL- Provide only what you need:
// Option 1: Just the base URL await mcp.call("set_env_vars", { baseUrl: "https://api.example.com/v1" }); // Option 2: Just authentication await mcp.call("set_env_vars", { auth_bearer: "your-jwt-token-here" }); // Option 3: Multiple parameters await mcp.call("set_env_vars", { baseUrl: "https://api.example.com/v1", auth_bearer: "your-jwt-token", auth_apikey: "your-api-key" }); // Option 4: Using variables dict for custom values await mcp.call("set_env_vars", { variables: { "baseUrl": "https://api.example.com/v1", "custom_header": "custom-value" } });
Default values help you understand available options:
// Ingest with defaults shown await mcp.call("ingest_spec", { spec_type: "openapi", // openapi, swagger, postman file_path: "./api-spec.json", // Path to JSON or YAML specification file preferred_language: "python", // python, typescript, javascript preferred_framework: "requests" // pytest, requests, playwright, jest, cypress, supertest }); // Project generation with defaults await mcp.call("generate_project_files", { language: "python", // python, typescript, javascript framework: "requests", // Framework matching the language project_name: "api-tests", // Project folder name include_examples: true // Include example test files });
// API tests with concurrency control await mcp.call("run_api_tests", { test_case_ids: null, // ["test_1", "test_2"] or null for all max_concurrent: 10 // Number of concurrent requests (1-50) }); // Load tests with performance parameters await mcp.call("run_load_tests", { test_case_ids: null, // ["test_1", "test_2"] or null for all duration: 60, // Test duration in seconds users: 10, // Number of concurrent virtual users ramp_up: 10 // Ramp up time in seconds });
// NEW: Check supported languages and frameworks const languages = await mcp.call("get_supported_languages"); console.log(languages.supported_combinations); // Ingest specification with language preferences await mcp.call("ingest_spec", { spec_type: "openapi", file_path: "./openapi-specification.json", preferred_language: "typescript", preferred_framework: "playwright" }); // Set environment variables for authentication await mcp.call("set_env_vars", { variables: { "baseUrl": "https://api.example.com", "auth_bearer": "your-bearer-token", "auth_apikey": "your-api-key" } }); // Generate test scenarios await mcp.call("generate_scenarios", { include_negative_tests: true, include_edge_cases: true }); // Generate test cases in TypeScript/Playwright await mcp.call("generate_test_cases", { language: "typescript", framework: "playwright" }); // Generate complete project files await mcp.call("generate_project_files", { language: "typescript", framework: "playwright", project_name: "my-api-tests", include_examples: true }); // Run API tests (still works with existing execution engine) await mcp.call("run_api_tests", { max_concurrent: 5 });
Here's a complete example of testing the Petstore API:
# 1. Start the MCP server npx @kirti676/api-tester-mcp@latest
Then in your MCP client (like Claude Desktop):
// 1. Load the Petstore OpenAPI spec await mcp.call("ingest_spec", { spec_type: "openapi", file_path: "./examples/petstore_openapi.json" }); // 2. Set environment variables await mcp.call("set_env_vars", { pairs: { "baseUrl": "https://petstore.swagger.io/v2", "auth_apikey": "special-key" } }); // 3. Generate test cases const tests = await mcp.call("get_generated_tests"); // 4. Run API tests const result = await mcp.call("run_api_tests"); // 5. View results in HTML report const reports = await mcp.call("list_resources", { uri: "file://reports" });
{ "tool": "ingest_spec", "params": { "spec_type": "openapi", "content": "{ ... your OpenAPI spec ... }" } }
{ "tool": "set_env_vars", "params": { "variables": { "auth_bearer": "your-token", "baseUrl": "https://api.example.com" } } }
{ "tool": "generate_scenarios", "params": { "include_negative_tests": true } }
- π Access HTML reports via MCP resources
- π Get session status and statistics
{ "tool": "ingest_spec", "params": { "spec_type": "graphql", "file_path": "./schema.graphql" } }
{ "tool": "set_env_vars", "params": { "graphqlEndpoint": "https://api.example.com/graphql", "auth_bearer": "your-jwt-token" } }
A comprehensive Model Context Protocol (MCP) server for QA/SDET engineers that provides API testing capabilities with Swagger/OpenAPI and Postman collection support.
πNow available on NPM!Install withnpx @kirti676/api-tester-mcp@latest
- β
Enhanced Progress Tracking- Real-time progress with completion percentages and ETA
- β
Visual Progress Bars- ASCII progress bars with milestone notifications
- β
Performance Metrics- Throughput calculations and execution summaries
- β
Published on NPM- Install instantly with NPX
- β
VS Code Integration- One-click installation buttons
- β
Simplified Setup- No manual Python installation required
- β
Cross-Platform- Works on Windows, macOS, and Linux
- β
Auto-Updates- Always get the latest version with@latest
The API Tester MCP server can be used directly with npx without any installation:
Follow the MCP installguide, use the standard config below:
{ "mcpServers": { "api-tester": { "command": "npx", "args": ["@kirti676/api-tester-mcp@latest"] } } }
The standard configuration works with most MCP clients:
{ "mcpServers": { "api-tester": { "command": "npx", "args": ["@kirti676/api-tester-mcp@latest"] } } }
- π€Claude Desktop
- π»VS Codewith MCP extension
- β‘Cursor
- πWindsurf
- πͺΏGoose
- π§ Any other MCP-compatible client
git clone https://github.com/kirti676/api_tester_mcp.git cd api_tester_mcp npm install
Try the API Tester MCP server immediately:
# Run the server npx @kirti676/api-tester-mcp@latest # Check version npx @kirti676/api-tester-mcp@latest --version # Get help npx @kirti676/api-tester-mcp@latest --help
For MCP clients like Claude Desktop, use this configuration:
{ "mcpServers": { "api-tester": { "command": "npx", "args": ["@kirti676/api-tester-mcp@latest"] } } }
- π₯ Input Support: OpenAPI/Swagger documents, Postman collections, and GraphQL schemas
- π Test Generation: Automatic API and Load test scenario generation
- π Multi-Language Support: Generate tests in TypeScript/Playwright, JavaScript/Jest, Python/pytest, and more
- β‘ Test Execution: Run generated tests with detailed reporting
- π Smart Auth Detection: Automatic environment variable analysis and setup guidance
- π Authentication: Bearer token and API key support viaset_env_vars
- π HTML Reports: Beautiful, accessible reports via MCP resources
- π Real-time Progress: Live updates with progress bars and completion percentages
- β±οΈ ETA Calculations: Estimated time to completion for all operations
- π― Milestone Tracking: Special notifications at key progress milestones (25%, 50%, 75%, etc.)
- π Performance Metrics: Throughput calculations and execution summaries
- β
Schema Validation: Request body generation from schema examples
- π― Assertions: Per-endpoint status code assertions (2xx, 4xx, 5xx)
- π¦ Project Generation: Complete project scaffolding with dependencies and configuration
The API Tester MCP now supports generating test code in multiple programming languages and testing frameworks:
π§ Supported Language/Framework Combinations
// 1. Get available languages and frameworks const languages = await mcp.call("get_supported_languages"); // 2. Choose your preferred combination await mcp.call("ingest_spec", { spec_type: "openapi", file_path: "./path/to/your/api-spec.json", preferred_language: "typescript", // python, typescript, javascript preferred_framework: "playwright" // varies by language }); // 3. Generate test cases with code await mcp.call("generate_test_cases", { language: "typescript", framework: "playwright" }); // 4. Get complete project setup await mcp.call("generate_project_files", { language: "typescript", framework: "playwright", project_name: "my-api-tests", include_examples: true });
Thegenerate_project_filestool creates a complete, ready-to-run project:
my-api-tests/ βββ π¦ package.json # Dependencies & scripts βββ βοΈ playwright.config.ts # Playwright configuration βββ π tests/ β βββ π§ͺ api.spec.ts # Generated test code βββ π README.md # Setup instructions
my-api-tests/ βββ π requirements.txt # Python dependencies βββ βοΈ pytest.ini # pytest configuration βββ π tests/ β βββ π§ͺ test_api.py # Generated test code βββ π README.md # Setup instructions
my-api-tests/ βββ π¦ package.json # Dependencies & scripts βββ βοΈ jest.config.js # Jest configuration βββ π tests/ β βββ π§ͺ api.test.js # Generated test code βββ π README.md # Setup instructions
- π Playwright: Browser automation, parallel execution, detailed reporting
- π Jest: Snapshot testing, mocking, watch mode for development
- π§ͺ pytest: Fixtures, parametrized tests, extensive plugin ecosystem
- π² Cypress: Interactive debugging, time-travel debugging, real browser testing
- π Supertest: Express.js integration, middleware testing
- π‘ requests: Simple API calls, session management, authentication helpers
The API Tester MCP includes comprehensive progress tracking for all operations:
π― API Test Execution: [ββββββββββββββββββββ] 50.0% (5/10) | ETA: 2.5s - GET /api/users β
- π Progress Bars: ASCII progress bars with filled/empty indicators
- π Completion Percentages: Real-time percentage completion
- β° ETA Calculations: Estimated time to completion based on current performance
- π― Milestone Notifications: Special highlighting at key progress points
- β‘ Performance Metrics: Throughput and timing statistics
- π Operation Context: Detailed information about current step being executed
- π¬ Scenario generation
- π§ͺ Test case generation
- π API test execution
- β‘ Load test execution
- π All long-running operations
The server provides 11 comprehensive MCP tools with detailed parameter specifications:
1. π₯ingest_spec- Load API Specifications
Load OpenAPI/Swagger, Postman collections, or GraphQL schemas with language/framework preferences
{ "spec_type": "openapi", // openapi, swagger, postman, graphql (optional, auto-detected) "file_path": "./api-spec.json", // Path to JSON, YAML, or GraphQL schema file (required) "preferred_language": "python", // python, typescript, javascript (optional, default: python) "preferred_framework": "requests" // pytest, requests, playwright, jest, cypress, supertest (optional, default: requests) }
2. π§set_env_vars- Configure Authentication & Environment
Set environment variables with automatic validation and guidance
{ "variables": {}, // Dictionary of custom environment variables (optional) "baseUrl": null, // API base URL (optional) "auth_bearer": null, // Bearer/JWT token (optional) "auth_apikey": null, // API key (optional) "auth_basic": null, // Base64 encoded credentials (optional) "auth_username": null, // Username for basic auth (optional) "auth_password": null // Password for basic auth (optional) }
3. π¬generate_scenarios- Create Test Scenarios
Generate test scenarios from ingested specifications
{ "include_negative_tests": true, // Generate failure scenarios (default: true) "include_edge_cases": true // Generate boundary conditions (default: true) }
4. π§ͺgenerate_test_cases- Convert to Executable Tests
Convert scenarios to executable test cases in preferred language/framework
{ "scenario_ids": null // Array of scenario IDs or null for all (optional) }
Execute API tests with detailed results and reporting
{ "test_case_ids": null, // Array of test case IDs or null for all (optional) "max_concurrent": 10 // Number of concurrent requests 1-50 (default: 10) }
6. β‘run_load_tests- Execute Performance Tests
Execute load/performance tests with configurable parameters
{ "test_case_ids": null, // Array of test case IDs or null for all (optional) "duration": 60, // Test duration in seconds (default: 60) "users": 10, // Number of concurrent virtual users (default: 10) "ramp_up": 10 // Ramp up time in seconds (default: 10) }
7. πget_supported_languages- List Language/Framework Options
Get list of supported programming languages and testing frameworks
8. π¦generate_project_files- Generate Complete Projects
Generate complete project structure with dependencies and configuration
{ "project_name": null, // Project folder name (optional, auto-generated if null) "include_examples": true // Include example test files (default: true) }
9. πget_workspace_info- Workspace Information
Get information about workspace directory and file generation locations
10. πdebug_file_system- File System Diagnostics
Get comprehensive workspace information and file system diagnostics
11. πget_session_status- Session Status & Progress
Retrieve current session information with progress details
- file://reports- List all available test reports
- file://reports/{report_id}- Access individual HTML test reports
- create_api_test_plan- Generate comprehensive API test plans
- analyze_test_failures- Analyze test failures and provide recommendations
The API Tester MCP now automatically analyzes your API specifications to detect required environment variables and provides helpful setup guidance:
- π Authentication Schemes: Bearer tokens, API keys, Basic auth, OAuth2
- π Base URLs: Extracted from specification servers/hosts
- π Template Variables: Postman collection variables like{{baseUrl}},{{authToken}}
- π Path Parameters: Dynamic values in paths like/users/{userId}
// 1. Ingest specification - automatic analysis included const result = await mcp.call("ingest_spec", { spec_type: "openapi", file_path: "./api-specification.json" }); // Check the setup message for immediate guidance console.log(result.setup_message); // "β οΈ 2 required environment variable(s) detected..." // 2. Get detailed setup instructions const suggestions = await mcp.call("get_env_var_suggestions"); console.log(suggestions.setup_instructions); // Provides copy-paste ready configuration examples
All MCP tools now provide helpful default parameter keys to guide users on what values they can set:
π§ Environment Variables (set_env_vars)
π ALL PARAMETERS ARE OPTIONAL- Provide only what you need:
// Option 1: Just the base URL await mcp.call("set_env_vars", { baseUrl: "https://api.example.com/v1" }); // Option 2: Just authentication await mcp.call("set_env_vars", { auth_bearer: "your-jwt-token-here" }); // Option 3: Multiple parameters await mcp.call("set_env_vars", { baseUrl: "https://api.example.com/v1", auth_bearer: "your-jwt-token", auth_apikey: "your-api-key" }); // Option 4: Using variables dict for custom values await mcp.call("set_env_vars", { variables: { "baseUrl": "https://api.example.com/v1", "custom_header": "custom-value" } });
Default values help you understand available options:
// Ingest with defaults shown await mcp.call("ingest_spec", { spec_type: "openapi", // openapi, swagger, postman file_path: "./api-spec.json", // Path to JSON or YAML specification file preferred_language: "python", // python, typescript, javascript preferred_framework: "requests" // pytest, requests, playwright, jest, cypress, supertest }); // Project generation with defaults await mcp.call("generate_project_files", { language: "python", // python, typescript, javascript framework: "requests", // Framework matching the language project_name: "api-tests", // Project folder name include_examples: true // Include example test files });
// API tests with concurrency control await mcp.call("run_api_tests", { test_case_ids: null, // ["test_1", "test_2"] or null for all max_concurrent: 10 // Number of concurrent requests (1-50) }); // Load tests with performance parameters await mcp.call("run_load_tests", { test_case_ids: null, // ["test_1", "test_2"] or null for all duration: 60, // Test duration in seconds users: 10, // Number of concurrent virtual users ramp_up: 10 // Ramp up time in seconds });
// NEW: Check supported languages and frameworks const languages = await mcp.call("get_supported_languages"); console.log(languages.supported_combinations); // Ingest specification with language preferences await mcp.call("ingest_spec", { spec_type: "openapi", file_path: "./openapi-specification.json", preferred_language: "typescript", preferred_framework: "playwright" }); // Set environment variables for authentication await mcp.call("set_env_vars", { variables: { "baseUrl": "https://api.example.com", "auth_bearer": "your-bearer-token", "auth_apikey": "your-api-key" } }); // Generate test scenarios await mcp.call("generate_scenarios", { include_negative_tests: true, include_edge_cases: true }); // Generate test cases in TypeScript/Playwright await mcp.call("generate_test_cases", { language: "typescript", framework: "playwright" }); // Generate complete project files await mcp.call("generate_project_files", { language: "typescript", framework: "playwright", project_name: "my-api-tests", include_examples: true }); // Run API tests (still works with existing execution engine) await mcp.call("run_api_tests", { max_concurrent: 5 });
Here's a complete example of testing the Petstore API:
# 1. Start the MCP server npx @kirti676/api-tester-mcp@latest
Then in your MCP client (like Claude Desktop):
// 1. Load the Petstore OpenAPI spec await mcp.call("ingest_spec", { spec_type: "openapi", file_path: "./examples/petstore_openapi.json" }); // 2. Set environment variables await mcp.call("set_env_vars", { pairs: { "baseUrl": "https://petstore.swagger.io/v2", "auth_apikey": "special-key" } }); // 3. Generate test cases const tests = await mcp.call("get_generated_tests"); // 4. Run API tests const result = await mcp.call("run_api_tests"); // 5. View results in HTML report const reports = await mcp.call("list_resources", { uri: "file://reports" });
{ "tool": "ingest_spec", "params": { "spec_type": "openapi", "content": "{ ... your OpenAPI spec ... }" } }
{ "tool": "set_env_vars", "params": { "variables": { "auth_bearer": "your-token", "baseUrl": "https://api.example.com" } } }
{ "tool": "generate_scenarios", "params": { "include_negative_tests": true } }
- π Access HTML reports via MCP resources
- π Get session status and statistics
{ "tool": "ingest_spec", "params": { "spec_type": "graphql", "file_path": "./schema.graphql" } }
{ "tool": "set_env_vars", "params": { "graphqlEndpoint": "https://api.example.com/graphql", "auth_bearer": "your-jwt-token" } }
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





