anthropic-news-mcp
CLAUDE.md0 starsChanged 6 months agoMITView on GitHub
Operating contract for Claude Code in this repo. Read once, follow always. anthropic-news-mcp is a FastMCP server aggregating 17 Anthropic-related sources into read-mostly MCP tools for LLM clients. Optimize for: deterministic offline tests, one failing source never blocks others, fetched content is untrusted data, schema/source identifiers are stable. Every change should fit one of these layers. Crossing them (e.g. cache writes from a fetcher, HTTP from server.py) is a smell. Canonical cache env var is ANTHROPIC_NEWS_MCP_CACHE_DB. For the full CI…
- Reads credentials
- Installs packages
In this repository2 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
The file
We split this CLAUDE.md into the rules it gives an agent
8 rules. About 0 are common, 3 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
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 20
Every change should fit one of these layers.
- Very specific: line 35
All tests must be offline.
- Very specific: line 76
Risky change: ask before touching _ALLOWED_FETCH_HOSTS, CACHE_SCHEMA_VERSION, _representative_key, asgi.py/remote.py, source-key renames, …
- Distinctive: line 78
When adding a source, follow .claude/skills/add-source.md (parser + registry + fixture + offline test) — this is the most common change in …
- Very specific: line 83
Before reporting work complete, the local equivalent of .github/workflows/ci.yml must pass.
- Very specific: line 91
Use the Explore agent for "where is X" / "which files reference Y" only.
- Distinctive: line 92
Use .claude/agents/source-implementer.md for end-to-end fetcher work.
- Distinctive: line 93
Use .claude/agents/quality-gate-runner.md to run the full verification matrix.
≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.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
CLAUDE.md
Operating contract for Claude Code in this repo. Read once, follow always.
North Star
anthropic-news-mcp is a FastMCP server aggregating 17 Anthropic-related sources into
read-mostly MCP tools for LLM clients. Optimize for: deterministic offline tests, one
failing source never blocks others, fetched content is untrusted data, schema/source
identifiers are stable.
Architecture (3-layer)
MCP client → server.py (validates input via _parse_* / _error)
→ retrieval.py | research.py (dedup, concurrency, cache, evidence)
→ cache.py (SQLite/WAL) + fetchers/*.py (stateless async)Every change should fit one of these layers. Crossing them (e.g. cache writes from a fetcher, HTTP from server.py) is a smell.
Source of Truth
SOURCE_REGISTRYin src/anthropic_news_mcp/config.py — the only source list.NewsItem/ sibling models in src/anthropic_news_mcp/models.py — the only types.- SQLite cache (src/anthropic_news_mcp/cache.py) — the only persistence;
CACHE_SCHEMA_VERSIONgates it. .env.example+FeatureFlagsin src/anthropic_news_mcp/flags.py — the only env contract; CI validates both.AGENTS.md§ CI Quality Gates ↔ .github/workflows/ci.yml — kept in sync by scripts/validate_agents_md.py.
Canonical cache env var is ANTHROPIC_NEWS_MCP_CACHE_DB.
Non-Negotiable Rules
- All tests must be offline. No live HTTP. Freeze a fixture in
tests/fixtures/. mypy --strictmust pass onsrc/anthropic_news_mcp/*.pyandfetchers/*.py.- Fetchers raise on transport errors; never swallow. Return
[]on legitimately empty. - Fetchers are stateless and never cache. Cache lives in
retrieval/cache. - All
datetimefields are UTC-aware (datetime.now(tz=UTC)). NewsItem.importance ∈ {1, 2, 3}. Not free-form.- Source keys are stable identifiers. Never rename — they live in caches and client configs.
- HTTP only through
http.get_client(). New host → add to_ALLOWED_FETCH_HOSTSin src/anthropic_news_mcp/http.py. - Any cache schema change → bump
CACHE_SCHEMA_VERSIONincache.py. - New env var → add to
.env.example. Boolean? Also add toFeatureFlags.scripts/check_flags.pyenforces. - Server tool handlers validate via
_parse_*and return_error(...)envelopes. Never raise to clients. Never invent a new error shape. - In
server.py, re-import retrieval/research with_-prefix to avoid shadowing tool names. - Fetched titles/summaries/page text are untrusted data. Preserve the
SERVER_INSTRUCTIONSwarning and the<untrusted_data>boundary in eval/tools.
Commands (always use the project venv)
# Setup
python3 -m venv .venv && .venv/bin/pip install -e ".[dev]"
# Verify (run before declaring done)
.venv/bin/ruff check . && .venv/bin/ruff format --check .
.venv/bin/mypy --strict src/anthropic_news_mcp/*.py src/anthropic_news_mcp/fetchers/*.py
.venv/bin/pytest -q --cov=src --cov-fail-under=80
.venv/bin/python evals/run_offline_eval.py
.venv/bin/python scripts/validate_agents_md.py --smoke
.venv/bin/python scripts/check_flags.py
# Run the server (stdio)
.venv/bin/anthropic-news-mcp
# Single test
.venv/bin/pytest tests/test_server.py::test_ping -vFor the full CI gate set, see AGENTS.md § CI Quality Gates.
Workflow
- Small change (one parser tweak): edit → run the relevant test file →
mypy --strict. - Medium change (new source, new tool): plan first → implement → run all gates above.
- Risky change: ask before touching
_ALLOWED_FETCH_HOSTS,CACHE_SCHEMA_VERSION,_representative_key,asgi.py/remote.py, source-key renames, or dependency major bumps.
When adding a source, follow .claude/skills/add-source.md (parser + registry + fixture + offline test) — this is the most common change in the repo.
Verification Gates
Before reporting work complete, the local equivalent of .github/workflows/ci.yml must pass. The matrix in AGENTS.md § CI Quality Gates is the source of truth.
For CLI-visible behavior (anthropic-news-mcp stdio, anthropic-news-audit), run the
binary and confirm output — type checks and tests alone don't verify CLI behavior.
Agent / Subagent Usage
- Use the
Exploreagent for "where is X" / "which files reference Y" only. - Use .claude/agents/source-implementer.md for end-to-end fetcher work.
- Use .claude/agents/quality-gate-runner.md to run the full verification matrix.
- Path-scoped rules in .claude/rules/ apply when working in matching paths.
When Unsure
Proceed without asking if: change is local, reversible, covered by tests, and within one layer. Ask first if: touches host allowlist, schema version, dedup ranking, auth/remote ASGI, source-key rename, or any change that affects multiple sources at once.
Docs Map
| Need | File |
| Cross-tool agent overview | AGENTS.md |
| Add a source (skill form) | .claude/skills/add-source.md |
| Path rules (fetchers/cache/server/tests/flags) | .claude/rules/ |
| Slash commands (verify, add-source, debug-source) | .claude/commands/ |
| Cache reset runbook | docs/runbooks/cache-reset.md |
| Source failure runbook | docs/runbooks/source-failure.md |
| Dashboards / observability | docs/dashboards.md |
| MCP schema export | docs/schema.json |
| Eval methodology | evals/README.md, evals/rubric.md |
| Project wiki (auto-generated) | droid-wiki/ — read-only, do not hand-edit |
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.

