MCP server for comprehensive Laravel API testing - security, validation, Query Builder, and ApiResponse verification for AI-assisted development
npm install gotrasoft-api-testingThe Ultimate MCP Server for Laravel API Testing
Empower your AI assistant to test Laravel APIs like a senior developer


---
Building Laravel APIs with AI assistance? How confident are you that the generated code is secure and robust?
This MCP (Model Context Protocol) server transforms your AI into a thorough API testing expert that:
- π Scans your Laravel project to understand routes, validation rules, and model configurations
- π‘οΈ Generates security tests for SQL injection, XSS, IDOR, and more
- β
Validates responses against your ApiResponse trait format
- π§ Tests Query Builder features like includes, filters, sorts, and search
- π Provides testing guidance with best practices and checklists
> "Stop hoping your API is secure. Start knowing it."
---
| Feature | What It Does |
|---------|--------------|
| πΊοΈ Route Scanning | Uses php artisan route:list --json for accurate route detection |
| π Form Request Analysis | Extracts validation rules from your Request classes |
| ποΈ Model Inspection | Reads Queryable trait config (searchable, includes, filters) |
| π§ͺ Test Case Generation | Creates 70+ test cases per endpoint automatically |
| π‘οΈ Security Payloads | SQL injection, XSS, path traversal attack vectors |
| β
Response Validation | Ensures responses follow ApiResponse trait format |
| π Postman Integration | Generates ready-to-execute requests for Postman MCP |
> Smart Fallback: If php artisan is not available, the tool automatically falls back to parsing route files directly.
---
``bash`
npm install -g gotrasoft-api-testing
Open your VS Code settings and configure the MCP server.
#### For Antigravity Client:
Create or edit antigravity_mcp.json in your project root:
`json`
{
"mcpServers": {
"api-testing": {
"command": "npx",
"args": ["-y", "gotrasoft-api-testing"]
}
}
}
#### For Other MCP Clients:
Add to your MCP configuration file:
`json`
{
"mcpServers": {
"api-testing": {
"command": "npx",
"args": ["-y", "gotrasoft-api-testing"]
}
}
}
After saving the configuration, restart VS Code or reload the window to activate the MCP server.
Ask your AI assistant:
> "Use the scan_project_full tool on my Laravel project"
If everything is set up correctly, you'll see a comprehensive scan of your routes, form requests, and models! π
---
| Tool | Description |
|------|-------------|
| get_testing_workflow | START HERE - Get step-by-step testing workflow |
| Tool | Description |
|------|-------------|
| scan_laravel_routes | Scan routes using php artisan route:list |scan_form_requests
| | Parse Form Request validation rules |scan_models
| | Extract Model Queryable configuration |scan_project_full
| | Comprehensive scan with automatic mappings |
| Tool | Description |
|------|-------------|
| generate_test_cases | Generate 70+ test cases per endpoint |generate_query_builder_tests
| | Tests for includes, filters, sorts, search |get_security_payloads
| | SQL injection, XSS, path traversal payloads |
| Tool | Description |
|------|-------------|
| evaluate_test_result | β NEW - Determine PASS/FAIL for each test |validate_api_response
| | Check response against ApiResponse format |analyze_test_results
| | Analyze results with recommendations |get_testing_guidance
| | Testing checklist and best practices |
| Tool | Description |
|------|-------------|
| generate_postman_request | Convert test case for Postman MCP |
---
``
AI, use scan_project_full on /path/to/my/laravel-project
Result:
- π 81 routes discovered
- π 36 Form Request classes parsed
- ποΈ 12 Models with Queryable configuration
- π Automatic resource-to-model mappings
``
AI, generate test cases for POST /api/v1/members using the validation rules from MemberStoreRequest
Result:
- β
1 valid case
- π 21 validation tests
- π‘οΈ 31 security tests
- β οΈ 3 error handling tests
- π 14 edge cases
``
AI, validate this API response against the ApiResponse format:
{
"success": true,
"message": "Data retrieved successfully",
"code": 200,
"data": [...],
"pagination": {...}
}
Result:
- β
Valid paginated response
- All required fields present
- Pagination structure verified
---
Our security payloads are battle-tested and comprehensive:
| Attack Type | Payloads | Severity |
|-------------|----------|----------|
| SQL Injection | 10+ variations | π΄ Critical |
| XSS (Cross-Site Scripting) | 10+ payloads | π High |
| Path Traversal | 10+ attempts | π΄ Critical |
| Command Injection | 10+ vectors | π΄ Critical |
| IDOR | Dynamic tests | π΄ Critical |
| Mass Assignment | Admin flag tests | π΄ Critical |
---
This diagram shows how api-testing MCP integrates with other MCP servers for complete API testing:
`mermaid`
flowchart LR
subgraph api-testing MCP
A[api-testing MCP]
end
subgraph Step 1
A -->|1. Scan| B[Laravel Project]
end
subgraph Step 2
A -->|2. Generate Tests| C[Test Suite]
end
subgraph Step 3 - Execute
C -->|3. Execute| D[postman MCP]
D -->|Request| E[Laravel API]
E -->|Response| D
end
subgraph Step 4 - Verify
D -->|Results| A
A -->|4. Verify| F[mysql MCP]
F -->|Query| G[Database]
end
subgraph Step 5 - Report
A -->|5. Report| H[Recommendations]
end
| MCP Server | Purpose | npm |
|------------|---------|-----|
| gotrasoft-postman | Execute HTTP requests |  |
| gotrasoft-mysql | Verify database state |  |
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AI Testing Workflow β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β 1. get_testing_workflow β Get step-by-step guide β
β 2. scan_project_full β Discover routes, requests, models β
β 3. generate_test_cases β Create 70+ test cases β
β 4. generate_postman_request β Format for Postman MCP β
β 5. [postman] make_request β Execute HTTP request β
β 6. validate_api_response β Check response format β
β 7. [mysql] execute_query β Verify database changes β
β 8. analyze_test_results β Get recommendations β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
This MCP server understands and supports:
- β
ApiResponse Trait - Standard JSON response format
- β
Queryable Trait - Spatie Query Builder integration
- β
Form Request Classes - Validation rules parsing
- β
Route Definitions - Standard and resource routes
- β
Model Relationships - belongsTo, hasMany, etc.
---
Q: Does this actually execute API requests?
No! This MCP server only generates test cases and analyzes your code structure. To execute requests, pair it with the Postman MCP.
Q: Will this work with my custom Laravel setup?
Yes! As long as you follow standard Laravel conventions for routes, requests, and models.
Q: Is this safe to use in production?
This tool only reads your code files. It never modifies anything or connects to your database/API directly.
---
MIT License - Created by I Komang Gede Yuliana
---
Made with β€οΈ by Gotrasoft
Helping developers build secure, tested APIs with confidence