Integrating with n8n AI Agent
Use n8n's AI Agent and MCP Client Tool nodes to let an agent work with your BugBug project. For example, the agent can run a named smoke test and return a short report with its status and failure evidence.
Before you start
You need:
An n8n instance with the AI Agent and MCP Client Tool nodes.
A BugBug project and a project API token. In BugBug, open Integrations → API and copy the project token. Treat it as a secret.
A named test or suite you want the agent to run.
Use a project API token dedicated to this workflow when possible. It limits the agent to that project and makes revoking the workflow's access straightforward.
Configure the MCP Client Tool
Add an AI Agent node to your workflow and connect a chat model to its Chat Model input.
Add an MCP Client Tool node and connect it to the AI Agent's Tool input, not its main workflow input.
In the MCP Client Tool, choose HTTP Streamable or Streamable HTTP as the transport and enter this endpoint:
https://mcp.bugbug.io/mcpCreate a Bearer Auth credential in n8n. Paste the BugBug project API token as the token value; n8n adds the
Bearerprefix to requests.Select only the tools needed for this first workflow. For a run-and-report flow, start with:
bugbug_list_projectsbugbug_list_testsbugbug_run_testbugbug_watch_run_progressbugbug_get_test_run
Save the credential and let n8n load the selected MCP tools.
Do not put the API token in a prompt, a Set node, workflow JSON, source control, or an n8n expression that exposes it in execution data. Store it only in n8n credentials.
Give the agent a narrow instruction
Add this to the AI Agent's system message, replacing the placeholders:
This keeps the initial workflow limited to reading project data and running an explicitly named test. Add tools that create, update, delete, import, or change visual-regression baselines only when the workflow has a clear human-approval step.
Test the workflow
Trigger the workflow with a request such as:
Run the Checkout smoke test and summarize the result. Do not make any changes.
On the first run, verify that the agent:
Finds the intended test instead of selecting a similarly named test.
Starts one run only after the request names that test.
Waits for completion rather than reporting a still-running status as a result.
Returns useful failure evidence, not only “failed.”
Troubleshooting
n8n cannot load BugBug tools
Confirm the endpoint is exactly https://mcp.bugbug.io/mcp and the node supports Streamable HTTP. A node that shows only an SSE endpoint cannot connect to BugBug MCP.
The server returns 401 or Invalid bearer token
Create a new project API token in BugBug and save it as an n8n Bearer Auth credential. Paste the token itself, without Bearer .
The agent does not call BugBug
Confirm that the MCP Client Tool is connected to the AI Agent's Tool input and that the system message tells the agent when to use it.
The response says a run is still in progress
Ensure bugbug_watch_run_progress is selected and instruct the agent to wait for the final status.
The agent chooses the wrong test
Require the exact test name in the trigger payload or have the agent ask when there is more than one match.
Next steps
Learn about the available BugBug MCP tools.
Use n8n's AI Agent documentation for model and trigger configuration.
Last updated
Was this helpful?
