Substack MCP Server
Provides tools for interacting with Substack to read posts, notes, comments, profiles, and feeds; publish notes and comments; reply to notes; and engage via reactions and restacks, including automation support.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
@postcli/substack
Your entire Substack, from the terminal.
Read posts. Publish notes. Automate engagement. Power AI agents.
Getting Started • CLI • TUI • MCP Server • Automations • API • Contributing
Why PostCLI?
Substack has no public API. PostCLI fills that gap with a fast, local-first toolkit that puts your entire Substack workflow in the terminal, in a TUI, or behind an AI agent.
CLI
Full command suite for posts, notes, comments, profiles, and engagement. Pipe-friendly --json output.
TUI
Interactive terminal UI with 6 tabs, sub-views, keyboard shortcuts, mouse scroll, and thread navigation.
MCP Server
16 tools for Claude, GPT, and any MCP-compatible AI agent. Read, write, and engage, all through natural language.
Automations
Like-back, auto-reply, auto-restack with SQLite-backed dedup engine. No cloud required.
Related MCP server: Substack MCP Server
Getting Started
Prerequisites
Node.js 18+ (LTS recommended)
Chrome/Chromium with an active Substack session (for auto cookie grab)
macOS or Linux (Windows support tracked here)
Install
npm install -g @postcli/substackAuthenticate
PostCLI grabs session cookies directly from Chrome. Just be logged into Substack in your browser:
postcli-substack auth loginAlternative methods: email OTP or manual cookie paste. See the auth guide.
Verify
postcli-substack auth test
# Connection successful. Logged in as @yourhandleFirst commands
postcli-substack posts list # see your posts
postcli-substack notes publish "Hello!" # publish a note
postcli-substack tui # launch the TUICLI
Read
postcli-substack posts list # your posts (all publications)
postcli-substack posts list --subdomain techblog # specific publication
postcli-substack posts get --slug my-latest-post # full post in markdown
postcli-substack notes list --limit 20 # recent notes
postcli-substack comments list 12345 # comments on a post
postcli-substack feed list --tab for-you # reader feed
postcli-substack profile me # your profile
postcli-substack profile get nicolascole77 # someone else's profileWrite
postcli-substack notes publish "Hello world" # publish a note
postcli-substack notes publish "Something **bold**" # markdown support
postcli-substack notes reply 12345 "Great point" # reply to a note
postcli-substack comments add 12345 "Nice post!" # comment on a postEngage
postcli-substack posts react 12345 # heart a post
postcli-substack notes react 67890 # heart a note
postcli-substack comments react 11111 # heart a comment
postcli-substack posts restack 12345 # restack a post
postcli-substack notes restack 67890 # restack a noteJSON output
Every command supports --json for piping and scripting:
postcli-substack posts list --json | jq '.[0].title'
postcli-substack notes list --json --limit 5 | jq '.[] | .id'Interactive TUI
postcli-substack tuiTabs
Tab | What it shows |
Notes | Your notes, following, and general feed with sub-tabs |
Posts | Posts from your publications with mine/following/general |
Comments | Thread view with parent and child context |
Feed | Reader feed (for-you, subscribed, categories) |
Auto | Automation rules and execution logs |
Profile | Your profile and publication list |
Keybindings
Key | Action |
| Switch between tabs |
| Switch sub-tabs (mine / following / general) |
| Navigate items |
| Open thread / detail view |
| Reply to note |
| Like / heart |
| Restack |
| Open in browser |
| Back / quit |
Mouse scroll is supported for navigation.
MCP Server
Connect your Substack to Claude, GPT, or any AI agent via the Model Context Protocol.
Start the server
postcli-substack --mcpClaude Code
Add to .claude/settings.json:
{
"mcpServers": {
"substack": {
"command": "postcli-substack",
"args": ["--mcp"]
}
}
}Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"substack": {
"command": "postcli-substack",
"args": ["--mcp"]
}
}
}Available tools (16)
Tool | Description |
| Test authentication |
| Your profile and publications |
| Profile by subdomain |
| List posts (all pubs or specific) |
| Full post by slug |
| Full post by numeric ID |
| Notes from feed |
| Comments on a post |
| Reader feed |
| Publish a new note |
| Reply to a note |
| Comment on a post |
| Heart a post |
| Heart a comment/note |
| Restack a post |
| Restack a note |
Automations
Local, SQLite-backed automation engine with deduplication. Runs on your machine, no cloud needed.
# See available presets
postcli-substack auto presets
# Create from preset
postcli-substack auto create "like-back" --preset 1
# Run once
postcli-substack auto run 1
# Manage
postcli-substack auto list
postcli-substack auto toggle 1 # enable/disable
postcli-substack auto remove 1 # deleteBuilt-in presets
# | Preset | Trigger | Action |
1 | Like back | Someone likes your note | Like their latest note |
2 | Auto-reply to likes | Someone likes your note | Reply with thank you |
3 | Auto-restack | New note from a handle | Restack it |
4 | Follow back | New follower | Follow them back |
Custom automations can combine any trigger + action. See the automations guide.
Programmatic API
Use the client in your own Node.js projects:
import { SubstackClient } from '@postcli/substack/client';
const client = new SubstackClient({
token: process.env.SUBSTACK_TOKEN,
publicationUrl: 'https://yourpub.substack.com',
});
// Read
const posts = await client.listPosts({ limit: 5 });
const notes = await client.listNotes({ limit: 10 });
const profile = await client.ownProfile();
// Write
await client.publishNote('Published via API');
await client.replyToNote(12345, 'Great note!');
await client.commentOnPost(67890, 'Nice post');
// Engage
await client.reactToPost(12345);
await client.reactToComment(67890);
await client.restackPost(12345);Project Structure
src/
cli/
commands/ # auth, posts, notes, comments, profile, social, auto
tui/ # Interactive terminal UI (React + Ink)
automations/ # SQLite-backed automation engine
formatters.ts # Output formatting (markdown, tables, colors)
chrome-cookies.ts # Chrome cookie extraction
lib/
substack.ts # SubstackClient (core API wrapper)
http.ts # HTTP client with throttling
models.ts # Domain models (Post, Note, Comment, Profile)
types.ts # Substack API response types
mcp/
index.ts # MCP stdio server
tools.ts # 16 tool definitions + handlers
client.ts # Client initialization & config
plugin.ts # Plugin registration for PostCLI ecosystemRoadmap
Track progress and vote on features via GitHub Issues.
Read posts, notes, comments, feed
Publish notes, reply, comment on posts
React (heart) and restack
Interactive TUI with 6 tabs
MCP Server for AI agents (16 tools)
Automation engine with presets
Thread view with parent + child context
Chrome cookie auto-grab
Profile feed (your activity)
Contributing
Contributions are welcome. Here's how to get started:
Setup
git clone https://github.com/postcli/substack.git
cd substack
npm install
npm run build
npm testDevelopment
# Run CLI in dev mode
npm run cli -- notes list
# Run MCP with inspector
npm run dev:mcp
# Run tests
npm testGuidelines
Open an issue first to discuss the change you'd like to make
Fork the repo and create a branch from
mainWrite tests for new functionality
Run
npm testandnpm run buildbefore submittingKeep PRs focused on a single change
Good first issues
Looking for something to work on? Check issues labeled good first issue or help wanted.
Authentication
PostCLI auto-grabs session cookies from Chrome. You must be logged into Substack in your browser.
postcli-substack auth loginThree auth methods:
Method | Command | How it works |
Chrome grab (default) |
| Reads cookies directly from Chrome's SQLite DB |
Email OTP |
| Sends a magic link to your email |
Manual paste |
| Paste cookies from Chrome DevTools |
Credentials are stored at ~/.config/postcli/.env with 0600 permissions (owner-only read/write).
Disclaimer
This is an unofficial tool, not affiliated with or endorsed by Substack. It interacts with undocumented APIs that may change without notice. Use at your own risk.
License
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Turn articles and text into narrated audio, playlists and podcast feeds from your AI agent.
Publish articles and notes under your own byline, to a readership of other AI agents.
Instagram for AI agents: publish, read comments and DMs, insights, and engage from your account.
Write, schedule, check and cancel social posts on your PostJr calendar from any AI agent.
Related MCP Servers
- AlicenseBqualityNot gradedmaintenanceEnables interaction with Substack publications through natural conversation, allowing users to create posts with cover images, publish notes, manage content, and retrieve profile information.82 npm-
- AlicenseAqualityDmaintenanceEnables AI tools to programmatically manage Substack content, including creating drafts, publishing posts, and posting to Substack Notes. It supports image uploads, live blogging, and document formatting compatible with Substack's ProseMirror editor.119MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to draft, publish, and schedule posts on Substack, bypassing the lack of an official publishing API.134-
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants to search and read Substack newsletter feeds, stage and publish drafts, interact with community comments, and track subscriber and post analytics through local tools and a web dashboard.1MIT