Multi-language MCP server for API testing with TypeScript/Playwright, JavaScript/Jest, Python/pytest support
Project description
API Tester MCP Server
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 with
npx @kirti676/api-tester-mcp@latest
๐ What's New
- โ 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
๐ Getting Started
Installation
The API Tester MCP server can be used directly with npx without any installation:
npx @kirti676/api-tester-mcp@latest
Quick Install:
Claude Desktop
Follow the MCP install guide, use the standard config below:
{
"mcpServers": {
"api-tester": {
"command": "npx",
"args": ["@kirti676/api-tester-mcp@latest"]
}
}
}
Other MCP Clients
The standard configuration works with most MCP clients:
{
"mcpServers": {
"api-tester": {
"command": "npx",
"args": ["@kirti676/api-tester-mcp@latest"]
}
}
}
Supported Clients:
- Claude Desktop
- VS Code with MCP extension
- Cursor
- Windsurf
- Goose
- Any other MCP-compatible client
Python Installation (Alternative)
pip install api-tester-mcp
From Source
git clone https://github.com/kirti676/api_tester_mcp.git
cd api_tester_mcp
npm install
โก Quick Start
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"]
}
}
}
โจ Features
- ๐ฅ Input Support: Swagger/OpenAPI documents and Postman collections
- ๐ 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 via
set_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
๐ Multi-Language Test Generation
The API Tester MCP now supports generating test code in multiple programming languages and testing frameworks:
Supported Language/Framework Combinations
| Language | Framework | Description | Use Case |
|---|---|---|---|
| TypeScript | Playwright | Modern E2E testing with excellent API support | Enterprise web applications |
| TypeScript | Supertest | Express.js focused API testing | Node.js backend services |
| JavaScript | Jest | Popular testing framework with good ecosystem | General API testing |
| JavaScript | Cypress | E2E testing with great developer experience | Full-stack applications |
| Python | pytest | Comprehensive testing with fixtures & plugins | Data-heavy APIs & ML services |
| Python | requests | Simple HTTP testing for quick validation | Rapid prototyping & scripts |
Language Selection Workflow
// 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",
content: spec_content,
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
});
Generated Project Structure
The generate_project_files tool creates a complete, ready-to-run project:
TypeScript + Playwright:
my-api-tests/
โโโ package.json # Dependencies & scripts
โโโ playwright.config.ts # Playwright configuration
โโโ tests/
โ โโโ api.spec.ts # Generated test code
โโโ README.md # Setup instructions
Python + pytest:
my-api-tests/
โโโ requirements.txt # Python dependencies
โโโ pytest.ini # pytest configuration
โโโ tests/
โ โโโ test_api.py # Generated test code
โโโ README.md # Setup instructions
JavaScript + Jest:
my-api-tests/
โโโ package.json # Dependencies & scripts
โโโ jest.config.js # Jest configuration
โโโ tests/
โ โโโ api.test.js # Generated test code
โโโ README.md # Setup instructions
Framework-Specific Features
- 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
๐ Progress Tracking
The API Tester MCP includes comprehensive progress tracking for all operations:
Visual Progress Indicators
๐ฏ API Test Execution: [โโโโโโโโโโโโโโโโโโโโ] 50.0% (5/10) | ETA: 2.5s - GET /api/users โ
Features:
- 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
Available for:
- Scenario generation
- Test case generation
- API test execution
- Load test execution
- All long-running operations
๐ ๏ธ MCP Tools
The server provides 10 comprehensive MCP tools:
ingest_spec- Load Swagger/OpenAPI or Postman collections with language preferencesget_supported_languages- Get list of supported programming languages and frameworks (NEW!)get_env_var_suggestions- Get detailed environment variable setup guidanceset_env_vars- Configure authentication and environment variablesgenerate_scenarios- Create test scenarios from specificationsgenerate_test_cases- Convert scenarios to executable test cases in selected language/framework (ENHANCED!)generate_project_files- Generate complete project with dependencies and configuration (NEW!)run_api_tests- Execute API tests with detailed resultsrun_load_tests- Execute performance/load testsget_session_status- Retrieve current session information
๐ MCP Resources
file://reports- List all available test reportsfile://reports/{report_id}- Access individual HTML test reports
๐ก MCP Prompts
create_api_test_plan- Generate comprehensive API test plansanalyze_test_failures- Analyze test failures and provide recommendations
๏ฟฝ Smart Environment Variable Analysis
The API Tester MCP now automatically analyzes your API specifications to detect required environment variables and provides helpful setup guidance:
Automatic Detection
- 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}
Smart Suggestions
// 1. Ingest specification - automatic analysis included
const result = await mcp.call("ingest_spec", {
spec_type: "openapi",
content: openapi_json_string
});
// 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
๐ง Configuration Example
// 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",
content: openapi_json_string,
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
});
๏ฟฝ Complete Workflow Example
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", {
kind: "openapi",
path_or_text: "https://petstore.swagger.io/v2/swagger.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"
});
๏ฟฝ๐ Usage Examples
Basic API Testing Workflow
-
Ingest API Specification
{ "tool": "ingest_spec", "params": { "spec_type": "openapi", "content": "{ ... your OpenAPI spec ... }" } }
-
Configure Authentication
{ "tool": "set_env_vars", "params": { "variables": { "auth_bearer": "your-token", "baseUrl": "https://api.example.com" } } }
-
Generate and Run Tests
{ "tool": "generate_scenarios", "params": { "include_negative_tests": true } }
-
View Results
- Access HTML reports via MCP resources
- Get session status and statistics
Load Testing
{
"tool": "run_load_tests",
"params": {
"users": 10,
"duration": 60,
"ramp_up": 10
}
}
๐ Test Generation Features
- Positive Tests: Valid requests with expected 2xx responses
- Negative Tests: Invalid authentication (401), wrong methods (405)
- Edge Cases: Large payloads, boundary conditions
- Schema-based Bodies: Automatic request body generation from OpenAPI schemas
- Comprehensive Assertions: Status codes, response times, content validation
๐ HTML Reports
Generated reports include:
- Test execution summary with pass/fail statistics
- Detailed test results with timing information
- Assertion breakdowns and error details
- Response previews and debugging information
- Mobile-friendly responsive design
๐ Authentication Support
- Bearer Tokens:
auth_bearerenvironment variable - API Keys:
auth_apikeyenvironment variable (sent as X-API-Key header) - Basic Auth:
auth_basicenvironment variable
๐ง Requirements
- Python: 3.8 or higher
- Node.js: 14 or higher (for npm installation)
๐ฆ Dependencies
Python Dependencies
- fastmcp>=0.2.0
- pydantic>=2.0.0
- aiohttp>=3.8.0
- jinja2>=3.1.0
- pyyaml>=6.0
- jsonschema>=4.0.0
- faker>=19.0.0
Node.js Dependencies
- None (self-contained package)
๐ง Troubleshooting
Common Issues
NPX Command Not Working
# If npx command fails, try:
npm install -g @kirti676/api-tester-mcp@latest
# Or run directly:
node ./node_modules/@kirti676/api-tester-mcp/cli.js
Python Not Found
# Make sure Python 3.8+ is installed and in PATH
python --version
# Install Python dependencies manually if needed:
pip install fastmcp>=0.2.0 pydantic>=2.0.0 requests>=2.28.0
MCP Client Connection Issues
- Ensure the MCP server is running on stdio transport (default)
- Check that your MCP client supports the latest MCP protocol version
- Verify the configuration JSON syntax is correct
Getting Help
- Check the Examples directory for working configurations
- See PROGRESS_TRACKING.md for detailed progress tracking documentation
- Run with
--verboseflag for detailed logging - Report issues on GitHub Issues
๐ค 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
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Issues & Support
- NPM Package: @kirti676/api-tester-mcp
- Report bugs: GitHub Issues
- Documentation: GitHub Wiki
- Discussions: GitHub Discussions
- Interactive install page: install.html
๐ Roadmap
- Multi-Language Test Generation - TypeScript/Playwright, JavaScript/Jest, Python/pytest support โจ NEW!
- Complete Project Generation - Full project scaffolding with dependencies and configuration โจ NEW!
- GraphQL API support
- Additional authentication methods (OAuth2, JWT)
- Go/Golang test generation (with testify/ginkgo)
- C#/.NET test generation (with NUnit/xUnit)
- Performance monitoring and alerting
- Integration with CI/CD pipelines (GitHub Actions, Jenkins)
- Advanced test data generation from examples and schemas
- API contract testing with Pact support
- Mock server generation for development
Made with โค๏ธ for QA/SDET engineers
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file api_tester_mcp-1.2.1.tar.gz.
File metadata
- Download URL: api_tester_mcp-1.2.1.tar.gz
- Upload date:
- Size: 46.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59c8752210e1b7741a9c9c60f015f9aeac7f0d7cb62348e5b470cb4e28975677
|
|
| MD5 |
60225471aeb03fe4675bece82b9d84dc
|
|
| BLAKE2b-256 |
58848790adc274a63b3e8d732e34aada97fbc09854c3c48c5a87401e03ef94f5
|
File details
Details for the file api_tester_mcp-1.2.1-py3-none-any.whl.
File metadata
- Download URL: api_tester_mcp-1.2.1-py3-none-any.whl
- Upload date:
- Size: 42.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
359b59e3c5f690b6b3856a235aa59bf126c8383eac21684772ac844f39301070
|
|
| MD5 |
8e301a2c3ccb9f5907e4bccdbb1d2dff
|
|
| BLAKE2b-256 |
10c89f7cc3a5a39ec2448c42a7b0ede8ccb1d3c3e7f59f99bc5722e97dec8f17
|