MCP actions

The MCP actions let a User Path connect to a Model Context Protocol (MCP) server, list its tools, call a tool, and disconnect. NeoLoad acts as an MCP client, so you can drive or load test any MCP server as part of a test. The actions appear in the custom actions list under the MCP display path.

Action reference

MCP connect

The MCP connect action (MCP_CONNECT) creates and initializes an MCP client, then stores it in the current Virtual User context as mcpClient. The action takes these parameters:

Parameter Description

type

Transport type: http (streamable HTTP, default), sse (SSE), or stdio (process transport that runs the command and arguments).

url

MCP server URL. For example, https://example.com/mcp/.

header

Request header, such as an authorization header. For example, Authorization: bearer mytoken.

command

Command to run for the stdio transport. Empty by default.

arguments

Arguments for the stdio command. Can be repeated. Empty by default.

timeout

Connection timeout in milliseconds. Default: 10000.

MCP tool list

The MCP tool list action (MCP_TOOL_LIST) uses the mcpClient from the Virtual User context and lists the available tools. On success, SampleResult.responseContent holds the JSON of the tool list.

MCP tool call

The MCP tool call action (MCP_TOOL_CALL) uses the mcpClient from the Virtual User context and calls one MCP tool. The action takes these parameters:

Parameter Description

tool

Tool name. Required.

arguments

JSON object string for the tool arguments. For example, {"city":"Paris"}.

On success, the textual tool content is in SampleResult.responseContent. On error, the action fails with the status code NL-MCP-ERROR-SRV or NL-MCP-UNKNOWN-ERROR.

MCP disconnect

The MCP disconnect action (MCP_DISCONNECT) closes the current MCP client and removes mcpClient from the Virtual User context. The action returns MCP client disconnected. when a client is present, or No MCP client found. Already disconnected. when none is present.

Recommended execution flow

Use the MCP actions in a User Path in this order:

  1. MCP connect.

  2. MCP tool list, to discover the available tools. This step is optional.

  3. MCP tool call, one or more times.

  4. MCP disconnect.

Run MCP connect first. If MCP tool list or MCP tool call runs before it, the action fails because no client exists in the Virtual User context.

Example scenario

This example connects to an MCP server, lists its tools, calls a weather tool, and disconnects:

  1. Add MCP connect with type=http and url=https://your-mcp-server/mcp.

  2. Add MCP tool list.

  3. Add MCP tool call with tool=get_weather and arguments={"city":"Paris"}.

  4. Add MCP disconnect.

Call errors

When an MCP tool call action fails, the status code shows which kind of error occurred:

Status code Meaning

NL-MCP-ERROR-SRV

The MCP server processed the request but returned an error in the tool result, such as invalid arguments or a failed tool. The response content holds the error message from the server. The transport worked, but the tool reported a problem. Check the tool name, the argument schema, or the server logs.

NL-MCP-UNKNOWN-ERROR

The action could not complete the call at all, for example because of a network failure, a serialization error, or a missing client. The response content holds the exception message and stack trace. Check connectivity, confirm that MCP connect ran first, and review the stack trace.

Troubleshooting

Use this table to resolve common problems:

Problem Fix

No MCP client found in the Virtual User context.

Run MCP connect in the same Virtual User before any other MCP action.

Unsupported connection type.

Set the type parameter to http, sse, or stdio.

Invalid URL.

Correct the url syntax.

Empty or invalid tool call arguments.

Provide valid JSON in the arguments parameter.