medium-ops
The medium-ops MCP server provides 22 tools for programmatic management of your Medium account, covering reads, writes, engagement, and a safe LLM-powered reply workflow — no external AI API keys required.
Authentication & Profile
Verify integration token and sid cookie credentials
Get your own profile (id, name, bio, follower/following counts) or any user's public profile by @username
List publications you can publish to as editor or writer
Reading & Discovery
List recent stories by yourself or any user
Get story metadata (title, URL, clap count, response count, publish date) or full content (HTML/Markdown)
Search public Medium stories
Browse home, following, or tag-based reader feeds
View per-post stats (views, reads, fans) over the last N days (requires sid cookie)
Responses & Engagement
List top-level comments on a story; walk nested reply threads
Identify unanswered responses on your posts (reply worklist)
Get total clap count for a story; clap a story 1–50 times (dedup-protected, dry-run by default)
Writing & Publishing
Publish stories as draft, public, or unlisted — optionally to a publication (dry-run by default)
Post top-level comments or nested replies (dry-run by default)
Safe LLM-Powered Reply Workflow
get_unanswered_responses→propose_reply(stages a reply with dedup hash, time-limited token) →confirm_reply(executes and logs; idempotent, single-use)bulk_draft_replies— generate AI drafts for all responses into a local JSON file without postingsend_approved_drafts— post only entries markedaction=approved; rate-throttled and dry-run by default
Audit & Safety
audit_search— query a local JSONL audit log of all write attempts, filterable by kind, target, status, and timededup_status— view the SQLite dedup database to confirm writes landed or diagnose skipped actions
Provides tools for reading and writing to Medium, including managing stories, responses, claps, feed, profiles, and stats, with a reply engine and MCP-native drafting loop.
medium-ops
Standalone Medium CLI + 22-tool MCP server for Cursor MCP, Claude MCP, OpenCode MCP, and any stdio MCP host. Your IDE drafts the replies. Zero AI API keys.
Stories, responses, claps, feed, profiles, stats, reply engine, MCP server. One Python install, one binary, MIT licensed. Sibling of substack-ops.
TL;DR — MCP-native (no API key, one command)
uvx medium-ops mcp install cursor # or claude-desktop, claude-code, opencode, print
# Restart your host. Then in chat:
# "list unanswered responses on post abc123def456"
# "draft a warm reply to response r1"
# "post that draft"Your host's LLM (Cursor's, Claude's) does the drafting via the
propose_reply / confirm_reply tools. No ANTHROPIC_API_KEY /
OPENAI_API_KEY needed.
Wrong install?
This project is medium-ops on PyPI — install with uv / uvx, not unrelated npx packages from “Medium MCP” searches. Canonical listing: Glama — 06ketan/medium-ops.
Related MCP server: Substack-OPS
Works with (MCP)
These rows help discovery (search keywords); confirm each host’s current MCP docs before upgrading.
Open source–oriented hosts
Host | Documentation | Typical wire-up |
OpenCode |
| |
Continue |
| |
Zed | Configure stdio MCP per Zed’s docs | |
Cline | MCP setup per extension / marketplace docs | |
Goose | MCP extensions per Goose docs |
Large commercial stacks
Host | Documentation | Typical wire-up |
Cursor |
| |
Claude (Desktop / Code) |
| |
GitHub Copilot | MCP in VS Code where supported — use | |
ChatGPT | Connector flows — often REST for tools without MCP | |
Google Gemini | Gemini CLI / IDE features per Google docs |
OpenCode (copy-paste)
Auto-install:
uvx medium-ops mcp install opencodeManual (~/.config/opencode/opencode.json):
{
"mcp": {
"medium-ops": {
"type": "local",
"command": ["uvx", "medium-ops", "mcp", "serve"],
"enabled": true
}
}
}Optional version pin: ["uvx", "medium-ops==0.1.2", "mcp", "serve"] (replace with current PyPI release).
Why a hybrid
Medium exposes three usable surfaces and we use all of them:
Public RSS (reads, no auth).
medium.com/feed/@{user}returns the author's ~10 most recent stories withbody_html,pubDate,tags, hero image, anddc:creator. Zero credentials, faster than GraphQL, stable. Used by default forlist_posts/get_post/get_post_content. Inspired by Portfolio_V2's blog page.Dashboard GraphQL (authenticated reads).
medium.com/_/graphql+medium.com/_/api/*with thesidcookie. Used as a fallback when you ask for more than ~10 posts, when the post isn't in the RSS window, or for things RSS can't give you (responses, claps, feed, stats, search).Official REST (writes).
api.medium.com/v1/*with an Integration Token. SupportscreatePost,createPostInPublication,getUser,getPublications. That's it.
Force a specific transport with --source rss|graphql|auto on posts list,
posts show, and posts content. The dashboard + GraphQL endpoints are
undocumented and Medium can change them at any time. See
Known gaps.
Setup (dev / from source)
git clone https://github.com/06ketan/medium-ops && cd medium-ops
uv sync
uv sync --extra mcp # mcp SDK for the MCP server (recommended)
uv sync --extra tui # textual for the TUIAuth is read from ~/.cursor/mcp.json's mcpServers.medium-ops.env (or
medium-api / medium). Override with env or .env.
uv run medium-ops auth verify
uv run medium-ops quickstartCommand surface
Every write defaults to --dry-run. Flip with --no-dry-run. All writes
land in .cache/audit.jsonl and are dedup-checked against
.cache/actions.db.
Auth (3)
Command | What it does |
| Probe both integration token (/me) and sid cookie (GraphQL Viewer). |
| Same but exits non-zero on failure (CI-friendly). |
| Interactive: paste token / sid / uid / username to |
Read — Stories (5)
Command | What it does |
| Latest stories by a user (default: self). |
| Story metadata (title, clap count, response count). |
| Body HTML (or Markdown with |
| Medium-side full-text search. |
`posts publish -t "..." -f body.md [--pub] [--status draft | public |
Read + Write — Responses (3)
Command | What it does |
| Top-level responses table. |
| Full response + reply tree JSON. |
| Post a response or reply. |
Read + Write — Claps (2)
Command | What it does |
| Total claps. |
| Clap 1-50 times. Dedup-protected. |
Read — Discovery + Profile (5)
Command | What it does |
| Reader feed. |
| Your full profile (GraphQL). |
| Any user's public profile. |
| Per-post views / reads / fans (dashboard scrape). |
| Publications you can publish to (integration token). |
Reply engine (3)
Command | What it does |
| Rule-based replies (no LLM). |
| Draft every response to a file. |
| Post only |
Operations + safety (2)
Command | What it does |
| Query the JSONL audit log. |
| Counts in the dedup SQLite DB. |
MCP server (3)
Command | What it does |
| Auto-merge config into your host. |
| stdio MCP server (22 tools). |
| Print the tool registry. |
Other (1)
Command | What it does |
| Print a quickstart checklist. |
Reply modes
Mode | What it does | Safety |
| YAML keyword rules under | dry-run default |
| LLM drafts every response to | offline review, dedup-checked on send |
| Posts only items with | dry-run default; dedup DB prevents dup replies |
MCP | Host LLM drafts, you approve per-item, token-gated | 5-min token TTL, idempotent, no API key |
MCP server
medium-ops mcp install opencode # ~/.config/opencode/opencode.json
medium-ops mcp install cursor # auto-add to ~/.cursor/mcp.json
medium-ops mcp install claude-desktop # auto-add to claude_desktop_config.json
medium-ops mcp install claude-code # uses `claude mcp add`
medium-ops mcp install print # print the snippet only
medium-ops mcp serve # stdio server
medium-ops mcp list-tools # 22 toolsManual config snippet:
{
"mcpServers": {
"medium-ops": {
"command": "medium-ops",
"args": ["mcp", "serve"]
}
}
}If the mcp SDK is not installed, the server falls back to a minimal
stdin/stdout JSON-line dispatcher:
echo '{"tool":"list_posts","args":{"limit":3}}' | medium-ops mcp serveMCP-native draft loop (no API key)
The safety + drafting stack that makes the unattended mode safe:
Tool | What it does |
| Worklist — responses where you haven't replied. |
| Dry-run only. Returns a |
| Posts the staged reply by token. Idempotent via dedup DB. Token TTL 5 min. |
| File-based offline review loop. |
| Read the audit log + dedup counts. |
LLM strategy
Two layers, both free:
MCP-native (default). Host LLM drafts via
propose_reply/confirm_reply. No env vars, no API key. Use this for interactive replies.Subprocess CLI (daemon path). For
reply bulkwhen no human is in the loop. Auto-detectsclaude(Claude Code),cursor-agent, orcodexon PATH. Override withMEDIUM_OPS_LLM_CMD.
There is no paid-API-key path.
Auth setup
Medium has two auth layers that map to different feature surfaces:
Integration Token —
Authorization: Bearer <token>. Used againstapi.medium.com/v1/*. Gets you:publish_post,list_own_publications. Token generation at https://medium.com/me/settings → "Integration tokens". Note: Medium stopped issuing new tokens in 2023. If you never generated one, the write path will 401 and you'll have to use the sid-cookie response path for any writes.sid cookie — from
medium.com(Application → Cookies →sid). Used againstmedium.com/_/graphqlandmedium.com/_/api/*. Gets you: all reads (stories, responses, claps, feed, stats, profile), plusclap_postandpost_response(fragile — undocumented).
medium-ops auth verify
medium-ops auth test
medium-ops auth setup
medium-ops auth har ./medium.har # ingest a Chrome devtools HAR exportRefreshing auth from a HAR
When cookies rotate or Medium changes a GraphQL schema, the fastest fix is:
Open
medium.comin Chrome with devtools → Network panel.Reproduce the failing action (publish a draft, post a response, etc.).
Right-click any request → "Save all as HAR with content".
medium-ops auth har ./medium.har
This:
merges fresh
sid,uid,xsrf,cf_clearancecookies into.env(preserving everything else)writes a redacted snapshot to
.cache/har-snapshot.jsonlisting every Medium GraphQL operation observed plus its request-variable / response-data key shapes — useful for diffing against the queries hard-coded inclient.pyto spot schema drift before users hit it.
Don't have these yet? See docs/AUTH-SETUP.md for a 5-minute browser-DevTools walkthrough. The Medium Integration Token API has been deprecated since 2023 — most users today use cookie-based auth via
MEDIUM_SID.
Env vars (or ~/.cursor/mcp.json → mcpServers.medium-ops.env):
MEDIUM_INTEGRATION_TOKEN=2fb00... # optional, for writes
MEDIUM_SID=1:... # optional, for reads
MEDIUM_UID=... # optional
MEDIUM_USERNAME=yourhandle # optional but recommendedArchitecture
mcp.json | env → auth.py
│
MediumConfig (token? sid? uid? username?)
│
MediumClient (httpx)
┌───────┼──────────┐
▼ ▼ ▼
api.medium.com medium.com/ medium.com/_/
/v1/* (REST) _/graphql api/* (dashboard)
│ │ │
Bearer token sid cookie sid cookie
│
┌──────┬──────┬────────────┬──────┬────────┬──────────┐
▼ ▼ ▼ ▼ ▼ ▼ ▼
posts responses claps profile stats feed reply_engine
│
┌───────────────────┼───────────────┐
▼ ▼ ▼
template ai_bulk MCP propose/confirm
└───────────────────┬───────────────┘
▼
base.post_response
│
┌─────────┼─────────┐
▼ ▼ ▼
dedup audit dry_run
(SQLite) (jsonl)
mcp/server.py ──── 22 tools ─── all share MediumClientEndpoints used
Action | Method + URL |
Auth: integration token |
|
Auth: sid cookie |
|
User profile |
|
List stories |
|
Story metadata |
|
Story body |
|
Story search |
|
Responses |
|
Feed |
|
Publish story |
|
Publish to pub |
|
Own pubs |
|
Clap |
|
Post response |
|
Stats |
|
Related MCPs
slideshot — HTML → slides (PNG / PDF / PPTX); npm
slideshot-mcp.substack-ops — Substack posts, notes, comments + MCP (PyPI
substack-ops).
Tests
uv run pytest -qCoverage: auth loading, client transports + XSSI stripping, dedup DB, audit log search, MCP tool registry + dispatcher, MCP install host-config merging, propose/confirm flow + token expiry, reply-engine template matching + dedup+audit flow, subprocess LLM detection.
Known gaps
Medium stopped issuing new Integration Tokens in 2023. If you never got one,
publish_post/list_own_publicationswill 401. The read + response + clap paths still work via sid. The RSS read path needs no credentials at all.RSS is capped at ~10 posts and lacks clap/response counts and stats. When you need more, pass
--source graphql(requires sid) or set--limit > 10and the client will auto-fall back to GraphQL.GraphQL operation names and schemas change silently. The queries in
client.pymirror what the dashboard uses today — expect breakage every couple of months. Pin this package's version.post_responseuses GraphQLsavePostResponse(deltas: [Delta!]!, inResponseToPostId: ID!). Delta shape is{type: 1, index: N, paragraph: {type: 1, text, markups: []}}(type=1 means insert; paragraph.type=1 is P). Reverse-engineered from error messages.update_draft_contentuses dashboardPOST /p/{id}/deltaswith{baseRev, rev, deltas}. For a brand-new draft,baseRev=-1, rev=0. Subsequent edits should bump both.clap_poststill uses the undocumented/_/api/posts/{id}/clapshape; not yet re-validated against the new GraphQL surface. Dry-run first.Members-only stories return a paywall preview unless the
sidbelongs to a paying member.No "restack" equivalent. Medium doesn't have reshares; the closest is a clap + a response. Use
clap_post+post_responsetogether for that.No notes / short-form. Medium killed short-form in 2018.
Chrome cookie auto-grab (the
auth_chromeflow from substack-ops) is not yet implemented. Paste yoursidinto.envfor now.TUI not yet implemented; the extras pin is there for future work.
License
MIT. See LICENSE.
Available Tools
23 toolsaudit_searchA
Read-only. Query the local audit.jsonl of every write this server has performed or attempted. Filters compose with AND.
Inputs: kind, target, status, since, +1 more.
bulk_draft_repliesA
WRITE TO LOCAL FILE (no Medium call). Generate reply drafts for every response on a post using the daemon-path LLM. Output is JSON with action='pending'; edit to 'approved', then run send_approved_drafts.
Inputs: post_id (required), out, model.
clap_postA
WRITE. Clap a story 1-50 times. Uses the undocumented dashboard endpoint — fragile. Dedup-protected per post. Dry-run by default.
Inputs: post_id (required), claps, dry_run.
confirm_replyA
EXECUTE the staged write. Look up the token, post to Medium, log to audit.jsonl, persist dedup row. Idempotent. Tokens are single-use.
Inputs: token (required), force.
dedup_statusA
Read-only. Counts from the local dedup SQLite DB (claps, responses, publishes) used to prevent the same write running twice. Call this after writes to confirm the ledger advanced, or if a write inexplicably skipped (status='deduped' in audit_search).
Inputs: no named parameters.
get_clap_countA
Read-only. Total claps (sum across all clappers, max 50 each) on a single story. Use this for engagement checks before/after posting a response. Faster than get_post when you only need the number.
Inputs: post_id (required).
get_feedA
Read-only. Reader feed. tab='home' for recommended, 'following', or 'tag-{slug}' (e.g. 'tag-programming').
Inputs: tab, limit.
get_own_profileA
Read-only. Return the authenticated user's profile from the dashboard GraphQL API: id, username, name, bio, follower/following counts. Use this when you need 'who am I' context for downstream calls. For any other user pass the @handle to get_profile instead.
Inputs: no named parameters.
get_postA
Read-only. Story metadata by Medium post id (12+ char hex, e.g. 'a1b2c3d4e5f6'): title, url, claps, response count, publication, publishedAt. For the article body use get_post_content. For the comment thread use list_responses.
Inputs: post_id (required).
get_post_contentB
Read-only. Return the story body as HTML. Set as_markdown=true to convert to Markdown. Members-only stories need a member sid.
Inputs: post_id (required), as_markdown.
get_profileA
Read-only. Public profile for any Medium user by @username (id, name, bio, follower count). Use list_posts after this to fetch their stories. For the authed user prefer get_own_profile.
Inputs: username (required).
get_response_repliesA
Read-only. Nested replies under a single top-level response. Use list_responses first to get response ids, then call this per response to walk the thread.
Inputs: response_id (required), limit.
get_statsA
Read-only. Per-post views / reads / fans for the last N days. Requires sid cookie for dashboard access.
Inputs: days.
get_unanswered_responsesA
Read-only. Return responses on a post where the authed user has NOT yet replied. Canonical worklist: read each, draft a reply in your context, then propose_reply -> confirm_reply.
Inputs: post_id (required), limit.
list_own_publicationsA
Read-only. Publications the authed user can publish to as editor or writer. Returns id + name pairs; use the id with publish_post's publication_id to publish into a publication. Requires the Medium integration token (MEDIUM_INTEGRATION_TOKEN).
Inputs: no named parameters.
list_postsC
Read-only. List recent stories by a user (default: self).
Inputs: limit, username.
list_responsesA
Read-only. Top-level responses under a story (Medium's word for comments). Each response has its own id you can pass to get_response_replies for the reply thread. For the filtered 'still need a reply' worklist prefer get_unanswered_responses.
Inputs: post_id (required), limit.
post_responseA
WRITE. Post a top-level response under a story, or a reply under a response. Uses the undocumented dashboard endpoint — fragile. For interactive drafting prefer propose_reply -> confirm_reply. Dry-run by default.
Inputs: post_id (required), body (required), parent_response_id, dry_run.
propose_replyA
STAGE A WRITE (no Medium call yet). Validate a reply, compute its dedup hash, store it under a token, return token + preview. On approval call confirm_reply. Tokens expire in 5 minutes. Set parent_response_id to reply under a specific response; omit for a top-level response on the post.
Inputs: post_id (required), body (required), parent_response_id.
publish_postA
WRITE. Publish a story. content_format is markdown. Defaults to publish_status='draft' so nothing goes public by accident; set to 'public' or 'unlisted' to flip it. Uses the integration token and api.medium.com/v1/*. Dry-run by default.
Inputs: title (required), content_markdown (required), tags, publication_id, +4 more.
search_postsC
Read-only. Medium-side search across public stories.
Inputs: query (required), limit.
send_approved_draftsA
WRITE. Sequentially post every entry in drafts.json where action=='approved'. Honors rate_seconds throttle. Dry-run by default.
Inputs: drafts_path (required), dry_run, rate_seconds, force.
test_connectionA
Read-only. Verify both credentials (integration token + sid cookie) and return the authed user id, username, and publication count. Call this first if other tools 401.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 23 tools
Each tool has a clearly distinct purpose with no overlap. Read-only tools cover specific queries (e.g., get_post vs get_post_content, list_responses vs get_unanswered_responses), and write tools handle distinct actions (publishing, clapping, replying via staging/confirmation). Even similar operations are differentiated by their target or workflow.
Most tools follow a verb_noun pattern (e.g., get_post, publish_post, confirm_reply). The outlier is bulk_draft_replies, which starts with a noun-like word instead of a clear verb. Overall, naming is predictable and readable.
23 tools is on the higher side, but each tool serves a specific need in the Medium domain (reading various data, writing with different operations). The count is justified by the breadth of functionality without being excessive.
The tool set covers most core Medium interactions: reading posts, profiles, responses, search, stats; writing responses, publishing, clapping, drafting replies. Missing operations like editing or deleting posts are minor gaps, but the workflow for replies is thorough.
Maintenance
Related MCP Connectors
Agent-first social media publishing, scheduling, analytics, and unified inbox API + 16-tool MCP server across 18 social platforms (X, LinkedIn, Instagram, YouTube, TikTok, Threads, Bluesky, Reddit, Telegram, Discord, Mastodon, Facebook, Pinterest).
Build, validate, deploy — HTTP APIs, cron jobs, webhooks and MCP tools — from your AI client.
Talk to your public-facing AI from any MCP client — Claude, ChatGPT, Cursor, Cline, Windsurf.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA browser-based solution that enables programmatic interaction with Medium's content ecosystem despite API deprecation, allowing publishing, retrieving, and searching Medium articles through Claude integration.12MIT
- AlicenseAqualityCmaintenanceStandalone Substack CLI + 26-tool MCP server. Your IDE drafts the replies. Zero AI API keys.261MIT
- AlicenseAqualityAmaintenanceOne local gateway for all your MCP servers — shared by every AI coding tool (Claude, Cursor, VS Code, Codex). Set up each server once; keys stay in the OS keychain; lazy discovery keeps agent context small. Local-first, open source.4243MIT
- AlicenseAqualityDmaintenanceOne MCP that turns Claude Code into your whole dev stack by swallowing other MCP servers, delegating to Codex & Gemini on your CLI subscriptions, remembering projects in a searchable knowledge graph, and carrying setup across sessions — secret-free by design.234MIT