Run Load Tests with Natural Language
An MCP server for running Locust load tests from an AI client, with configurable users, spawn rate, host, and runtime.
Maintainer of this project? Claim this page to edit the listing.
1.0.0Add to Favorites
Why it matters
Integrate Locust load testing with AI development environments to execute and analyze performance tests using natural language commands.
Outcomes
What it gets done
Execute Locust load tests via natural language commands.
Configure and customize test parameters like users, spawn rate, and runtime.
Analyze test results using LLM for efficient debugging and insights.
Support for headless and UI modes with HTTP/HTTPS protocol.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-locust | bash Capabilities
Tools your agent gets
Run a load test with customizable options for headless mode, host, runtime, users, and spawn rate
Overview
Locust MCP Server
This MCP server exposes a single run_locust tool that executes a Locust load test script with configurable users, spawn rate, host, and runtime, streaming real-time output back to the AI client. It runs existing Locust scripts rather than authoring them. Use it to trigger and analyze Locust load tests conversationally, especially for LLM-assisted debugging of test failures. A working Locust test script must already exist.
What it does
An MCP server that lets an AI client trigger and manage Locust load tests through a single tool, run_locust, which runs a specified Locust test file with configurable headless-or-UI mode, target host, runtime, concurrent user count, and spawn rate. It streams real-time execution output back into the conversation, so a request like "run locust test for hello.py" kicks off an actual load test and reports results as it runs, supporting whatever custom task scenarios the target script defines.
When to use - and when NOT to
Use it for load and performance testing of HTTP/HTTPS services with Locust, driven conversationally - particularly for LLM-assisted results analysis and debugging of test failures. It requires a working Locust test script already written against the locust Python library (an HttpUser subclass with @task methods and an optional on_start hook) - this server runs existing test scripts, it doesn't author them. It is not a substitute for knowing Locust itself: test scenarios, wait times, and task weights still need to be written in Python before the MCP tool can run them.
Capabilities
A single tool, run_locust(test_file, headless=True, host="http://localhost:8089", runtime="10s", users=3, spawn_rate=1), covers headless or UI-mode runs, a configurable target host, test duration (e.g. 30s, 1m, 5m), number of simulated concurrent users, and the rate at which those users spawn - plus real-time output as the test executes and support for whatever custom task scenarios the Locust script defines.
How to install
git clone https://github.com/qainsights/locust-mcp-server.git
uv pip install -r requirements.txt
Requires Python 3.13 or higher and the uv package manager. Optional defaults can be set in a .env file: LOCUST_HOST, LOCUST_USERS, LOCUST_SPAWN_RATE, and LOCUST_RUN_TIME. Configure an MCP client such as Claude Desktop, Cursor, or Windsurf by registering a locust server whose command is the uv binary, run with --directory pointing at the cloned locust-mcp-server folder and the arguments run locust_server.py (the source's own example config hardcodes the author's personal machine paths for both, which don't generalize - use your own uv and clone locations instead). Then write a Locust test script and simply ask the LLM to run it against the target file. A typical example script defines an HttpUser class with a wait_time between requests, one or more @task methods hitting different endpoints (optionally weighted, e.g. @task(3) to run three times as often), and an on_start hook that logs the simulated user in before the timed test load begins.
Who it's for
QA engineers and developers who want to trigger and analyze Locust load tests conversationally, letting an LLM help interpret real-time results and debug failures without leaving their AI-powered development environment.
Source README
🚀 ⚡️ locust-mcp-server
A Model Context Protocol (MCP) server implementation for running Locust load tests. This server enables seamless integration of Locust load testing capabilities with AI-powered development environments.
✨ Features
- Simple integration with Model Context Protocol framework
- Support for headless and UI modes
- Configurable test parameters (users, spawn rate, runtime)
- Easy-to-use API for running Locust load tests
- Real-time test execution output
- HTTP/HTTPS protocol support out of the box
- Custom task scenarios support
🔧 Prerequisites
Before you begin, ensure you have the following installed:
- Python 3.13 or higher
- uv package manager (Installation guide)
📦 Installation
- Clone the repository:
git clone https://github.com/qainsights/locust-mcp-server.git
- Install the required dependencies:
uv pip install -r requirements.txt
- Set up environment variables (optional):
Create a.envfile in the project root:
LOCUST_HOST=http://localhost:8089 # Default host for your tests
LOCUST_USERS=3 # Default number of users
LOCUST_SPAWN_RATE=1 # Default user spawn rate
LOCUST_RUN_TIME=10s # Default test duration
🚀 Getting Started
- Create a Locust test script (e.g.,
hello.py):
from locust import HttpUser, task, between
class QuickstartUser(HttpUser):
wait_time = between(1, 5)
@task
def hello_world(self):
self.client.get("/hello")
self.client.get("/world")
@task(3)
def view_items(self):
for item_id in range(10):
self.client.get(f"/item?id={item_id}", name="/item")
time.sleep(1)
def on_start(self):
self.client.post("/login", json={"username":"foo", "password":"bar"})
- Configure the MCP server using the below specs in your favorite MCP client (Claude Desktop, Cursor, Windsurf and more):
{
"mcpServers": {
"locust": {
"command": "/Users/naveenkumar/.local/bin/uv",
"args": [
"--directory",
"/Users/naveenkumar/Gits/locust-mcp-server",
"run",
"locust_server.py"
]
}
}
}
- Now ask the LLM to run the test e.g.
run locust test for hello.py. The Locust MCP server will use the following tool to start the test:
run_locust: Run a test with configurable options for headless mode, host, runtime, users, and spawn rate
📝 API Reference
Run Locust Test
run_locust(
test_file: str,
headless: bool = True,
host: str = "http://localhost:8089",
runtime: str = "10s",
users: int = 3,
spawn_rate: int = 1
)
Parameters:
test_file: Path to your Locust test scriptheadless: Run in headless mode (True) or with UI (False)host: Target host to load testruntime: Test duration (e.g., "30s", "1m", "5m")users: Number of concurrent users to simulatespawn_rate: Rate at which users are spawned
✨ Use Cases
- LLM powered results analysis
- Effective debugging with the help of LLM
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.