python-substack

Safe Substack draft automation from Markdown with Python, CLI, and MCP.

View the Project on GitHub ma2za/python-substack

MCP server

Install the optional dependency and start the stdio server:

pip install "python-substack[mcp]"
substack-mcp

Equivalent Python entry point:

python -c "from substack_mcp.mcp_server import main; main()"

The server uses the same EMAIL, PASSWORD, PUBLICATION_URL, COOKIES_PATH, and COOKIES_STRING environment variables as the SDK.

Available Tools

The server exposes tools for reading content, managing drafts, and publishing.

Read Operations (Safe to run automatically):

Draft Creation and Reversible Writes:

Publishing Operations (Use with caution):

Client Configuration Examples

Claude Desktop

You can configure Claude Desktop to use python-substack as an MCP server by adding it to your claude_desktop_config.json:

{
  "mcpServers": {
    "substack": {
      "command": "substack-mcp",
      "env": {
        "EMAIL": "your-email@example.com",
        "PASSWORD": "your-password"
      }
    }
  }
}

If you prefer to use session cookies instead of a password, use the COOKIES_STRING variable:

{
  "mcpServers": {
    "substack": {
      "command": "substack-mcp",
      "env": {
        "COOKIES_STRING": "cookie1=value1; cookie2=value2"
      }
    }
  }
}