substack-mcp CLAUDE.md

Instructions for an MCP server that connects coding agents to Substack, a publishing platform for newsletters and posts. It supports reading posts, managing drafts, and creating short notes, while posts cannot be published or deleted through it.

In plain words
What is it for?
It helps read Substack posts, create or edit post drafts, and publish short notes, including notes with links.
Why use it?
It makes the allowed Substack actions and their limits clear, helping prevent accidental publishing or deletion and ensuring content uses the expected editor format.

Instructions file

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/conorbronsdon/substack-mcp/claude-md
Clone the repo
git clone --depth 1 https://github.com/conorbronsdon/substack-mcp
Per session 545 This file is loaded in full into every session.
When invoked 545 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00545 $0.00545
Opus 5 $0.00272 $0.00272
Sonnet 5 $0.00109 $0.00109
Haiku 4.5 $0.00055 $0.00055

Measured 3d ago against content hash cc8291f01ccf, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

substack-mcp CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 41 lines

How it starts

The opening of the file, as written. The whole thing — 41 lines — stays where its author put it; the contents beside it link to each section on GitHub.

substack-mcp

MCP server for Substack — read posts, manage drafts, create notes. Cannot publish or delete posts by design; notes (short-form) publish immediately since Substack has no note-draft state.

Architecture

  • src/index.ts — MCP server bootstrap and entry point
  • src/server.ts — Tool registration, request handlers, Zod schema generation
  • src/annotations.ts — Tool side-effect classification (read / draft-write / public-upload / publish) → MCP annotations (hints set explicitly; MCP defaults omitted hints to the unsafe direction)
  • src/api/client.ts — HTTP client for Substack API (session cookie auth)
  • src/api/types.ts — TypeScript interfaces for API responses
  • src/utils/errors.ts — Error handling utilities
  • src/utils/markdown-to-prosemirror.ts — Markdown to ProseMirror AST converter (Substack editor format)
  • src/__tests__/ — Vitest tests for client, errors, and markdown conversion

Key constraints

  • Posts are read/draft only — no publish or delete capabilities by design
  • Notes publish immediately via create_note / create_note_with_link — Substack has no note-draft state, so there is no preview step
  • Auth sends both connect.sid and substack.sid cookies set to the same session token (custom domains use connect.sid, substack.com uses substack.sid)
  • Markdown must be converted to ProseMirror format for Substack's editor

Development

npm ci
npm run lint    # tsc --noEmit -p tsconfig.lint.json (type-checks all of src/, tests included)
npm run build   # tsc (outputs to dist/; excludes src/__tests__)
npm test        # vitest run

Testing

4 test suites:

  • client.test.ts — API client auth validation
  • errors.test.ts — Error handling and wrapping
  • markdown-to-prosemirror.test.ts — Markdown to ProseMirror AST conversion
  • annotations.test.ts — Annotation mapping + completeness (every registered tool classified)

Agent workflow

  • Always work on a branch. Never push directly to main.
  • Create PRs targeting main. CI must pass (build + test on Node 20 and 22). npm run build runs tsc and fails on type errors.
  • Keep changes focused — one feature or fix per PR.
  • Run npm run lint (fast no-emit type-check) and npm test locally before pushing.

Read the full file on GitHub · 41 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 41 lines · 545 tokens per session scan A cc8291f01ccf

Subscribe to this mod's changes

substack-mcp CLAUDE.md is an instructions file published in the GitHub repository conorbronsdon/substack-mcp (22 stars, last pushed 4d ago), licensed MIT. It adds 545 tokens to every session, about $0.0027 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.