An MCP server has two audiences. One is the client, the program that starts the server and talks to it over JSON-RPC. That is ordinary software, and ordinary tests cover it. The other is the model, which never touches the code. All it sees is text: the tool names, their descriptions, the argument schemas, and the wording of every result and every error. Change any of that text and the model behaves differently, while every unit test still passes.
I wanted tests for that second audience that run in CI with no key, no network and no model, so I wrote a small server to have something real to test: stepinto-mcp, which searches and reads the posts on this blog. The whole suite takes under a second on my laptop. This post is how they work, and what they caught while I was writing them.
Three things to pin down
The harness checks three things, all against the real binary, started as a process and spoken to over stdio as a desktop client would:
- The contract. Every tool's name, description, input schema and output schema, saved as a file in the repository.
- The results. Direct calls to each tool, errors included, with the whole result saved.
- Conversations. The model's side of a real conversation, recorded once and replayed, with the tool calls it asks for run against the current server.
The server reads from a copy of the site in testdata/ (twelve posts from the search index and three of their Markdown copies), served by httptest. The tests never touch stepinto.dev.
The contract is a file in the repository
The first test lists the tools and compares them with testdata/contract/tools.json:
func TestContract(t *testing.T) { session := connect(t) res, err := session.ListTools(context.Background(), nil) if err != nil { t.Fatal(err) } var tools []tool for _, t := range res.Tools { tools = append(tools, tool{t.Name, t.Description, t.InputSchema, t.OutputSchema}) } sort.Slice(tools, func(i, j int) bool { return tools[i].Name < tools[j].Name }) golden(t, "contract/tools.json", tools, "the model will read something different. If that is intended, run with -update and record the conversations again") } -update writes the current listing as the expected one, so an intended change is one flag and the new file shows up in review like any other change to an API. An unintended one fails the build.
The case for this came from an older server of mine. The geographic scene server is Python on FastMCP, and its pyproject.toml asks for fastmcp>=2.0.0. I installed it twice. With fastmcp 2.13.1, the newest release at the end of November 2025, each tool's description is its whole docstring, with the Args, Returns and Raises sections in it. With 4.2.5, the current release, the description is the docstring's first line, and the argument text moves into each property of the schema. All eleven tools changed. The descriptions went from 3,132 characters to 557 between the two installs, and nobody touched the server's code. (fastmcp 2.12, which that version floor also allows, no longer imports at all next to today's pydantic.)
Whether the shorter description is better is a fair question, and the answer may well be yes. It should be a decision someone makes in a pull request, and a dependency update shouldn't be able to make it silently.
Calling the tools directly
The second test calls each tool with a table of arguments and saves the whole result:
{"search-testing", "search_posts", map[string]any{"query": "testing mocks", "limit": 3}}, {"search-limit-too-big", "search_posts", map[string]any{"query": "go", "limit": 50}}, {"search-wrong-type", "search_posts", map[string]any{"query": "go", "limit": "three"}}, {"search-unknown-argument", "search_posts", map[string]any{"query": "go", "max": 3}}, {"get-post-not-a-path", "get_post", map[string]any{"url": "https://stepinto.dev/go/testing-without-a-framework/"}}, Six of the thirteen cases are errors, because an error's text goes back to the model, which reads it and decides what to do next. Some of that text is mine:
{ "isError": true, "text": "\"https://stepinto.dev/go/testing-without-a-framework/\" is not a post address; use the url from search_posts or recent_posts, like /go/some-post/" } and some comes from the Go MCP SDK, which validates arguments against the schema before my handler runs:
{ "isError": true, "text": "validating \"arguments\": validating root: validating /properties/limit: type: three has type \"string\", want \"integer\"" } Both are what the model will act on, so both are saved. If an SDK upgrade rewords the second, the test says so, for the same reason the contract does.
Replaying the model
The third test is the one that needs a model, and gets a recording of one instead. The server behind it is claude-like-replayable, which I pulled out of the Claude hot path benchmark this week. The benchmark already had a stand-in for the Messages API that replays recorded exchanges byte for byte, so every client it measures waits for exactly the same stream. It is now a Go module the benchmark imports, with a way of choosing recordings that suits a tool loop: a conversation is a folder, each turn is a file, and the turn is one more than the number of assistant messages in the request.
testdata/recordings/ testing-in-go/1.json the model searches testing-in-go/2.json searches again, in the Go lane testing-in-go/3.json reads the post testing-in-go/4.json answers The test starts it in-process and points the agent loop at it:
model := &replayable.Server{Dir: "../testdata/recordings", NoDelay: true} if rec { model.Upstream = "https://api.anthropic.com" } ts := httptest.NewServer(model) defer ts.Close() answer, err := agent.Ask(context.Background(), connect(t), c.question, 6, option.WithBaseURL(ts.URL), option.WithAPIKey("placeholder"), option.WithHeader(replayable.ScenarioHeader, c.name), ) With -record, the same server forwards each request to the real API with the real key, streams the answer back and saves it. The model's turns come from the recording; the tool calls it asks for run against the server as it is today. The test saves the transcript (every call, its arguments, its result and the final answer) and compares it with the last one.
The agent loop is about 120 lines in agent/. It lists the server's tools, offers them to the model, runs each call and sends the results back. The first recording found a bug in it straight away. list_lanes takes no arguments, so its schema has no properties, and the Anthropic Go SDK leaves an empty input schema out of the request altogether. The API answered tools.1.custom.input_schema: Field required. A hand-written fake model would have accepted the request without complaint.
A recording that has gone stale
For the first recording of the testing conversation, I had copied only two posts' Markdown into the test site, and the post the model wanted to read wasn't one of them. It searched, found Mocking in a Language Without Mockito, asked for it, got 404 Not Found, and said so in its answer:
I couldn't open the full text, because the page returned a 404 when I tried to fetch it. What follows comes from its search summary, not from reading it.
When I added the missing file and ran the tests without recording again, the conversation failed:
--- FAIL: TestConversations/testing-in-go testing-in-go.json differs from what the server gives now; the model's later turns were recorded against the old answers, so record this conversation again with -record -update line 26 want "result": "/go/mocking-in-a-language-without-mockito/index.md: 404 Not Found", got "result": "{\"markdown\":\"# Mocking in a Language Without Mockito\\n\\n... The replay went on to play the model's recorded answer, the one that says the page was missing, after the server had handed over the whole post. A recording holds what the model did with the old answers and can't say what it would do with the new ones. The transcript check is there so that the recording can't go stale without anyone noticing. The fix is to record that conversation again, and the message says so instead of suggesting -update, which would have saved a transcript where the model contradicts its own tool results.
Recording again is one command and a few cents:
RECORD_ONLY=testing-in-go go test ./harness -run TestConversations -record -update This time the model read the post and recommended hand-written fakes with small interfaces, which is what the post says.
One rename, three failures
To see the three layers together, I renamed the limit argument of search_posts and recent_posts to max_results, the kind of tidy-up that looks harmless in a diff. All three tests failed:
- The contract showed
"limit"becoming"max_results"in both schemas. - The direct calls that passed
limitcame back as SDK validation errors:unexpected additional properties ["limit"]. - The conversation asking about fast Claude clients failed because the recorded model had called
search_postswith"limit": 10, and the current server now rejects it.
The contract test says the schema changed. The conversation shows what that does to a model that learnt the old schema: it sends a call the server now refuses, and CI finds out without paying for a model.
What it doesn't do
It doesn't tell you whether a model will use the tools well. A recording holds one conversation with one model on one day; a new model, or the same one asked slightly differently, may search with other words or skip a tool. That needs an evaluation run against the real API, with a lot of questions and a score, and it is a different job from this one. The harness's job is narrower: nothing the model reads changes without someone accepting it, and every recorded conversation still gets the answers it was recorded against.
It also leaves the request alone. claude-like-replayable chooses a recording by conversation and turn, so a change to the system prompt or the question replays the old turns without complaint. The transcript check catches it once a tool result differs, and not before.
Running it
git clone https://github.com/AndyCross/stepinto-mcp cd stepinto-mcp go test ./... The repository's CI runs exactly that, with no secrets configured. The server itself is useful on its own: go install github.com/AndyCross/stepinto-mcp/cmd/stepinto-mcp@latest and add it to a client as a stdio server, and a model can search and read this blog.
First published on stepinto.dev.
