Configuring an MCP server endpoint in VS Code

You can configure an MCP server endpoint that enables an MCP-compliant client, such as VS Code, to access specific server-side tools. The endpoint offers several tools that provide access to teamspace, project, and test asset details, along with the ability to run tests and retrieve test results.

Before you begin

You must have completed the following tasks:
  • Obtained the hostname or IP address of Test Hub.
  • Logged in to VS Code.

About this task

While configuring the endpoint, you will be prompted to authenticate the connection by entering the credentials. And when you run tests using the tool, you must provide an offline token for authentication.

Procedure

  1. Press Ctrl+Shift+P to open the command palette in VS Code.
  2. Type MCP add and select the MCP: Add Server... option from the list.
  3. Select the HTTP (HTTP or Server-Send-Events) option.
  4. Paste the URL of the Test Hub MCP server in the Enter Server URL field in the following format:
    https://<server_hostname>/test/mcp

    For example, https://testhubserver.com/test/mcp

  5. Enter a name to identify the server, or accept the default when prompted to enter the server ID in the Enter Server ID field.
    For example, myTestHub_mcp.
  6. Select one of the following workspace options when prompted:
    • Global: Ensures the tools are available from all your workspaces.
    • Workspace: Ensures the tools are available from only the current workspace.
    An mcp.json configuration file is created.
  7. Open the mcp.json file from the explorer.
  8. Perform one of the following steps to connect to the server:
    • Click Start that is displayed above the server name in the .JSON file.
    • Click Extensions, right-click the server name, and then select Start Server.
    VS Code displays a notification stating that the MCP server requires authentication.
  9. Click Allow.
    A second notification is displayed asking whether you want to open an external website.
  10. Click Open.
    Your default browser opens and displays the Test Hub login page.
  11. Sign in with your Test Hub credentials.
    A consent screen is displayed requesting access to Test Hub MCP tools.
  12. Click Yes to approve and complete the connection.

    After successful authentication, VS Code displays the number of available MCP tools.

    Note:
    The MCP server times out after 30 minutes of inactivity. If no tool calls occur during this period, your session will expire and you are prompted to re-authenticate.

Results

You have configured an MCP server endpoint in VS Code.

What to do next

In the VS Code chat window, you can type a prompt that requires data from the server. For example, you can enter Get the list of projects or List the latest failed test runs. If you enter a prompt such as Execute the test <test_name> for running the test, the tool retrieves the test assets details from the server and then displays a prompt to enter the offline token to process the request. You must generate a token, copy it and paste the token in the VS Code chat window for the test run to complete.