跳到正文

alxgntv

substack-api-mcp

MCP server for Substack posts (FastMCP + substack-api-client)

README 已保存到本站,可直接阅读

Documentation snapshot

README 快照

本页保存的是公开项目资料快照,阅读过程不需要连接 GitHub。

Substack API MCP

Substack does not provide a native public API for publishing posts.

But authors who want to draft, publish, and schedule from AI agents (Cursor, Claude, and other MCP hosts) still need a way out. This is the MCP server to publish to Substack via any agent.

Will not start without a valid APISUBSTACK_API_KEY (ask_*). Get API key here: apisubstack.com.

Why this exists

RealityWhat we built
No official Substack write/publish API for authorsA posting MCP so agents can create drafts, publish now, and schedule
Authors live in the browser editorAuthors publish through their agents instead
Session-cookie auth is the practical path todaysubstack.sid + your publication URL, gated by an API Substack key

Examples

Tools

ToolDescription
test_connectionVerify substack.sid and return profile
create_postCreate draft / publish now / schedule (+ optional tags)
get_draftFetch draft by id
update_draftUpdate draft fields
publish_postPublish existing draft
schedule_postSchedule existing draft
delete_draftDelete draft
list_tagsList publication tags
create_tagCreate tag
set_tagsEnsure + attach tags
get_post_tagsList tags on a post/draft

Install

cd /path/to/Substack-API-MCP
python3 -m venv .venv
source .venv/bin/activate
pip install -e .

Auth env

  1. Sign in at apisubstack.com, start the free trial, generate an ask_* API key.
  2. Copy your Substack substack.sid cookie:
    • Open Chrome and sign in to Substack.
    • Open DevTools → ApplicationCookies.
    • Select https://substack.com (or your publication host, e.g. https://yourname.substack.com).
    • Find the cookie named substack.sid and copy its Value.
  3. Export:
export APISUBSTACK_API_KEY="ask_YOUR_KEY"
export SUBSTACK_PUBLICATION_URL="https://yourname.substack.com"
export SUBSTACK_SID="YOUR_SUBSTACK_SID_VALUE"
# optional
# export SUBSTACK_USER_ID="123456"

Cookies expire. If you get 401/403, refresh substack.sid and try again.

Run

substack-api-mcp
# or
python -m substack_api_mcp

Cursor / Claude Desktop config

See mcp.example.json:

{
  "mcpServers": {
    "substack-api": {
      "command": "/ABSOLUTE/PATH/TO/Substack-API-MCP/.venv/bin/substack-api-mcp",
      "args": [],
      "env": {
        "APISUBSTACK_API_KEY": "ask_YOUR_KEY",
        "SUBSTACK_PUBLICATION_URL": "https://yourname.substack.com",
        "SUBSTACK_SID": "YOUR_SUBSTACK_SID_VALUE"
      }
    }
  }
}

Use absolute paths. Restart the host after config changes.

License

Use at your own risk. Not affiliated with Substack. Built so authors can publish through their agents when Substack itself does not offer a native publishing API.

Official distribution

获取与安装

暂未发现可确认的官方软件包地址

当前 README 快照没有出现 npm、PyPI、Crates.io、pub.dev 等官方包页链接。本站不会根据仓库名称猜测下载地址。

本站不托管项目文件;需要安装时,请以项目维护者发布的官方文档为准。

使用前核验

本站保存公开资料用于阅读,不代表安全审计或功能背书。安装前请核对许可证、依赖来源和发布签名,不要直接运行来源不明的二进制文件或高权限脚本。