Locust MCP Server

by QAInsights
Verified

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Enables running Locust load tests with configurable parameters (users, spawn rate, runtime) for HTTP/HTTPS performance testing through a simple API.

🚀 ⚡️ locust-mcp-server

Locust 負荷テストを実行するための Model Context Protocol (MCP) サーバー実装。このサーバーにより、Locust 負荷テスト機能と AI を活用した開発環境をシームレスに統合できます。

✨ 特徴

  • モデルコンテキストプロトコルフレームワークとのシンプルな統合
  • ヘッドレスモードとUIモードのサポート
  • 設定可能なテストパラメータ(ユーザー、生成率、実行時間)
  • Locust 負荷テストを実行するための使いやすい API
  • リアルタイムテスト実行出力
  • HTTP/HTTPSプロトコルのサポート
  • カスタムタスクシナリオのサポート

🔧 前提条件

始める前に、以下がインストールされていることを確認してください。

📦 インストール

  1. リポジトリをクローンします。
git clone https://github.com/qainsights/locust-mcp-server.git
  1. 必要な依存関係をインストールします。
uv pip install -r requirements.txt
  1. 環境変数を設定する (オプション): プロジェクト ルートに.envファイルを作成します。
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

🚀 はじめに

  1. Locust テスト スクリプト (例: 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"})
  1. お気に入りの MCP クライアント (Claude Desktop、Cursor、Windsurf など) で以下の仕様を使用して MCP サーバーを構成します。
{ "mcpServers": { "locust": { "command": "/Users/naveenkumar/.local/bin/uv", "args": [ "--directory", "/Users/naveenkumar/Gits/locust-mcp-server", "run", "locust_server.py" ] } } }
  1. LLMにテストの実行を指示します(例run locust test for hello.py 。Locust MCPサーバーは以下のツールを使用してテストを開始します。
  • run_locust : ヘッドレスモード、ホスト、ランタイム、ユーザー、およびスポーンレートの設定可能なオプションを使用してテストを実行します。

📝 APIリファレンス

Locustテストを実行する

run_locust( test_file: str, headless: bool = True, host: str = "http://localhost:8089", runtime: str = "10s", users: int = 3, spawn_rate: int = 1 )

パラメータ:

  • test_file : Locust テスト スクリプトへのパス
  • headless : ヘッドレスモード(True)またはUI付き(False)で実行
  • host : 負荷テストの対象ホスト
  • runtime : テスト期間(例:「30秒」、「1分」、「5分」)
  • users : シミュレートする同時ユーザー数
  • spawn_rate : ユーザーが生成されるレート

✨ ユースケース

  • LLMを活用した結果分析
  • LLMを活用した効果的なデバッグ

🤝 貢献する

貢献を歓迎します!お気軽にプルリクエストを送信してください。

📄 ライセンス

このプロジェクトは MIT ライセンスに基づいてライセンスされています - 詳細については LICENSE ファイルを参照してください。

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

Locust 負荷テスト機能と AI を活用した開発環境を統合し、ユーザーが自然言語コマンドを使用してパフォーマンス テストを実行できるようにするサーバー。

  1. ✨ Features
    1. 🔧 Prerequisites
      1. 📦 Installation
        1. 🚀 Getting Started
          1. 📝 API Reference
            1. Run Locust Test
          2. ✨ Use Cases
            1. 🤝 Contributing
              1. 📄 License
                ID: ka9m9g964t