{
  "markdown": "<div align=\"center\">\n  <h1>@cyanheads/wikipedia-mcp-server</h1>\n  <p><b>Search Wikipedia articles, read summaries and full text, target sections, find nearby pages, and list language editions via MCP. STDIO or Streamable HTTP.</b>\n  <div>6 Tools</div>\n  </p>\n</div>\n\n<div align=\"center\">\n\n[![Version](https://img.shields.io/badge/Version-0.1.17-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/wikipedia-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^2.0.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/wikipedia-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/wikipedia-mcp-server) [![TypeScript](https://img.shields.io/badge/TypeScript-^7.0.2-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.4.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/wikipedia-mcp-server/releases/latest/download/wikipedia-mcp-server.mcpb) [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=wikipedia-mcp-server&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBjeWFuaGVhZHMvd2lraXBlZGlhLW1jcC1zZXJ2ZXIiXX0=) [![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%22wikipedia-mcp-server%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40cyanheads%2Fwikipedia-mcp-server%22%5D%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## Tools\n\nSix tools for working with Wikipedia across all language editions:\n\n| Tool | Description |\n|:---|:---|\n| `wikipedia_search` | Full-text search across Wikipedia, returning ranked results with plain-text snippets and page IDs. |\n| `wikipedia_get_summary` | Lead-section summary for any article — plain text, Wikidata QID, description, thumbnail URL, and page type. |\n| `wikipedia_get_article` | Full article or a targeted section as clean plain text, with section markers preserved. |\n| `wikipedia_get_sections` | Table of contents with `section_index` values for targeted section reads. |\n| `wikipedia_search_nearby` | Geotagged Wikipedia articles within a radius of a WGS 84 coordinate, sorted by distance. |\n| `wikipedia_get_languages` | All language editions available for an article, with titles and URLs. |\n\n### `wikipedia_search`\n\nSearch Wikipedia articles by full-text query.\n\n- Returns ranked results with plain-text snippets (HTML stripped), page IDs, and word counts\n- Use when the exact article title is unknown or to discover multiple articles on a topic\n- Page beyond the first result page with `offset`; the enrichment `nextOffset` signals more results remain (pass it back as `offset`)\n- Supports all Wikipedia language editions via the `language` parameter\n\n---\n\n### `wikipedia_get_summary`\n\nFetch the lead-section summary for a Wikipedia article.\n\n- Returns the 2–4 paragraph intro, Wikidata QID for cross-referencing, short description, and thumbnail URL\n- Surfaces `page_type: \"disambiguation\"` — a signal to follow up with `wikipedia_search` using a more specific query\n- Redirect pages followed automatically\n- Right tool for 90% of encyclopedic lookups\n\n---\n\n### `wikipedia_get_article`\n\nFetch article content as clean plain text.\n\n- Without `section_index`: returns the full article with `== Section ==` markers — unless it exceeds `WIKIPEDIA_ARTICLE_OVERFLOW_BYTES` (default 80 KB), in which case it returns a compact section outline (`truncated: true`) pointing to `wikipedia_get_sections` plus a `section_index` read\n- With `section_index` (from `wikipedia_get_sections`): returns that section together with every subsection nested under it, each heading above its own body\n- Data tables and figures are omitted from both paths, so a section whose body is entirely a data table returns its heading and little else. Tables used only for layout — multi-column lists, succession boxes — keep their content\n- Page furniture is omitted too: maintenance banners, sister-project and library-resource boxes, portal bars, and spoken-article notices. Hatnotes are kept — they name the article to read next\n- Redirect pages followed automatically\n\n---\n\n### `wikipedia_get_sections`\n\nFetch the table of contents for a Wikipedia article.\n\n- Returns section titles, heading levels, section numbering (e.g. \"2.1\"), and `section_index` values\n- `section_index` is the integer to pass to `wikipedia_get_article` for targeted reads\n- Call this before `wikipedia_get_article` when only a specific section is needed\n- Redirect pages followed automatically\n\n---\n\n### `wikipedia_search_nearby`\n\nFind Wikipedia articles about places near a geographic coordinate.\n\n- Results sorted ascending by distance in meters\n- Only articles with geographic coordinates in their Wikidata record are returned\n- Radius capped at 10,000 meters; up to 50 results per call\n\n---\n\n### `wikipedia_get_languages`\n\nList language editions available for a Wikipedia article.\n\n- Returns each edition's language code, tool-usable subdomain code (`edition_code`), article title, and URL\n- Pass `edition_code` as the `language` parameter on other tools — it can differ from `language_code` (e.g. `gsw` vs `als`)\n- Use for cross-language research or to discover a non-English title before switching editions\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\nWikipedia-specific:\n\n- Dual API integration — MediaWiki REST API (`/api/rest_v1/`) for summaries, Action API (`/w/api.php`) for search, full text, sections, geo search, and language links\n- Retry and backoff on all requests; `User-Agent` header per Wikimedia API policy\n- Both read paths render to the same plain-text shape — `== Heading ==` markers, one list item per line — the full article from Action API extracts, a section from the parser's own HTML for that section. A section read additionally keeps code-sample indentation and the lists inside layout tables, neither of which the extract carries\n- Per-call `language` parameter on every tool — all Wikipedia language editions accessible in a single session\n- Language validation against a live edition registry built from the MediaWiki `action=sitematrix` endpoint (cached 24h) — catches structurally valid but nonexistent editions before they cause timeouts\n\nAgent-friendly output:\n\n- `page_type` field on summaries discriminates article / disambiguation / redirect — no string parsing needed\n- `wikibase_item` (Wikidata QID) on summaries enables direct cross-referencing with wikidata-mcp-server\n- `section_index` on table-of-contents entries links directly to the targeted-read parameter on `wikipedia_get_article`\n- Recovery hints on every error type — callers get actionable next steps (e.g., \"use `wikipedia_search` to find the correct title\")\n\n## Getting started\n\nAdd the following to your MCP client configuration file.\n\n```json\n{\n  \"mcpServers\": {\n    \"wikipedia-mcp-server\": {\n      \"type\": \"stdio\",\n      \"command\": \"bunx\",\n      \"args\": [\"@cyanheads/wikipedia-mcp-server@latest\"],\n      \"env\": {\n        \"MCP_TRANSPORT_TYPE\": \"stdio\",\n        \"MCP_LOG_LEVEL\": \"info\"\n      }\n    }\n  }\n}\n```\n\nOr with npx (no Bun required):\n\n```json\n{\n  \"mcpServers\": {\n    \"wikipedia-mcp-server\": {\n      \"type\": \"stdio\",\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@cyanheads/wikipedia-mcp-server@latest\"],\n      \"env\": {\n        \"MCP_TRANSPORT_TYPE\": \"stdio\",\n        \"MCP_LOG_LEVEL\": \"info\"\n      }\n    }\n  }\n}\n```\n\nOr with Docker:\n\n```json\n{\n  \"mcpServers\": {\n    \"wikipedia-mcp-server\": {\n      \"type\": \"stdio\",\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\", \"-i\", \"--rm\",\n        \"-e\", \"MCP_TRANSPORT_TYPE=stdio\",\n        \"ghcr.io/cyanheads/wikipedia-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 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- No API keys required — Wikipedia's API is public.\n\n### Installation\n\n1. **Clone the repository:**\n\n```sh\ngit clone https://github.com/cyanheads/wikipedia-mcp-server.git\n```\n\n2. **Navigate into the directory:**\n\n```sh\ncd wikipedia-mcp-server\n```\n\n3. **Install dependencies:**\n\n```sh\nbun install\n```\n\n4. **Configure environment (optional):**\n\n```sh\ncp .env.example .env\n# edit .env if you want to customize WIKIPEDIA_USER_AGENT or logging\n```\n\n## Configuration\n\n| Variable | Description | Default |\n|:---------|:------------|:--------|\n| `WIKIPEDIA_USER_AGENT` | User-Agent header sent with every Wikimedia API request. Customize for your deployment. | `wikipedia-mcp-server/0.1.17 (https://github.com/cyanheads/wikipedia-mcp-server)` |\n| `WIKIPEDIA_BASE_URL` | Optional single-instance override. Unset (default): compose per-language hosts, `language` selects the edition per call. Set to a full base URL (e.g. a private MediaWiki mirror): route every call at that one fixed host — `language` no longer varies it. | *(unset)* |\n| `WIKIPEDIA_ARTICLE_OVERFLOW_BYTES` | Byte budget above which a full-article read (`wikipedia_get_article` without `section_index`) returns a section outline instead of the full text. Tuned for this domain — ordinary articles stay whole; only genuine mega-articles (World War II ~86 KB, United States ~94 KB) outline. Section-targeted reads are never affected. | `80000` |\n| `MCP_TRANSPORT_TYPE` | Transport: `stdio` or `http`. | `stdio` |\n| `MCP_HTTP_PORT` | Port for HTTP server. | `3010` |\n| `MCP_SESSION_MODE` | HTTP session mode: `stateless`, `stateful`, or `auto` (which resolves to `stateful`). The Docker image ships `stateless`. | `auto` |\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| `OTEL_ENABLED` | Enable OpenTelemetry instrumentation (spans, metrics, completion logs). | `false` |\n\nSee [`.env.example`](./.env.example) for the full list of optional overrides.\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 wikipedia-mcp-server .\ndocker run --rm -p 3010:3010 wikipedia-mcp-server\n```\n\nThe Dockerfile defaults to HTTP transport, stateless session mode, and logs to `/var/log/wikipedia-mcp-server`. OpenTelemetry peer dependencies are installed by default — build with `--build-arg OTEL_ENABLED=false` to omit them.\n\n## Project structure\n\n| Directory | Purpose |\n|:----------|:--------|\n| `src/index.ts` | `createApp()` entry point — registers tools and inits the Wikipedia service. |\n| `src/config` | Server-specific environment variable parsing and validation with Zod. |\n| `src/mcp-server/tools` | Tool definitions (`*.tool.ts`) — one file per tool. |\n| `src/services/wikipedia` | WikipediaService — REST API + Action API client with retry/backoff and language validation. |\n| `tests/` | Unit and integration tests mirroring `src/`. |\n\n## Development guide\n\nSee [`CLAUDE.md`](./CLAUDE.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 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## 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## License\n\nApache-2.0 — see [LICENSE](LICENSE) for details.\n",
  "bytes": 13170,
  "sha": "18189daaaab0d38892eae25460d13cdc5f7ec11be88dff4d322c88960a70d8d0",
  "repo_slug": "cyanheads/wikipedia-mcp-server",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_cyanheads_wikipedia_mcp_server_6af0891b/readme"
}