Guide

Testing code written by AI agents: a guide to the TAIP MCP server

Published

A coding agent can change an application in minutes and still have no idea whether the change works when someone uses it. This guide shows how an agent can ask TAIP, through its MCP server, to discover the application, run tests and report what failed, and where that stops being enough.

The problem: code that nobody has used

An agent writes a feature, then writes tests for it, and the tests are checked against the code that produced them. When one system writes the code and judges it, the mistakes tend to agree with each other. The suite passes, the pull request looks tidy, and the first real user finds the checkout that returns an error.

Sending a person to click through every change does not scale to an agent that opens ten changes a day. What the agent needs is a second opinion that does not come from its own context: an independent tool that explores the real application, keeps the tests, runs them somewhere real and reports failures with evidence the agent can act on.

MCP in two sentences, and how TAIP uses it

The Model Context Protocol (MCP) is an open standard that lets an AI agent call tools that live outside its editor, in the same way for every server. TAIP runs one: the agent connects with an API key sent as a Bearer token, and the platform's tools appear in its tool list.

Access is scoped. Every project and application the agent names must belong to the key owner's projects, and anything else is answered as not found, exactly like an identifier that does not exist, so an identifier cannot be used to discover what other organisations have.

What the server lets the agent do

The server lists its own tools, more than a hundred of them, and opens with a short orientation for the agent: start with get_context, then follow one chain from an application to a run. A coding agent gets most of its value from a handful of them, which are below.

What the agent may call depends on the role of the key owner in the organisation. A viewer's key can read but not write. An engineer's key can do everything except disconnect an integration, delete a quality gate or archive a project. Admins and owners can do everything. get_context lists the refused tools up front, in denied_tools, so the agent checks before it tries.

  • get_context

    Who the key belongs to, what the plan allows and which calls will be refused right now, in blocked_capabilities: a month's credits already used up, for instance, show up here instead of at the end of a planned run. Given a project_id, it also summarises that project's applications, tests and latest run. Reading is never blocked.

  • quickstart

    From a URL to a running discovery in one call. It creates the project and the application, or reuses them if they exist, and starts the crawl. It accepts a login for applications behind one, and it is safe to call twice.

  • analyze_application · get_discovery_run

    analyze_application starts a discovery run and returns at once; get_discovery_run is how the agent follows the crawl until it is finished.

  • generate_tests

    Creates real tests from a finished discovery, using only what was found. It creates the tests TAIP considers safe to select on its own and lists the rest in skipped_for_review; those are created only if the agent passes include_review_required.

  • list_impacted_tests · select_tests

    list_impacted_tests takes the files a change touched and returns the tests with evidence of depending on them, plus the files it could not map, in unmapped_files. select_tests picks the best tests that fit a time budget, in budget_seconds, and says why. Neither runs anything.

  • run_tests · get_run

    run_tests starts a run for a suite or for chosen test_ids and returns a run_id straight away. get_run reports the status and the reason for each failure, and can be limited to failures with status_filter. Passing an environment_id is the reliable way to say where to run: the run records resolved_base_url, the address it really used.

  • get_failures · group_failures

    get_failures lists what is failing now, one row per test, and flags a stored verdict that contradicts its own error message, in classification_disputed. group_failures collapses a red run into a few decisions, each with a suggested_action such as FILE_BUG, FIX_TESTS or RERUN.

  • create_bug · verify_fix · close_bug

    create_bug files a bug with the failing results attached as evidence, in test_result_ids; reporting a bug that is already known increases its count instead of creating a duplicate. verify_fix reruns the tests that prove it and does not close the bug. close_bug takes a resolution_reference, the run that backs the closure.

Calls that take time, a discovery or a run, return an identifier and keep working. The agent polls, and each read says whether the work is finished, in is_terminal, and how long to wait. A failed call returns an error code, whether it can be retried and the tool that fixes it.

An example, from a URL to a verified bug

The sequence below is illustrative: the shop, the addresses and the key are invented and marked as such, and the identifiers are shortened. It follows an agent that has just changed the cart of a shop and wants evidence before it opens a pull request.

The agent starts with get_context and sees that nothing is blocked. After a discovery and generate_tests it has real tests, and list_impacted_tests narrows them to the ones the change can affect. The failing results go through group_failures, which turns three red rows into one decision, and the bug it files carries its evidence. The last step, verify_fix, is the agent's own check that the fix works.

# Fictional example: demo-shop.example.com is not a real site and <your-api-key> is a placeholder.
# MCP server address: https://taip.example.com/mcp/ (header "Authorization: Bearer <your-api-key>")

1. get_context()
2. quickstart(app_url="https://demo-shop.example.com")
3. get_discovery_run(discovery_run_id="<discovery-run-id>")   # repeat until is_terminal
4. generate_tests(discovery_run_id="<discovery-run-id>")
5. list_impacted_tests(application_id="<application-id>", files=[{"filename": "src/checkout/cart.ts", "patch": "<diff>"}])
6. run_tests(project_id="<project-id>", test_ids=["<test-id>", "<test-id>"])
7. get_run(run_id="<run-id>", status_filter=["FAILED", "ERROR"])
8. group_failures(run_id="<run-id>")
9. create_bug(project_id="<project-id>", title="Checkout returns 500 on an empty cart", description="<what the agent saw>", test_result_ids=["<result-id>"])
10. verify_fix(bug_id="<bug-id>")

Limits you should know before you start

This is a way to give an agent independent evidence, and it has edges. These are the ones that matter in practice.

  • It tests the running application, not the code

    TAIP explores a live application and runs tests against it. The agent gets routes, results and evidence, not a review of its diff. list_impacted_tests is conservative evidence, not a complete impact analysis, and files it cannot map are returned rather than treated as safe.

  • A green run is evidence, not a verdict

    verify_fix returns a run to poll and never closes the bug. Deciding what a passing run proves stays with the agent or the person reviewing it.

  • Risky tests wait for a person

    generate_tests leaves out flows that need human review, such as destructive ones, unless the agent asks for them explicitly. Leave that option off unless someone has read those tests.

  • Runs cost credits and need a plan that allows them

    A web execution costs 1 credit and an API execution costs 0.2 credits. Free Basic includes 500 credits a month and Starter 3,000. When a month's credits are used up, new runs wait for the next month, while the application map, the tests and the history stay readable.

  • The agent has the permissions of its key

    Give an agent that only needs to read a key with the viewer role. The server enforces the role, so what the agent is told in a prompt does not matter.

None of this makes the agent's code correct. It gives the agent, and the person reviewing its work, an independent record of what happened when the application was actually used.

Try it on your own application

Connect an application, let discovery map it and give an agent the key. Free Basic is free forever, with 500 credits a month and no credit card.