Substack MCP
Enables managing Substack publications: publish Notes and posts, manage drafts, pull analytics, and read any publication's public feed via MCP.
README
Substack MCP
⚠️ Unofficial. Use at your own risk. This drives Substack's private, undocumented API by reverse-engineering the browser session — there is no official API. It may break without notice and may be against Substack's terms. Auth is a session cookie (
substack.sid/connect.sid) — a bearer secret, treat it like a password: never commit it, keep it in a local gitignored.env, rotate it if exposed. No warranty. See SECURITY.md.
An MCP server that lets Claude (or any MCP client) drive Substack: publish Notes and posts, manage drafts, pull analytics, and read any publication's public feed.
Substack has no official API. Like every Substack automation, this talks to
the private, undocumented API using your browser session cookie (substack.sid).
That means:
- Endpoints can change without notice. If a tool starts returning odd errors, an endpoint probably moved.
- The cookie is a bearer secret. Anyone holding it is you, and it stays
valid for months even with MFA on. It lives only in a local, gitignored
.env— never in code or the MCP client config. - Be polite to the API. Calls are throttled to ~1 request/second.
Publishing tools (publish_note, publish_post, schedule_post) are public
and irreversible. Treat them accordingly.
Tools (20)
Connection
test_connection— verify the cookie works; returns your user id/handle.
Notes
publish_note— post a Note now (markdown supported).reply_to_note— reply to a Note by id.create_note_attachment— attach an image (local file or URL) or a link.list_my_notes— your recent Notes with engagement counts.
Posts
create_draft/update_draft— compose and edit drafts (markdown body).publish_post— publish a draft live (optionally emailing subscribers).schedule_post— schedule a draft (ISO-8601 UTC).list_drafts/list_published/get_post— inventory and read.list_sections— section ids (needed if your publication uses sections).upload_image— push a local image to Substack's CDN.
Stats
get_dashboard— subscribers, paid, views, growth over 30/60/90 days.get_post_stats— per-post views/opens/clicks/shares/conversions.get_subscriber_growth— subscriber count over time.get_top_posts— ranked by engagement.get_earnings— pledge/revenue summary.
Public (no auth)
get_public_posts— read any publication's RSS feed (defaults to yours).
Setup
Dependencies are already installed in .venv. To recreate from scratch:
py -3.14 -m venv .venv
.\.venv\Scripts\python.exe -m pip install -r requirements.txt
1. Get your session cookie
- Log into Substack in a browser.
- Open DevTools (F12) → Application → Cookies →
https://substack.com. - Copy the value of the
substack.sidcookie.
2. Configure
cp .env.example .env
Edit .env:
SUBSTACK_SID=<substack.sid from substack.com>
SUBSTACK_SUBDOMAIN=codalanguez
SUBSTACK_PUB_HOST=newsletter.codalanguez.com
SUBSTACK_PUB_SID=<substack.sid from newsletter.codalanguez.com>
Custom domains need two cookies. Coda's publication redirects
codalanguez.substack.com → newsletter.codalanguez.com, and Substack splits
auth across the two hosts:
| Env var | Extract from | Cookie name | Used for |
|---|---|---|---|
SUBSTACK_SID |
substack.com |
substack.sid |
Notes, profile, public reads |
SUBSTACK_PUB_SID |
newsletter.codalanguez.com |
connect.sid |
dashboard, drafts, publishing, stats |
The two hosts use different cookie names — substack.com uses substack.sid,
the custom domain uses connect.sid (Substack's older stack). Extract each via
DevTools → Application → Cookies → that host → that cookie. For a plain
*.substack.com publication, leave SUBSTACK_PUB_HOST / SUBSTACK_PUB_SID
blank — SUBSTACK_SID covers everything.
3. Verify
.\.venv\Scripts\python.exe -c "import asyncio, server; print(asyncio.run(server.test_connection()))"
You should see your user id and handle. Auth failed means the cookie is
missing or expired — re-extract it.
Register with Claude Code
claude mcp add substack -- "<repo>/.venv/Scripts/python.exe" "<repo>/server.py"
Replace <repo> with the absolute path to your clone. No secret goes in the
client config — the server reads .env itself. Restart Claude Code and the tools
appear under the substack server.
Weekly health check
health_check.py pulls your current stats, writes a timestamped JSON snapshot +
markdown report with week-over-week deltas, then asks claude -p to append an
Analysis & Recommendations section. Output goes to health-checks/reports/
and health-checks/snapshots/; each run appends a line to health-checks/run.log.
.\.venv\Scripts\python.exe health_check.py # full report + analysis
.\.venv\Scripts\python.exe health_check.py --no-analysis # numbers only
It's registered as a Windows Scheduled Task — "Weekly Substack Health Check — Coda Languez", Mondays 9:00 AM (America/Denver). Manage it:
$n = "Weekly Substack Health Check " + [char]0x2014 + " Coda Languez"
Get-ScheduledTaskInfo -TaskName $n # last run / result
Start-ScheduledTask -TaskName $n # run now
Disable-ScheduledTask -TaskName $n # pause
To change the day/time, edit the trigger in Task Scheduler (or re-run the
Register-ScheduledTask command with a new -At / -DaysOfWeek). Reports need
SUBSTACK_PUB_SID set; without it the report notes that stats are unavailable.
When the cookie expires
Tools return {"error": "Auth failed — the substack.sid cookie is likely expired..."}. Re-extract substack.sid (step 1) and update .env.
Credits
Endpoint shapes were verified against the open-source
adelaidasofia/substack-mcp
(MIT) and ma2za/python-substack.
The cookie-extraction technique follows Paweł Huryn's write-up on Substack's
undocumented API.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。