Skip to main content
Glama

substack-mcp

Create and manage your Substack newsletter from your AI assistant or terminal. Prepare rich drafts, search your archive, publish Notes, inspect analytics, and manage explicitly consented free subscribers across publications. Review and publish long-form posts in Substack.

License: MIT Language: TypeScript npm version MCP HOL Plugin Security Scan Podcast X


Create, search, export, plan and review a draft with substack-mcp

The demo runs actual MCP handlers against offline sample data. No live API calls or publication occur. Follow the draft workflow to create, find, export and review a post.

Draft-only long-form posts; explicit public actions: This server cannot publish or delete long-form posts. Post tools create and edit drafts only; you review and publish manually through Substack's editor. Public community comments/restacks are separately experimental and consent-gated. Substack Notes also publish publicly: create_note and create_note_with_link publish short-form Notes immediately, because Notes have no draft state on Substack. Treat the Note tools as public-publish actions — there is no preview step and no undo from this server. The split is proportionate review, the piece of trust infrastructure for agents this server cares most about: the high-stakes surface gets a human gate, and the exception is stated loudly.

This server imposes no Bestseller-status check. Use an authenticated account with permission to manage the publication; individual operations depend on your Substack access. Connect through local stdio or self-hosted HTTP.

For 1.0 setup coverage and account eligibility, see compatibility. Run substack-mcp compatibility report for an offline, shareable diagnostic report; reporting guide. Maintainers can use the release checklist and distribution inventory.

Contents: Quick start · Setup · Tools · Operator CLI · Draft workflow · Analytics to draft · Export · Markdown · Multiple publications · Transports · Compatibility

Quick start

  1. Install and sign in. Browser login needs the optional Playwright dependency:

    npm install @conorbronsdon/substack-mcp playwright
    npx playwright install chromium
    npx substack-mcp login https://yourblog.substack.com --user-id 12345

    Use your own account's user ID (how to find it). The session is saved only after a bounded authenticated read succeeds. To paste credentials instead, see Option B.

  2. Verify a read. npx substack-mcp doctor --json --check-auth makes one bounded read per publication. It confirms read access, not your user ID or write permission.

  3. Connect your MCP client. Add the server to Claude Desktop or Claude Code, or use the Codex plugin. Environment variables take precedence; omit them to use the stored browser-login session. A stored session token is never sent to a SUBSTACK_PUBLICATION_URL env var on a different origin (scheme, host and port; the path is ignored); startup fails instead, as it does when the stored URL or that env var is not a valid http(s) URL. Run substack-mcp-login for the other host, including a publication's custom domain. Only a stored token is checked. A token you set yourself, in SUBSTACK_SESSION_TOKEN or a SUBSTACK_PUB_<KEY>_SESSION_TOKEN triplet, has no recorded origin and is sent to whichever URL resolves, including the stored URL. Then ask your assistant: "How many Substack subscribers do I have?"

  4. Prepare a draft for review. Follow the draft workflow: create_draft, search_posts, export_draft, preflight_draft, then plan_draft_update and update_draft. Long-form posts stay unpublished drafts until you publish them in Substack's editor. create_note and create_note_with_link publish immediately.

Related MCP server: substack-mcp

Community walkthrough

Jonathan Price's I used Codex to connect ChatGPT to Substack. Then it drafted this post. walks through using Codex to install the MCP locally, connecting ChatGPT through OpenAI's Secure MCP Tunnel, and creating a private draft for manual publication. He used the connection to create the draft of the guide itself.

The guide documents his September 18, 2026 setup with version 1.2.0. Its reported get_post 404 is fixed in 1.2.1. Client interfaces and access requirements can change; use the setup instructions below for this package's current configuration. This is a community walkthrough, not a hosted service provided by this project.

Setup

Requires Node.js 22 or newer (CI covers Node 22 and 24). Browser login additionally requires Playwright.

You can supply credentials two ways: paste them as env vars (below), or run the optional browser login which captures and stores them for you.

Install the server and optional Playwright dependency together in a local tools directory, then sign in:

npm install @conorbronsdon/substack-mcp playwright
npx playwright install chromium
npx substack-mcp login https://yourblog.substack.com --user-id 12345

substack-mcp-login remains a supported alias. Missing publication URL and user ID are prompted. Supply your own account's user ID (steps below); a post author's byline does not verify your identity. The browser opens for sign-in, including any CAPTCHA. Login then opens <publication>/publish/home and waits for the publication session cookie; on custom domains this is connect.sid on the custom domain. A bounded authenticated read must succeed before saving. The default flow verifies read access, not the configured user ID or permission to write.

To derive your ID from the selected publication's authenticated session instead of entering it manually, use:

npx substack-mcp login https://yourblog.substack.com --verify-identity --profile work

--verify-identity reads the publication-host /api/v1/user/profile/self with that host's cookie, requires a positive safe integer top-level ID, and then performs the existing authenticated draft-list check before saving. Supplying --user-id as well turns it into an assertion: a mismatch stops without saving or replacing a profile, even with --force. No public profile, post byline, other-host cookie or other-host endpoint is used as a fallback. The verified mode's JSON result reports user_identity: "verified" and identity_source: "authenticated_publication_self_profile"; it prints no ID. This is an observation at login time, not a persisted identity attestation or proof of write permission. Ordinary doctor continues to report identity as unverified.

For subscriber tools or the calendar opt-in sync, add --subscriber-access. Substack asks for a one-time "Confirm it's you" code (by email or authenticator app) before it allows subscriber reads, and login prompts for it. See docs/subscriber-step-up.md.

Self-profile support on publication hosts has not been live-verified for every Substack/custom-domain configuration. If the endpoint is unavailable, expired, redirected or malformed, verified mode fails closed and saves nothing. The existing manually configured-ID flow remains available and explicitly unverified. A real browser run is still needed for #150; fixture tests are not evidence about the current sign-in UI.

Without --profile, login saves ~/.substack-mcp/session.json (directory override: SUBSTACK_MCP_HOME). The server uses this legacy session when publication credential environment variables and SUBSTACK_PROFILES are unset.

Default storage (SUBSTACK_CREDENTIAL_STORE=file): sessions use AES-256-GCM with a key derived from the OS account and machine. File permissions request 0600; Windows access also depends on directory ACLs. This is a machine-bound file, not an OS keychain or secret vault. Code running as your OS user can derive the key. Use environment credentials if your MCP client manages secrets for you.

Optional OS keychain: set SUBSTACK_CREDENTIAL_STORE=keychain in both the login process and the MCP client's environment. macOS uses Keychain via /usr/bin/security; Linux needs libsecret and secret-tool plus an unlocked Secret Service; Windows uses Credential Manager through PowerShell's PasswordVault. All three are exercised with synthetic credentials by the keychain CI workflow on GitHub-hosted runners (an unlocked temporary macOS keychain and a gnome-keyring session on Linux); desktop setups with locked keychains may still prompt. Login writes the selected account to the keychain, and the server reads it there. Explicit keychain selection never reads the encrypted file as a fallback. The keychain helps against other OS users, copied disks, and some malware limited to file access. Code running as your user can usually query the keychain. Keep the OS account and running code trusted. On Linux, secret-tool lookup can exit 1 without an error message for either an absent entry or a locked keyring. Named writes without --force search and unlock first, and refuse overwrites when an entry is found.

Named profiles and migration

npx substack-mcp login https://yourblog.substack.com --user-id 12345 --profile work
npx substack-mcp profiles list
# Copy an existing legacy session without changing its file:
npx substack-mcp profiles migrate --name personal
# Copy a file session or named file profile into the keychain; source remains:
npx substack-mcp profiles migrate --to keychain
npx substack-mcp profiles migrate --to keychain --name work

Keys start with a lowercase ASCII letter and contain only lowercase letters, digits and hyphens, up to 64 characters. Existing profiles require explicit --force to replace. List output contains keys, readability status, publication origins and file save times; it excludes cookies and user IDs. Unreadable profiles remain visible but cannot be selected. Save time records local persistence, including migration; it is not token issuance or expiration time. Listing is bounded to 32 profiles.

Profile storage requires a local filesystem supporting hard links (such as NTFS or a typical Linux filesystem), so creation can install a complete encrypted file without overwriting an existing name. FAT/exFAT and some network mounts are not supported: set SUBSTACK_MCP_HOME to a suitable local directory. Do not use --force to work around an unsupported filesystem.

Set SUBSTACK_PROFILES=work,personal in your MCP client's environment to select up to 32 distinct profiles. Remove all publication credential variables first: combining profile selection with legacy or named credential variables is an error, including empty variables. Missing, corrupt or invalid selected profiles stop startup; they never fall back to another account. Profiles on disk are never activated by discovery. With multiple profiles, tools require an explicit publication key and CLI reads require --publication.

To roll back, unset SUBSTACK_PROFILES and restore your previous environment configuration. Migration preserves the legacy session byte-for-byte. These files use the existing encryption format. profiles list lists file profiles; select keychain profiles explicitly with SUBSTACK_PROFILES after migration or login. Run substack-mcp status --json for offline configuration diagnostics or substack-mcp doctor --check-auth --json for a bounded read per selected account.

Option B — Get your credentials manually

Open your Substack in a browser, then:

  1. Session token: For custom domains, open DevTools → Application → Cookies → https://your-custom-domain and copy connect.sid from the publication's own domain (URL-encoded string starting with s%3A). Do not copy substack.sid from substack.com: it is a different session that the custom domain's admin API rejects with 403. For *.substack.com publications, use connect.sid on that host or substack.sid on .substack.com. The token must match the host of SUBSTACK_PUBLICATION_URL, with the .substack.com fallback only for Substack-hosted publications.

  2. User ID: Follow Find your account user ID. Do not use a publication post's byline ID: publications can have multiple authors. This server does not independently verify the supplied ID.

  3. Publication URL: Your Substack URL, including custom domain if you have one (e.g., https://newsletter.yourdomain.com or https://yourblog.substack.com)

Find your account user ID

  1. In Substack, open your own account profile and copy its handle (the part after @ in https://substack.com/@your-handle). A publication URL or another author's profile is not your account handle.

  2. Open https://substack.com/api/v1/user/your-handle/public_profile with that handle substituted. Read the top-level numeric id in the JSON response; do not use an ID nested under a publication or post byline. This public profile endpoint is also used by this server's anonymous profile lookup.

  3. Confirm that the response's handle and name match the account you will sign in with. Supply the top-level id to login --user-id or SUBSTACK_USER_ID. A public profile lookup identifies the handle you entered; the browser-login read check does not prove that the cookie belongs to that ID. Recheck the account before any write operation.

2. Configure your MCP client

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "substack": {
      "command": "npx",
      "args": ["-y", "@conorbronsdon/substack-mcp"],
      "env": {
        "SUBSTACK_PUBLICATION_URL": "https://yourblog.substack.com",
        "SUBSTACK_SESSION_TOKEN": "your-session-token",
        "SUBSTACK_USER_ID": "your-user-id"
      }
    }
  }
}

Claude Code and Codex plugin setup is available alongside manual MCP configuration. The repository marketplace and local plugin are separate from curated-directory acceptance or hosted ChatGPT support.

Claude Code

Add to your .mcp.json:

{
  "mcpServers": {
    "substack": {
      "command": "npx",
      "args": ["-y", "@conorbronsdon/substack-mcp"],
      "env": {
        "SUBSTACK_PUBLICATION_URL": "https://yourblog.substack.com",
        "SUBSTACK_SESSION_TOKEN": "your-session-token",
        "SUBSTACK_USER_ID": "your-user-id"
      }
    }
  }
}

3. Verify

Ask your AI assistant: "How many Substack subscribers do I have?"

Tool output compatibility, response limits and versioning are documented in the tool contract.

Operator diagnostics

The CLI exposes operator commands and configuration checks through the same MCP handlers and credential resolution as the server. drafts create writes one private draft and images upload returns a publicly fetchable (unlisted) image URL for it; the other operator commands read:

substack-mcp status --json
substack-mcp doctor --json --check-auth
substack-mcp drafts list --limit 10

Commands, the JSON envelope, exit codes, request deadlines and response limits are documented in operator CLI and diagnostics.

Tools

Every tool declares explicit MCP side-effect annotations; see tool annotations. Tool descriptions carry the authoritative wording.

Read

Tool

Description

get_subscriber_count

Get your publication's current subscriber count

list_subscribers

Read a bounded page of private subscriber records

search_subscribers

Filter and page private subscriber records; optional activity, date, flags and revenue fields

get_subscriber

Look up membership by exact email; reconcile pending additions

list_published_posts

List published posts with pagination

get_publication

Read projected publication identity/settings, verify the configured host, and report missing fields; does not verify account identity or role

list_publication_tags

Read tag definitions, including hidden tags by default, with bounded local pagination

get_post_tags

Resolve post tag associations; preserves unresolved IDs and reports empty-result identity uncertainty. Draft coverage is currently live-verified only for empty responses

search_posts

Search a publication archive by query and status; bounded pages with continuation metadata

plan_draft_update

Review proposed changes, preflight and a receipt for best-effort stale detection; no writes

export_draft

Editable Markdown, exact original body, conversion diagnostics, preflight and editor link

preflight_draft

Read-only checks for title, audience, body structure, images, and paywalls, with an editor link; optionally adds Substack's own prepublish errors and suggestions

list_drafts

List draft posts

get_post

Get full content of a published post by ID

get_draft

Get full content of a draft by ID

get_post_comments

Get comments on a published post

get_sections

List your publication's sections (categories) with their IDs

get_post_analytics

Get a published post's stats (views, opens, signups, subscribes, reactions) by ID

rank_posts

Rank posts by views, opens, sends, rates, signups, subscribes, estimated value or date, keeping null and missing values distinct

get_publication_stats

Read dashboard summary and ranged publication metrics, with missing and unavailable states

get_growth_sources

Read bounded growth source attribution and optional events

list_incoming_recommendations

List publications that recommend yours, with start date, active state and dashboard-attributed subscribers

list_outgoing_recommendations

List whom your publication recommends (can be partial). This is not who recommends it; use list_incoming_recommendations for that

list_outgoing_recommendation_stats

List subscribers your publication has sent to the publications it recommends

list_scheduled_posts

List posts scheduled for future publication (read-only; scheduling stays in Substack's editor)

get_user_profile

Read a minimal public user profile by handle, anonymously

get_profile_feed

Read one public profile feed page with cursor continuation, anonymously

get_note_thread

Read a public Note, ancestors and one replies page, anonymously

list_public_posts

Read a bounded public archive page, anonymously

get_public_post

Read an anonymous public post by URL with body status and truncation flags

Public reading

These five tools use a separate anonymous reader. It sends only User-Agent and Accept, never the configured publication cookie or other credentials. The configured publication selects the default archive origin; callers may supply an allowlisted HTTPS publication origin. Allowed hosts are substack.com, one-label *.substack.com, configured publication origins, and exact origins in SUBSTACK_PUBLIC_READ_ORIGINS (comma-separated HTTPS origins without ports, paths or userinfo). Redirects are rejected. A *.substack.com publication may redirect to its custom domain (for example, lenny.substack.com); JSON reads do not follow that redirect. Add the custom HTTPS origin to SUBSTACK_PUBLIC_READ_ORIGINS and read through that origin. With multiple publications, the publication key remains required for every publication tool.

Profile feed pages are upstream-sized; has_more: null means the upstream omitted continuation metadata. Thread pages can omit replies when more_branches or next_cursor is present; completeness: "unknown" means continuation metadata was omitted. Archive full pages have has_more: null because no total is returned. Public post body_status is a heuristic based on audience and body presence; it does not establish full access. The anonymous reader does not use subscription entitlements. Reader subscriptions and inbox are unsupported: the configured publication session received 401 on the substack.com reader-account routes, which require a separate reader session this server does not manage.

Archive search and draft review

search_posts accepts query (1–500 characters), status (published, drafts, or scheduled, default published), offset (default 0), and limit (1–50, default 25). It makes one authenticated archive request and returns projected metadata, returned, total, has_more, and next_offset. Continue with next_offset and the same query/status. When Substack omits the total and a page is full, has_more is null (unknown); another page may be empty. Substack controls matching and indexing: this is not a guaranteed full-text scan. Use get_post or get_draft to retrieve full content. Pagination is not a snapshot; concurrent edits can move results between pages.

preflight_draft accepts draft_id, reads it once, and returns checks_passed, findings with severity/code/message, content counts and an editor link. It checks title, audience, JSON/body shape, image wrappers and HTTPS sources, and paywall count and edge placement. Unknown nodes and external images produce review warnings. Bodies over two million characters, 10,000 nodes, or depth 100 are not fully checked; counts.complete is false and aggregate checks are skipped after a scan limit. Unknown-node warnings name up to five types for editor review.

With substack_check: true, it also makes one more read: Substack's own prepublish validator (GET /api/v1/drafts/{id}/prepublish, the check the editor runs before its publish dialog). The result comes back separately as substack_check with errors and suggestions (up to 50 each, 300 characters each) and never changes checks_passed or findings. The endpoint is undocumented and its response shape is not yet live-verified: any failure or unexpected shape returns substack_check.status: "unavailable" with a reason, and the static checks still return. A clean result is not publish approval. This is a focused static check, not full ProseMirror validation or publish approval. It does not fetch links/images, verify access settings, or prove final rendering. Review the draft in Substack; no content is modified.

Both tools require publication when multiple publications are configured.

Write (private drafts; image upload returns a public URL)

Tool

Description

create_draft

Create a new draft from markdown (private)

update_draft

Apply a reviewed change receipt; recheck unpublished state and report readback outcomes

update_draft_tags

Plan or change draft tags; dry-run by default, draft-only, with one readback after writes

upload_image

Upload an image to Substack's CDN from a file, data URI or public HTTPS URL — returns a publicly-fetchable (unlisted) URL

Review before changing a draft

In 0.9, call plan_draft_update, review its output, then call update_draft with the same fields and returned receipt. Published or known stale drafts are rejected. The read/write race remains; check readback outcomes and review in Substack. The CLI shares this flow through drafts plan and drafts apply. See draft changes and migration for examples and limits.

Public community writes (experimental)

Tool

Description

create_post_comment

Comment at a configured publication; preview by default, publishes immediately when live

restack

Restack a post or Note as a separate reader account; preview by default, publishes immediately when live

Live attempts require SUBSTACK_EXPERIMENTAL_COMMUNITY_WRITES=1, dry_run=false, confirm_publish=true and explicit approval of the exact account, target and text. Restacks additionally need a separate reader session. Both tools check the authenticated identity before writing, attempt one POST, and report bounded readback outcomes without automatic retries. The endpoints have source evidence; live verification remains pending. See setup, credential routing, consent and limitations.

Publish (Notes — public immediately)

Tool

Description

create_note

Publish a Substack Note (short-form, publishes immediately)

create_note_with_link

Publish a Note with a link card attachment (publishes immediately)

Notes have no draft state on Substack, so there is no draft-first option for these two tools.

Subscriber management

add_free_subscriber adds one consenting reader to the free newsletter. It is a distribution change: that reader may receive future newsletter emails. It can request a welcome email with send_welcome_email: true (off by default). It never grants paid access or overrides Substack's suppression of previously unsubscribed addresses. Its MCP annotations identify it as an external write (readOnlyHint: false, openWorldHint: true).

{"email":"reader@example.org","consent_confirmed":true,"consent_evidence":{"source":"booking:message-id","recorded_at":"2026-09-01T00:00:00Z"},"dry_run":true}

Dry-run is the default. After checking actual newsletter consent, set dry_run: false to execute. Live adds require the source reference and timestamp in consent_evidence; this attestation is echoed with the publication key for auditing and does not replace checking the underlying consent record. Multi-publication configurations also require the publication selector, just like every other tool.

Results distinguish existing, dry_run, verified, blocked, and unverified, busy, and retryable. busy performs no write; wait for the other operation. retryable means authentication or rate limiting refused the request; resolve that condition before explicitly retrying. An empty API acknowledgement is not proof of addition. verified means an exact membership lookup succeeded after the request; it does not prove that this request originally created the membership. Dashboard data can lag. A missing reader may also have previously unsubscribed.

For unverified, recheck with get_subscriber; never automatically repeat the add. For blocked, review in Substack without bypassing suppression. Automated callers must persist an attempt ledger before sending each live request. The client's in-memory duplicate guard does not survive restarts or separate HTTP sessions. Keep subscriber identities and consent evidence out of shared repositories, prompts to unapproved public services, and routine logs.

Implementation and live verification notes: subscriber API.

For Google Calendar booking opt-ins, the calendar sync helper provides a bounded Gmail scan, latest-answer selection, a private durable attempt ledger, and read-only reconciliation after uncertain writes. Scheduling is an explicit local setup step; installing the MCP does not start a background job.

Prompts and resources

Clients that support MCP prompts (often shown as slash commands) get four workflows. Each one only tells the model which existing tools to chain, so a prompt adds no endpoint, write path or permission:

Prompt

What it does

review_draft

export_draft, then preflight_draft with substack_check; reports static findings, Substack's own findings and an editorial read separately. Edits go through plan_draft_update and update_draft only after you approve

what_worked

Unfiltered archive rank_posts by subscribes/open rate in both directions, separately from get_publication_stats and get_growth_sources over a window (default 90 days), with sources and missing values kept explicit

draft_from_idea

Checks past posts and drafts with search_posts, proposes an outline, and after approval creates a private draft and preflights it

plan_notes

Proposes Notes that resurface recent posts as text only. It never calls create_note: Notes publish immediately, so you post each approved one yourself

With several publications configured, each prompt takes a required publication argument that accepts only the configured keys, matching the tools' enum. The keys are listed in the argument description and offered through argument completion; an unknown key is rejected.

The substack://publications resource lists the configured publications (key, label, origin) from local configuration, so a client can load them without a tool call. It makes no request and contains no credentials.

Intentionally excluded

  • Publish posts — Publishing long-form posts should be a deliberate human action (Notes are the documented exception above)

  • Delete — Too destructive for an AI tool

  • Schedule — Use Substack's editor for scheduling. (list_scheduled_posts reads what you've queued there, but this server never creates, edits, or cancels a schedule.)

For an always-on scheduler with durable cloud state and weekly email reports, see Cloud Calendar sync.

Multiple publications

Running more than one publication behind a single server? Set a SUBSTACK_PUB_<KEY>_* triplet per publication instead of the plain SUBSTACK_* vars. <KEY> is any name you choose (letters, digits, underscores) — it becomes the publication's lowercase, hyphenated key, e.g. KEVIN_MULDOON → kevin-muldoon.

"env": {
  "SUBSTACK_PUB_KEVIN_MULDOON_PUBLICATION_URL": "https://kevinmuldoon.substack.com",
  "SUBSTACK_PUB_KEVIN_MULDOON_SESSION_TOKEN": "token-1",
  "SUBSTACK_PUB_KEVIN_MULDOON_USER_ID": "111",
  "SUBSTACK_PUB_SAPERE_PUBLICATION_URL": "https://sapere.substack.com",
  "SUBSTACK_PUB_SAPERE_SESSION_TOKEN": "token-2",
  "SUBSTACK_PUB_SAPERE_USER_ID": "222"
}

Each triplet is independent, and setting any SUBSTACK_PUB_<KEY>_* variable declares that publication. An incomplete triplet — a missing variable, an empty value, or a whitespace-only value — fails startup with an error naming the key, rather than silently dropping that publication. That matters because a dropped publication is not "one fewer publication": drop the only one and the server falls back to your stored browser-login session; drop one of two and every tool loses its publication parameter, so a call meant for the dropped publication routes silently to the surviving one.

Keys are compared case-insensitively, with _ folded to -. Two names that resolve to the same key (SUBSTACK_PUB_ALPHA_* and SUBSTACK_PUB_Alpha_*) are a startup error too — merging them silently would let one publication's URL pair with another's session token.

<KEY> accepts ASCII letters, digits, and underscores; the three suffixes must be uppercase and the whole name must have no stray whitespace. Anything that begins with SUBSTACK_PUB_ but does not fit that shape — a hyphen in the key, a lowercase suffix, an accented character, a trailing space — is a startup error naming the variable, not a variable that gets quietly ignored. For the same reason as above: an ignored publication is not one fewer publication, it is a silent reroute to a different one.

With two or more publications configured, every publication tool gains a required publication parameter — one of your configured keys (e.g. kevin-muldoon, sapere above). The calling model must specify one on every publication call; an unrecognized value is rejected before any Substack API call is made, so a stray write can't land on the wrong publication. With exactly one publication configured — the common case, whether via plain SUBSTACK_* vars or a single SUBSTACK_PUB_<KEY>_* triplet — no publication parameter is added at all; every tool's schema is unchanged from single-publication mode.

Don't mix the two styles: if any SUBSTACK_PUB_<KEY>_* var is set, the plain SUBSTACK_* vars are ignored (with a startup warning) rather than treated as an unnamed extra publication.

The account-wide restack tool uses an explicit reader account_user_id instead of a publication parameter. Its reader credential is configured separately; it never uses a publication session.

SUBSTACK_USER_AGENT and SUBSTACK_REQUEST_TIMEOUT_MS apply to every configured publication — they are not per-publication. Browser login also supports explicit named profiles; see Named profiles and migration.

Token expiration

Substack session tokens expire periodically (typically ~90 days). If you get authentication errors, re-run substack-mcp login to refresh the stored session, or copy a fresh cookie from DevTools on the matching publication host and update the env var. Custom domains require their own connect.sid, not substack.com's different substack.sid session (which the custom domain rejects with 403). For *.substack.com publications, use connect.sid on that host or substack.sid on .substack.com. Then run substack-mcp doctor --check-auth to verify access.

Custom domains & Cloudflare

This section covers authenticated creator API calls. Anonymous public reading uses the public reading origin rules above.

Substack publications served on a custom domain (e.g. blog.example.com) sit behind Cloudflare, which can reject non-browser requests with 403 error code: 1010. To avoid this, the server sends a browser User-Agent and a Referer by default, and uses the configured publication URL.

  • Match the host and cookie. If using the canonical *.substack.com URL, use its host session or the .substack.com fallback. A custom-domain connect.sid pairs with the custom-domain SUBSTACK_PUBLICATION_URL.

  • Override the User-Agent (optional) via SUBSTACK_USER_AGENT if you need a different browser signature:

"env": {
  "SUBSTACK_PUBLICATION_URL": "https://yourblog.substack.com",
  "SUBSTACK_SESSION_TOKEN": "your-session-token",
  "SUBSTACK_USER_ID": "your-user-id",
  "SUBSTACK_USER_AGENT": "Mozilla/5.0 ..."
}

Request timeout

Every request to Substack is bounded by a 30-second deadline. Node applies no request timeout of its own — only a 10-second connect timeout — so a host that accepts the connection and then goes silent (a proxy that drops packets rather than refusing them) would otherwise hang a tool call indefinitely. A request that hits the deadline fails with a TimeoutError naming the endpoint and the limit.

Raise or lower it with SUBSTACK_REQUEST_TIMEOUT_MS (milliseconds; a non-numeric or non-positive value is ignored with a warning and the default is used):

"env": {
  "SUBSTACK_REQUEST_TIMEOUT_MS": "60000"
}

Transports

By default the server speaks MCP over stdio, which the client configurations above assume. Set MCP_TRANSPORT=http for a stateless Streamable HTTP server (POST /mcp, GET /health) in a persistent, self-hosted deployment. Setup, listener variables and the security model are in HTTP transport.

What this listener will accept

The HTTP listener starts closed: loopback Host and Origin allowlists by default, an optional bearer token (MCP_HTTP_TOKEN) and a 10 MiB body cap. Host and Origin checks are not authentication; set a token wherever other processes can reach the port. See the listener policy.

Versioned GHCR images and transport verification: container distribution.

Typed errors

API failures map to typed errors (AuthenticationError, RateLimitError, ValidationError, NotFoundError, ServerError, TimeoutError, and the base SubstackAPIError). The status mapping and error-body parsing are documented in typed errors.

Draft export

Use export_draft for a read-only Markdown/JSON bundle, or run:

substack-mcp export 42 --output draft-export.json
substack-mcp export 42 --format markdown --output draft.md

Markdown exports retain the exact original body in a .source.json sidecar. Inspect unsupported_nodes before reuse. Existing files require --force. See export and CLI behavior for publication selection, limits, partial exports and file recovery.

Markdown support

Drafts accept CommonMark/GFM Markdown: headings, nested bold/italic/strikethrough, links and reference links, images with captions and linked destinations, nested lists with starting numbers, code, blockquotes, rules and hard breaks. A standalone <!-- paywall --> block adds one paywall to a long-form draft.

Unsupported content returns unsupported_nodes before a write. After reviewing those diagnostics, draft callers can explicitly set allow_unsupported: true to retain literal fallbacks. Tables remain Markdown inside code blocks; native tables, callouts and arbitrary embeds are not advertised as supported. Footnotes in top-level paragraphs map to the editor's native footnotes in long-form drafts. Notes reject unsupported conversion before either publication or attachment creation and have no fallback override.

See Markdown authoring for mappings, limits, compatibility changes and the distinction between offline fixtures and live editor checks.

Important notes

  • This server uses Substack's unofficial API. It may break if Substack changes their endpoints.

  • Session tokens are sent as cookies. Keep your SUBSTACK_SESSION_TOKEN secure.

  • The server checks your credentials on startup, after the MCP handshake completes, and only warns — it never blocks startup on a network call. Tools still error individually if the token is expired, which is where the failure is actionable.

  • SIGTERM and SIGINT are handled: the server closes its transport and exits 0, so docker stop returns promptly instead of waiting out the grace period.

Development

For opt-in live read checks, see live contract evidence. The probe is disabled in ordinary CI and never publishes or writes.

Before releasing, run npm run test:package. It installs the built tarball with production dependencies in a clean temporary directory, checks both executable entrypoints, and verifies the MCP version and the complete registered tool catalog without real credentials.

git clone https://github.com/conorbronsdon/substack-mcp.git
cd substack-mcp
npm install
npm run build

Run locally:

SUBSTACK_PUBLICATION_URL=https://yourblog.substack.com \
SUBSTACK_SESSION_TOKEN=your-token \
SUBSTACK_USER_ID=your-id \
npm start

Contributing

Issues and pull requests are welcome. Because this server uses Substack's unofficial API, the most useful contributions are fixes when an endpoint changes. If a tool stops working, open an issue with the tool name and the error. The safe-by-design boundary stays: no publish, no delete, no schedule for long-form posts. Notes publish immediately by design and must keep saying so loudly in their descriptions.

About

Built and maintained by Conor Bronsdon for the Chain of Thought podcast production workflow, where it drafts and reviews newsletter posts before a human hits publish. Conor hosts Chain of Thought, a show about AI infrastructure and how practitioners actually build with it. More tools for creators live in ai-tools-for-creators. Find Conor on X at @ConorBronsdon.

Companion tools:

  • Transistor MCP: Transistor.fm's official MCP server. Episodes, publishing, and analytics.

  • podcastindex-mcp: search the Podcast Index and track guest appearances

  • op3-mcp: report downloads, listener geography, and apps from OP3

  • apple-podcasts-mcp: pull plays, followers, and per-episode listening from Apple Podcasts Connect

  • gsc-mcp: query search performance, keywords, and sitemaps in Google Search Console

  • podcast-benchmark: benchmark a show against its peers using only public data


Disclaimer

This is an independent personal project, not affiliated with, sponsored by, or endorsed by any company. All views expressed are my own.

Codex plugin

The repository includes a Codex manifest at .codex-plugin/plugin.json and an MCP configuration at .mcp.json. It runs the published npm package over stdio using npx; Node.js and npm must be available. The package version is pinned in .mcp.json, so upgrading the plugin's server is an explicit change.

Configure your Substack credentials outside the plugin using the environment variables or browser-login session described above. Never commit a session token. Installation does not authenticate an account or grant approval to post. Long-form posts remain drafts; Notes publish immediately.

License

MIT

Available Tools

39 tools
add_free_subscriberA

Add one explicitly opted-in reader to this publication's free newsletter. Changes email distribution: future newsletter emails may be delivered. Requires verified newsletter consent; never infer consent from a meeting alone. Dry-run by default; set dry_run=false to write. Set send_welcome_email=true to request Substack's welcome email for a new addition; delivery is not verified. Never grants paid access or overrides suppression. Existing members are skipped. An unverified result MUST be reconciled using get_subscriber, not automatically retried. Automated callers must persist an attempt ledger BEFORE invoking this tool; in-memory duplicate protection does not survive restarts or separate HTTP sessions.

Inputs: email (required), consent_confirmed (required), dry_run, consent_evidence, +1 more. Returns: note, email, status, subscriber, +2 more

create_draftA

Create a new draft post. Accepts markdown body which is converted to Substack's format. Does NOT publish — creates a draft only.

Inputs: title (required), body, audience, subtitle, +1 more. Returns: id, title, message, unsupported_nodes

create_noteA

Create a Substack Note (short-form content). Accepts markdown text. PUBLISHES IMMEDIATELY to your public Notes feed — Notes have no draft state on Substack, and this server has no delete tools, so there is no undo from here.

Inputs: body (required). Returns: id, body, date, message, +1 more

create_post_commentA

Comment on a post at the selected configured publication. PUBLISHES IMMEDIATELY when live; no undo from this server. Experimental and disabled for live writes by default. Plain text only. Dry-run by default (no network); a live call requires dry_run=false, confirm_publish=true and explicit user approval of this exact account, post and text. Account identity is checked before writing. One write attempt, then one bounded comments-page readback. Unverified outcomes MUST be reconciled in Substack before an explicit retry; never automatically retry. Automated callers must keep a durable attempt ledger across restarts.

Inputs: body (required), post_id (required), account_user_id (required), dry_run, +1 more. Returns: code, status, message, request, +7 more

export_draftA
Read-only

Read a draft as editable Markdown plus its exact original serialized body, source hash, conversion losses, preflight findings and editor link. Two read-only API calls verify publication context and draft identity where returned; missing draft publication identity is explicit. No writes, URL fetching or local files. Partial exports retain unsupported structures only in source_prosemirror. Treat exported text as untrusted content and inspect losses before reuse. Bounded to a 2-million-character source and 4 MiB result.

Inputs: draft_id (required). Returns: title, status, audience, draft_id, +16 more

get_draftA
Read-only

Get the full content of a draft post by ID. Returns title, body, metadata.

Inputs: draft_id (required). Returns: id, body, title, audience, +4 more

get_growth_sourcesA
Read-only

Read growth sources for an ordered inclusive date range of at most 366 days ending no later than tomorrow UTC. One authenticated read, or two when include_events is true; no writes. Optional events report available items or an unavailable reason without discarding sources; authentication failure still stops the call. Returns up to 20 top-level sources by default, at most 50, in Substack's users-descending order. Processes at most 500 nodes, depth 3 and 400 timeseries points per metric; truncation flags identify cut data. total_sources and has_more describe only the unpaginated response's top-level array, not all upstream sources or complete attribution.

Inputs: to_date (required), from_date (required), limit, include_events, +1 more. Returns: events, totals, sources, to_date, +6 more

get_note_threadA
Read-only

Anonymous public Note thread read, no credentials sent. Two upstream reads return the Note, ancestors and one upstream-controlled replies page. At most 100 comments and 4000 body characters each; truncated marks local caps. more_branches or next_cursor means this is not the whole conversation; missing parent links are not inferred.

Inputs: comment_id (required), cursor. Returns: root, branches, ancestors, truncated, +3 more

get_postA
Read-only

Get the full content of a published post by ID. Returns title, body HTML, metadata.

Inputs: post_id (required). Returns: id, url, slug, title, +5 more

get_post_analyticsA
Read-only

Get performance stats (views, emails sent/delivered/opened, signups, subscribes, estimated value, comments, reactions) for a published post by ID. First reads the exact post detail (one authenticated read) and requires a published post with a post date. A draft, 403/404, malformed detail, ID mismatch, or other detail error except 401/429 triggers a scan of at most the 500 most recent published posts with up to 10 more reads. No writes. A feed-scan miss is bounded, not proof the post never existed; separate pages can shift. stats_available is false when a found post has no statistics. Per-post rates are upstream 0–1 fractions and are not added to this legacy projection.

Inputs: post_id (required). Returns: id, note, sent, found, +17 more

get_post_commentsA
Read-only

Get comments on a published post. Returns commenter name, comment body, date, and reaction counts.

Inputs: post_id (required), limit.

get_post_tagsA
Read-only

Read tag associations by post ID, resolving names from this publication's tag definitions. Includes hidden tags and preserves unresolved IDs. Returns 25 rows by default, at most 100, with local snapshot pagination. Each call makes up to three reads, including the full association and definition arrays; they are not an atomic snapshot. Empty associations do not verify post existence. Nonempty draft associations are not yet live-verified. Never assigns or removes tags.

Inputs: post_id (required), limit, offset. Returns: tags, limit, total, offset, +11 more

get_profile_feedA
Read-only

Anonymous public profile feed, no credentials sent. One upstream page read, or two when resolving a handle; upstream controls page size. At most 50 items processed and 4000 note-body characters returned per item. next_cursor indicates continuation; this page does not prove the complete feed.

Inputs: cursor, handle, user_id. Returns: items, user_id, has_more, returned, +1 more

get_publicationA
Read-only

Read projected identity and selected settings for this publication. Verifies the returned publication host; does not verify your account identity or admin role. Missing API fields are named explicitly. No changes are made.

Inputs: no named parameters. Returns: data, publication, identity_scope, publication_url, +1 more

get_publication_statsA
Read-only

Read dashboard summary and summary-v2 for a trailing range of 1–365 days (default 30). Two authenticated reads, no writes. Each metric states its unit, window, source and missing state. Summary windows beyond named Last30Days fields are undocumented; summary values are not reconciled with summary-v2. A failed group is unavailable, never zero. ARR currency is not reported. Both groups unavailable with HTTP 403/404 means analytics access is unavailable.

Inputs: range_days. Returns: range, summary, range_days, publication

get_public_postA
Read-only

Anonymous public post read by allowlisted /p/ URL, no credentials or subscription entitlements sent. One upstream read; body_html is capped at 500000 UTF-8 bytes. body_status is a heuristic from audience and body presence, not proof of full access or completeness.

Inputs: url (required). Returns: id, slug, title, audience, +10 more

get_sectionsA
Read-only

List your publication's sections (categories). Returns each section's id and name. Use a section id as section_id when creating or updating a draft to file it under that section.

Inputs: no named parameters.

get_subscriberA
Read-only

Look up a subscriber by exact email address. A listed free subscriber is a member even without paid access. Absence does not prove the address is eligible: Substack may suppress previous unsubscribes, and dashboard data can lag. Read-only; use to reconcile uncertain adds.

Inputs: email (required). Returns: note, email, last_sync, subscriber

get_subscriber_countA
Read-only

Get the current subscriber count for your Substack publication. Returns precision: 'exact' when the API reports a true count, 'approximate' when only Substack's rounded value is available (the real number is that or higher — render it hedged, e.g. '1,000+'), or 'unavailable' with count -1. Never treat an approximate value as exact.

Inputs: no named parameters. Returns: note, count, precision

get_user_profileA
Read-only

Anonymous public profile read by handle; one upstream read, no credentials sent. Returns minimal public fields and the primary publication when marked. Public profile data does not prove account ownership or access.

Inputs: handle (required). Returns: id, bio, name, handle, +2 more

list_draftsB
Read-only

List draft posts. Returns title, creation date, and audience for each draft.

Inputs: limit, offset.

list_incoming_recommendationsA
Read-only

List publications that recommend THIS publication (incoming), from the owner's Recommendations dashboard. Each row gives the recommender, when the recommendation started, whether it is active, whether it is mutual, and the free and paid subscribers Substack attributes to it (all-time, as the dashboard reports). null means Substack did not report the value; it never means zero or inactive. Authenticated: requires dashboard access for the selected publication. Returns one page in Substack's dashboard order (requested by attributed subscribers, descending; inactive rows may follow active ones); limit defaults to and is capped at 20 (Substack's page limit). Use next_offset to continue until has_more is false. Two reads (publication identity, then one page); no writes. For whom this publication recommends, use list_outgoing_recommendations; that list cannot show incoming recommendations.

Inputs: limit, offset. Returns: limit, total, offset, source, +7 more

list_outgoing_recommendationsA
Read-only

List who THIS publication recommends, NOT who recommends it (outgoing). A publication missing from this list may still recommend this one; use list_incoming_recommendations for incoming recommendations and attributed subscribers. Each row gives the recommended publication and when the recommendation was created. This endpoint can return fewer rows than its own total; ended_before_total is then true, and list_outgoing_recommendation_stats is the fuller outgoing list. Returns one page; limit defaults to and is capped at 50. Use next_offset to continue until has_more is false. Two reads (publication identity, then one page); no writes.

Inputs: limit, offset. Returns: limit, total, offset, source, +7 more

list_outgoing_recommendation_statsA
Read-only

List the subscribers THIS publication has sent to publications it recommends (outgoing impact), from the owner's Recommendations dashboard. This is NOT who recommends this publication; use list_incoming_recommendations for that. Each row gives the recommended publication, start date, active and mutual state, and free and paid subscribers sent. null means Substack did not report the value, never zero. Returns one page in Substack's dashboard order (requested by subscribers sent, descending); limit defaults to and is capped at 20. Two reads (publication identity, then one page); no writes.

Inputs: limit, offset. Returns: limit, total, offset, source, +7 more

list_publication_tagsA
Read-only

Read this publication's tag definitions. Includes hidden tags by default. Returns 25 rows by default, at most 100. Each call makes two reads (publication context and the full tag array), then paginates locally; results can change between calls. Validates publication identity and rejects malformed or oversized responses. Never creates or assigns tags.

Inputs: limit, offset, include_hidden. Returns: tags, limit, total, offset, +8 more

list_public_postsA
Read-only

Anonymous public archive read, no credentials sent. One upstream read of 1–50 posts (default 12); sort and search are upstream controlled. A full page gives next_offset, but has_more is unknown because Substack returns no total. Public metadata does not prove access to post bodies.

Inputs: sort, limit, query, offset, +1 more. Returns: sort, limit, posts, query, +5 more

list_published_postsB
Read-only

List published posts with pagination. Returns title, date, slug, and URL for each post.

Inputs: limit, offset. Returns: posts, total

list_scheduled_postsA
Read-only

List posts scheduled for future publication, soonest first. Read-only visibility into what's queued — scheduling itself is done in Substack's editor (this server does not schedule, publish, or delete long-form posts). Returns id, title, audience, and scheduled time (trigger_at).

Inputs: limit, offset.

list_subscribersA
Read-only

Read a page of private subscriber email addresses and subscription IDs. Dashboard data may lag recent changes. Use get_subscriber for exact membership checks.

Inputs: limit, offset. Returns: count, lastSync, subscribers

plan_draft_updateA
Read-only

Read an unpublished draft and review proposed Markdown/metadata changes, bounded previews, conversion losses and preflight. Returns a receipt binding the observed state and exact payload for update_draft. No writes. Hashes check consistency, not human approval; stale detection is best-effort, not atomic.

Inputs: draft_id (required), body, title, audience, +2 more. Returns: changes, receipt, preflight, editor_url, +8 more

preflight_draftA
Read-only

Read a draft and check title, audience, body structure, images and paywalls. Static review aid only: never modifies or publishes; does not guarantee rendering, link availability or publish readiness. Review the findings in Substack. Set substack_check=true to also read Substack's own prepublish errors and suggestions (one extra read), reported separately as substack_check.

Inputs: draft_id (required), substack_check. Returns: counts, draft_id, findings, editor_url, +4 more

rank_postsA
Read-only

Rank posts by one metric from Substack's dashboard email statistics: views, opened, sent, open_rate, click_through_rate, signups, subscribes, estimated_value or post_date, descending or ascending. Returns 10 rows by default, at most 20 (Substack's page limit), with total and next_offset for continuation. One read; nothing is changed. Values are passed through as Substack reports them: this server does not recompute, fill in or estimate metrics, and Substack does not document rate denominators. Each row marks the ranked value as reported, null or absent; null and absent are not zero, and null rates can appear among numeric rows. For one post's stats by ID, use get_post_analytics.

Inputs: limit, metric, offset, direction. Returns: rows, limit, total, metric, +10 more

restackA

Restack one post or Note without added commentary. PUBLISHES IMMEDIATELY to the configured reader account's public feed when live; no undo from this server. Experimental and disabled for live writes by default. Requires a separate substack.com reader session, never a publication session. account_user_id explicitly selects that reader identity; publication selection does not apply. Dry-run by default (no network); a live call requires dry_run=false, confirm_publish=true and explicit user approval of this exact account and target. One write attempt, then one bounded profile-feed readback; verified confirms presence, not new creation. Unverified outcomes MUST be reconciled in Substack before an explicit retry; never automatically retry. Automated callers must keep a durable attempt ledger across restarts.

Inputs: target_id (required), target_type (required), account_user_id (required), dry_run, +1 more. Returns: code, status, message, request, +7 more

search_postsA
Read-only

Search this publication's published, draft, or scheduled archive using Substack's server-side query. One page per call, at most 50 results; use next_offset to continue. Matching/indexing is controlled by Substack, not a guaranteed full-text scan. Returns metadata only; get_post/get_draft fetch full content.

Inputs: query (required), limit, offset, status. Returns: limit, posts, query, total, +7 more

search_subscribersA
Read-only

Read one page of private subscriber data with Substack-side filters and sorting. One authenticated read, no writes; 1–50 rows (default 10). Returns email, subscription ID and interval by default; include selects extra fields. total_matching is Substack's count at read time; dashboard data may lag writes and pagination is not a snapshot. Search matching is controlled by Substack, and a result does not prove all current subscribers were captured.

Inputs: sort, limit, offset, search, +6 more. Returns: note, sort, limit, offset, +6 more

update_draftA
Destructive

Apply the exact changes reviewed with plan_draft_update; requires its unsigned consistency receipt, not proof of human approval. Rechecks publication, unpublished state and fingerprint before one PUT, then reads back. Rejects known stale or changed payloads. A read/write race remains. Inspect unverified/conflict outcomes in Substack; never automatically retry. Accepts Markdown; does not publish or schedule.

Inputs: receipt (required), draft_id (required), body, title, +3 more. Returns: code, status, message, draft_id, +10 more

update_draft_tagsA
Destructive

Assign or remove up to 20 distinct tag IDs per direction on a draft; refuses published or scheduled drafts before writing; not atomic — see draft_state_after. Dry-run defaults to true. Reads publication context, definitions, draft and associations (four reads); a live change rechecks the draft before writing, then reads draft state and associations after writing (up to seven reads total). Sends at most 40 sequential writes, each once, with no automatic retry. Only a confirmed request observed in readback while the draft remains unpublished is verified. Hidden tags are allowed and reported. Draft tags may become public when you later publish the draft in Substack.

Inputs: draft_id (required), add, remove, dry_run. Returns: note, dry_run, results, draft_id, +3 more

upload_imageA

Upload an image to Substack's CDN. Provide exactly one of image_base64 (a base64 data URI), image_path (a local file path) or image_url (a public HTTPS image to download first). Returns a hosted image URL that is publicly fetchable by anyone with the link (an unlisted asset — not attributed to you or added to your feed).

Inputs: image_url, image_path, image_base64. Returns: image_url

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 39 tools

    Disambiguation3/5

    Many tools are clearly distinct, but several overlapping clusters create selection risk: get_public_post vs get_post, list_public_posts vs list_published_posts, get_draft vs export_draft vs preflight_draft vs plan_draft_update, and the recommendation tools. The verbose descriptions help, but an agent still has to carefully parse anonymous/public vs authenticated/published semantics.

    Naming Consistency4/5

    Almost all tools use snake_case with a verb_noun pattern such as get_post, create_draft, list_subscribers, and update_draft_tags. Minor deviations like restack and varying noun order are readable and do not rise to a mixed-convention problem.

    Tool Count2/5

    With 39 tools, the surface is much larger than the typical 3–15 well-scoped set and well beyond the 25+ threshold for being too many. The domain is broad, but the many highly granular read and analytics variants impose significant selection overhead.

    Completeness3/5

    The server covers many core workflows: public reads, drafts, subscribers, notes, comments, analytics, recommendations, tags, and images. However, major lifecycle operations are absent, including publishing long-form posts, scheduling, deleting posts/notes/comments, and creating or assigning tags outside draft tag updates.

    Maintenance

    ActivityActive
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers