MCP and Agentic QA
Eight guides to MCP protocol testing, conformance, authorization, tool safety, prompt injection, approvals, observability, and Playwright MCP boundaries.
Series Chapters (8)
How to Test an MCP Server: Protocol to Safety
A drafts server that passes its happy-path tests can still write a draft after the client has timed out, because the official TypeScript client opens with the 2025 handshake by default and the stateless legacy path never delivers the cancellation. This guide tests an MCP server layer by layer against the 2026-07-28 specification with SDK 2.4.0: era pinning, raw envelope probes with real -32602, -32020 and -32022 responses, per-principal tools/list, refusals checked against storage, cancellation in both eras, and an audit log that records refused calls.
Gate an MCP Server and Client on the Official Conformance Suite
The official MCP conformance suite was run at v0.1.16 against a fixture server built on TypeScript SDK 1.32.2: 13 of 30 active scenarios passed on the first run. This guide pins the protocol revision while the current 2026-07-28 spec is still a draft target in the suite, adds owners and review dates to the expected-failures file, and covers the warning that shows a tick in the summary but fails the baseline. It also shows the 0.0.0.0 bind that fails DNS rebinding protection and gives a GitHub Actions job that diffs check-level results.
Test MCP Authorization Beyond a Valid Access Token
A verifier that checks only signature and expiry accepted a token minted for the downstream API, a token from an unknown issuer and an ID token, then forwarded the caller's token on every write. Build the token matrix that catches each of those against an MCP 2026-07-28 server, and see why a per-object denial must be a tool error rather than an insufficient_scope 403.
Design MCP Tools That Are Safe to Test and Operate
A single manage_tenant tool cannot be annotated, approved or retried safely, because one name both lists and deletes. This part splits it by risk, makes the destructive write accept only a caller-bound plan from a read-only preview plus an idempotency key, and asks the user through elicitation. It runs on the MCP TypeScript SDK 1.32.2 and shows two SDK behaviours a spec-driven test would miss: output validation that fails after the write has happened, and unknown tools returned as isError results.
Test MCP Hosts for Prompt Injection and Data Exfiltration
A model that obeys an instruction hidden in an MCP resource can post a secret to a webhook, or leak it through a markdown image the client fetches. This part replaces the model with a scripted attacker that obeys every seeded injection, then proves on the MCP TypeScript SDK 2.4.0 that read-only tool subsets, server-side path and destination checks and a renderer policy leave nothing to exfiltrate. Turning each control off in turn shows the image channel had exactly one, and live models get a separate eval reported as rates.
Test MCP Clients for SSRF in Discovery, Redirects and DNS
A discovery client that checked the URL before fetching still returned fake cloud credentials once the server answered with a 302 or a rebinding DNS name. This guide builds the matrix that catches it: twelve spellings of 169.254.169.254, ranges taken from the IANA registries, a connector that checks every resolved address and dials the one it checked, and manual redirects re-validated on every hop. It runs on loopback stubs with a fake resolver, and shows what @modelcontextprotocol/client 2.4.0 already guards and what it leaves to you.
MCP Observability: Audit Tool Calls Without Logging Secrets
One approved MCP tool call with well-meant telemetry left a bearer token, an unpublished draft, a signed preview URL and a user's email in the access log and trace store, and its failure path put a database password in the model's context. This guide classifies each field before it is emitted, allowlists the 2026-07-28 Mcp-Name and Mcp-Param headers at the edge, carries a server-minted approval ID through input_required rounds, and rebuilds the decision chain from the audit log alone. It ends with a canary suite that fails when any sink holds a secret, or holds nothing.
Playwright MCP Is Not Your Regression Test Suite
A Playwright MCP session confirmed a checkout coupon worked, and the assertion it recorded passed against the correct page and against three broken versions of it. This guide runs @playwright/mcp 0.0.83 and Playwright 1.64.1 on a loopback lab: what the accessibility snapshot shows, why the agent's default browser differs from your CI build, how a verified text becomes a bare visibility check, and why an agent working at its own pace misses a sub-second race. It then encodes the race with a held page.route, proves each test against three hand-written mutants, and sets limits for Playwright's planner, generator and healer agents.