Skip to main content
Glama

🚀 ⚡️ k6-mcp-server

A Model Context Protocol (MCP) server implementation for running k6 load tests.

✨ Features

  • Simple integration with Model Context Protocol framework

  • Support for custom test durations and virtual users (VUs)

  • Easy-to-use API for running k6 load tests

  • Configurable through environment variables

  • Real-time test execution output

Related MCP server: JMeter MCP Server

🔧 Prerequisites

Before you begin, ensure you have the following installed:

📦 Installation

  1. Clone the repository:

git clone https://github.com/qainsights/k6-mcp-server.git
  1. Install the required dependencies:

uv pip install -r requirements.txt
  1. Set up environment variables (optional): Create a .env file in the project root:

K6_BIN=/path/to/k6  # Optional: defaults to 'k6' in system PATH

🚀 Getting Started

  1. Create a k6 test script (e.g., test.js):

import http from "k6/http";
import { sleep } from "k6";

export default function () {
  http.get("http://test.k6.io");
  sleep(1);
}
  1. Configure the MCP server using the below specs in your favorite MCP client (Claude Desktop, Cursor, Windsurf and more):

{
  "mcpServers": {
    "k6": {
      "command": "/path/to/bin/uv",
      "args": [
        "--directory",
        "/path/to/k6-mcp-server",
        "run",
        "k6_server.py"
      ]
    }
  }
}
  1. Now ask the LLM to run the test e.g. run k6 test for hello.js. The k6 mcp server will leverage either one of the below tools to start the test.

  • execute_k6_test: Run a test with default options (30s duration, 10 VUs)

  • execute_k6_test_with_options: Run a test with custom duration and VUs

k6-MCP

📝 API Reference

Execute K6 Test

execute_k6_test(
    script_file: str,
    duration: str = "30s",  # Optional
    vus: int = 10          # Optional
)

Execute K6 Test with Custom Options

execute_k6_test_with_options(
    script_file: str,
    duration: str,
    vus: int
)

✨ Use cases

  • LLM powered results analysis

  • Effective debugging of load tests

🤝 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.

Available Tools

2 tools
execute_k6_testB

Execute a k6 load test.

Args: script_file: Path to the k6 test script (.js) duration: Duration of the test (e.g., "30s", "1m", "5m") vus: Number of virtual users to simulate

ParametersJSON Schema
NameRequiredDescriptionDefault
script_fileYes
durationNo30s
vusNo

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states the tool executes a load test, implying a potentially resource-intensive operation, but does not disclose behavioral traits such as permissions needed, rate limits, whether it runs synchronously/asynchronously, or what happens on failure. This is a significant gap for a tool with mutation-like behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded with the main purpose, followed by parameter explanations in a structured 'Args:' section. Every sentence earns its place by clarifying parameters, though it could be slightly more concise by integrating the parameter details more seamlessly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of executing a load test (a mutation-like operation), no annotations, and no output schema, the description is incomplete. It covers the basic purpose and parameters but lacks critical context such as return values, error handling, or execution behavior. This is adequate as a minimum but has clear gaps for safe agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It provides clear semantics for all three parameters: 'script_file' as a path to a .js file, 'duration' with examples of time formats, and 'vus' as the number of virtual users. This adds substantial value beyond the bare schema, though it could include more details like valid ranges or constraints.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Execute a k6 load test' with a specific verb ('execute') and resource ('k6 load test'). It distinguishes from the sibling tool 'execute_k6_test_with_options' by being the basic version, though this distinction is implied rather than explicit. The purpose is not vague or tautological.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by specifying parameters for a basic load test, but does not explicitly state when to use this tool versus the sibling 'execute_k6_test_with_options'. No exclusions or alternatives are mentioned, leaving the agent to infer that this is for simpler tests without additional options.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

execute_k6_test_with_optionsB

Execute a k6 load test with custom duration and VUs.

Args: script_file: Path to the k6 test script (.js) duration: Duration of the test (e.g., "30s", "1m", "5m") vus: Number of virtual users to simulate

ParametersJSON Schema
NameRequiredDescriptionDefault
script_fileYes
durationYes
vusYes

TDQS

B3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool executes a load test but doesn't mention critical behaviors like whether it's destructive (e.g., impacts system performance), requires specific permissions, has rate limits, or what happens upon execution (e.g., returns results, runs in background). This leaves significant gaps for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded with the core purpose in the first sentence. The parameter explanations are concise and directly relevant. However, the 'Args:' section formatting is slightly redundant with the schema but still earns its place by clarifying semantics.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and a mutation tool (executing tests), the description is incomplete. It lacks information on return values, error handling, prerequisites (e.g., script availability), and behavioral implications. For a tool that likely affects system resources, this is inadequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It effectively adds meaning by explaining all three parameters: 'script_file' as a path to a .js file, 'duration' with format examples, and 'vus' as number of virtual users. This provides clear semantics beyond the bare schema, though it could be more detailed (e.g., constraints on values).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Execute a k6 load test with custom duration and VUs.' It specifies the verb ('execute'), resource ('k6 load test'), and key customizable parameters. However, it doesn't explicitly differentiate from its sibling 'execute_k6_test' (mentioned in context), which would be needed for a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus its sibling 'execute_k6_test' or any alternatives. It mentions custom parameters but doesn't explain scenarios where this tool is preferred over simpler versions or when it should be avoided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 2 tool updates
    • First observedexecute_k6_test
    • First observedexecute_k6_test_with_options

TDQS

C2.8/5.0

Scored across 2 tools

Disambiguation1/5

The two tools are essentially identical in purpose and functionality, both executing k6 load tests with the exact same parameters (script_file, duration, vus). The only difference is the tool name, which creates confusion rather than clarity. An agent would have no meaningful basis to choose between them.

Naming Consistency3/5

Both tools follow a consistent snake_case pattern with 'execute_k6_test' as the base, which is readable. However, the second tool's name 'execute_k6_test_with_options' is redundant since the first tool already accepts options (duration and VUs), making the naming somewhat inconsistent in logic despite matching the format.

Tool Count2/5

With only 2 tools, the server feels thin for a load testing domain, as it lacks operations like listing tests, getting results, or managing test configurations. The tools are redundant, so the effective count is even lower, failing to cover basic workflows beyond a single execution action.

Completeness2/5

The server is severely incomplete for k6 load testing, missing essential operations such as retrieving test results, monitoring test status, or managing test scripts. It only offers execution with no way to access outcomes, leaving agents unable to perform a full testing lifecycle.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers