Skip to main content
Glama

substack-mcp

Сервер протокола контекста модели (MCP) для Substack. Позволяет Claude Code создавать черновики, загружать изображения, устанавливать обложки, планировать и публиковать посты в вашей публикации Substack.

Построено на базе python-substack. Использует внутренний API Substack (публичного 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 в CDN Substack, возвращая 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) — Установить обложку (из URL upload_image).

Вспомогательные

  • 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-mcp

Перезапустите Claude Code, после чего /mcp должен показать substack-mcp как connected.

Как работает аутентификация

По умолчанию substack-mcp-setup считывает cookie substack.sid напрямую из вашего существующего сеанса Chrome через pycookiecheat. Substack не может определить, что что-то было автоматизировано, потому что ничего не было: это тот же сеанс, который вы уже используете.

macOS один раз запросит доступ к связке ключей ("Chrome Safe Storage"). Нажмите "Всегда разрешать" ("Always Allow"), чтобы он не спрашивал снова в следующий раз.

Поддерживаются: 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.

Безопасность

Cookie 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 также записывает временный файл cookie через tempfile.mkstemp (режим 0600) и удаляет его в блоке finally — см. auth.py:write_cookie_file.

Если токен скомпрометирован

  1. Выйдите из всех сеансов: Substack → Настройки → Безопасность → "Выйти из всех сеансов". Это немедленно аннулирует каждый существующий substack.sid.

  2. Снова войдите в Substack в своем браузере.

  3. Запустите substack-mcp-setup повторно, чтобы захватить новый cookie.

Безопасность загрузки изображений

upload_image принимает только:

  • HTTP(S) URL-адреса, или

  • Локальные файлы с расширениями изображений (.png, .jpg, .jpeg, .gif, .webp, .heic, .heif), которые не находятся в чувствительных системных путях (/etc, /System, ~/.ssh, ~/.aws, ~/Library/Keychains и т. д.)

Это защищает от того, чтобы помощника обманом (через инъекцию промпта в полученном контенте) заставили загрузить, например, закрытый ключ SSH в CDN Substack.

Известное ограничение: Markdown-синтаксис изображений ![alt](path) внутри create_draft обрабатывается python-substack и обходит эту проверку. Если вы передаете ненадежный Markdown, сначала очистите пути к изображениям.

Зависимости

Версии закреплены с помощью ~= (совместимый релиз, без мажорных обновлений). Обновление python-substack, в частности, должно проверяться — он взаимодействует с приватным API Substack и находится вне официальной поверхности Substack.

Примечания

  • audience принимает: everyone (по умолчанию), only_paid, founding, only_free.

  • Markdown-синтаксис изображений ![alt](path/or/url) автоматически загружает локальные файлы при вызове create_draft.

  • Обложка (устанавливаемая через set_cover_image) — это то, что отображается на главной странице вашей публикации и в социальных сетях. Если вы не установите ее явно, Substack обычно использует первое изображение в теле поста.

Available Tools

11 tools
create_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 (alt - 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 alt.

Inputs: image_path (required).

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 11 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: draft CRUD, publishing, scheduling, notes, and image operations. No two tools overlap in functionality.

    Naming Consistency5/5

    All tools follow a consistent verb_noun pattern with underscores (e.g., create_draft, publish_draft, upload_image), making the API predictable.

    Tool Count5/5

    11 tools is well-scoped for a Substack server, covering drafting, publishing, scheduling, notes, and images without being excessive.

    Completeness4/5

    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

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      Not graded
      maintenance
      An 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
    • A
      license
      A
      quality
      A
      maintenance
      MCP 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.
      39
      2,698 npm
      53
      MIT