{"id":50993867,"url":"https://github.com/cyanheads/gutenberg-mcp-server","last_synced_at":"2026-06-20T06:32:38.522Z","repository":{"id":361815700,"uuid":"1255771166","full_name":"cyanheads/gutenberg-mcp-server","owner":"cyanheads","description":"Search, browse, and read 75,000+ public-domain books from Project Gutenberg with full plain-text retrieval and offset/limit chunking via MCP. STDIO or Streamable HTTP.","archived":false,"fork":false,"pushed_at":"2026-06-12T07:50:34.000Z","size":531,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-12T09:24:04.720Z","etag":null,"topics":["ai-agent","books","bun","ebooks","gutenberg","literature","mcp","mcp-server","model-context-protocol","project-gutenberg","public-domain","stdio","streamable-http","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cyanheads.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-06-01T06:48:09.000Z","updated_at":"2026-06-12T08:03:57.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/cyanheads/gutenberg-mcp-server","commit_stats":null,"previous_names":["cyanheads/gutenberg-mcp-server"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/cyanheads/gutenberg-mcp-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyanheads%2Fgutenberg-mcp-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyanheads%2Fgutenberg-mcp-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyanheads%2Fgutenberg-mcp-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyanheads%2Fgutenberg-mcp-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cyanheads","download_url":"https://codeload.github.com/cyanheads/gutenberg-mcp-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyanheads%2Fgutenberg-mcp-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34560265,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-20T02:00:06.407Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-agent","books","bun","ebooks","gutenberg","literature","mcp","mcp-server","model-context-protocol","project-gutenberg","public-domain","stdio","streamable-http","typescript"],"created_at":"2026-06-20T06:32:36.983Z","updated_at":"2026-06-20T06:32:38.509Z","avatar_url":"https://github.com/cyanheads.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003e@cyanheads/gutenberg-mcp-server\u003c/h1\u003e\n  \u003cp\u003e\u003cb\u003eSearch, browse, and read 75,000+ public-domain books from Project Gutenberg with full plain-text retrieval and offset/limit chunking via MCP. STDIO or Streamable HTTP.\u003c/b\u003e\n  \u003cdiv\u003e4 Tools\u003c/div\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\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\u0026logo=docker\u0026logoColor=white)](https://github.com/users/cyanheads/packages/container/package/gutenberg-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^1.29.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/gutenberg-mcp-server?style=flat-square\u0026logo=npm\u0026logoColor=white)](https://www.npmjs.com/package/@cyanheads/gutenberg-mcp-server) [![TypeScript](https://img.shields.io/badge/TypeScript-^5.9.3-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.3.11-blueviolet.svg?style=flat-square)](https://bun.sh/)\n\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![Install in Claude Desktop](https://img.shields.io/badge/Install_in-Claude_Desktop-D97757?style=for-the-badge\u0026logo=anthropic\u0026logoColor=white)](https://github.com/cyanheads/gutenberg-mcp-server/releases/latest/download/gutenberg-mcp-server.mcpb) [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=gutenberg-mcp-server\u0026config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBjeWFuaGVhZHMvZ3V0ZW5iZXJnLW1jcC1zZXJ2ZXIiXX0=) [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=for-the-badge\u0026logo=visualstudiocode\u0026logoColor=white)](https://vscode.dev/redirect?url=vscode:mcp/install?%7B%22name%22%3A%22gutenberg-mcp-server%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40cyanheads%2Fgutenberg-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\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n**Public Hosted Server:** [https://gutenberg.caseyjhand.com/mcp](https://gutenberg.caseyjhand.com/mcp)\n\n\u003c/div\u003e\n\n---\n\n## Tools\n\nFour tools for searching and reading Project Gutenberg's public-domain library:\n\n| Tool | Description |\n|:-----|:------------|\n| `gutenberg_search_books` | Search the Gutenberg catalog by title, author, topic, language, or author lifespan — returns popularity-ordered results with IDs ready for follow-up calls |\n| `gutenberg_get_book` | Fetch complete metadata for a book by ID — full formats map, translators, editors, subjects, bookshelves, copyright status, and the `has_plain_text` flag |\n| `gutenberg_get_text` | Retrieve the plain-text content of a book, stripped of license boilerplate, with offset/limit chunking for context-budget management |\n| `gutenberg_browse_popular` | Browse the most-downloaded books, optionally filtered by language or topic — useful as a discovery entry point |\n\n### `gutenberg_search_books`\n\nSearch the Project Gutenberg catalog of 78,000+ public-domain books.\n\n- Full-text search against titles and author names (space-separated words, case-insensitive)\n- Topic filter matches subject headings and bookshelf categories\n- Language filter by ISO 639-1 two-character codes (e.g., `[\"en\"]`, `[\"fr\", \"de\"]`)\n- Author lifespan range filter via `author_year_start` / `author_year_end`\n- Sort by popularity (download count), or by Gutenberg ID ascending/descending\n- Batch lookup by known ID list via `ids` parameter\n- Paginated — up to 32 books per page; use `totalCount` to determine total pages\n- Each result includes `has_plain_text` to indicate whether `gutenberg_get_text` will work\n\n---\n\n### `gutenberg_get_book`\n\nFetch complete metadata for a single Project Gutenberg book.\n\n- Returns the full formats map (MIME type → download URL) including plain text, HTML, EPUB, and cover image\n- Includes translators and editors alongside authors, each with birth/death years\n- `has_plain_text` flag confirms whether a UTF-8 or ASCII plain-text format is available\n- `media_type` distinguishes readable text books from audio recordings\n- Use this before `gutenberg_get_text` to confirm text availability and inspect the formats map\n\n---\n\n### `gutenberg_get_text`\n\nRetrieve the plain-text content of a Project Gutenberg book, stripped of license boilerplate.\n\n- Strips the standard Gutenberg license header and footer — response contains only the literary work\n- Offset/limit chunking for long works: novels routinely run 500 KB–2 MB; read in manageable chunks without loading the whole file\n- Response includes `totalChars`, `offset`, `length`, and `remainingChars` for precise pagination\n- Paragraph-boundary trimming: actual returned length may be slightly less than `limit` — use `length` (not `limit`) to compute the next offset\n- Prefers UTF-8 plain text; falls back to ASCII plain text; converts HTML as a last resort\n- Refuses audio books (`media_type \"Sound\"`) with a clear recovery hint\n- `provenance` field carries the Gutenberg ID, title, and license URL for attribution\n\n---\n\n### `gutenberg_browse_popular`\n\nBrowse the most-downloaded Project Gutenberg books.\n\n- Returns up to 32 titles ordered by download count (most popular first)\n- Optionally filter by language (ISO 639-1 codes) and/or topic keyword\n- Useful as a discovery entry point: \"what are the most popular classics in French?\"\n- `totalInCatalog` provides full context — \"top 20 of 60,000\"\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 with recovery hints\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\nProject Gutenberg integration:\n\n- Catalog search and metadata via [Gutendex](https://gutendex.com/) — an unofficial but stable JSON API over the Gutenberg dataset\n- Full plain-text retrieval directly from Project Gutenberg file servers with transparent UTF-8/ASCII/HTML fallback chain\n- In-session text caching: book text is fetched once per session and served from cache for subsequent chunk reads\n- No API key required — Project Gutenberg data is freely available; no registration needed\n\nAgent-friendly output:\n\n- `has_plain_text` flag on every search/browse result so agents can pre-filter before attempting text retrieval\n- Precise chunking contract: `offset`, `length`, `totalChars`, `remainingChars`, `hasMore` on every `gutenberg_get_text` response for reliable sequential reads\n- `provenance` field on every text response for attribution\n- Discriminated `sourceFormat` field (`text/plain; charset=utf-8`, `text/plain; charset=us-ascii`, `text/html`) so agents know the fidelity of the text\n\n---\n\n## Getting started\n\n### Public Hosted Instance\n\nA public instance is available at `https://gutenberg.caseyjhand.com/mcp` — no installation required. Point any MCP client at it via Streamable HTTP:\n\n```json\n{\n  \"mcpServers\": {\n    \"gutenberg-mcp-server\": {\n      \"type\": \"streamable-http\",\n      \"url\": \"https://gutenberg.caseyjhand.com/mcp\"\n    }\n  }\n}\n```\n\n### Self-Hosted / Local\n\nNo API key required. Add the following to your MCP client configuration file:\n\n```json\n{\n  \"mcpServers\": {\n    \"gutenberg-mcp-server\": {\n      \"type\": \"stdio\",\n      \"command\": \"bunx\",\n      \"args\": [\"@cyanheads/gutenberg-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    \"gutenberg-mcp-server\": {\n      \"type\": \"stdio\",\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@cyanheads/gutenberg-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    \"gutenberg-mcp-server\": {\n      \"type\": \"stdio\",\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\", \"-i\", \"--rm\",\n        \"-e\", \"MCP_TRANSPORT_TYPE=stdio\",\n        \"ghcr.io/cyanheads/gutenberg-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.11](https://bun.sh/) or higher (or Node.js v24+).\n- No API key required — Project Gutenberg data is freely available.\n\n### Installation\n\n1. **Clone the repository:**\n\n```sh\ngit clone https://github.com/cyanheads/gutenberg-mcp-server.git\n```\n\n2. **Navigate into the directory:**\n\n```sh\ncd gutenberg-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 if you need to override any defaults\n```\n\n---\n\n## Configuration\n\n| Variable | Description | Default |\n|:---------|:------------|:--------|\n| `GUTENDEX_BASE_URL` | Base URL for the Gutendex catalog API. Override for self-hosted instances. | `https://gutendex.com/books/` |\n| `GUTENBERG_TEXT_BASE_URL` | Base URL for Project Gutenberg file servers. Override for mirrors. | `https://www.gutenberg.org` |\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). | `\u003cproject-root\u003e/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). | `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 gutenberg-mcp-server .\ndocker run --rm -p 3010:3010 gutenberg-mcp-server\n```\n\nThe Dockerfile defaults to HTTP transport, stateless session mode, and logs to `/var/log/gutenberg-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| Path | Purpose |\n|:-----|:--------|\n| `src/index.ts` | `createApp()` entry point — registers tools and inits services. |\n| `src/config/server-config.ts` | Server-specific environment variable parsing (Gutendex and file-server URL overrides). |\n| `src/mcp-server/tools/definitions/` | Tool definitions (`*.tool.ts`). |\n| `src/services/gutendex/` | Gutendex catalog API client — search and book metadata. |\n| `src/services/gutenberg-text/` | Full plain-text retrieval, boilerplate stripping, in-session caching, and chunking. |\n| `tests/` | Unit and integration tests mirroring `src/`. |\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 entry arrays in `src/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\nData from [Project Gutenberg](https://www.gutenberg.org/) is in the public domain. Catalog metadata sourced from [Gutendex](https://gutendex.com/) (MIT license).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyanheads%2Fgutenberg-mcp-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcyanheads%2Fgutenberg-mcp-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyanheads%2Fgutenberg-mcp-server/lists"}