Skip to main content
Glama
README.md
# daily-stoic-mcp

An MCP tool (`get_daily_stoic`) that serves one daily entry — quote, title,
source, and full reflection — from *The Daily Stoic* by Ryan Holiday &
Stephen Hanselman, keyed by `MM-DD`. Built to feed a "daily motivation" box
in a briefing/dashboard tool.

## What's here vs. what isn't

This repo ships **code only**: the MCP tool, an EPUB parser, and a static
page generator. It does **not** ship `daily-stoic.json` or any generated
HTML pages — those contain the book's actual text (quotes and full daily
reflections), and redistributing all 366 days of a commercial book's content
would go well beyond fair use. You generate your own data file from your own
copy of the book.

## Setup

1. Get a `.epub` copy of *The Daily Stoic* you're licensed to read, and
   place it at `book.epub` next to `parse_daily_stoic.py`.
2. Parse it:

   ```sh
   python3 parse_daily_stoic.py
   ```

   Produces `daily-stoic.json` (366 entries, keyed `MM-DD`, each
   `{date_label, title, quote, source, body}`). Delete `book.epub`
   afterward if you don't want the raw copyrighted source sitting around —
   the JSON is all the tool needs.

   The parser handles three paragraph-class layouts found across editions'
   XHTML (a common case, a body-text fallback, and a verse/poem fallback for
   entries with multi-line epigraphs). If your EPUB's markup differs, expect
   to adjust `parse_part()`.

3. (Optional) Generate static "micro learning" pages, e.g. to serve a
   tap-through link for the full reflection:

   ```sh
   python3 gen_stoic_pages.py daily-stoic.json stoic-pages/
   ```

4. Wire the tool into your MCP server:

   ```js
   import { registerDailyStoicTool } from "daily-stoic-mcp";

   registerDailyStoicTool(server, {
     dataPath: "/path/to/daily-stoic.json",
     pageBase: "https://your-host/stoic-pages", // optional, omit to skip the URL line
   });
   ```

   `dataPath` and `pageBase` can also be set via `DAILY_STOIC_DATA_PATH` /
   `DAILY_STOIC_PAGE_BASE` env vars instead of passing options.

## Tool

`get_daily_stoic(date?: "MM-DD")` — defaults to today. Returns a single text
block: date/title header, the quote, the source, optionally a full-reflection
URL, then the full body after a `---BODY---` marker.

## License

Code: MIT (see `LICENSE`). This license does not extend to any
`daily-stoic.json` or generated pages you produce — that content remains the
publisher's copyright.