Medium CLI + 23-tool MCP server. Your IDE drafts replies. No API keys.
io.github.06ketan/medium-ops — MCP Server
The io.github.06ketan/medium-ops MCP server integrates a Medium CLI and exposes its capabilities through Model Context Protocol. It is described as a “Medium CLI + 23-tool” server, with the claim that the IDE can draft replies. No API keys are required.
🛠️ Key Features
Medium CLI integration
23 tools exposed via MCP
“No API keys” requirement
🚀 Use Cases
Drafting Medium responses from within an IDE
Using Medium-related CLI actions via MCP tooling
⚡ Developer Benefits
MCP-compatible (Model Context Protocol)
Available as the medium-ops Python package
Python 3.12+ supported
⚠️ Limitations
No further tool details, endpoints, or capabilities beyond the “23-tool” description are provided
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)
bash
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.
Works with (MCP)
These rows help discovery (search keywords); confirm each host’s current MCP docs before upgrading.
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 with body_html, pubDate, tags,
hero image, and dc:creator. Zero credentials, faster than GraphQL,
stable. Used by default for list_posts / get_post / get_post_content.
Inspired by Portfolio_V2's blog page.
Dashboard GraphQL (authenticated reads).medium.com/_/graphql +
medium.com/_/api/* with the sid cookie. 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. Supports createPost, 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)
bash
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 TUI
Auth is read from ~/.cursor/mcp.json's mcpServers.medium-ops.env (or
medium-api / medium). Override with env or .env.
bash
uv run medium-ops auth verify
uv run medium-ops quickstart
Command 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
auth verify
Probe both integration token (/me) and sid cookie (GraphQL Viewer).
The safety + drafting stack that makes the unattended mode safe:
Tool
What it does
get_unanswered_responses
Worklist — responses where you haven't replied.
propose_reply
Dry-run only. Returns a token + payload preview.
confirm_reply
Posts the staged reply by token. Idempotent via dedup DB. Token TTL 5 min.
bulk_draft_replies / send_approved_drafts
File-based offline review loop.
audit_search / dedup_status
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 bulk when no human is in the
loop. Auto-detects claude (Claude Code), cursor-agent, or codex on
PATH. Override with MEDIUM_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 against
api.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 against medium.com/_/graphql and medium.com/_/api/*. Gets you:
all reads (stories, responses, claps, feed, stats, profile), plus
clap_post and post_response (fragile — undocumented).
bash
medium-ops auth verify
medium-ops auth test
medium-ops auth setup
medium-ops auth har ./medium.har # ingest a Chrome devtools HAR export
Refreshing auth from a HAR
When cookies rotate or Medium changes a GraphQL schema, the fastest fix is:
Open medium.com in 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_clearance cookies into .env
(preserving everything else)
writes a redacted snapshot to .cache/har-snapshot.json listing every
Medium GraphQL operation observed plus its request-variable / response-data
key shapes — useful for diffing against the queries hard-coded in
client.py to 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):
bash
MEDIUM_INTEGRATION_TOKEN=2fb00... # optional, for writes
MEDIUM_SID=1:... # optional, for reads
MEDIUM_UID=... # optional
MEDIUM_USERNAME=yourhandle # optional but recommended
Medium stopped issuing new Integration Tokens in 2023. If you never
got one, publish_post / list_own_publications will 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 > 10 and the client will auto-fall back to GraphQL.
GraphQL operation names and schemas change silently. The queries in
client.py mirror what the dashboard uses today — expect breakage every
couple of months. Pin this package's version.
post_response uses GraphQL savePostResponse(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_content uses dashboard POST /p/{id}/deltas with
{baseRev, rev, deltas}. For a brand-new draft, baseRev=-1, rev=0.
Subsequent edits should bump both.
clap_post still uses the undocumented /_/api/posts/{id}/clap shape;
not yet re-validated against the new GraphQL surface. Dry-run first.
Members-only stories return a paywall preview unless the sid belongs
to a paying member.
No "restack" equivalent. Medium doesn't have reshares; the closest is
a clap + a response. Use clap_post + post_response together for that.
No notes / short-form. Medium killed short-form in 2018.
Chrome cookie auto-grab (the auth_chrome flow from substack-ops) is
not yet implemented. Paste your sid into .env for now.
TUI not yet implemented; the extras pin is there for future work.
Legacy Medium Integration Token (api.medium.com/v1/*). Optional. Generate at medium.com/me/settings → 'Integration tokens' (note: Medium stopped issuing new tokens in 2023).
MEDIUM_SIDsecret
Medium 'sid' cookie value from medium.com (Application → Cookies). Used for authenticated reads + dashboard GraphQL.
MEDIUM_UID
Medium 'uid' cookie value. Required alongside sid for some authenticated endpoints.
MEDIUM_XSRFsecret
Medium 'xsrf' cookie value. Required for any dashboard write (post_response, publish_post, delete_post, draft updates).
MEDIUM_CF_CLEARANCEsecret
Cloudflare 'cf_clearance' cookie. Only required when Cloudflare challenges your IP for dashboard write calls.
MEDIUM_USERNAME
Your Medium handle (without the @). Required for the public RSS read path so the client knows whose feed to fetch.
MEDIUM_OPS_MCP_PATH
Override path to the mcp.json file the auth layer reads. Defaults to ~/.cursor/mcp.json.
MEDIUM_OPS_LLM_CMD
Optional: override the host CLI used by the unattended daemon path (default: auto-detect claude / cursor-agent / codex on PATH). Use {prompt} placeholder if your CLI takes the prompt as an arg.