Skip to main content
Glama
Awzy11

gutenberg-mcp

by Awzy11
README.md
# gutenberg-mcp

An [MCP](https://modelcontextprotocol.io) server that gives an LLM direct search and read access to [Project Gutenberg](https://www.gutenberg.org)'s catalog of 75,000+ free public-domain books.

## Tools

| Tool | Purpose |
| --- | --- |
| `search_books(query, author)` | Search the catalog by title and/or author |
| `search_books_by_subject(subject)` | Search by subject/topic |
| `get_book_info(book_id)` | Metadata + approximate word count for a book |
| `get_book_text(book_id, start_word, word_count)` | Fetch a word-range slice of a book's plain text |

`get_book_text` is paginated by word count (default 3,000 words, ~10-12 pages) rather than returning entire books at once, so an LLM can pull exactly the section it needs without blowing its context window.

## Why this exists (and not the gutendex API)

Most Gutenberg MCP servers wrap the third-party [gutendex.com](https://gutendex.com) API. As of mid-2026 that service sits behind a Cloudflare JS challenge that a plain HTTP client can't solve — every request gets a 403, regardless of headers or user-agent. Several existing "Gutenberg MCP" repos on GitHub are broken for this same reason.

This server goes straight to Project Gutenberg instead:

- **Search** is built from Gutenberg's own sanctioned bulk catalog feed (`gutenberg.org/cache/epub/feeds/pg_catalog.csv`) — the same data Gutendex itself is built from. Gutenberg's `robots.txt` explicitly disallows crawling `/ebooks/search`, so this server doesn't scrape that page; the bulk feed is the sanctioned way to get catalog data for search.
- **Book text** is fetched directly from Gutenberg's own plaintext mirrors (`gutenberg.org/cache/epub/{id}/pg{id}.txt`), which `robots.txt` does allow.

The catalog CSV (~21MB) is fetched once per server process and cached in memory — not re-downloaded per call.

## Running it

```bash
docker build -t gutenberg-mcp-server .
```

Add to your MCP client config (e.g. Claude Desktop / Claude Code):

```json
{
  "mcpServers": {
    "gutenberg": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "gutenberg-mcp-server"]
    }
  }
}
```

## License

MIT