{
  "markdown": "<div align=\"center\">\n  <h1>@cyanheads/guardian-mcp-server</h1>\n  <p><b>Search, browse, and retrieve full article text from The Guardian's journalism archive (1999–present) via MCP. STDIO or Streamable HTTP.</b>\n  <div>3 Tools</div>\n  </p>\n</div>\n\n<div align=\"center\">\n\n[![Version](https://img.shields.io/badge/Version-0.1.3-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/guardian-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-%5E2.0.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/guardian-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/guardian-mcp-server) [![TypeScript](https://img.shields.io/badge/TypeScript-%5E7.0.2-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.3.0-blueviolet.svg?style=flat-square)](https://bun.sh/)\n\n</div>\n\n<div align=\"center\">\n\n[![Install in Claude Desktop](https://img.shields.io/badge/Install_in-Claude_Desktop-D97757?style=for-the-badge&logo=anthropic&logoColor=white)](https://github.com/cyanheads/guardian-mcp-server/releases/latest/download/guardian-mcp-server.mcpb) [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=guardian-mcp-server&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBjeWFuaGVhZHMvZ3VhcmRpYW4tbWNwLXNlcnZlciJdLCJlbnYiOnsiTUNQX1RSQU5TUE9SVF9UWVBFIjoic3RkaW8iLCJHVUFSRElBTl9BUElfS0VZIjoieW91ci1hcGkta2V5In19) [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=for-the-badge&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect?url=vscode:mcp/install?%7B%22name%22%3A%22guardian-mcp-server%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40cyanheads%2Fguardian-mcp-server%22%5D%2C%22env%22%3A%7B%22MCP_TRANSPORT_TYPE%22%3A%22stdio%22%2C%22GUARDIAN_API_KEY%22%3A%22your-api-key%22%7D%7D)\n\n[![Framework](https://img.shields.io/badge/Built%20on-@cyanheads/mcp--ts--core-67E8F9?style=flat-square)](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)\n\n</div>\n\n---\n\n## Prerequisites\n\n> **A free Guardian Open Platform API key is required.** Register at [https://open-platform.theguardian.com/access](https://open-platform.theguardian.com/access) — the non-commercial developer tier is free. Set it as `GUARDIAN_API_KEY` in your MCP client config or `.env` file. The server will not start without it.\n>\n> **Rate limits (free tier):** 5,000 requests/day, 12 calls/second. The server applies no additional throttling — stay within these bounds.\n\n---\n\n## Tools\n\nThree tools for working with The Guardian's journalism archive:\n\n| Tool | Description |\n|:-----|:------------|\n| `guardian_search` | Full-text search across The Guardian's archive (1999–present) with optional section, tag, contributor, and date filters. Returns articles with full body text (HTML stripped, truncated at 2,000 words). |\n| `guardian_get_article` | Fetch a single Guardian article by its ID (path slug) with full body text and all metadata. Use after `guardian_search` to retrieve the complete untruncated text. |\n| `guardian_browse` | Browse The Guardian's content by section or tag, or discover available sections and tags. Four modes: `section_latest`, `tag_latest`, `list_sections`, `list_tags`. |\n\n### `guardian_search`\n\nFull-text search with structured filters across the entire Guardian archive.\n\n- Supports AND, OR, NOT boolean operators and exact phrases in double quotes\n- Filters: section ID, tag ID, contributor profile ID, date range (`from_date`, `to_date`)\n- Returns body text (HTML stripped) truncated at 2,000 words with a truncation flag — use `guardian_get_article` for complete text\n- Sort by `relevance` (default), `newest`, or `oldest`\n- Pagination via `page` + `page_size` (1–50 per page)\n\n---\n\n### `guardian_get_article`\n\nFetch one article by its Guardian path-slug ID.\n\n- Input: `article_id` from `guardian_search` results — the `id` field, e.g. `\"world/2024/mar/01/ukraine-war-latest\"`\n- Returns complete untruncated body text (HTML stripped), full metadata, contributor list, and pillar/section classification\n- `truncated: true` in the response means the body still exceeded 2,000 words after fetching\n\n---\n\n### `guardian_browse`\n\nBrowse and discover Guardian content — four modes in one tool.\n\n- `section_latest`: newest articles from a section (requires `section_id`)\n- `tag_latest`: newest articles carrying a tag (requires `tag_id`)\n- `list_sections`: returns all Guardian sections as a flat list — use to discover valid `section_id` values\n- `list_tags`: searches the tag taxonomy with optional `query` and `tag_type` filter — use to discover contributor IDs (`tag_type=contributor`), keyword tags, series, and more\n- Pagination applies to all modes\n\n---\n\n## Features\n\nBuilt on [`@cyanheads/mcp-ts-core`](https://www.npmjs.com/package/@cyanheads/mcp-ts-core):\n\n- Declarative tool definitions — single file per tool, framework handles registration and validation\n- Unified error handling — handlers throw, framework catches, classifies, and formats\n- Pluggable auth: `none`, `jwt`, `oauth`\n- Swappable storage backends: `in-memory`, `filesystem`, `Supabase`, `Cloudflare KV/R2/D1`\n- Structured logging with optional OpenTelemetry tracing\n- STDIO and Streamable HTTP transports\n\nGuardian-specific:\n\n- Wraps the [Guardian Open Platform API](https://open-platform.theguardian.com/) with a free developer key\n- Full body text extraction — HTML stripped, not just headlines or abstracts\n- Contributor ID discovery via `guardian_browse` mode `list_tags` + `tag_type=contributor`\n- Section and tag taxonomy browsing for filter discovery before searching\n- Powered by The Guardian\n\nAgent-friendly output:\n\n- Truncation flags on every article — agents know whether to call `guardian_get_article` for the rest\n- Typed error reasons (`unauthorized`, `no_results`, `not_found`, `invalid_date`, `api_error`) with recovery hints for each case\n- `total`, `page`, and `pages` on all paginated responses so agents can communicate result scope\n- Zero-result enrichment notice on `guardian_search` — echoes the query and suggests how to broaden\n\n---\n\n## Getting started\n\n> **A `GUARDIAN_API_KEY` is required.** Register for the free non-commercial developer key at [https://open-platform.theguardian.com/access](https://open-platform.theguardian.com/access).\n\nAdd the following to your MCP client configuration file:\n\n```json\n{\n  \"mcpServers\": {\n    \"guardian-mcp-server\": {\n      \"type\": \"stdio\",\n      \"command\": \"bunx\",\n      \"args\": [\"@cyanheads/guardian-mcp-server@latest\"],\n      \"env\": {\n        \"MCP_TRANSPORT_TYPE\": \"stdio\",\n        \"MCP_LOG_LEVEL\": \"info\",\n        \"GUARDIAN_API_KEY\": \"your-api-key\"\n      }\n    }\n  }\n}\n```\n\nOr with npx (no Bun required):\n\n```json\n{\n  \"mcpServers\": {\n    \"guardian-mcp-server\": {\n      \"type\": \"stdio\",\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@cyanheads/guardian-mcp-server@latest\"],\n      \"env\": {\n        \"MCP_TRANSPORT_TYPE\": \"stdio\",\n        \"MCP_LOG_LEVEL\": \"info\",\n        \"GUARDIAN_API_KEY\": \"your-api-key\"\n      }\n    }\n  }\n}\n```\n\nOr with Docker:\n\n```json\n{\n  \"mcpServers\": {\n    \"guardian-mcp-server\": {\n      \"type\": \"stdio\",\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\", \"-i\", \"--rm\",\n        \"-e\", \"MCP_TRANSPORT_TYPE=stdio\",\n        \"-e\", \"GUARDIAN_API_KEY=your-api-key\",\n        \"ghcr.io/cyanheads/guardian-mcp-server:latest\"\n      ]\n    }\n  }\n}\n```\n\nFor Streamable HTTP, set the transport and start the server:\n\n```sh\nMCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 GUARDIAN_API_KEY=your-api-key bun run start:http\n# Server listens at http://localhost:3010/mcp\n```\n\n### Prerequisites\n\n- [Bun v1.3.0](https://bun.sh/) or higher (or Node.js v24+).\n- A free Guardian Open Platform API key — register at [https://open-platform.theguardian.com/access](https://open-platform.theguardian.com/access). The non-commercial developer tier is free and instant.\n\n### Installation\n\n1. **Clone the repository:**\n\n```sh\ngit clone https://github.com/cyanheads/guardian-mcp-server.git\n```\n\n2. **Navigate into the directory:**\n\n```sh\ncd guardian-mcp-server\n```\n\n3. **Install dependencies:**\n\n```sh\nbun install\n```\n\n4. **Configure environment:**\n\n```sh\ncp .env.example .env\n# Edit .env and set GUARDIAN_API_KEY\n```\n\n---\n\n## Configuration\n\n| Variable | Description | Default |\n|:---------|:------------|:--------|\n| `GUARDIAN_API_KEY` | **Required.** Free developer key from [open-platform.theguardian.com/access](https://open-platform.theguardian.com/access). | — |\n| `MCP_TRANSPORT_TYPE` | Transport: `stdio` or `http`. | `stdio` |\n| `MCP_HTTP_PORT` | Port for HTTP server. | `3010` |\n| `MCP_AUTH_MODE` | Auth mode: `none`, `jwt`, or `oauth`. | `none` |\n| `MCP_LOG_LEVEL` | Log level (RFC 5424). | `info` |\n| `LOGS_DIR` | Directory for log files (Node.js only). | `<project-root>/logs` |\n| `STORAGE_PROVIDER_TYPE` | Storage backend. | `in-memory` |\n| `OTEL_ENABLED` | Enable [OpenTelemetry instrumentation](https://github.com/cyanheads/mcp-ts-core/tree/main/docs/telemetry) (spans, metrics, completion logs). | `false` |\n\nSee [`.env.example`](./.env.example) for the full list of optional overrides.\n\n---\n\n## Running the server\n\n### Local development\n\n- **Build and run:**\n\n  ```sh\n  # One-time build\n  bun run rebuild\n\n  # Run the built server\n  bun run start:stdio\n  # or\n  bun run start:http\n  ```\n\n- **Run checks and tests:**\n\n  ```sh\n  bun run devcheck   # Lint, format, typecheck, security\n  bun run test       # Vitest test suite\n  bun run lint:mcp   # Validate MCP definitions against spec\n  ```\n\n### Docker\n\n```sh\ndocker build -t guardian-mcp-server .\ndocker run --rm -e GUARDIAN_API_KEY=your-api-key -p 3010:3010 guardian-mcp-server\n```\n\nThe Dockerfile defaults to HTTP transport, stateless session mode, and logs to `/var/log/guardian-mcp-server`. OpenTelemetry peer dependencies are installed by default — build with `--build-arg OTEL_ENABLED=false` to omit them.\n\n---\n\n## Project structure\n\n| Directory | Purpose |\n|:----------|:--------|\n| `src/index.ts` | `createApp()` entry point — registers tools and initializes the Guardian service. |\n| `src/config` | Server-specific environment variable parsing (`GUARDIAN_API_KEY`). |\n| `src/mcp-server/tools` | Tool definitions (`*.tool.ts`): `guardian_search`, `guardian_get_article`, `guardian_browse`. |\n| `src/services/guardian` | Guardian Open Platform API client, normalization, and type definitions. |\n| `tests/` | Unit and integration tests. |\n| `docs/` | Design document and directory tree. |\n\n---\n\n## Development guide\n\nSee [`CLAUDE.md`](./CLAUDE.md) / [`AGENTS.md`](./AGENTS.md) for development guidelines and architectural rules. The short version:\n\n- Handlers throw, framework catches — no `try/catch` in tool logic\n- Use `ctx.log` for request-scoped logging, `ctx.state` for tenant-scoped storage\n- Register new tools via the barrel in `src/mcp-server/tools/definitions/index.ts`\n- Wrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields\n\n---\n\n## Contributing\n\nIssues and pull requests are welcome. Run checks and tests before submitting:\n\n```sh\nbun run devcheck\nbun run test\n```\n\n---\n\n## License\n\nApache-2.0 — see [LICENSE](LICENSE) for details.\n\n---\n\n*Powered by [The Guardian](https://open-platform.theguardian.com/).*\n",
  "bytes": 11639,
  "sha": "5fc34adf5d1dce7d40f9e39b93471ac4c747bd3d726d47de2cf65a5560275631",
  "repo_slug": "cyanheads/guardian-mcp-server",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_cyanheads_guardian_mcp_server_e81cb3c9/readme"
}