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は通常、本文中の最初の画像を使用します。
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- -licenseNot 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.
- AlicenseAqualityAmaintenanceMCP server for Substack — read posts, manage drafts, and upload images. Safe by design: cannot publish or delete.1443918MIT
- AlicenseNot gradedqualityDmaintenanceEnables 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.3920MIT
Related MCP Connectors
WordPress MCP server: generate SEO posts, AI images, autoblog & WooCommerce on your self-hosted site
WordPress MCP server: publish posts, AI images, SEO and full site management, self-hosted
MCP Server for Slima - AI Writing IDE for Novel Authors with AI Beta Reader.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/nanameru/substack-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server