Cristian Glavan Case study

Rebuilding a dental clinic’s search traffic with MCP

The site had lost 43% of its organic traffic. I wired Search Console, Analytics and Trends into Claude Code and spent a year on it. Here is what moved, what did not, and the number I had to delete.

Why I did this, and why the numbers are checkable

Disclosure first. dentalclinica.ro is my family's dental practice in Bucharest. I had the server, the Search Console property, the Analytics property and the content, and I needed nobody's approval to change any of it. Most of the speed described below is a function of that access, not of unusual skill. Read it as an engineering log from an unusually permissive environment, not as a client case study.

The site was in trouble. Organic sessions fell from 31,369 in 2024 to 17,783 in 2025 — down 43.3% — and bottomed at 725 sessions in December 2025, the worst month on record. Nothing dramatic had happened. It had simply been a WordPress site nobody tended, slowly losing ground.

−43.3%
Organic sessions, 2024 → 2025
725
Trough, December 2025
6,483
Peak, July 2026
+167.8%
Sessions, Jan–Nov YoY

The thing that actually slowed me down was not knowing what to fix. The data lived in three separate dashboards. Every question — which pages lost the most, which queries sit just off page one, did that change help — meant exporting a CSV, reshaping it, and losing the thread. The answer was not a better dashboard. It was giving the agent I was already working in direct, authenticated access to the APIs underneath.

How to reproduce anything here

Every figure on this page is followed by the call that produced it: the tool, the property, the date range and the dimensions. If you have access to a property, you can re-run them. One of them no longer reproduces, and that turned out to be the most useful thing I learned all year — see the expired metric.

Three MCP servers, two of which I wrote

Model Context Protocol lets an agent call tools you define. I containerised three and wired them into Claude Code over stdio, so the agent queries Google directly instead of reading my exports.

Search Console — 12 tools

The useful ones are not thin wrappers over the API. search_analytics is, but the rest encode the questions I actually ask: striking_distance (queries ranking 4–20 with real impressions), detect_cannibalization (several pages competing for one query, ranked by wasted impressions), find_ctr_anomalies (good position, bad click-through — a title problem, not a ranking problem), compare_periods, inspect_url and batch_inspect_urls over the URL Inspection API, plus list_sitemaps, page_performance, top_queries and query_page_matrix.

Google Trends — 8 tools

A wrapper around pytrends: interest over time and by region, related queries and topics, suggestions, trending and realtime searches. Be honest about what this is. pytrends is an unofficial client against an undocumented endpoint, it rate-limits aggressively and returns 429s, and Trends values are relative indices from 0–100 that are only comparable inside a single call. They are never volumes. I have watched people quote them as traffic estimates; they are not.

Analytics — not mine

The GA4 server is Google's own analytics-mcp package in a nine-line Dockerfile. I did not write it and will not pretend otherwise.

One pin worth keeping

Both of my servers pin "mcp<2". The 2.x release removed FastMCP, which is what the decorator-based tool definitions are built on. Unpin it and the servers stop importing.

The migration, and a limit on what I can prove

In December 2025 I moved the site from WordPress to Hugo, static, on Cloudflare Pages. That is also the month traffic hit its floor, which looks alarming on a chart and was mostly coincidence: December is the trough every year on this property (1,936 in 2024, 725 in 2025).

What I cannot show you

Search Console keeps roughly 16 months of data. Pulling the full range today returns 499 days starting 17 July 2025. The 2024–2025 decline is no longer visible in Search Console at all — it exists only in Analytics, which is why the decline figures above are GA4 and the search figures below start later. I cannot show you a Search Console view of the fall, and I am not going to imply one.

Striking distance, and what the agent actually changed

With measurement working, the question became where to spend effort. striking_distance returns every query where the site ranks 4–20 with meaningful impressions — pages Google already considers relevant but does not quite trust. They are cheaper to move than anything on page five.

What came back was not a keyword list, it was a content brief. A page ranking 11th for a question it answers in one line is a different problem from a page ranking 14th for a question it never addresses. The work that followed was ordinary: titles rewritten against the queries people actually typed, headings restructured to match question patterns, sections added for questions the article had not answered, FAQ blocks, internal links.

What I will not claim

Two pull requests merged on 21 and 22 February 2026. When I went back to check the weekly click series, the recovery had already happened: 265, 472, 574, then 596 in the last week of January — the series maximum. Every week after those merges came in lower (442, 495). The February content work cannot claim the January recovery. I believed it could until I looked properly, which is the entire argument for keeping the query next to the number.

What a year actually moved

Like-for-like, 1 September to 27 November, this year against last. Call: search_analytics(site_url="https://dentalclinica.ro/", start_date="2026-09-01", end_date="2026-11-27", dimensions=["device"]) and the same for 2025.

Search Console, 1 Sep – 27 Nov20252026Change
Clicks5,47015,689+186.8%
Impressions220,123868,819+294.7%
Average position21.711.4−10.3
Average position, mobile11.98.6−3.3
Average position, desktop39.722.1−17.6

And the full arc in Analytics, which is the only place the decline survives. Call: run_report(property_id=<id>, dimensions=["yearMonth"], metrics=["sessions"], dimension_filter: sessionDefaultChannelGroup EXACT "Organic Search").

Organic sessions202420252026
January3,3862,5522,103
April2,7711,4762,613
July2,4541,2546,483
September2,0041,1465,563
November2,3761,2415,316
December1,936725—
Full year31,36917,78346,227 to 28 Nov

Average position has sat in a 10.7–12.6 band for five consecutive months. That stability is better evidence than any single month: it suggests the gains are structural rather than one lucky article. Fifty queries went from no clicks at all to page one, and 37 more that had never recorded an impression now rank in the top ten.

The expired metric, which is the real lesson

For months I quoted a headline from this project: clicks up 130.8%, 8,122 to 18,747, May to August year over year. I had recorded it properly — the exact call, the property, the dimensions, the date.

I re-ran that call while writing this. It returns 2,384 clicks.

Nothing was wrong with the original measurement. Search Console's retention window had simply rolled past the 2025 half of the comparison, and the API truncates silently: no error, no warning, no flag on the response. You get a smaller number that looks exactly like a real answer. Anyone checking my claim would have concluded I had invented it.

What I do now

Record the call, the result and the date it was run, and treat any Search Console figure older than about fourteen months as expired rather than merely old. A number is not a fact you own; it is a claim with a shelf life, and the only way to discover it has gone off is to store the query beside it and re-run it occasionally.

I deleted the figure rather than softening it. The replacement is in the results table, it is larger, and it will itself expire around February 2027.

Building this yourself

There is nothing proprietary in any of this. It is a Google Cloud service account with the Search Console and Analytics Data APIs enabled, added as a user on the properties exactly as a person would be, with its JSON key kept outside every repository and mounted into the container at runtime. The server is a few dozen lines per tool on a python:3.12-slim base, pinned to "mcp<2" because 2.x drops FastMCP, and wired to the client over stdio in .mcp.json. The part worth thinking about is not the plumbing but the shape of the tools: a thin search_analytics passthrough makes the agent re-derive the question every time, whereas striking_distance(min_position=4, max_position=20) encodes it once and hands back something you can act on. Aim for tools whose names are the questions you keep asking.

Then the rules that turned out to matter more than the code:

  • Put the call next to the number, always. Not for anyone else's benefit — for yours, six months later, when you cannot remember which date range produced it. This habit is the only reason I caught both the expired metric and the February causality error.
  • Make the agent prove causality, and disbelieve it when the dates disagree. The most satisfying story I had about this project was wrong, and only the weekly series showed it.
  • Volume is not the goal. Almost none of this came from publishing more. One antibiotics article carries 3,263 clicks on its own — 20.8% of the entire window — and the gains came from fixing pages that already existed and already ranked somewhere on page two. An agent will happily generate a hundred articles for you. It is the wrong thing to ask it for.

The tooling is worth maybe a weekend. Knowing which question to ask it is the part that took a year.