Dave Stanton PhD

Publishing a Book as an MCP Server

2026-06-28

I added an MCP server to this site. It exposes the contents of my free book, Geography as Destiny, as a set of read-only tools any MCP-compatible client can call. List chapters, read one. List reference cards, read one. List literature reviews. List figures. Full-text search across all of it.

The book has been here for a while. What’s new is that you can read it from inside Claude — phone, desktop, web — without leaving the conversation you’re already having.


Why a server at all

This site blocks AI crawlers at the Cloudflare edge. That’s deliberate. Most of what I write isn’t model-training material, and I’d rather decide what gets surfaced and how.

But there’s a use case the bot wall accidentally breaks: I walk a lot, I dictate to Claude on my phone, and I sometimes want to pull a thread from the book into the conversation. Without a machine-facing endpoint, the only way to do that is to find the chapter in a browser tab and read it out loud. Which is absurd.

MCP fixes the absurd part. The endpoint is on, the wall stays up, and I get to decide exactly what’s exposed and to whom.


What’s exposed

Nine tools, all read-only:

  • list_chapters, read_chapter
  • list_references, read_reference
  • list_literature_reviews, read_literature_review
  • list_figures, read_figure
  • search across all four kinds, with an optional kinds filter

The data comes straight off disk — the book repo is a submodule of the website repo, and the server reads markdown files at request time. No database, no index, no cache. When I update the submodule the content updates.

search is a substring grep, not a vector index. The book is small enough that grep is sufficient and the results are predictable.


How to connect

The URL and instructions live at davestanton.com/book#connect. Three paths, depending on your client:

Claude iOS / Claude.ai web. Settings → Connectors → Add custom connector. Paste the URL. The server announces itself as an OAuth 2.1 endpoint, the app discovers it, opens an authorize page in a browser, and asks for a password. You paste the connector password from the book page once. After that the app holds a long-lived bearer and you never see auth again.

Claude Code. One line:

claude mcp add --transport http geography-as-destiny https://davestanton.com/mcp \
  --header "Authorization: Bearer <token>"

Claude Desktop. Use the mcp-remote npx shim — exact config snippet is on the book page.


The OAuth detour

The Claude iOS app’s connector UI only accepts OAuth. No bearer-header field, no API-key field, no “advanced” toggle. If you want your MCP server to work from the phone, you implement OAuth 2.1 with Dynamic Client Registration. There’s no shortcut.

Implementing OAuth properly is a real lift — discovery endpoints, DCR, authorize, token, PKCE, JWT signing. But the trust model here is small (one user, one site, public content) so most of the OAuth machinery can be skipped or simplified. Authorization codes live in process memory with a short TTL. Issued tokens are JWTs signed with the same password that gates the authorize page — rotate the password and every previously issued token dies in the same second.

A real multi-tenant service would need persistent client registration, a real user system, refresh tokens, scope-aware authorization. I needed none of those. The whole OAuth implementation is about 250 lines of Python on top of the original 350-line server.


What I didn’t build

No write access. The server can list and read; it can’t create, modify, or delete anything.

No clever ontology. The data shapes are the directory structure: chapters, references, literature reviews, figures. I didn’t model a “concept graph,” didn’t try to expose the book’s argument structure as a queryable thing. If you want to know what’s in the book, you read it — possibly through the server, possibly through the web.

No images. Figures are exposed as their text spec, not the rendered PNG/SVG. The voice-walking use case I built this for doesn’t benefit from images anyway. Easy to add later.

No analytics. I don’t know who’s calling the server or what they ask for. The Heroku access log captures requests but I haven’t built anything on top of it.

No personalization. There’s one password and it’s published on the book page. If it gets abused I rotate it. If abuse becomes a pattern I make it private. The mechanism is in place; the policy isn’t deployed.


What this is

It’s the smallest useful primitive: take content you already have, expose it through a protocol the AI tools already speak, do the auth dance once.

The book content existed. The website existed. Claude on the phone existed. The missing piece was a five-hundred-line bridge between them. Most of the value isn’t in the bridge — it’s in the fact that the things on both sides already work.

If you want to read the book from Claude, the connection details are at davestanton.com/book#connect. If you want to build something similar for your own content, the code is in the website repo.