<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Configure your AI assistant on Grafana Labs</title><link>https://grafana.com/docs/k6/v2.3.x/set-up/configure-ai-assistant/</link><description>Recent content in Configure your AI assistant on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/k6/v2.3.x/set-up/configure-ai-assistant/index.xml" rel="self" type="application/rss+xml"/><item><title>Bootstrap your editor with k6 x agent</title><link>https://grafana.com/docs/k6/v2.3.x/set-up/configure-ai-assistant/bootstrap-with-k6-x-agent/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/set-up/configure-ai-assistant/bootstrap-with-k6-x-agent/</guid><content><![CDATA[&lt;h1 id=&#34;bootstrap-your-editor-with-k6-x-agent&#34;&gt;Bootstrap your editor with k6 x agent&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;k6 x agent&lt;/code&gt; command scaffolds an AI-assisted k6 testing workflow in your project. A single invocation drops portable &lt;a href=&#34;https://docs.claude.com/en/docs/agents/skills&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;SKILL.md&lt;/code&gt;&lt;/a&gt; bundles into your editor&amp;rsquo;s expected locations and registers the k6 MCP server in your editor&amp;rsquo;s MCP configuration — so you don&amp;rsquo;t have to author MCP client configuration by hand.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;k6 x agent&lt;/code&gt; is a &lt;a href=&#34;../../extensions/create/subcommand-extensions/&#34;&gt;subcommand extension&lt;/a&gt; shipped with k6. The first time you run it, k6 transparently fetches the extension; subsequent invocations start immediately.&lt;/p&gt;
&lt;h2 id=&#34;what-k6-x-agent-init-does-for-you&#34;&gt;What &lt;code&gt;k6 x agent init&lt;/code&gt; does for you&lt;/h2&gt;
&lt;p&gt;For each editor you target, &lt;code&gt;init&lt;/code&gt; will:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Install bundled skills:&lt;/strong&gt; Write portable &lt;code&gt;SKILL.md&lt;/code&gt; files (or the editor&amp;rsquo;s equivalent rule format) into the locations your editor reads from. Skills auto-activate based on user intent, for example &amp;ldquo;write a smoke test&amp;rdquo; or &amp;ldquo;convert this Playwright script&amp;rdquo;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Register the k6 MCP server:&lt;/strong&gt; Surgically merge a &lt;code&gt;k6&lt;/code&gt; entry into the editor&amp;rsquo;s MCP config (&lt;code&gt;.mcp.json&lt;/code&gt;, &lt;code&gt;.cursor/mcp.json&lt;/code&gt;, &lt;code&gt;.vscode/mcp.json&lt;/code&gt;, …) so your assistant can call &lt;code&gt;validate_script&lt;/code&gt;, &lt;code&gt;run_script&lt;/code&gt;, and the rest of the &lt;a href=&#34;./tools-prompts-resources/&#34;&gt;k6 MCP tools&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Stay out of your way:&lt;/strong&gt; Files written by &lt;code&gt;k6 x agent&lt;/code&gt; carry an ownership marker. Re-running &lt;code&gt;init&lt;/code&gt; is idempotent. Files you&amp;rsquo;ve edited locally are never overwritten unless you pass &lt;code&gt;--force&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;prerequisites&#34;&gt;Prerequisites&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;k6 v2.0 or later on your &lt;code&gt;PATH&lt;/code&gt; (&lt;a href=&#34;../install-k6/&#34;&gt;install k6&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;A project directory you want to scaffold into (run the command from the project root).&lt;/li&gt;
&lt;li&gt;One of the editors in &lt;a href=&#34;#supported-targets&#34;&gt;Supported targets&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;quickstart&#34;&gt;Quickstart&lt;/h2&gt;
&lt;p&gt;From the root of your k6 project:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;sh&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sh&#34;&gt;k6 x agent init claude-code           # one editor
k6 x agent init claude-code cursor    # several
k6 x agent init --all                 # every supported target
k6 x agent status                     # verify what got installed&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Then open your editor and ask it to plan or write a k6 test. The bundled skills auto-activate based on intent — for example, &amp;ldquo;write a smoke test for the login flow&amp;rdquo; or &amp;ldquo;convert this Playwright script to k6&amp;rdquo;.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Before any disk writes, you can run &lt;code&gt;k6 x agent init --dry-run &amp;lt;target&amp;gt;&lt;/code&gt; to preview every file the command would create or merge, with byte counts and write modes.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;supported-targets&#34;&gt;Supported targets&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Target&lt;/th&gt;
              &lt;th&gt;CLI name&lt;/th&gt;
              &lt;th&gt;Skills location&lt;/th&gt;
              &lt;th&gt;MCP config&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;Claude Code&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;claude-code&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;.claude/skills/&amp;lt;name&amp;gt;/&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;.mcp.json&lt;/code&gt; &#43; &lt;code&gt;.claude/settings.local.json&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;OpenCode&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;opencode&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;.opencode/skills/&amp;lt;name&amp;gt;/&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;opencode.json&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;OpenAI Codex CLI&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;codex-cli&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;.codex/skills/&amp;lt;name&amp;gt;/&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;.codex/mcp.json&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;GitHub Copilot&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;vscode-copilot&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;.github/copilot/skills/&amp;lt;name&amp;gt;/&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;.vscode/mcp.json&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Cursor&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;cursor&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;.cursor/rules/&amp;lt;name&amp;gt;.mdc&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;.cursor/mcp.json&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Cline&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;cline&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;.clinerules/&amp;lt;name&amp;gt;.md&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;global (snippet printed as a notice)&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;

&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Cline&amp;rsquo;s MCP configuration is global rather than project-scoped. &lt;code&gt;k6 x agent init cline&lt;/code&gt; prints the JSON snippet you need to paste into &lt;code&gt;cline_mcp_settings.json&lt;/code&gt; instead of writing it for you.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;If your editor isn&amp;rsquo;t listed, see &lt;a href=&#34;#editors-not-supported-by-k6-x-agent&#34;&gt;Editors not supported by &lt;code&gt;k6 x agent&lt;/code&gt;&lt;/a&gt; below for manual setup.&lt;/p&gt;
&lt;h2 id=&#34;bundled-skills&#34;&gt;Bundled skills&lt;/h2&gt;
&lt;p&gt;The skills below are embedded in the binary and installed for every target. They are written in portable &lt;code&gt;SKILL.md&lt;/code&gt; format and auto-activate when your assistant detects matching intent in the conversation.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Skill&lt;/th&gt;
              &lt;th&gt;Triggers on&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;k6-test-planner&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&amp;ldquo;plan tests&amp;rdquo;, &amp;ldquo;design a test strategy&amp;rdquo;, &amp;ldquo;what k6 tests should I write&amp;rdquo;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;k6-load-test&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&amp;ldquo;write a k6 script&amp;rdquo;, &amp;ldquo;load test&amp;rdquo;, &amp;ldquo;stress / soak / spike test&amp;rdquo;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;k6-smoke-test&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&amp;ldquo;smoke test&amp;rdquo;, &amp;ldquo;sanity check&amp;rdquo;, &amp;ldquo;quick health check&amp;rdquo;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;k6-browser-test&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&amp;ldquo;browser test&amp;rdquo;, &amp;ldquo;UI test with k6&amp;rdquo;, &amp;ldquo;test the frontend&amp;rdquo;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;k6-playwright-converter&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A Playwright script that needs to be ported to &lt;code&gt;k6/browser&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;Run &lt;code&gt;k6 x agent skills show &amp;lt;name&amp;gt;&lt;/code&gt; to print a skill&amp;rsquo;s full &lt;code&gt;SKILL.md&lt;/code&gt; to stdout.&lt;/p&gt;
&lt;h2 id=&#34;commands&#34;&gt;Commands&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Command&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;k6 x agent init &amp;lt;target&amp;gt;...&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Write or update files for one or more targets.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;k6 x agent init --all&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Initialize every registered target.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;k6 x agent status&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Show what is installed in the current workspace.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;k6 x agent list&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;List available targets and bundled skills.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;k6 x agent skills list&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;List skills shipped in the binary.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;k6 x agent skills show &amp;lt;name&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Print a skill&amp;rsquo;s &lt;code&gt;SKILL.md&lt;/code&gt; to stdout.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;init-flags&#34;&gt;&lt;code&gt;init&lt;/code&gt; flags&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Flag&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--all&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Apply to every registered target. Cannot be combined with positional target names.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--force&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Overwrite a managed file even if it has been edited locally.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--dry-run&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Print the plan (paths, write modes, sizes) without touching disk.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example-status-output&#34;&gt;Example status output&lt;/h3&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;Agent installation status

[&amp;#43;] Claude Code
   - .mcp.json detected
[-] Cursor
   - Missing: .cursor/mcp.json
   - Hint: k6 x agent init cursor

[&amp;#43;] k6 MCP support
   - Found at /usr/local/bin/k6&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;A &lt;code&gt;[&#43;]&lt;/code&gt; next to &lt;strong&gt;k6 MCP support&lt;/strong&gt; confirms that the editor will be able to launch &lt;code&gt;k6 x mcp&lt;/code&gt; when your assistant connects.&lt;/p&gt;
&lt;h2 id=&#34;safety&#34;&gt;Safety&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;k6 x agent&lt;/code&gt; is conservative about what it writes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It never creates or modifies user-owned top-level files such as &lt;code&gt;AGENTS.md&lt;/code&gt; or &lt;code&gt;README.md&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;For shared JSON config files (&lt;code&gt;.mcp.json&lt;/code&gt;, &lt;code&gt;.cursor/mcp.json&lt;/code&gt;, &lt;code&gt;.vscode/mcp.json&lt;/code&gt;, &lt;code&gt;opencode.json&lt;/code&gt;), only the &lt;code&gt;k6&lt;/code&gt; entry is touched. Other servers and unrelated keys in the file are preserved.&lt;/li&gt;
&lt;li&gt;Files inside &lt;code&gt;xk6-subcommand-agent&lt;/code&gt;-owned folders are stamped with an ownership marker. Re-running &lt;code&gt;init&lt;/code&gt; is idempotent, and &lt;code&gt;--force&lt;/code&gt; is required to overwrite a file you have edited locally.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--dry-run&lt;/code&gt; prints the full plan before any disk write, so you can review every path and write mode up front.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For the full design, see &lt;a href=&#34;https://github.com/grafana/xk6-subcommand-agent/blob/main/docs/DESIGN.md&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;xk6-subcommand-agent/docs/DESIGN.md&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;troubleshooting&#34;&gt;Troubleshooting&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;folder already exists&lt;/code&gt; or file collision&lt;/strong&gt; — re-run with &lt;code&gt;--force&lt;/code&gt; to overwrite managed files. &lt;code&gt;k6 x agent&lt;/code&gt; never deletes files it does not own.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Status shows &lt;code&gt;[-] k6 MCP support&lt;/code&gt;&lt;/strong&gt; — &lt;code&gt;k6&lt;/code&gt; is not on the editor&amp;rsquo;s &lt;code&gt;PATH&lt;/code&gt;. Install k6 from &lt;a href=&#34;../install-k6/&#34;&gt;Install k6&lt;/a&gt;, and make sure your editor is launched in a shell that can find it.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cline MCP entry missing&lt;/strong&gt; — Cline&amp;rsquo;s MCP configuration is global. Copy the JSON snippet printed by &lt;code&gt;k6 x agent init cline&lt;/code&gt; into &lt;code&gt;cline_mcp_settings.json&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Unsupported editor&lt;/strong&gt; — see &lt;a href=&#34;#editors-not-supported-by-k6-x-agent&#34;&gt;Editors not supported by &lt;code&gt;k6 x agent&lt;/code&gt;&lt;/a&gt; for manual MCP setup guidance.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;editors-not-supported-by-k6-x-agent&#34;&gt;Editors not supported by &lt;code&gt;k6 x agent&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;If your editor or MCP client isn&amp;rsquo;t in the &lt;a href=&#34;#supported-targets&#34;&gt;Supported targets&lt;/a&gt; table, you can still register the k6 MCP server manually — it works with any client that speaks stdio.&lt;/p&gt;
&lt;p&gt;Before you start:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If you launch the server via the &lt;strong&gt;k6 subcommand&lt;/strong&gt; (&lt;code&gt;k6 x mcp&lt;/code&gt;), ensure &lt;code&gt;k6&lt;/code&gt; is on your &lt;code&gt;PATH&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;If you launch the &lt;strong&gt;standalone&lt;/strong&gt; &lt;code&gt;mcp-k6&lt;/code&gt; binary, ensure both &lt;code&gt;mcp-k6&lt;/code&gt; and &lt;code&gt;k6&lt;/code&gt; are on your &lt;code&gt;PATH&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;If you launch the server &lt;strong&gt;in Docker&lt;/strong&gt;, ensure Docker is installed and running.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;how-mcp-works&#34;&gt;How MCP works&lt;/h3&gt;
&lt;p&gt;The Model Context Protocol (MCP) is a standard way for AI assistants to communicate with external tools. At its core, an MCP server is a program that:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Reads JSON-RPC messages from &lt;strong&gt;stdin&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Writes JSON-RPC responses to &lt;strong&gt;stdout&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Advertises tools, resources, and prompts that the AI can use.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;When you configure an MCP client, you define the command it should launch — the MCP server binary — and the client communicates with it over stdio.&lt;/p&gt;
&lt;h3 id=&#34;what-to-configure&#34;&gt;What to configure&lt;/h3&gt;
&lt;p&gt;Most MCP clients ask for the following information:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Field&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;name&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;An identifier for the server (for example, &lt;code&gt;k6&lt;/code&gt;).&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;command&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;The program to run. For &lt;code&gt;k6 x mcp&lt;/code&gt;, this is &lt;code&gt;k6&lt;/code&gt;. For native installs, &lt;code&gt;mcp-k6&lt;/code&gt;. For Docker, &lt;code&gt;docker&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;args&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Command-line arguments. For &lt;code&gt;k6 x mcp&lt;/code&gt;, this is &lt;code&gt;[&amp;quot;x&amp;quot;, &amp;quot;mcp&amp;quot;]&lt;/code&gt;. For Docker, include &lt;code&gt;run&lt;/code&gt;, &lt;code&gt;--rm&lt;/code&gt;, &lt;code&gt;-i&lt;/code&gt;, and the image name.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;env&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Optional environment variables to pass to the server.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;transport&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Usually &lt;code&gt;stdio&lt;/code&gt; (some clients assume this by default).&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;Consult your client&amp;rsquo;s documentation for the exact configuration file location and format. Look for sections about &amp;ldquo;MCP servers&amp;rdquo;, &amp;ldquo;tool servers&amp;rdquo;, or &amp;ldquo;stdio servers&amp;rdquo;.&lt;/p&gt;
&lt;h2 id=&#34;next-steps&#34;&gt;Next steps&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Learn what your assistant can do once the server is wired up: &lt;a href=&#34;./tools-prompts-resources/&#34;&gt;Tools, prompts, and resources&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="bootstrap-your-editor-with-k6-x-agent">Bootstrap your editor with k6 x agent&lt;/h1>
&lt;p>The &lt;code>k6 x agent&lt;/code> command scaffolds an AI-assisted k6 testing workflow in your project. A single invocation drops portable &lt;a href="https://docs.claude.com/en/docs/agents/skills" target="_blank" rel="noopener noreferrer">&lt;code>SKILL.md&lt;/code>&lt;/a> bundles into your editor&amp;rsquo;s expected locations and registers the k6 MCP server in your editor&amp;rsquo;s MCP configuration — so you don&amp;rsquo;t have to author MCP client configuration by hand.&lt;/p></description></item><item><title>Tools, prompts, and resources</title><link>https://grafana.com/docs/k6/v2.3.x/set-up/configure-ai-assistant/tools-prompts-resources/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/set-up/configure-ai-assistant/tools-prompts-resources/</guid><content><![CDATA[&lt;h1 id=&#34;tools-prompts-and-resources&#34;&gt;Tools, prompts, and resources&lt;/h1&gt;
&lt;p&gt;The k6 MCP server exposes three kinds of MCP primitives:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Tools&lt;/strong&gt;: Allow your AI assistant to perform actions, such as validating or running a script.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Prompts&lt;/strong&gt;: Guided workflows that help you generate scripts or convert existing tests.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Resources&lt;/strong&gt;: Reference data, which includes docs and type definitions, that your assistant can consult for accurate answers.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These primitives behave identically regardless of how you launch the server — via &lt;code&gt;k6 x mcp&lt;/code&gt;, the standalone &lt;code&gt;mcp-k6&lt;/code&gt; binary, or Docker.&lt;/p&gt;
&lt;h2 id=&#34;tools&#34;&gt;Tools&lt;/h2&gt;
&lt;p&gt;Tools are the core capability of the k6 MCP server. Your AI assistant calls them automatically when it needs to validate code, run a test, or look up documentation.&lt;/p&gt;
&lt;h3 id=&#34;info&#34;&gt;info&lt;/h3&gt;
&lt;p&gt;Returns runtime information about the server and local environment:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Server version&lt;/li&gt;
&lt;li&gt;Detected &lt;code&gt;k6&lt;/code&gt; version&lt;/li&gt;
&lt;li&gt;Login status for Grafana Cloud k6 (via the k6 CLI)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;validate_script&#34;&gt;validate_script&lt;/h3&gt;
&lt;p&gt;Validates a k6 script by running it with minimal load:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;1 VU&lt;/li&gt;
&lt;li&gt;1 iteration&lt;/li&gt;
&lt;li&gt;30s timeout&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This validation catches syntax errors, missing imports, missing export default function declarations, and common runtime issues early, before you scale up.&lt;/p&gt;
&lt;h3 id=&#34;run_script&#34;&gt;run_script&lt;/h3&gt;
&lt;p&gt;Runs a k6 script locally with configurable parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;vus&lt;/code&gt; (default: 1, max: 50)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;duration&lt;/code&gt; (default: &lt;code&gt;30s&lt;/code&gt;, max: &lt;code&gt;5m&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;iterations&lt;/code&gt; (overrides &lt;code&gt;duration&lt;/code&gt; if provided)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Returns stdout/stderr, exit code, and (when available) parsed metrics.&lt;/p&gt;
&lt;h3 id=&#34;list_sections&#34;&gt;list_sections&lt;/h3&gt;
&lt;p&gt;Lists k6 documentation sections as a depth-limited tree, so your assistant can explore docs without pulling large amounts of content into context.&lt;/p&gt;
&lt;p&gt;Parameters include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;version&lt;/code&gt; (optional): The k6 version to query. Use &lt;code&gt;all&lt;/code&gt; to list all available versions.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;category&lt;/code&gt; (optional): The documentation category, such as &lt;code&gt;using-k6&lt;/code&gt; or &lt;code&gt;javascript-api&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;root_slug&lt;/code&gt; (optional):  The specific branch to explore.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;depth&lt;/code&gt; (default: 1, max: 5): The number of levels to include in the tree.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;get_documentation&#34;&gt;get_documentation&lt;/h3&gt;
&lt;p&gt;Fetches the full Markdown for a specific documentation section.&lt;/p&gt;
&lt;p&gt;Use the &lt;code&gt;slug&lt;/code&gt; returned from &lt;code&gt;list_sections&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;search_terraform&#34;&gt;search_terraform&lt;/h3&gt;
&lt;p&gt;Searches for Grafana Cloud k6-related resources in the Grafana Terraform provider schema.&lt;/p&gt;
&lt;p&gt;Prerequisites:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Terraform installed (&lt;code&gt;terraform&lt;/code&gt; on your &lt;code&gt;PATH&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;A Terraform project initialized with the Grafana provider (&lt;code&gt;terraform init&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;prompts&#34;&gt;Prompts&lt;/h2&gt;
&lt;p&gt;Prompts are guided workflows that you invoke explicitly. Unlike tools, which your assistant calls on its own, you trigger a prompt when you want structured help generating or converting a script.&lt;/p&gt;
&lt;h3 id=&#34;generate_script&#34;&gt;generate_script&lt;/h3&gt;
&lt;p&gt;Generates a production-ready k6 script from plain-English requirements.&lt;/p&gt;
&lt;p&gt;The prompt guides your assistant through:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Researching relevant k6 docs&lt;/li&gt;
&lt;li&gt;Applying best practices&lt;/li&gt;
&lt;li&gt;Writing the script and validating it&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;convert_playwright_script&#34;&gt;convert_playwright_script&lt;/h3&gt;
&lt;p&gt;Converts a Playwright test to a &lt;code&gt;k6/browser&lt;/code&gt; script.&lt;/p&gt;
&lt;p&gt;The prompt guides your assistant through:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Mapping Playwright APIs to k6 equivalents&lt;/li&gt;
&lt;li&gt;Applying browser-testing best practices&lt;/li&gt;
&lt;li&gt;Validating the converted script&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you set up your editor with &lt;a href=&#34;./bootstrap-with-k6-x-agent/&#34;&gt;&lt;code&gt;k6 x agent&lt;/code&gt;&lt;/a&gt;, the same workflow is also available as the bundled &lt;code&gt;k6-playwright-converter&lt;/code&gt; skill, which activates automatically when you ask your assistant to convert a Playwright test.&lt;/p&gt;
&lt;h3 id=&#34;how-to-invoke-prompts&#34;&gt;How to invoke prompts&lt;/h3&gt;
&lt;p&gt;The way you invoke a prompt depends on your MCP client:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Client&lt;/th&gt;
              &lt;th&gt;How to invoke&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Claude Code&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Type &lt;code&gt;/mcp__k6__generate_script&lt;/code&gt; or &lt;code&gt;/mcp__k6__convert_playwright_script&lt;/code&gt; in the chat.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Codex CLI&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Type &lt;code&gt;/mcp&lt;/code&gt; to list available prompts, then invoke by name.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Cursor&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Type &lt;code&gt;/&lt;/code&gt; in chat to open the prompt list and select the prompt.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;

&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Prompt support varies by client. If your client doesn&amp;rsquo;t show prompts, you can describe your goal in chat and your assistant will use the underlying tools directly.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;resources&#34;&gt;Resources&lt;/h2&gt;
&lt;p&gt;Resources are reference data your assistant can read to produce accurate, up-to-date answers.&lt;/p&gt;
&lt;h3 id=&#34;docsk6best_practices&#34;&gt;docs://k6/best_practices&lt;/h3&gt;
&lt;p&gt;A curated best-practices document intended for AI-assisted script authoring.&lt;/p&gt;
&lt;h3 id=&#34;typesk6&#34;&gt;types://k6/&amp;hellip;&lt;/h3&gt;
&lt;p&gt;k6 TypeScript type definitions, exposed as MCP resources. These help your assistant:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Discover valid import paths&lt;/li&gt;
&lt;li&gt;Verify option names and shapes (&lt;code&gt;options&lt;/code&gt;, scenario config, thresholds)&lt;/li&gt;
&lt;li&gt;Avoid hallucinated APIs when generating scripts&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;recommended-workflows&#34;&gt;Recommended workflows&lt;/h2&gt;
&lt;h3 id=&#34;validate-then-run&#34;&gt;Validate, then run&lt;/h3&gt;
&lt;p&gt;Use this loop for most authoring:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Ask your assistant to validate the script (&lt;code&gt;validate_script&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Fix any issues and repeat until validation passes.&lt;/li&gt;
&lt;li&gt;Run the script with a small load (for example, 1–5 VUs) before scaling up.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;explore-documentation-during-authoring&#34;&gt;Explore documentation during authoring&lt;/h3&gt;
&lt;p&gt;When you need a specific k6 API or option shape:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Your assistant can use &lt;code&gt;list_sections&lt;/code&gt; and &lt;code&gt;get_documentation&lt;/code&gt; to find authoritative docs.&lt;/li&gt;
&lt;li&gt;Type definitions (&lt;code&gt;types://k6/...&lt;/code&gt;) confirm exact signatures and option shapes.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;terraform--grafana-cloud-k6-provisioning&#34;&gt;Terraform &#43; Grafana Cloud k6 provisioning&lt;/h3&gt;
&lt;p&gt;If you manage Grafana Cloud k6 resources via Terraform:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Ask your assistant to search for relevant resources with &lt;code&gt;search_terraform&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Review the schema and apply changes in your Terraform project.&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="tools-prompts-and-resources">Tools, prompts, and resources&lt;/h1>
&lt;p>The k6 MCP server exposes three kinds of MCP primitives:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Tools&lt;/strong>: Allow your AI assistant to perform actions, such as validating or running a script.&lt;/li>
&lt;li>&lt;strong>Prompts&lt;/strong>: Guided workflows that help you generate scripts or convert existing tests.&lt;/li>
&lt;li>&lt;strong>Resources&lt;/strong>: Reference data, which includes docs and type definitions, that your assistant can consult for accurate answers.&lt;/li>
&lt;/ul>
&lt;p>These primitives behave identically regardless of how you launch the server — via &lt;code>k6 x mcp&lt;/code>, the standalone &lt;code>mcp-k6&lt;/code> binary, or Docker.&lt;/p></description></item></channel></rss>