Skip to main content
Glama
substack-saved-mcp

substack-saved-mcp

by toniher

Substack Saved Posts & Notes MCP & CLI

PyPI version

A local stdio Model Context Protocol (MCP) server and sync engine for the Substack posts and notes you have saved.

Behavior change in 0.4.0: a plain substack-saved-mcp sync now syncs your reading history too: every post you opened on Substack, saved or not. Run sync --no-history to sync only saved posts and notes as before. Unsaved posts from your history stay out of default list/search results.

Features

  • Read & Search: Full-text search (SQLite FTS5) over saved post titles, excerpts, authors, and publications. Filter by publication, audience tier (everyone, only_paid), reading progress, and date ranges (published_at or saved_at). Search covers a post's full body text only after you fetch it once with get-content or the get_post_content tool. A normal sync stores metadata and excerpts, so search matches posts you haven't opened on their title, excerpt, and metadata.

  • Reading Progress: Substack records how far you've read each saved post. Its mobile apps show this; the web UI doesn't. This tool stores it, so you can list the posts you haven't read or haven't finished, and sort by the minutes left. See Which saved posts haven't I read?.

  • Reading History: sync also pulls Substack's inbox History tab: every post you opened, saved or not, with when you last viewed it (seen_at) and your reading progress. Browsed-but-unsaved posts are cached with is_saved = 0, so default list/search results stay saved-only; add --history (MCP: history=True) to browse or search what you've read.

  • Saved Notes: The tool syncs, searches, and caches Substack's short-form notes apart from posts. A note has an author and a body instead of a title or audience tier. Search covers note bodies, authors, and the titles of restacked posts. Notes skip the browser: sync, save, unsave, and content fetch are all plain authenticated API calls.

  • Full Content for LLMs: Fetch a saved post or note and get its content back as clean text, with headings, lists, and links kept readable. The tool caches the result for next time.

  • Save & Unsave: Bookmark posts and notes, or remove bookmarks. Posts use a headless browser session; notes use the API.

  • Offline Queries: Read and search tools query the local SQLite cache, with no network calls.

  • Local Credentials: Your Substack session stays on your machine, in a data directory only your user can read.

  • MCP Tools and Resources for both posts and notes over stdio.


Related MCP server: substack-article-mcp

Installation with uv

Install and run substack-saved-mcp with uv.

Option A: Install from PyPI as a system-wide tool (uv tool install)

Install the published package from PyPI:

# Install system-wide into an isolated uv environment
uv tool install substack-saved-mcp

To install from a local checkout instead:

# Navigate to the repository
cd /path/to/substack-saved-mcp

# Install system-wide into an isolated uv environment
uv tool install .

# Or install from the Git repository:
# uv tool install git+https://github.com/toniher/substack-saved-mcp.git

The install puts substack-saved-mcp on your PATH:

# Verify installation
substack-saved-mcp --help

To update or uninstall:

# Upgrade installed tool
uv tool upgrade substack-saved-mcp

# Uninstall tool
uv tool uninstall substack-saved-mcp

Option B: Development environment (uv sync)

To develop or modify the code:

# Clone and enter directory
cd substack-saved-mcp

# Install dependencies and dev tools (pytest)
uv sync --extra dev

# Run CLI commands using uv run
uv run substack-saved-mcp --help

# Run tests
uv run pytest

Quick Start

# 1. Initialize local database
substack-saved-mcp init

# 2. Authenticate with Substack (opens interactive browser window once)
substack-saved-mcp login

# 3. Sync saved posts, saved notes, AND reading history (all three by default;
#    add --no-history to skip history)
substack-saved-mcp sync

# 3b. Or sync just one entity
substack-saved-mcp sync --only posts
substack-saved-mcp sync --only notes
substack-saved-mcp sync --only history
substack-saved-mcp sync --no-history   # saved posts and notes, skip history

# 4. Search saved posts via CLI
substack-saved-mcp search "artificial intelligence"

# 4b. Filter by publication or audience tier (see which tiers are cached with `audiences`)
substack-saved-mcp audiences
substack-saved-mcp list --audience only_paid
substack-saved-mcp search "artificial intelligence" --audience everyone

# 4c. Find posts you haven't read or haven't finished
substack-saved-mcp list --read-state unread
substack-saved-mcp list --read-state unfinished --sort-by minutes_remaining

# 4d. Browse or search your reading history (viewed posts, saved or not)
substack-saved-mcp list --history
substack-saved-mcp search "democracy" --history
substack-saved-mcp search "artificial intelligence" --read-state unread

# 5. Save or unsave a post
substack-saved-mcp save "https://example.substack.com/p/post-slug"
substack-saved-mcp unsave "https://example.substack.com/p/post-slug"

# 6. Get a saved post's full content, cleaned up and ready for an LLM
substack-saved-mcp get-content "https://example.substack.com/p/post-slug"

# 7. Work with saved notes the same way
substack-saved-mcp list-notes --limit 10
substack-saved-mcp search-notes "kubernetes" --author alice
substack-saved-mcp note-authors
substack-saved-mcp save-note "https://substack.com/@handle/note/c-123456"
substack-saved-mcp unsave-note "https://substack.com/@handle/note/c-123456"
substack-saved-mcp get-note "https://substack.com/@handle/note/c-123456"

# 8. Check combined status (counts, unread totals, last sync per entity)
substack-saved-mcp status

# 9. Launch stdio MCP server
substack-saved-mcp serve

Configuring MCP Clients (Claude Desktop, Goose, Cursor, etc.)

Add substack-saved-mcp to your MCP client's configuration file (e.g. claude_desktop_config.json).

Using the installed tool (uv tool or global binary)

{
  "mcpServers": {
    "substack-saved": {
      "command": "substack-saved-mcp",
      "args": ["serve"]
    }
  }
}

Using uv from the repository path

To run from your checkout without installing:

{
  "mcpServers": {
    "substack-saved": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/substack-saved-mcp",
        "run",
        "substack-saved-mcp",
        "serve"
      ]
    }
  }
}

Frequently Asked Questions (FAQ)

Where is the database saved?

The SQLite database lives in your OS application data directory:

  • Linux / macOS: ~/.local/share/substack-saved-mcp/saved_posts.sqlite
    (or $XDG_DATA_HOME/substack-saved-mcp/saved_posts.sqlite if you set XDG_DATA_HOME)

Set a custom database path or directory with environment variables:

export SUBSTACK_SAVED_DB_PATH="/path/to/my/custom_database.sqlite"
# or
export SUBSTACK_SAVED_DATA_DIR="/path/to/my/data_dir"

Which saved posts haven't I read?

Filter by reading state on the CLI with --read-state, or pass read_state to the list_saved_posts and search_saved_posts MCP tools. In a chat, ask your assistant to "list my unread saved posts".

State

Posts it matches

unread

You never opened them, and Substack recorded no progress.

in_progress

You read part, below the finished threshold.

finished

You read past the threshold (default 95%).

unfinished

Everything below the threshold: unread plus in_progress.

started

You opened them or read any part.

substack-saved-mcp sync --force                      # refresh progress for every post first
substack-saved-mcp list --read-state unfinished --sort-by minutes_remaining --limit 20
substack-saved-mcp status                            # unread count and total minutes remaining

Sorting unfinished posts by minutes_remaining puts the quickest ones to finish at the top. Each post also reports is_fully_read and minutes_remaining. Notes have no reading progress.

How does the tool decide a post is fully read, and how fresh is that?

Substack reports a max_read_progress high-water mark (0.0 to 1.0) for each saved post. The tool counts a post as fully read once that value reaches a threshold, 0.95 by default, because finished posts on Substack tend to stop around 0.98 to 0.9999 rather than at 1.0. Change it with:

export SUBSTACK_SAVED_FULLY_READ_THRESHOLD="0.90"

A sync refreshes progress for each post it fetches. An incremental sync stops at the first posts it already has, so progress on older posts goes stale until you run substack-saved-mcp sync --force. A post you finished last week can show as unread until then.

Which Substack API does syncing saved posts use?

Sync tries Substack's unified reader API first. If that fails, it falls back to an older posts-only API, then to headless browser scraping. To force one source while troubleshooting, set:

export SUBSTACK_SAVED_POSTS_SOURCE="unified"  # or "legacy" or "dom"

Leave it unset, or set "auto", for the default fallback chain.

What does a "partial" sync status mean?

Substack sometimes rate-limits a sync (HTTP 429) so hard that a page of results fails even after retries. The sync then keeps what it fetched and reports status: partial instead of success, in substack-saved-mcp status and in the sync tool's response. On a sync --force, a partial run skips reconciliation, so the tool won't mark a post or note as unsaved because it couldn't fetch it. Run sync again later to pick up what it missed.

Will a browser window pop up when running as an MCP server?

No. During normal MCP use you won't see a browser window.

  • Read & Search Tools (search_saved_posts, list_saved_posts, get_saved_post, search_saved_notes, list_saved_notes, get_saved_note, list_publications, list_audiences, saved_posts_status):
    Query the local SQLite database offline. No browser.

  • Post Sync & Write Tools (sync_saved_posts, sync_reading_history, save_post, unsave_post, get_post_content):
    Run headless with the session stored in storage_state.json.

  • Note Sync & Write Tools (sync_saved_notes, save_note, unsave_note, get_note_content):
    Make direct API requests with storage_state.json, with no browser page, headless or visible.

  • Interactive Login:
    A browser window opens only when you run substack-saved-mcp login in your terminal. If your session expires while you use an MCP client, the tool returns an error telling you to run substack-saved-mcp login.

What if I get a Playwright "Executable doesn't exist" error?

An error like BrowserType.launch: Executable doesn't exist (often during login) means Playwright hasn't installed its browsers in the tool's isolated environment. Run playwright install inside that environment.

For a system-wide install (uv tool install):

~/.local/share/uv/tools/substack-saved-mcp/bin/playwright install

For a development environment (uv sync):

uv run playwright install

I edited the source code, but the installed substack-saved-mcp command still runs the old version. Why?

uv tool install copies the package into its own environment at install time and doesn't track your working tree. After you edit files under src/ or pull new commits, the installed copy keeps running the old code. uv run substack-saved-mcp ... from the repo uses your current source.

Reinstall from your working tree to pick up the changes:

uv tool install . --no-cache --force
  • --force replaces the installed version instead of skipping because one is present.

  • --no-cache builds fresh instead of reusing a cached wheel from before your edits.

Available Tools

18 tools
get_note_contentA

Fetch a saved note's full content, cleaned and formatted for LLM consumption.

Returns the cached body_text if a previous fetch already stored it, unless force_refetch is set. Otherwise fetches the note directly via Substack's reader API (no browser page needed) and caches the result. Requires an active authenticated Substack session.

Inputs: url_or_id (required), force_refetch. Returns: object

get_post_contentA

Fetch a saved post's full content, cleaned and formatted for LLM consumption.

Returns the cached content_text if a previous fetch already stored it, unless force_refetch is set. Otherwise fetches the post's page directly, extracts its body_html from Substack's server-rendered window._preloads blob, converts it to plain text (headings, list items, and links kept readable), and caches the result. Requires an active authenticated Substack session. If the content can't be located on the page (e.g. Substack changed how it embeds it, or the post is paywalled beyond this account's access), returns success=False with a message suggesting the caller run 'substack-saved-mcp inspect-network' while opening the post so the real content source can be captured.

Inputs: url_or_id (required), force_refetch. Returns: object

get_saved_noteA

Retrieve full cached note details (author, body, engagement counts) by URL or local ID.

Inputs: url_or_id (required). Returns: result

get_saved_postA

Retrieve full cached post details, timestamps (published_at and saved_at), and content by URL or local ID.

An all-digit value is always treated as the local ID, so a numeric Substack post ID will not match; pass the post URL instead. content_text is empty until get_post_content has fetched the post.

Inputs: url_or_id (required). Returns: result

list_audiencesA

List distinct audience tiers present in local cache with post counts.

Discovers actual values in use (e.g. "everyone", "only_paid") rather than a hardcoded enum, since Substack's audience values aren't officially documented and may vary or grow over time.

Inputs: no named parameters. Returns: result

list_publicationsA

List all publications in local cache with post counts.

Inputs: no named parameters. Returns: result

list_saved_notesA

List cached saved notes with pagination and optional author/restack filters.

sort_by can be 'posted_at' (when the note was posted) or 'saved_at' (always None for notes, so it gives no meaningful order). restacks_only limits results to notes that restack a post.

Inputs: limit, author, offset, sort_by, +1 more. Returns: result

list_saved_postsA

List cached saved posts with pagination and optional publication/audience filters.

history=True lists the reading history instead: posts viewed on Substack (seen_at set), saved or not (is_saved tells which), newest view first. sort_by can be 'saved_at' (default), 'published_at', 'read_progress', 'minutes_remaining', or 'seen_at' (default with history=True). audience filters by tier (see list_audiences for cached values, e.g. "everyone", "only_paid"). read_state filters by reading progress: 'unread', 'in_progress', 'finished', 'unfinished' (unread + in_progress), or 'started' — a post is 'finished' once its high-water reading progress crosses a threshold, default 0.95.

Inputs: limit, offset, history, sort_by, +3 more. Returns: result

saved_posts_statusA

Return cache statistics, database path, and last sync run status.

Inputs: no named parameters. Returns: Overall status and metrics of the local SQLite cache.

save_noteA

Bookmark a Substack note remotely on Substack and save it to the local cache.

Requires an active authenticated Substack session (run 'substack-saved-mcp login' if expired). remote_confirmed=False means the note is still cached locally, but the tool could not verify the bookmark was actually created on Substack's side — a subsequent 'sync --force' will correct the local cache if the remote save didn't actually happen.

Inputs: url (required). Returns: object

save_postA

Bookmark a Substack post remotely on Substack and save it to the local cache.

Requires an active authenticated Substack session (run 'substack-saved-mcp login' if expired). Confirmation comes from Substack's save API (keyed by the post's numeric ID, read from the page) or, failing that, from a best-effort bookmark-button click whose rendered state is checked. remote_confirmed=False means the post is still cached locally, but the tool could not verify the bookmark was actually created on Substack's side — a subsequent 'sync --force' will correct the local cache if the remote save didn't actually happen.

Inputs: url (required). Returns: object

search_saved_notesA

Perform full-text FTS5 search across cached saved notes.

Searches body text, author name/handle, and (for restacks) the attached post's title. query uses SQLite FTS5 syntax. Allows filtering by author (name or handle) and original note date (posted_after/posted_before, ISO 8601 strings). Substack exposes no bookmark time for notes, so saved_at is always None and saved_after/saved_before match nothing.

Inputs: query (required), limit, author, saved_after, +3 more. Returns: result

search_saved_postsA

Perform full-text FTS5 search across cached saved posts.

history=True searches the reading history instead: posts viewed on Substack (seen_at set), saved or not (is_saved tells which).

Searches title, excerpt, publication name, author, and content text (content is only present for posts fetched via get_post_content). query uses SQLite FTS5 syntax; a malformed query falls back to a substring match. Date filters take ISO 8601 strings (e.g. "2026-01-31"). Allows filtering by publication name, audience tier (see list_audiences for cached values, e.g. "everyone", "only_paid"), original post date (published_at), saved date (saved_at), and read_state ('unread', 'in_progress', 'finished', 'unfinished' (unread + in_progress), or 'started' — a post is 'finished' once its high-water reading progress crosses a threshold, default 0.95).

Inputs: query (required), limit, history, audience, +6 more. Returns: result

sync_reading_historyA

Sync the reading history (posts viewed on Substack, saved or not) into the local cache.

Fills seen_at and reading progress; never changes a cached post's saved state. Unsaved viewed posts are stored with is_saved=0 and only show up via history=True on list_saved_posts/search_saved_posts. force=True walks the whole history instead of stopping at already-cached views. Status is 'success', 'partial', 'auth_required', or 'failed'.

Inputs: force. Returns: Tracks execution history of sync operations.

sync_saved_notesA

Trigger incremental or full resync of saved notes from Substack account into local SQLite cache.

Incremental (default) stops early once it reaches notes already saved locally. force=True fetches the whole list and soft-deletes local notes no longer saved on Substack. Returns a SyncRun whose status is 'success', 'partial' (the fetch was truncated, e.g. by rate limiting, and reconciliation was skipped), 'auth_required' (run 'substack-saved-mcp login'), or 'failed'. Requires an active authenticated Substack session.

Inputs: force. Returns: Tracks execution history of sync operations.

sync_saved_postsA

Trigger incremental or full resync of saved posts from Substack account into local SQLite cache.

Incremental (default) stops early once it reaches already-cached posts, so older posts' reading progress isn't refreshed. force=True fetches the whole list, refreshes every post, and soft-deletes local posts no longer saved on Substack. Returns a SyncRun whose status is 'success', 'partial' (the fetch was truncated, e.g. by rate limiting, and reconciliation was skipped), 'auth_required' (run 'substack-saved-mcp login'), or 'failed'. Requires an active authenticated Substack session and can take minutes on large accounts.

Inputs: force. Returns: Tracks execution history of sync operations.

unsave_noteA

Unbookmark a Substack note remotely and soft-delete it in local cache.

Soft-deletion preserves note history while removing it from active search/list outputs. remote_confirmed=False means the note was still soft-deleted locally, but the tool could not verify the unbookmark on Substack's side.

Inputs: url_or_id (required). Returns: object

unsave_postA

Unbookmark a Substack post remotely and soft-delete it in local cache.

Soft-deletion preserves post history while removing it from active search/list outputs. When the post's Substack ID is known (normally true after a sync), this calls Substack's real unsave endpoint directly and is reliably confirmed; otherwise it falls back to a best-effort DOM click (see save_post). remote_confirmed=False means the post was still soft-deleted locally, but the tool could not verify the unbookmark on Substack's side.

Inputs: url_or_id (required). Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 18 tools

    Disambiguation4/5

    The tool set is mostly clearly split by resource (posts vs. notes) and action (save, unsave, list, search, sync, content). The main ambiguity is between content-fetching tools like get_post_content/get_note_content and cached-detail tools like get_saved_post/get_saved_note, which overlap somewhat in returning note/post bodies. The history flag on list/search saved posts adds a secondary mode but remains distinguishable from sync_reading_history.

    Naming Consistency4/5

    Most tools follow a predictable snake_case verb_noun pattern: save_post, unsave_note, list_saved_posts, search_saved_notes, sync_reading_history. Minor deviations like saved_posts_status and the get_*_content vs get_saved_* distinction keep it from being perfectly uniform, but the convention is still easy to follow.

    Tool Count4/5

    18 tools is slightly on the heavy side, but the server manages two related resource types (posts and notes) plus sync, search, listing, content retrieval, and status operations. Each tool maps to a fairly specific operation, so the count is reasonable rather than padded.

    Completeness5/5

    The surface covers the full saved-item lifecycle for both posts and notes: save, unsave, get cached details, fetch content, list, search, and sync. It also includes publication/audience discovery, cache/sync status, and reading-history sync, leaving no obvious dead ends for the stated purpose.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers