# Model-in-the-loop test for an MCP connector Version 1.2, November 26, 2026 (1.2 adds section 12: the declared-fields stand-in, the instructions-withheld mode, and scoring volunteered and asked-for arithmetic apart; 1.1 added sections 9 to 11: the real client walk, the cached definition check and the header check). Companion guide: https://jwatte.com/blog/change-live-mcp-connector-without-breaking-it/ Written by J.A. Watte, jwatte.com. Free to copy, adapt and ship. No attribution required. A server test proves the server. It does not prove that a model picks the right tool, fills in the right arguments and answers from what the tool returned. This file sets up a small test that asks real questions through a real model client, with only your connector's read-only tools attached. Use it with your developer, or paste it to an AI coding agent as its brief. Replace every ALL-CAPS placeholder. Run the protocol and scenario checks first. Our free script covers null optional arguments, `_meta`, freshness, links, clean failures and description length: https://jwatte.com/downloads/mcp-connector-scenario-tests.mjs (explained at https://jwatte.com/blog/test-mcp-connector-like-real-users/). This file does not repeat those checks. ## 1. What we found when we ran it We ran 69 real questions through a real model client against our connectors, with only each connector's read-only tools attached, on two models. - Tool choice and arguments were correct on every question, on both models. - The failures were content gaps on our side. One model turned a monthly rate into a nightly figure, because the server never said the monthly rate is not a nightly price. Neither model could answer a tax question, because the server said only that taxes are extra. Both declined to guess. - When a tool declared an `outputSchema`, the Claude Code client handed the model the `structuredContent` JSON, not the text block. A notice that exists only in the text block may never reach the model. Put every notice the model must see into the structured data. - ChatGPT fails differently: it passes the model only the top-level fields the tool's `outputSchema` declares, and in our ChatGPT chats a pricing rule in the server instructions did not hold. A test through Claude alone passed on the same server. Put every notice in a declared structured field and in the text block, and run section 12. - The harness needed four corrections for false positives (section 5). - After a release, one live question through a published client found a fault that neither this harness nor the server suite had found. See section 8. - A later walk through two published assistants got every answer right and still found twelve things no test had caught, from a cached tool definition that rejected correct answers to a business that could not be found by its own name. See section 9. ## 2. Write the questions Aim for 5 to 15 per connector. Use the words your customers use, taken from emails, calls and search terms. Include: | Kind | Example | What it catches | |---|---|---| | Plain fact | "What time do you open on Sunday?" | Tool choice | | Fact with an argument | "How much is a QUANTITY UNIT?" | Argument filling | | Arithmetic trap | "What is the nightly cost if I stay a month?" | A model turning one price into another | | Gap | "What taxes will I pay?" | What your server does not say | | Out of scope | "Can you book it for me?" | Honest refusals: nothing was booked, sent or paid | | Other language | "¿A qué hora abren?" | Language input and wording | | Recency | "What is new this week?" and "What are the three newest ITEMS?" | Date-sorted listing, and recency questions that carry a count or filler words | For each question write an expectation file: ```json { "tools": ["mcp__SERVER_NAME__TOOL_NAME"], "args": { "ARG_NAME": "EXPECTED_VALUE" }, "must_include": ["FACT_FROM_YOUR_SITE"], "must_not_include": ["WRONG_CLAIM"], "may_decline": false } ``` Set `may_decline` to true when a careful "I cannot find that" is an acceptable answer, as with a question your server cannot answer yet. ## 3. Isolate the model client to your read-only tools The example uses the Claude Code command line. Any client that can attach one MCP server, restrict its tools and log the tool calls will do. `mcp-test.json`: ```json { "mcpServers": { "SERVER_NAME": { "type": "http", "url": "https://DRAFT_OR_PRODUCTION_HOST/mcp" } } } ``` One question: ```bash claude -p "QUESTION" \ --strict-mcp-config --mcp-config mcp-test.json \ --tools "" \ --allowedTools "mcp__SERVER_NAME__TOOL_1 mcp__SERVER_NAME__TOOL_2" \ --disallowedTools "mcp__SERVER_NAME__WRITE_TOOL_1 mcp__SERVER_NAME__WRITE_TOOL_2" \ --output-format stream-json --verbose < /dev/null > run-QUESTION_ID.jsonl ``` - `--strict-mcp-config` loads only the servers in `mcp-test.json`, ignoring every other MCP configuration. - `--tools ""` turns off the built-in tools (files, shell, web), so the model can answer only from your connector or from what it already knows. - `--allowedTools` lists your **read-only** tools by name. It approves them in advance. It does **not** hide the server's other tools from the model. - `--disallowedTools` lists every tool that books, sends, cancels or changes a record: every tool whose `readOnlyHint` is not true. This is what removes them. Without it the model is still offered those tools, and whether a call runs depends on the permission mode of the machine. On ours, a tool that was only left out of `--allowedTools` was offered and ran. - Check before the first real question: the first output line (`"subtype":"init"`) has a `tools` list. It must contain only your read-only tools. If you have a read-only endpoint, or a draft with a fake store, point `mcp-test.json` at that and not at production. - `--output-format stream-json --verbose` records every tool call, its arguments, the tool result and the final answer, one JSON object per line. - Add `--model MODEL` and repeat to compare models. Pace the questions. Ours allow 60 requests a minute per address; check yours, and one question can make several tool calls. Leave a few seconds between questions, and never run this in a loop against someone else's server. ## 4. Score each run Three things, in this order: 1. **Tool choice:** the expected tool was called. 2. **Arguments:** the values the model filled in match. 3. **Grounded answer:** every required fact is in the answer **and** in what the tools returned. A fact in the answer but not in any tool result is a possible invention. Mark it for a person to read. `score.mjs` does this for one run. Node 18 or later, no dependencies: ```javascript // score.mjs: score one model run (stream-json lines) against one question's expectations. // usage: node score.mjs RUN.jsonl EXPECT.json // EXPECT.json: {"tools":["mcp__SERVER__TOOL"], "args":{"ARG":"VALUE"}, "must_include":["$100"], "must_not_include":["per night"], "may_decline":false} import { readFileSync } from 'node:fs'; const [runFile, expectFile] = process.argv.slice(2); const lines = readFileSync(runFile, 'utf8').trim().split('\n').map((l) => JSON.parse(l)); const exp = JSON.parse(readFileSync(expectFile, 'utf8')); const calls = []; const results = []; let answer = ''; for (const m of lines) { for (const c of (m.type === 'assistant' || m.type === 'user') ? (m.message?.content || []) : []) { if (c.type === 'tool_use') calls.push({ name: c.name, input: c.input || {} }); if (c.type === 'tool_result') results.push(typeof c.content === 'string' ? c.content : JSON.stringify(c.content)); } if (m.type === 'result') answer = String(m.result || ''); } const norm = (s) => s.toLowerCase().replace(/\s+/g, ' '); const out = []; const check = (label, ok, detail = '') => out.push(`${ok ? 'PASS' : 'FAIL'} ${label}${detail ? ': ' + detail : ''}`); check('tool choice', (exp.tools || []).every((t) => calls.some((c) => c.name === t)), calls.map((c) => c.name).join(', ') || 'no tool called'); for (const [k, v] of Object.entries(exp.args || {})) { check(`argument ${k}`, calls.some((c) => JSON.stringify(c.input[k]) === JSON.stringify(v)), JSON.stringify(calls.map((c) => c.input[k]))); } const declined = /\b(do not|don't|cannot|can't|not able|unable)\b.*\b(know|find|say|confirm|answer)\b/i.test(answer); for (const s of exp.must_include || []) { const inAnswer = norm(answer).includes(norm(s)); check(`answer includes "${s}"`, inAnswer || (exp.may_decline && declined), inAnswer ? '' : (declined ? 'declined' : 'missing')); // grounded: every required fact must also appear in what the tools returned const grounded = results.some((r) => norm(r).includes(norm(s))); if (inAnswer) check(`"${s}" is in the tool output`, grounded, grounded ? '' : 'not found in any tool result: possible invention'); } for (const s of exp.must_not_include || []) check(`answer avoids "${s}"`, !norm(answer).includes(norm(s))); console.log(out.join('\n')); console.log(`ANSWER: ${answer}`); process.exit(out.some((l) => l.startsWith('FAIL')) ? 1 : 0); ``` ```bash node score.mjs run-QUESTION_ID.jsonl expect-QUESTION_ID.json ``` It exits 1 on any FAIL, so a loop over your questions can count them. ## 5. False positives to expect Read every FAIL before you change anything. Our four corrections fell into the first three classes below; the fourth is one to watch for. The figures are illustrations. - **Rounding:** an answer rounds a figure the tool returned exactly ("about $33" for $33.33). Allow the rounded form when the site itself rounds, or compare numbers with a tolerance. - **Published arithmetic:** an answer gives a total the site itself publishes (for example a weekly price), which was not in the tool result you expected. Add it to the expectation if the site says it. - **Structured data:** the fact is in `structuredContent` in a different form (an ISO date, a number without a currency sign). Match the form the tool returns. - **Wording (watch for it):** "closed" versus "not open". Prefer short, distinctive facts for `must_include`. ## 6. Turn the results into fixes | Finding | Usual fix | |---|---| | Wrong tool | Sharpen both tool descriptions: what each returns and when to use it. Do not add instructions about other tools. | | Wrong argument | Clearer enum values, a better parameter description, accepting common spellings. | | Invented fact | Return the fact, or an explicit "not published" field, in the structured data. | | Price turned into another price | Say what a price is NOT ("this monthly rate is not a nightly price") in the structured answer. | | "Cannot answer" | A content gap: publish the fact on the site, then return it. | | A notice the model ignored | Move it from the text block into a declared field of `structuredContent`, and keep it in the text block. | | A price divided or multiplied in one client only | Put a short rule sentence in the declared fields of every answer that carries a price (section 12). | | A recency question answered with old items | Make recency detection ignore count words and filler words. | Re-run the same questions after each fix, and keep the runs. They are your regression set. ## 7. Record | Date | Connector version | Model | Questions | Tool choice | Arguments | Grounded | Content gaps found | |---|---|---|---|---|---|---|---| | DATE | VERSION | MODEL | N | N/N | N/N | N/N | LIST | ## 8. After every release: real questions through each real client This harness uses one client. Each published client sends its own wording to your tools. After every release, ask three to five real questions by hand through each client where the connector is published, and read which tool was called and what came back. - [ ] One plain fact, one question with a number in it ("the three newest"), one recency question, and one in each language you serve. - [ ] The answer matches the site today. - [ ] If the client shows the tool call, it is the tool you expected. What it caught for us: "What are the three newest articles on the blog" went to the search tool, not the tool that lists articles by date. The search tool returns date order for a pure recency query ("newest articles" worked), but the number word matched article text, so the query ran as a keyword search and returned relevance results from two months earlier. The release had not caused it. The server-side suite asked "latest articles," which is not what a model actually sends. The planned fix: recency detection ignores count words and filler words. Add every question that fails to your question set in section 2. ## 9. The real client walk The harness above uses one client that you control. Customers use the published assistants, signed in, in their own browser. Our connectors had passed a scenario suite of more than 1,600 checks with 0 failures, schema checks, this test and several independent review rounds per release. A walk through two published assistants then got every answer right (24 of 24 chats, two languages) and still found twelve things no validation had caught. For each connector, each language and each assistant where the connector is published. Repeat after every release. A one-page copy of this checklist, to paste into release notes, is https://jwatte.com/downloads/mcp-real-client-walk-checklist.md - [ ] Three natural questions, in a fresh chat. - [ ] The business name typed in the assistant's app menu. Every business a customer would search for by name is found, including one served by a group connector named after something else. - [ ] The same question asked plainly, with no connector named. The assistant picks up the connector and does not prefer an old website. - [ ] One generic category question ("A GOOD CATEGORY in TOWN"). Write down that you asked from your own account with the connector attached: a stranger sees something else. - [ ] The icon in three places: the chat chip, the menu and the listing. - [ ] Every link in the answer opens, and goes to your site, not to a stale third-party copy. - [ ] Every number in the answer matches the tool output, including any total or sum the assistant worked out itself. - [ ] Anything the customer needs (a live-status link, the way to report a problem) came from a tool result, not only from the server instructions. - [ ] A size or type with nothing open is reported as zero open, not as "I cannot tell." - [ ] Times are shown in the business's local time. - [ ] Sections 10 and 11 pass. What the walk found, and the fix for each: | What we saw | Fix | |---|---| | A client session that loaded the tool list before a release refused every answer of one tool: "Structured content does not match the tool's output schema: must NOT have additional properties". Fresh chats worked. | Prefer open top-level output schemas for anything that may grow. Treat a new field in a closed schema as a breaking change with a notice period. Run section 10. | | The first probe saw no output schemas, because the servers declare them only to clients that send the protocol header. | Run section 11. | | A live-status link was only in the server instructions. One assistant gave it; the other never did. | Put everything the customer needs in a tool result. | | A property served by a group connector was not found by its own name in the app menu, and one assistant said the connector "covers only" the main town. | A listing of its own, or its name in the listing title and short description. | | A retired third-party website, still live with old facts, was preferred as "the website." | Search for your business name through each assistant with the connector detached or not named. Redirect a stale domain if it is yours. If it is not, put the business name in your own listing's name, title and description, and fix the website field on every listing and profile you control. | | A generic mark instead of the real logo. Broken images on two connectors were our developer copies, which carry no icon; the published listings had their logos. | Know which copy you are testing, and walk the published listing. The business's real logo at the sizes each directory asks for; check it per assistant. | | A feed listed only unit types with something open, so both assistants could not tell whether a size was open. | Publish explicit zeros. | | A UTC time was converted to the reader's time zone, not the business's. | Return a ready-made local-time string for the business next to the UTC value. | | The assistant added its own map with star ratings, a second phone number from the website, its own checklist items, and once an arithmetic slip in its own summary. | Keep the website, map listings and reviews consistent with the connector. Put worked totals in the tool result. | | The availability tool returned its own "could not be read" error twice in a minute; the feed answered seconds later. | One retry, then a clearly labeled last-good snapshot. | | Long automated browser batches timed out, and a person watching the same browser clicked links. | Keep each automated batch under about 90 seconds and read the answers back from the chat history when a batch is cut off. | ## 10. Cached definition check A rescan updates the directories that rescan. It does not update a chat session that loaded your tool list before the release, and that session validates new answers against the definition it holds. So keep the `tools/list` of every release, and after each release validate live answers against the previous release's output schemas. The two scripts are in the companion kit https://jwatte.com/downloads/mcp-change-without-breaking-clients.md (section 5). ```bash # keep one tools/list per release: capture.mjs writes PREFIX-tools.json node capture.mjs https://YOUR_HOST/mcp calls.json live # both answer arguments are the live answers; read the lines that say definition=old node compat-check.mjs PREVIOUS_RELEASE-tools.json live-tools.json live-answers.json live-answers.json ``` Both `server=` columns show the live answers here. Any `definition=old ... REJECTED` line means a session that loaded the previous list refuses those answers. Fresh chats worked for us; the old session did not. Before you ship such a change, open the schema's top level, or announce it and give clients time. ## 11. Header check Some servers, ours included, declare `outputSchema` only to clients that send the `MCP-Protocol-Version` header for 2025-06-18 or later. A probe without the header can then report "no output schema" for a server that has them. Probe both ways. Node 18 or later, curl: ```bash #!/bin/bash # header-check.sh: tools/list with and without the MCP-Protocol-Version header. # usage: bash header-check.sh https://YOUR_HOST/mcp [PROTOCOL_VERSION] EP=${1:?usage: bash header-check.sh ENDPOINT [PROTOCOL_VERSION]} PV=${2:-2025-06-18} T=$(mktemp -d); trap 'rm -rf "$T"' EXIT H=(-H 'content-type: application/json' -H 'accept: application/json, text/event-stream') curl -s -m 30 -D "$T/init-headers" -o "$T/init" "${H[@]}" -X POST "$EP" \ --data "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"initialize\",\"params\":{\"protocolVersion\":\"$PV\",\"capabilities\":{},\"clientInfo\":{\"name\":\"header-check\",\"version\":\"1.0\"}}}" SID=$(tr -d '\r' <"$T/init-headers" | sed -n 's/^[Mm][Cc][Pp]-[Ss][Ee][Ss][Ss][Ii][Oo][Nn]-[Ii][Dd]: *//p') S=(); [ -n "$SID" ] && S=(-H "mcp-session-id: $SID") curl -s -m 30 -o /dev/null "${H[@]}" "${S[@]}" -H "mcp-protocol-version: $PV" -X POST "$EP" \ --data '{"jsonrpc":"2.0","method":"notifications/initialized"}' for mode in with without; do P=(); [ "$mode" = with ] && P=(-H "mcp-protocol-version: $PV") sleep 1 curl -s -m 30 -o "$T/$mode" "${H[@]}" "${S[@]}" "${P[@]}" -X POST "$EP" \ --data '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' node -e ' const s = require("fs").readFileSync(process.argv[1], "utf8"); const t = s.split("\n").filter((l) => l.startsWith("data:")).map((l) => l.slice(5)).join("") || s; let tools; try { tools = JSON.parse(t).result.tools; } catch { console.log(process.argv[2] + " the header: unreadable answer"); process.exit(0); } const n = tools.filter((x) => x.outputSchema).length; console.log(process.argv[2] + " the header: " + tools.length + " tools, " + n + " with an outputSchema"); ' "$T/$mode" "$mode" done ``` If the two lines differ, every test and every probe you run must send the header that real clients send, or it tests a server the customer never sees. ## 12. Imitate a client that passes only declared fields In our chats, ChatGPT passed the model only the top-level fields each tool's `outputSchema` declares. It also did not hold a pricing rule that lived in the server instructions, while this harness, through Claude, passed. So run the questions in section 3 a second time through a small local stand-in that cuts every tool result to its declared top-level keys and, in one mode, deletes `instructions` from `initialize`. The stand-in (`declared-proxy.mjs`) and a projection test that needs no model are in https://jwatte.com/downloads/mcp-declared-fields-and-rules-check.md ```bash node declared-proxy.mjs https://DRAFT_HOST/mcp 8790 standin-log.jsonl noinstr & # point mcp-test.json at http://127.0.0.1:8790/ and keep every flag from section 3 ``` Run four modes for the price questions: old build and new build, each with instructions withheld (`noinstr`) and present. In ours, the old build with instructions withheld reproduced the ChatGPT figures almost exactly (4 of 5 and 5 of 5 failed on two models); the new build failed none; with instructions present, both builds passed. This is a Claude model imitating ChatGPT, not ChatGPT. The walk in section 9 is still the proof. Score two kinds of question apart: | Kind | Example | Score | |---|---|---| | Volunteered | "Two adults, DATES, what does a room cost?" | `node figures.mjs RUN.jsonl plain`: FAIL on any money figure that no tool result contains. PASS gives the tool's estimate as the total. | | Asked for | "And what is that per night and per person?", "What would three months cost?" | `node figures.mjs RUN.jsonl asked` lists the model's own figures. A person scores it: PASS if they are labeled as the assistant's own estimate, the business is named as the one that confirms, and no policy (proration, a tax exemption) is stated as fact. Do not count the arithmetic itself as a FAIL. | A rule sentence in the answer stopped volunteered arithmetic for us. It did not stop arithmetic the customer asked for, in ChatGPT, on a fast model or on a medium thinking setting. For that, state facts in the result (only if true for you: "there is no daily rate and no prorated rate"), return the totals you stand behind, and keep the human confirmation step. ## Sources and what was checked - Claude Code command-line flags `-p`, `--mcp-config`, `--strict-mcp-config`, `--tools`, `--allowedTools`, `--disallowedTools`, `--output-format`, `--verbose`: checked with `claude --help` (Claude Code 2.1.323) on November 24, 2026. - On November 24, 2026 the command in section 3 was run once against a local test server with one read-only tool: the answer quoted the tool's date and source. With a second, non-read-only tool on the test server, that tool was offered and ran when it was only left out of `--allowedTools`; with `--disallowedTools` it was not offered. `score.mjs` was run on that output with a passing and a failing expectation file, and gave PASS and FAIL as expected. Both JSON blocks were checked with a JSON parser. - The results in section 1 and the false-positive classes in section 5 come from our own run of November 23 and 24, 2026, described in the companion guide. - The findings in section 9 come from our own walk on November 25, 2026, 03:30 to 04:20 UTC, signed in to ChatGPT and Claude in a real browser, across four connectors in English and Spanish, described in the companion guide. - On November 25, 2026, the commands in section 10 were run with the companion kit's `capture.mjs` and `compat-check.mjs` (Node 24, @modelcontextprotocol/sdk 1.32.1, Ajv 8.20.0) against two local test servers: a closed schema from the previous release rejected the new release's live answers with "must NOT have additional properties", and accepted them when nothing had changed. `header-check.sh` in section 11 passed `bash -n` and was run against a local test server that declares output schemas only when the header is sent: it printed 1 of 1 with the header and 0 of 1 without, and it printed the same count twice for a server that always declares them. - The findings in section 12 come from our own work on November 25 and 26, 2026 (UTC), described in the companion guide. `declared-proxy.mjs` and `figures.mjs` were run on November 26, 2026 against a local test server; how is recorded in the companion kit. *Informational only. Test only servers you operate or have permission to test. Model behavior changes between versions; re-run after any model or server change.*