gsc-mcp
AGENTS.md1 starsChanged 7 days agoMITView on GitHub
One source for every agent. This file applies to every coding agent (Claude Code, Antigravity, Codex, Cursor …). .claude/CLAUDE.md only imports it. Update rules here, nowhere else. gsc-mcp is a minimal, strictly read-only Model Context Protocol (MCP) server for Google Search Console over stdio. It is kept small enough to inspect in full before building a pinned commit locally (or using it as a blueprint), so Google service-account credentials never pass through unpinned npx @latest auto-updates. Every invariant below is…
- Commits and pushes
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 35,117 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
The file
We split this AGENTS.md into the rules it gives an agent
6 rules. About 1 is common, 0 are distinctive, and 5 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 11
Every invariant below is backed by unit or protocol tests in tests/.
- Very specific: line 14
Read-only tool annotations: Every registered MCP tool must carry readOnlyHint: true and destructiveHint: false.
- Common: line 15
Zero credential leakage: Never read, print, or include service-account JSON contents, private keys, or tokens in tool responses, error …
- Very specific: line 16
Placeholder domains only: All tool descriptions, examples, tests, and documentation in this repository must use RFC 2606 placeholders …
- Very specific: line 17
Minimal dependency surface: Keep runtime dependencies limited to @modelcontextprotocol/sdk, @googleapis/searchconsole, and zod.
- Very specific: line 19
Git and publishing: Use Conventional Commits on feature/fix branches.
≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md — rules for coding agents working on gsc-mcp
One source for every agent. This file applies to every coding agent (Claude Code, Antigravity, Codex, Cursor …).
.claude/CLAUDE.mdonly imports it. Update rules here, nowhere else.
1. What this is
gsc-mcp is a minimal, strictly read-only Model Context Protocol (MCP) server for Google Search Console over stdio. It is kept small enough to inspect in full before building a pinned commit locally (or using it as a blueprint), so Google service-account credentials never pass through unpinned npx @latest auto-updates.
2. Non-negotiable safety invariants
Every invariant below is backed by unit or protocol tests in tests/. If a change breaks one of those tests, the change is wrong, not the test.
- Strictly read-only OAuth scope:
READONLY_SCOPEinsrc/gsc-client.tsmust remainhttps://www.googleapis.com/auth/webmasters.readonly. Never requesthttps://www.googleapis.com/auth/webmastersor add mutating tools (such as submitting/deleting sitemaps or requesting URL removals). - Read-only tool annotations: Every registered MCP tool must carry
readOnlyHint: trueanddestructiveHint: false. - Zero credential leakage: Never read, print, or include service-account JSON contents, private keys, or tokens in tool responses, error messages, logs, tests, or commits. On POSIX systems, warn on
stderrif the credentials file has group/world permissions (mode & 0o077). - Placeholder domains only: All tool descriptions, examples, tests, and documentation in this repository must use RFC 2606 placeholders (
example.com,sc-domain:example.com,your-project-id). Never commit real user or client domains, project IDs, or service-account email addresses. - Minimal dependency surface: Keep runtime dependencies limited to
@modelcontextprotocol/sdk,@googleapis/searchconsole, andzod. Do not install the monolithicgoogleapispackage. - Quality gate before every commit: Run
npm run check(typecheck,vitest run,tscbuild; skip for pure documentation edits that touch no code or config). Runnpm auditwheneverpackage.jsonorpackage-lock.jsonchanges and once before merging tomain. Every new test covering a bug or safety rule must be verified once via mutation (temporarily break the guarded line insrc/and confirm the test turns red). - Git and publishing: Use Conventional Commits on feature/fix branches. Never run
git push, create tags/releases, or runnpm publishwithout the maintainer's explicit approval.
3. Commands
Node 22+ at runtime (.nvmrc pins Node 24 LTS for CI and local development).
npm run check # typecheck (src + tests), vitest run, tsc build — the gate
npm run typecheck # tsc --noEmit for src/ and tests/
npm test # vitest run
npm run test:watch # vitest watch mode
npm run build # compiles src/ -> dist/
npm start # runs node dist/index.js on stdio4. Architecture
| File | Responsibility |
src/index.ts | CLI entry point (#!/usr/bin/env node): runs a non-fatal startup permission check and connects createGscServer() to StdioServerTransport. |
src/server.ts | createGscServer plus pure formatting, sorting, and period-comparison helpers. gsc_compare_periods queries ungrouped property totals alongside dimension rows so Google's privacy thresholding on query rows never undercounts site clicks/impressions, and skips one-sided truncated keys when fetchLimit is reached. |
src/gsc-client.ts | Resolves GSC_CREDENTIALS_PATH (default ~/.config/gsc/service-account.json), rejects symlinks and oversized files via lstatSync + O_NOFOLLOW, checks POSIX 0600 permissions, caches the read-only Search Console v1 client, and formats API errors cleanly. |
src/date-utils.ts | Strict UTC YYYY-MM-DD validation (rejecting calendar rollovers like 2026-02-31), 3-day GSC lag defaults, and single/comparison period resolution. |
tests/*.test.ts | Unit tests and end-to-end MCP protocol tests over InMemoryTransport with mocked Search Console clients (no network or real credentials required). |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

