# Connecting AI Agents to Loadster

> Connect AI agents like Claude, ChatGPT, Cursor, and Codex to Loadster so they can write and play scripts, build load tests, and analyze results.

Source: https://loadster.com/manual/ai-agents/

Leading AI assistants like Claude, ChatGPT, Cursor, Codex, and others can communicate directly with Loadster
to help you with your load testing and monitoring!

Agents can speed up the slow parts of load testing for you: writing and playing scripts, building load test scenarios,
setting up monitors, and analyzing test results. You describe the flow you want to test, and the agent builds it in your
Loadster project using the same tools you'd use in the dashboard.

It works best if your agent knows your application or site already, taking advantage of that context to
speed up testing. Run the agent from a project with as much of that context available as possible.

The way this works under the hood is through Loadster's [Model Context Protocol](https://modelcontextprotocol.io/) (MCP)
server. MCP is the open standard that AI agents can use to call external tools, and Loadster's MCP server (at
`https://api.loadster.com/mcp`) exposes the script editor, scenarios, monitors, and results. Compatible clients must
support remote servers over Streamable HTTP and authenticate with OAuth or an `Authorization: Bearer` header.

## What Your AI Agent Can Do with Loadster

The MCP server gives your agent access to many of the capabilities in the Loadster dashboard.

- **Scripts**: create, edit, validate, and play Protocol Bot, Browser Bot, and Playwright scripts. After a play,
  the agent can inspect each step's results, response bodies, captured values, logs, and even screenshots from
  real browser plays.
- **Datasets**: create and update [datasets](https://loadster.com/manual/dynamic-datasets/) to feed test data into scripts.
- **Scenarios**: create and configure [load test scenarios](https://loadster.com/manual/load-test-scenarios/), choosing bot groups,
  ramp patterns, and regions.
- **Load test reports**: read the results of finished load tests, dig into the numbers, and add notes.
- **Monitoring**: create and manage [monitors](https://loadster.com/manual/monitoring/), review monitor cycles, and investigate incidents.

Some actions are intentionally left to humans. An agent cannot launch or stop a full load test, enable a monitor,
manage notification policies or maintenance windows, or administer your team, billing, or Fuel.

Your agent can get everything ready and then hand it off so you push the launch button.

## How Your Agent Authenticates

There are two ways to connect to the Loadster MCP: OAuth and static tokens.

### Authenticating with OAuth

Clients with MCP OAuth support can connect by pointing them at the server URL and approving the connection in your
browser. This includes ChatGPT web connections created in Developer Mode and local Codex clients. If your tool
supports OAuth it's generally the preferred way.

There's no token to copy, and you can see and revoke connected agents
on the **AI Agents** page in your Loadster settings. Later, we'll show how to initiate the connection
for several of the leading tools.

### Authenticating with static tokens

If your tool doesn't support OAuth, you'll need to create a static MCP token and use that instead.

1. In the Loadster dashboard, go to **Settings → AI Agents → MCP Tokens**.
2. Give the token a name (like "Claude Code") and create it.
3. Copy the token right away, since it's only shown once.

Each token acts on your behalf within your team, so treat it like a password. You can revoke a token at any time
from the same page, and any agent using it immediately loses access.

## Connecting Claude Code to Loadster

The quickest way is one command, with your token substituted in:

```bash
claude mcp add --transport http loadster https://api.loadster.com/mcp --header "Authorization: Bearer YOUR_TOKEN"
```


Or, if you prefer a project-level `.mcp.json` file:

```json
{
  "mcpServers": {
    "loadster": {
      "type": "http",
      "url": "https://api.loadster.com/mcp",
      "headers": { "Authorization": "Bearer YOUR_TOKEN" }
    }
  }
}
```


Then ask Claude something like _"List my Loadster projects"_ to make sure the connection works. If you'd rather
not manage a token, you can instead add the server without the header
(`claude mcp add --transport http loadster https://api.loadster.com/mcp`) and Claude Code will walk you through
signing in to Loadster with OAuth.

_These instructions worked when this page was last reviewed. If they no longer match what you see, check the client's
official MCP documentation and email [help@loadster.com](mailto:help@loadster.com) so we can update this page._

## Connecting ChatGPT Web to Loadster

ChatGPT on the web connects to remote MCP servers through plugins. It does not read the MCP configuration on your
computer.

1. In ChatGPT, open **Settings → Security and login** and turn on **Developer mode**. Availability depends on your
   account and workspace policy.
2. Open **Plugins**, select the plus button, and enter a name and description for the connection.
3. Under **Connection**, enter the Loadster MCP URL: `https://api.loadster.com/mcp`.
4. Create the connection and review the Loadster tools ChatGPT discovers.
5. Start a new conversation, add the Loadster connection from the tools menu, and approve the Loadster OAuth
   connection when prompted.

Developer Mode gives the connection real reach into your account, and Loadster writes are real, so only connect
servers you trust and keep experiments in their own project. If you change or add tools later, refresh the connection
under **Plugins** and start another new conversation.

_These instructions worked when this page was last reviewed. If they no longer match what you see, check the client's
official MCP documentation and email [help@loadster.com](mailto:help@loadster.com) so we can update this page._

## Connecting Codex Desktop to Loadster

Codex in the ChatGPT desktop app can connect directly to Loadster. This local MCP configuration is shared with the
Codex CLI and IDE extension on the same Codex host.

1. Open **Settings → MCP servers**.
2. Select **Add server**, name it `loadster`, and choose **Streamable HTTP**.
3. Enter `https://api.loadster.com/mcp` as the URL, save the server, and select **Restart**.
4. If the server list says authentication is required, select **Authenticate** and approve the Loadster OAuth
   connection in your browser.
5. Start a new Codex task and type `/mcp` in the composer to confirm that Loadster is connected.

The desktop app, CLI, and IDE extension all use `~/.codex/config.toml` by default. You can also put the configuration
in a trusted project's `.codex/config.toml` if you want it available only in that project.

_These instructions worked when this page was last reviewed. If they no longer match what you see, check the client's
official MCP documentation and email [help@loadster.com](mailto:help@loadster.com) so we can update this page._

## Connecting the Codex CLI to Loadster

For OAuth, add Loadster and then sign in:

```bash
codex mcp add loadster --url https://api.loadster.com/mcp
codex mcp login loadster
```


Start a new Codex session and run `/mcp` to confirm the Loadster tools are connected.

If you prefer a static MCP token, create one under **Settings → AI Agents → MCP Tokens**, make it available to the
Codex process as an environment variable, and add the server with that variable's name:

```bash
export LOADSTER_MCP_TOKEN="YOUR_TOKEN"
codex mcp add loadster --url https://api.loadster.com/mcp --bearer-token-env-var LOADSTER_MCP_TOKEN
```


The equivalent `config.toml` entry is:

```toml
[mcp_servers.loadster]
url = "https://api.loadster.com/mcp"
bearer_token_env_var = "LOADSTER_MCP_TOKEN"
```


Make sure `LOADSTER_MCP_TOKEN` is set in the environment before starting Codex. OAuth is usually easier in the desktop
app because an app launched from the Dock or Start menu may not inherit variables from your shell.

See [OpenAI's MCP documentation](https://learn.chatgpt.com/docs/extend/mcp) for the latest Codex client details.

_These instructions worked when this page was last reviewed. If they no longer match what you see, check the client's
official MCP documentation and email [help@loadster.com](mailto:help@loadster.com) so we can update this page._

## Connecting Cursor to Loadster

Add the server to `.cursor/mcp.json` in your project (or `~/.cursor/mcp.json` for all projects). Cursor supports OAuth
for remote MCP servers, so start with just the Loadster URL:

```json
{
  "mcpServers": {
    "loadster": {
      "url": "https://api.loadster.com/mcp"
    }
  }
}
```


When Cursor connects for the first time, approve the Loadster OAuth connection in your browser. You can then find and
enable the server under **Customize** in Cursor.

To use a static MCP token instead, set `LOADSTER_MCP_TOKEN` in the environment before starting Cursor and add an
authorization header with Cursor's environment-variable interpolation:

```json
{
  "mcpServers": {
    "loadster": {
      "url": "https://api.loadster.com/mcp",
      "headers": {
        "Authorization": "Bearer ${env:LOADSTER_MCP_TOKEN}"
      }
    }
  }
}
```


See [Cursor's MCP documentation](https://cursor.com/docs/mcp) for the latest configuration details.

_These instructions worked when this page was last reviewed. If they no longer match what you see, check the client's
official MCP documentation and email [help@loadster.com](mailto:help@loadster.com) so we can update this page._

## Connecting VS Code to Loadster

You can run **MCP: Add Server** from the Command Palette and choose a workspace or global installation. To configure a
workspace manually, add the server to `.vscode/mcp.json`. Use an input variable so the token isn't stored in the file:

```json
{
  "inputs": [
    {
      "type": "promptString",
      "id": "loadster-mcp-token",
      "description": "Loadster MCP token",
      "password": true
    }
  ],
  "servers": {
    "loadster": {
      "type": "http",
      "url": "https://api.loadster.com/mcp",
      "headers": {
        "Authorization": "Bearer ${input:loadster-mcp-token}"
      }
    }
  }
}
```


Start or restart the server from the inline actions in `mcp.json`, or run **MCP: List Servers** from the Command
Palette. The first time it starts, VS Code prompts for the token and stores it securely. Review the configuration and
confirm that you trust the server when asked; otherwise its tools won't be available in chat.

See [VS Code's MCP documentation](https://code.visualstudio.com/docs/agent-customization/mcp-servers) for the latest
configuration details.

_These instructions worked when this page was last reviewed. If they no longer match what you see, check the client's
official MCP documentation and email [help@loadster.com](mailto:help@loadster.com) so we can update this page._

## Connecting Claude Desktop and Other MCP Clients

Any MCP client that supports remote servers over streamable HTTP with a custom header can connect the same way:
the endpoint is `https://api.loadster.com/mcp` and the token goes in an `Authorization: Bearer` header.

Some clients only support local (stdio) servers, or don't have a place to enter a custom header yet. For those,
the [mcp-remote](https://www.npmjs.com/package/mcp-remote) bridge usually works. In Claude Desktop, for example,
you can add this to `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "loadster": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://api.loadster.com/mcp", "--header", "Authorization: Bearer YOUR_TOKEN"]
    }
  }
}
```


_These instructions worked when this page was last reviewed. If they no longer match what you see, check the client's
official MCP documentation and email [help@loadster.com](mailto:help@loadster.com) so we can update this page._

## AI Load Testing Safety Practices

There are a few things worth knowing before you turn an agent loose on your projects.
They are probably common sense, but worth thinking about all the same.

- **The agent will do things in your Loadster account.** Agents edit the same scripts, scenarios, datasets, and monitors your team sees in the
  dashboard. Loadster marks destructive operations for MCP clients, but whether you see an approval prompt depends
  on the client and its settings. Script changes create revisions you can restore, but it's still a good idea to
  review proposed changes and keep experiments in their own project.
- **Only test what's yours.** As always, point your scripts only at systems you own or are authorized to test. Playing
  a script runs just one bot, but it's your responsibility either way.
- **Scope your access.** Create a separate token per agent or machine, name them clearly, and revoke any you no
  longer use. For OAuth connections, review the connected agents on the AI Agents page and revoke any you don't
  recognize. If you belong to more than one team, note that access is tied to the team you connected in.
- **You're responsible for what your agent does.** Loadster doesn't run the AI agents themselves, so whatever your
  agent of choice does in Loadster is equivalent to you doing it yourself. Agent behavior and approval defaults vary,
  so review requested changes and any destructive-action prompts carefully.
- **Using the Loadster MCP consumes your agent's usage and tokens.** Like anything your agent does, using the Loadster MCP
  consumes some of its usage limits or tokens, so keep an eye on your usage with the provider.

## Troubleshooting AI Agent Connections

Once connected, agents are pretty good at figuring things out, but here are a few potential problems.

- **401 or unauthorized errors**: an initial unauthenticated 401 in server logs can be a normal part of OAuth
  discovery. A 401 shown to the user, or repeated after OAuth completes, usually means a token is missing, mistyped,
  or revoked, or the OAuth connection was revoked. Check the `Authorization: Bearer` header and mint a fresh token,
  or reconnect over OAuth.
- **The agent can't find a project or script**: access is scoped to the team you connected in. Ask the agent to
  call `list_projects` and check that the right team's projects come back.
- **Tools seem stale or missing**: some clients cache the tool list per session. In ChatGPT web, refresh the connection
  under **Plugins** and start a new conversation. In Codex desktop, restart after saving MCP settings and start a new
  task.

If you get stuck, email [help@loadster.com](mailto:help@loadster.com) and we'll help you out.

