
marcomoauro/substack-mcp
Analytics & monitoringA Model Context Protocol (MCP) Server for Substack enabling LLM clients to interact with Substack's API for automations like creating posts, managing drafts, and more.
Overview
A Model Context Protocol (MCP) Server for Substack enabling LLM clients to interact with Substack's API for automations like creating posts, managing drafts, and more.
README
Substack MCP Server
A Model Context Protocol (MCP) Server for Substack enabling LLM clients to interact with Substack’s API for automations like creating posts, managing drafts, and more.
Create and publish posts, work with subscribers and analytics, browse your reader feeds, manage tags and comments, and upload images — 27 tools exposed through one MCP server.
[!IMPORTANT] Substack does not provide a public API for these operations. This server uses your authenticated web session. Treat the session token exactly like a password: keep it local, never commit it, and never include it or a complete Cookie header in a bug report.
Quick start
The fastest installation uses Node.js 22 or newer and npx.
1. Collect your Substack credentials
Sign in to Substack in your browser and open your publication dashboard. You need three values:
- Publication URL — the full base URL of your publication, for example
https://your-publication.substack.com. - Session token — open your browser’s developer tools, select Network, filter to
Fetch/XHR, and reload the dashboard. Open a successful authenticated request to your
publication. Under Request Headers, find the
Cookieheader and locate a session cookie namedsubstack.sidorconnect.sid. Copy its value without the cookie name or the rest of the header. If both names appear with different values, test them separately and locally with the read-only verification in step 3; never paste either value into an issue. - User ID — in the same Network panel, search for a successful
publication_userrequest. In its JSON response, copy the numericidinside theuserobject.
If the browser UI differs, the illustrated credential guide shows the same requests. If authentication later stops working, sign in again and repeat these steps to obtain the current token.
2. Add the server to your MCP client
For clients that accept MCP JSON configuration, add:
{
"mcpServers": {
"substack": {
"command": "npx",
"args": ["-y", "substack-mcp@latest"],
"env": {
"SUBSTACK_PUBLICATION_URL": "https://your-publication.substack.com",
"SUBSTACK_SESSION_TOKEN": "your-session-token",
"SUBSTACK_USER_ID": "your-user-id"
}
}
}
}
Replace the three example values, save the configuration, and restart your MCP client. Consult your client’s documentation if it uses a different configuration format.
3. Verify the connection
Ask your client:
List my five most recent Substack drafts.
The client should call list_posts with status: "drafts". If it fails, check the client’s MCP
logs and the logging section below before opening an issue.
Docker quick start
To use the published Docker image instead of Node.js, add this server configuration:
{
"mcpServers": {
"substack": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "SUBSTACK_PUBLICATION_URL",
"-e", "SUBSTACK_SESSION_TOKEN",
"-e", "SUBSTACK_USER_ID",
"marcomoauro/substack-mcp:latest"
],
"env": {
"SUBSTACK_PUBLICATION_URL": "https://your-publication.substack.com",
"SUBSTACK_SESSION_TOKEN": "your-session-token",
"SUBSTACK_USER_ID": "your-user-id"
}
}
}
}
🛠 Available Tools
The seven tools below read substack.com, not your publication. They are about the account as a
reader — what it subscribes to, what is in its inbox and feed — which is a different host and a
different id space from the publisher surface above.
🏗 Running from Source
Use this if you want to hack on the server itself. There is no build step — the sources are plain ESM and run as they are.
Node.js
git clone https://github.com/marcomoauro/substack-mcp.git
cd substack-mcp
npm ci
Then add to your MCP config:
{
"mcpServers": {
"substack-api": {
"command": "node",
"args": ["/src/index.js"],
"env": {
"SUBSTACK_PUBLICATION_URL": "",
"SUBSTACK_SESSION_TOKEN": "",
"SUBSTACK_USER_ID": ""
}
}
}
}
Docker (build from source)
git clone https://github.com/marcomoauro/substack-mcp.git
cd substack-mcp
docker build -t substack-mcp .
Then add to your MCP config:
{
"mcpServers": {
"substack-api": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "SUBSTACK_PUBLICATION_URL",
"-e", "SUBSTACK_SESSION_TOKEN",
"-e", "SUBSTACK_USER_ID",
"substack-mcp"
],
"env": {
"SUBSTACK_PUBLICATION_URL": "",
"SUBSTACK_SESSION_TOKEN": "",
"SUBSTACK_USER_ID": ""
}
}
}
}
🪵 Logs
The server logs what it does as one JSON object per line, on stderr — MCP clients collect it
into their own log file (on macOS, Claude Desktop writes it to
~/Library/Logs/Claude/mcp-server-substack-api.log). It is the fastest way to see what your LLM
actually sent when a call does not do what you expected:
{"ts":"2026-08-07T10:12:03.114Z","level":"info","msg":"tool.call.start","tool":"create_draft_post","args":{"title":"My title","subtitle":"My subtitle","body":"…"}}
{"ts":"2026-08-07T10:12:03.402Z","level":"info","msg":"substack.response","status":200,"duration_ms":287}
{"ts":"2026-08-07T10:12:03.403Z","level":"info","msg":"create_draft_post.created","draft_id":167712345}
Set the optional SUBSTACK_MCP_LOG_LEVEL env var alongside your credentials to change how much
is written:
| Value | What you get |
|---|---|
silent |
nothing |
error |
failed calls only |
warn |
the above, plus every answer the client received as an error — including calls rejected for bad arguments before they ran |
info (default) |
the above, plus every tool call, request and response |
debug |
the above, plus full payloads and every JSON-RPC message |
Your session token is never written to the log, at any level.
💻 Popular MCP clients
For a complete list of MCP clients and their feature support, visit the official MCP clients page.
| Client | Description |
|---|---|
| Claude Desktop | Desktop application for Claude AI |
| Cursor | AI-first code editor |
| Cline for VS Code | VS Code extension for AI assistance |
| GitHub Copilot MCP | VS Code extension for GitHub Copilot MCP integration |
| Windsurf | AI-powered code editor and development environment |
🆘 Support
- For issues with this MCP Server: Open an issue on GitHub
Install
npx -y substack-mcp@latestConfiguration
{
"mcpServers": {
"substack": {
"command": "npx",
"args": ["-y", "substack-mcp@latest"],
"env": {
"SUBSTACK_PUBLICATION_URL": "https://your-publication.substack.com",
"SUBSTACK_SESSION_TOKEN": "your-session-token",
"SUBSTACK_USER_ID": "your-user-id"
}
}
}
}