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: |
|
url |
MCP server URL. For example, |
|
header |
Request header, such as an authorization header. For example, |
|
command |
Command to run for the |
|
arguments |
Arguments for the |
|
timeout |
Connection timeout in milliseconds. Default: |
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, |
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:
-
MCP connect.
-
MCP tool list, to discover the available tools. This step is optional.
-
MCP tool call, one or more times.
-
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:
-
Add MCP connect with
type=httpandurl=https://your-mcp-server/mcp. -
Add MCP tool list.
-
Add MCP tool call with
tool=get_weatherandarguments={"city":"Paris"}. -
Add MCP disconnect.
Call errors
When an MCP tool call action fails, the status code shows which kind of error occurred:
| Status code | Meaning |
|---|---|
|
|
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. |
|
|
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 |
|
Invalid URL. |
Correct the url syntax. |
|
Empty or invalid tool call arguments. |
Provide valid JSON in the arguments parameter. |