substack-mcp
substack-mcp
Substack用のModel Context Protocol (MCP) サーバーです。Claude CodeがSubstackのパブリケーションで下書きの作成、画像のアップロード、カバーサムネイルの設定、予約投稿、記事の公開を行えるようにします。
python-substackをベースに構築されています。 Substackの内部APIを使用しています(公開されている投稿用APIは存在しません)。Substack Inc.とは提携していません。
ツール
必須
create_draft(title, content_markdown, subtitle?, audience?)— Markdownから新しい下書きを作成します。update_draft(post_id, title?, subtitle?, content_markdown?, audience?)— 既存の下書きを編集します。upload_image(image_path)— ローカルファイルまたはリモートURLをSubstackのCDNにアップロードし、URLを返します。publish_draft(post_id, send_email?, share_automatically?)— 即時公開します。send_emailでメール配信のオン/オフを切り替えます。
推奨
schedule_draft(post_id, iso_datetime)— 未来の日時(ISO 8601)に公開を予約します。unschedule_draft(post_id)— 予約投稿をキャンセルします。set_cover_image(post_id, image_url)— カバーサムネイルを設定します(upload_imageのURLを使用)。
ユーティリティ
list_drafts(limit?)— 最近の下書きを一覧表示します。get_draft(post_id)— 下書きの本文を取得します。delete_draft(post_id)— 完全に削除します。
Related MCP server: Substack MCP Server
セットアップ
# 1. Install dependencies
uv pip install -e .
# 2. Make sure you're logged in to Substack in Chrome (or Brave/Edge) — that's it.
# 3. Save credentials — auto-detects your existing browser session
substack-mcp-setup
# 4. Register with Claude Code
claude mcp add substack-mcp --scope user -- /Users/$USER/substack/.venv/bin/substack-mcpClaude Codeを再起動すると、/mcpでsubstack-mcpがconnectedと表示されるはずです。
認証の仕組み
デフォルトでは、substack-mcp-setupはpycookiecheatを介して、既存のChromeセッションから直接substack.sidクッキーを読み取ります。
自動化されたことはSubstack側には検知されません。なぜなら、何も自動化されていないからです。あなたがすでに使用しているセッションと同じものを使用します。
macOSでは、キーチェーンへのアクセス(「Chrome Safe Storage」)を1回求められます。次回以降尋ねられないように「常に許可」をクリックしてください。
対応ブラウザ: Chrome, Brave, Edge, Chromium, Vivaldi, Opera。
フォールバックモード
# Specific browser
substack-mcp-setup --from-browser brave
# Playwright-based (often blocked by Substack — use --chrome instead)
substack-mcp-setup --browser
# Manual paste from DevTools
substack-mcp-setup --manualトークンは~/Library/Application Support/substack-mcp/config.jsonに0600の権限で保存されます。
セキュリティ
substack.sidクッキーはパスワードと同等です。これを持つ者は誰でもアカウントにフルアクセス(記事の公開、請求情報の編集など)できます。そのように扱ってください。
トークンの保存場所
macOS:
~/Library/Application Support/substack-mcp/config.json(モード0600)Linux:
~/.config/substack-mcp/config.json(モード0600)または環境変数経由:
SUBSTACK_PUBLICATION_URL+SUBSTACK_SESSION_TOKEN(環境変数は子プロセスに継承されるため、サブプロセスを生成する際は注意してください)
.gitignoreにはconfig.jsonが含まれています。決してコミットしないでください。また、MCPはtempfile.mkstemp(モード 0600)を介して一時的なクッキーファイルを作成し、finallyブロックで削除します。詳細はauth.py:write_cookie_fileを参照してください。
トークンが漏洩した場合
すべてのセッションからサインアウト: Substack → 設定 → セキュリティ → 「すべてのセッションからサインアウト」を実行します。これにより、既存のすべての
substack.sidが即座に無効化されます。ブラウザでSubstackに再度ログインします。
substack-mcp-setupを再実行して、新しいクッキーを取得します。
画像アップロードの安全性
upload_imageは以下のみを受け付けます:
HTTP(S) URL
画像拡張子(
.png,.jpg,.jpeg,.gif,.webp,.heic,.heif)を持つローカルファイルで、機密性の高いシステムパス(/etc,/System,~/.ssh,~/.aws,~/Library/Keychainsなど)下にないもの
これは、アシスタントが(取得したコンテンツ内のプロンプトインジェクションなどを通じて)SSH秘密鍵などをSubstackのCDNにアップロードさせられることを防ぐためのガードです。
既知の制限: create_draft内のMarkdown画像構文  はpython-substackによって処理され、この検証をバイパスします。信頼できないMarkdownを渡す場合は、事前に画像パスをサニタイズしてください。
依存関係
バージョンは~=(互換性のあるリリース、メジャーアップデートなし)で固定されています。特にpython-substackのアップデートは慎重に検討してください。これはSubstackのプライベートAPIと通信するものであり、Substackの公式インターフェース外で動作するためです。
注意事項
audienceは以下を受け付けます:everyone(デフォルト),only_paid,founding,only_free。Markdownの画像構文
は、create_draftを呼び出すとローカルファイルを自動的にアップロードします。カバー画像(
set_cover_imageで設定)は、パブリケーションのホームページやSNSシェア時に表示される画像です。明示的に設定しない場合、Substackは通常、本文中の最初の画像を使用します。
Available Tools
11 toolscreate_draftA
Create a new Substack draft post from Markdown.
Args:
title: Post title (max 280 chars).
content_markdown: Body in Markdown. Supports headings, bold/italic, links,
bullet lists, blockquotes, code blocks, and images ( - local
paths are auto-uploaded to Substack CDN).
subtitle: Optional subtitle (max 280 chars).
audience: Who can read it: 'everyone' (default), 'only_paid', 'founding',
or 'only_free'.
Returns: Summary including post_id, title, edit_url.
Inputs: title (required), content_markdown (required), subtitle, audience.
delete_draftA
Permanently delete a draft. This cannot be undone.
Args: post_id: Draft ID.
Returns: {post_id, deleted: true}
Inputs: post_id (required).
get_draftA
Get full details of a specific draft, including the body content.
Args: post_id: Draft ID.
Returns: Full draft data including draft_body (ProseMirror JSON).
Inputs: post_id (required).
list_draftsA
List recent drafts (unpublished posts).
Args: limit: Max number of drafts to return (1-50). Default 10.
Returns: List of draft summaries with post_id, title, edit_url, etc.
Inputs: limit. Returns: result
post_noteA
Post a Note (Substack's short-form, X/Threads-like post) to the public feed.
Notes are different from Posts:
No title or subtitle.
No email delivery to subscribers.
Not added to the publication's article archive.
Visible in the Substack Notes feed (cross-publication discovery surface).
Use Notes for:
Quick thoughts, links, restacks, questions to your audience
Daily presence between long-form posts
Networking with other Substackers (replies, mutual follows)
Args: text: Plain text body. Use \n\n to separate paragraphs and \n for soft line breaks. Max 4000 chars (Substack's practical Notes limit).
Returns: {note_id, url, raw}
Inputs: text (required).
publish_draftA
Publish a draft immediately.
Args: post_id: Draft ID. send_email: If True (default), send the post as an email to subscribers. If False, publish to web only without emailing. share_automatically: If True, auto-share to Substack social channels.
Returns: {post_id, title, public_url, post_date, send_email}
Inputs: post_id (required), send_email, share_automatically.
schedule_draftA
Schedule a draft to publish at a future datetime.
Args: post_id: Draft ID. iso_datetime: ISO 8601 datetime, e.g., '2026-05-15T09:00:00+09:00' for JST or '2026-05-15T00:00:00Z' for UTC.
Returns: {post_id, scheduled_for}
Inputs: post_id (required), iso_datetime (required).
set_cover_imageA
Set the cover (thumbnail) image for a draft.
The cover image is shown on the publication homepage, in social shares, and as the email header. Use upload_image first to get a CDN URL.
Args: post_id: Draft ID. image_url: Substack CDN URL from upload_image, or any public image URL.
Returns: Updated draft summary.
Inputs: post_id (required), image_url (required).
unschedule_draftB
Cancel a scheduled publish, keeping the post as a draft.
Args: post_id: Draft ID.
Returns: {post_id}
Inputs: post_id (required).
update_draftA
Update an existing draft. Provide only the fields you want to change.
Args: post_id: Draft ID returned by create_draft or list_drafts. title: New title (optional). subtitle: New subtitle (optional). content_markdown: New body in Markdown (optional, replaces full body). audience: New audience setting (optional).
Returns: Updated draft summary.
Inputs: post_id (required), title, subtitle, content_markdown, +1 more.
upload_imageA
Upload an image to Substack's CDN and return its public URL.
Args: image_path: Local file path (e.g., /Users/foo/cover.png) or remote URL.
Returns:
{url, id, width, height} — pass url to set_cover_image or embed in
Markdown as .
Inputs: image_path (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 11 tools
Each tool has a clearly distinct purpose: draft CRUD, publishing, scheduling, notes, and image operations. No two tools overlap in functionality.
All tools follow a consistent verb_noun pattern with underscores (e.g., create_draft, publish_draft, upload_image), making the API predictable.
11 tools is well-scoped for a Substack server, covering drafting, publishing, scheduling, notes, and images without being excessive.
The tool set covers core drafting and publishing workflows comprehensively, but lacks tools for managing published posts, subscribers, or analytics, which are minor gaps for a content creation MCP.
Maintenance
Related MCP Connectors
MCP server for QPost — lets AI agents publish video and image posts to YouTube, TikTok, Instagram.
PostHero MCP server — schedule and publish social media posts from any MCP-compatible AI tool
HTTP-first Apify MCP server for Substack RAG Markdown, sponsor domains, and /about emails.
Hosted MCP server for AI agents to post to LinkedIn profiles and X and upload to YouTube.
Related MCP Servers
- AlicenseNot gradedqualityNot gradedmaintenanceAn MCP server that enables AI assistants like Claude to interact with Substack newsletters, allowing for post retrieval, content searching, and author information access through a standardized interface.MIT
- AlicenseAqualityAmaintenanceMCP server and CLI for Substack creators: rich Markdown drafts, draft tags, Notes, publication and post analytics, growth sources, archive search, anonymous reading of public profiles and Note threads, subscriber segmentation and consented subscriber management. Long-form posts stay drafts; Notes publish immediately.392,698 npm53MIT
- AlicenseNot gradedqualityCmaintenanceEnables programmatic management of Substack content, including creating drafts, publishing posts, and uploading images. It supports specialized features like live blogging and posting to Substack Notes through MCP-compatible AI tools.MIT
- AlicenseNot gradedqualityDmaintenanceCreate, manage, and publish Substack posts with full rich text formatting directly from Claude Desktop or any MCP-compatible client.88 npm26MIT