Olga Ostrovskiy

Notes · November 21, 2026

My Storyland MCP server

My Storyland takes a book and turns its places into a trip, so you can follow the story beyond the page.

I added an MCP server so you can use My Storyland from Claude, Codex, or any other MCP client, and get regions, a route, and a day-by-day plan. Clients that support MCP Apps also show a card in the chat.

My Storyland in Claude: a 3-day trip card for The Shadow of the Wind, five stops in Barcelona, from Carrer de l'Arc de Teatre to Ateneu Barcelonès, with a button to open the book map on My Storyland.

Ask for a 3-day trip around The Shadow of the Wind, and you get a trip card with five stops in Barcelona.

Solution overview

I built the MCP server as a thin layer over the code behind the website, so a request from a chat reaches the same story agent. The gateway handles the MCP session and checks whether the request can proceed. The story agent does the search.

The diagram follows a request from the client’s tool call through the gateway and back to the chat, then shows how the card requests its map image. The numbers match the steps below.

What one tool call touches: the reader's AI agent calls a tool over HTTPS; Caddy and nginx pass /mcp to the FastAPI gateway; a rate limit and the MCP session manager sit in front of the three tools; if no author is given the catalog (Google Books, Open Library) names one, and one call is spent from the in-memory daily quota, both free; only then the story agent in storyland-ai (Google ADK and Gemini) runs over SSE; text, card data and a link go back to the chat; the card loads its map image from mystoryland.ai, which places the stops with Mapbox; a public /i/ link is a free read from Postgres.

  1. The agent calls a tool over HTTPS, using JSON-RPC to send the request.
  2. Caddy and nginx pass /mcp to the FastAPI gateway, behind a rate limit and the MCP session manager.
  3. The gateway checks the book against the site’s own catalog.
  4. One call is spent from the daily quota.
  5. The story agent runs over SSE. This is the only paid step.
  6. Text, card data, and a link go back to the chat.
  7. The card loads its map image from mystoryland.ai.
  8. The server places the stops and draws pins with Mapbox.

The tools

search_book_places finds the regions and cities behind a book, so you can see where a trip might take you before choosing a route. Its job is discovery.

get_literary_route returns a route of stops for one region, and gives the agent the places to use for that part of the book.

plan_trip splits the route across your days, and accepts an optional starting city and pace. The day split adds no places and makes no model call.

The “plan a literary trip” prompt tells the agent how to choose a region and split stops into days, and suggests including passages to read. You can download the same file as a skill.

The widget in the chat

The part I find most interesting is the card I added to My Storyland: in apps that support MCP Apps, you can see the trip alongside the text. The trip card shows days and stops, with a button to open the book map. The route card includes a numbered map: for A Moveable Feast, six stops in Paris’s 5th and 6th arrondissements.

A conversation in Claude: the question "I'll be in Paris for two days. Which places from A Moveable Feast by Ernest Hemingway can I walk to? Use My Storyland.", the agent's steps (it loads My Storyland and plans a walkable two-day route), then the plan_trip call with its trip card: two days, six stops, and a button to open the book map.

The same conversation a little further down: the get_literary_route call with its route card, six numbered stops on a Mapbox map of Paris's 5th and 6th arrondissements, and the first stops listed below with tips.

MCP Apps is an extension of the MCP protocol, and I register two small HTML pages under ui:// addresses so the app knows what to display. Each tool’s metadata names its page: get_literary_route uses the route card, and plan_trip uses the trip card. search_book_places stays text only.

Each card-producing call returns the answer as plain text and the card’s data as structured content, so a client without MCP Apps still has the answer. Nothing depends on displaying the card.

Claude hosts our HTML inside its own interface, so it runs the card in a sandboxed iframe that cannot see the conversation or touch the app. The only channel is postMessage. A small bridge script in the card receives the tool’s data through that channel.

The card only places text the server already wrote, and I insert it as text rather than markup so nothing in the data can run as code.

I also declare which domains the card may load from: our domain and the sources for book covers and fonts. The map is a ready PNG from mystoryland.ai, rendered on the server with Mapbox from signed stop names, so the map rendering stays with the product. No map key or map library goes into the chat.

Design decisions

Reuse the product code

I kept each tool as a wrapper over calls the site already makes, so the MCP server runs the same story agent without a second copy of the business rules. Splitting a route into days is the one exception. That step arranges the route already returned.

Check before spending

I put the free checks before the paid call: valid input, a catalog match, search enabled, and room in both daily quotas. If books share a title, the catalog entry with the most ratings wins. A failed check returns a plain sentence.

One plan_trip call step by step, for a 3-day trip around The Shadow of the Wind: the agent calls plan_trip; if no author is given the catalog names one; one call is spent from the quota; the gateway calls discover and reads the stream until done (regions: Barcelona); then compose returns an itinerary with 5 stops; the gateway splits them into 3 days with no model call and sends back text, a card and a link. Notes: calls with no session id count on the shared cap only; closing the stream early would cancel the job compose needs; steps 4 to 7 share one 50-second budget.

The diagram follows one plan_trip request through those free checks and shows where the single paid call begins.

The search has a 50-second budget because agents give a tool call about a minute, and a timeout returns the book’s link instead of an error. A public route link is cheaper still. The server reads it straight from the database.

Count by session

I chose a daily allowance per MCP session because Claude and ChatGPT send requests from shared provider IPs, so an IP-based allowance would group unrelated readers together. One busy agent could use up website visitors’ allowance. Each session gets N calls a day.

Everyone together gets M calls a day, because a new session starts with a fresh allowance and the session limit alone cannot cap total use. An unset or broken setting means zero calls. A configuration mistake cannot open free access.

The reader chooses the region

You can ask for a trip around A Moveable Feast by Ernest Hemingway, and Claude asks you to choose between “Paris, France” and “Hemingway Sites in USA.” You choose which trip you want.

When several regions are available and the tool call contains none, the server returns the options and asks the agent to ask you before calling again. The reader makes that choice.

Claude asks which of two My Storyland routes to show for A Moveable Feast: Paris, France, or Hemingway Sites in USA.

Lessons learned

Hosted connectors sometimes called tools without a session ID, so I made those requests count only against the shared daily limit. The shared cap still applies.

The search returns a stream of events, and closing it as soon as the regions arrive cancels the upstream job that the next step needs. I changed the server to read the stream to the end.

The MCP library accepted only requests addressed to localhost by default, so callers reaching the public domain were refused. I disabled that restriction because /mcp carries no cookies or other credentials.

Try it

Add https://mystoryland.ai/mcp as a custom connector in Claude, or as an MCP server in Codex or another client, and ask for a trip around a book. You can also use My Storyland on the website.