google-search-console-mcp: Agent for Claude Code

.claude/agents/test-writer-pytest.md

test-writer-pytest is an agent for Claude Code from FlorianBruniaux/google-search-console-mcp. It costs 0 tokens per session (1,216 once invoked), scanned A, original, MIT.

A specialized coding agent for writing pytest tests for the gsc-mcp codebase. It follows the project’s existing fixtures, naming patterns, and methods for mocking Google API calls.

In plain words
What is it for?
Use it to write new tests, cover edge cases, test Google Search Console tools, and check error paths using mocked services.
Why use it?
It helps add test coverage without making real external requests or overlooking the project’s testing conventions.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter.

This is FlorianBruniaux/google-search-console-mcp's own configuration. It tells Claude Code how to work on google-search-console-mcp itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything google-search-console-mcp configures →

Reuse

Borrowing it

Nothing to install: this file belongs to FlorianBruniaux/google-search-console-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/FlorianBruniaux/google-search-console-mcp/main/.claude/agents/test-writer-pytest.md
Clone the repo
git clone --depth 1 https://github.com/FlorianBruniaux/google-search-console-mcp

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for test-writer-pytest

README.md
[![agentmods](https://agentmods.dev/badge/agents/florianbruniaux/google-search-console-mcp/test-writer-pytest/github.svg)](https://agentmods.dev/agents/florianbruniaux/google-search-console-mcp/test-writer-pytest)
Your own site
<a href="https://agentmods.dev/agents/florianbruniaux/google-search-console-mcp/test-writer-pytest"><img src="https://agentmods.dev/badge/agents/florianbruniaux/google-search-console-mcp/test-writer-pytest/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for test-writer-pytest

Your own site · 80×15
<a href="https://agentmods.dev/agents/florianbruniaux/google-search-console-mcp/test-writer-pytest"><img src="https://agentmods.dev/badge/agents/florianbruniaux/google-search-console-mcp/test-writer-pytest.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,216 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.01216
Opus 5 $0.00000 $0.00608
Sonnet 5 $0.00000 $0.00243
Haiku 4.5 $0.00000 $0.00122

Measured 10d ago against content hash 58f3dce2f7b9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

test-writer-pytest scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/agents/test-writer-pytest.md · 138 lines

How it starts

The opening of the file, as written. The whole thing — 138 lines — stays where its author put it; the contents beside it link to each section on GitHub.

pytest Test Writer for gsc-mcp

You write pytest tests for the gsc-mcp codebase. No real Google API calls ever. All external I/O is mocked.

First Step: Always Read First

Before writing tests for any module, read in this order:

  1. tests/conftest.py (shared fixtures)
  2. The existing test file for that module (e.g. tests/test_analytics.py)
  3. The module under test itself

Matching existing conventions is required, not optional.

Shared Fixtures

mock_gsc_service: a MagicMock wired for .sites(), .searchanalytics(), .sitemaps(), and .urlInspection() chains. Patch the service getter at the call site, not at the source:

def test_analytics(mock_gsc_service):
    with patch("gsc_mcp.tools.analytics.get_searchconsole_service", return_value=mock_gsc_service):
        result = json.loads(get_search_analytics(site="sc-domain:example.com"))

mock_indexing_service: a MagicMock with new_batch_http_request() that fires callbacks synchronously. Use for indexing.py tests.

GA4 Tests

GA4 tests require GA4_PROPERTY_ID in the environment. Copy the autouse fixture from tests/test_ga4.py:

@pytest.fixture(autouse=True)
def set_ga4_property_id(monkeypatch):
    monkeypatch.setenv("GA4_PROPERTY_ID", "123456789")

Mocking Rules

Patch at the call site. The target is the module where the function is actually imported and called, not the source module.

# Wrong: patches the source, never reaches call site
patch("gsc_mcp.auth.get_searchconsole_service")

# Correct for analytics.py
patch("gsc_mcp.tools.analytics.get_searchconsole_service")

# Correct for seo.py
patch("gsc_mcp.tools.seo.get_searchconsole_service")

httpx mocking for CrUX and sitemap tools. Mock as a context manager:

mock_client = MagicMock()
mock_client.__enter__ = MagicMock(return_value=mock_client)
mock_client.__exit__ = MagicMock(return_value=False)
mock_client.post.return_value = MagicMock(
    status_code=200,
    json=lambda: {"record": {"key": {"url": "https://example.com"}, "metrics": {}}}
)

with patch("gsc_mcp.tools.crux.httpx.Client", return_value=mock_client):
    result = json.loads(crux_page_vitals(url="https://example.com"))

Read the full file on GitHub · 138 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 138 lines · 0 tokens per session scan A 58f3dce2f7b9

Subscribe to this mod's changes

test-writer-pytest is an agent published in the GitHub repository FlorianBruniaux/google-search-console-mcp (10 stars, last pushed 8d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,216 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.