Model Context Protocol (MCP) server that wraps Locust, letting AI-powered IDEs/agents launch and monitor load tests programmatically.
https://github.com/QAInsights/locust-mcp-serverStop switching between your IDE and terminal to run load tests. This MCP server wraps Locust and lets your AI assistant launch, monitor, and analyze performance tests directly from your development environment.
You're deep in a coding session, building an API endpoint. You want to test it under load, but now you need to:
This context switching kills productivity. You lose focus, forget parameters, and debugging performance issues becomes a manual slog.
Instead of juggling terminals, you can now tell your AI assistant: "Run a load test with 50 users for 2 minutes against my API" and get results directly in your IDE. The MCP server bridges Locust and your AI-powered development environment.
Here's what happens:
Conversational Load Testing: "Test my checkout endpoint with 100 concurrent users" becomes a simple chat message instead of remembering complex CLI syntax.
Contextual Analysis: Your AI assistant can correlate performance results with your code changes, suggesting optimizations based on actual load patterns.
Seamless Integration: No separate tools to manage. Load testing becomes part of your development conversation, not a separate workflow.
Instant Debugging: When tests reveal issues, you can immediately ask your AI to analyze the results alongside your code and suggest fixes.
API Development: While building a new endpoint, quickly test it with realistic load without leaving your IDE. Get AI-powered suggestions for performance improvements based on actual metrics.
Performance Regression Detection: After making changes, run automated load tests and have AI compare results with previous runs to catch performance regressions early.
Capacity Planning: Ask your AI to run tests with different user loads and analyze the results to determine optimal scaling thresholds.
Load Pattern Analysis: Generate different user behavior patterns and have AI help interpret which scenarios reveal bottlenecks in your application.
Add this to your MCP client configuration:
{
"mcpServers": {
"locust": {
"command": "uv",
"args": [
"--directory",
"/path/to/locust-mcp-server",
"run",
"locust_server.py"
]
}
}
}
Create a simple Locust test file:
from locust import HttpUser, task, between
class APIUser(HttpUser):
wait_time = between(1, 3)
@task
def test_endpoint(self):
self.client.get("/api/users")
Then simply ask your AI assistant: "Run a load test with 25 users for 30 seconds"
Instead of this traditional workflow:
# Terminal 1
cd /path/to/tests
locust -f my_test.py --headless -u 50 -r 10 -t 2m --host=http://localhost:8000
# Wait... switch to browser for results
# Copy/paste results somewhere
# Analyze manually
You get this:
You: "Run a load test with 50 users against my API for 2 minutes"
AI: "Running load test with 50 users, spawn rate 10/sec for 2 minutes...
Test completed. Average response time: 245ms
95th percentile: 890ms
Error rate: 0.2%
Analysis: Your API handles the load well, but I notice response times
spike at the 95th percentile. The /users endpoint is your bottleneck.
Suggestion: Consider adding database connection pooling or caching
for user queries."
This MCP server fits naturally into AI-powered development environments like Claude Desktop, Cursor, and Windsurf. It transforms load testing from a separate tool into a conversational part of your development process.
Whether you're building microservices, API endpoints, or full applications, having AI-assisted load testing at your fingertips means you can catch performance issues early and optimize with confidence.
Ready to make performance testing as easy as asking a question? Clone the repository and add conversational load testing to your development toolkit.