medium-ops

io.github.06ketan由 GitHub 帳號 06ketan 發布v0.1.2更新於 Oct 24, 2026

Medium CLI + 23-tool MCP server. Your IDE drafts replies. No API keys.

已驗證STDIO僅桌面效率與工作流溝通與協作

概覽

AI 產生的概覽

本機 stdio MCP 伺服器兼命令列工具,讓助理讀取 Medium 文章、回應、鼓掌、動態消息與統計,並起草、確認和張貼回覆。

可以做什麼
讀取文章、搜尋貼文、取得正文與中繼資料,並列出閱讀動態、個人檔案與統計;預設走公開 RSS,需要更多內容時改用需登入的儀表板查詢。列出某篇文章的回應與完整回應樹,並統計鼓掌數。借助宿主模型起草回覆:先提出草稿並回傳權杖與預覽,再憑權杖張貼已暫存的回覆;也可把所有回應批次起草到檔案,只送出標記為已核准的項目。張貼文章或草稿、送出鼓掌,寫入操作預設為演練模式。查詢稽核日誌與去重計數以回顧過往操作。
適用情境
適合希望在自己的 IDE 或聊天宿主中處理 Medium 未回覆回應、起草並逐筆確認回覆、查看文章統計的 Medium 作者,且不必另外設定 AI API 金鑰。也適合閱讀與搜尋 Medium 內容,以及在持有權杖時透過官方 API 張貼。
執行需求
以 Python 套件形式透過 uvx 或原始碼安裝在本機執行,建議安裝 MCP SDK 附加相依套件。憑證從宿主的 mcp.json 環境區塊、環境變數或 .env 檔讀取:MEDIUM_SID 與 MEDIUM_UID 用於登入讀取和儀表板寫入,MEDIUM_XSRF 用於寫入,MEDIUM_USERNAME 用於 RSS 路徑,可選 MEDIUM_INTEGRATION_TOKEN 用於張貼。需要連線至 Medium 各端點的網路。
安裝前請注意
會索取 Medium 即時工作階段 Cookie(MEDIUM_SID、MEDIUM_UID、MEDIUM_XSRF、MEDIUM_CF_CLEARANCE)以及可選的整合權杖,這些等同帳號存取權限,應視為機密保管。可執行張貼回應、張貼文章、鼓掌和刪除等寫入操作,不過預設為演練模式,並有去重資料庫防止重複。儀表板與 GraphQL 端點未公開,可能隨時失效;整合權杖 API 自 2023 年起已停止發放。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 medium-ops,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

medium-ops

[PyPI version] [PyPI downloads] [Python 3.12+] [License: MIT] [MCP compatible] [MCP Registry] [Anthropic DXT] [Glama MCP server] [MCP Badge]

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.

Open source–oriented hosts

HostDocumentationTypical wire-up
OpenCodeOpenCode MCP serversuvx medium-ops mcp install opencode
ContinueContinueuvx medium-ops mcp install print — paste the snippet into Continue’s MCP settings
ZedZedConfigure stdio MCP per Zed’s docs
ClineClineMCP setup per extension / marketplace docs
GooseGooseMCP extensions per Goose docs

Large commercial stacks

HostDocumentationTypical wire-up
CursorCursor MCPuvx medium-ops mcp install cursor
Claude (Desktop / Code)Claude Desktop, Claude Codemcp install claude-desktop / claude-code
GitHub CopilotCopilotMCP in VS Code where supported — use print + host docs
ChatGPTOpenAIConnector flows — often REST for tools without MCP
Google GeminiGeminiGemini CLI / IDE features per Google docs

OpenCode (copy-paste)

Auto-install:

bash
uvx medium-ops mcp install opencode

Manual (~/.config/opencode/opencode.json):

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:

  1. 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.
  2. 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).
  3. 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-opsuv syncuv 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 verifyuv 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)

CommandWhat it does
auth verifyProbe both integration token (/me) and sid cookie (GraphQL Viewer).
auth testSame but exits non-zero on failure (CI-friendly).
auth setupInteractive: paste token / sid / uid / username to .env.

Read — Stories (5)

CommandWhat it does
posts list [--user] [--limit]Latest stories by a user (default: self).
posts show <id_or_url>Story metadata (title, clap count, response count).
posts content <id> [--md]Body HTML (or Markdown with --md).
posts search <query> [--limit]Medium-side full-text search.
`posts publish -t "..." -f body.md [--pub] [--status draftpublic

Read + Write — Responses (3)

CommandWhat it does
responses list <post_id> [--limit]Top-level responses table.
responses tree <post_id> [--out file.json]Full response + reply tree JSON.
responses add <post_id> "body" [--parent <r_id>] [--no-dry-run]Post a response or reply.

Read + Write — Claps (2)

CommandWhat it does
claps count <post_id>Total claps.
claps give <post_id> [--claps N] [--no-dry-run]Clap 1-50 times. Dedup-protected.

Read — Discovery + Profile (5)

CommandWhat it does
feed list [--tab home|following|tag-{slug}] [--limit]Reader feed.
profile meYour full profile (GraphQL).
profile get <username>Any user's public profile.
profile stats [--days N]Per-post views / reads / fans (dashboard scrape).
profile publicationsPublications you can publish to (integration token).

Reply engine (3)

CommandWhat it does
reply template <post_id> --template thanksRule-based replies (no LLM).
reply bulk <post_id> --out drafts.jsonDraft every response to a file.
reply bulk-send drafts.json [--no-dry-run]Post only action=approved rows. Dedup-checked.

Operations + safety (2)

CommandWhat it does
audit search [--kind] [--target] [--status] [--since 7d]Query the JSONL audit log.
audit dedup-statusCounts in the dedup SQLite DB.

MCP server (3)

CommandWhat it does
mcp install <cursor|claude-desktop|claude-code|opencode|print> [--dry-run]Auto-merge config into your host.
mcp servestdio MCP server (22 tools).
mcp list-toolsPrint the tool registry.

Other (1)

CommandWhat it does
quickstartPrint a quickstart checklist.

Reply modes

ModeWhat it doesSafety
templateYAML keyword rules under src/medium_ops/templates/*.yamldry-run default
bulkLLM drafts every response to drafts.json. Edit, set action: "approved"offline review, dedup-checked on send
bulk-sendPosts only items with action: "approved"dry-run default; dedup DB prevents dup replies
MCP propose_reply → confirm_replyHost LLM drafts, you approve per-item, token-gated5-min token TTL, idempotent, no API key

MCP server

bash
medium-ops mcp install opencode          # ~/.config/opencode/opencode.jsonmedium-ops mcp install cursor              # auto-add to ~/.cursor/mcp.jsonmedium-ops mcp install claude-desktop      # auto-add to claude_desktop_config.jsonmedium-ops mcp install claude-code         # uses `claude mcp add`medium-ops mcp install print               # print the snippet onlymedium-ops mcp serve                       # stdio servermedium-ops mcp list-tools                  # 22 tools

Manual config snippet:

json
{  "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:

bash
echo '{"tool":"list_posts","args":{"limit":3}}' | medium-ops mcp serve

MCP-native draft loop (no API key)

The safety + drafting stack that makes the unattended mode safe:

ToolWhat it does
get_unanswered_responsesWorklist — responses where you haven't replied.
propose_replyDry-run only. Returns a token + payload preview.
confirm_replyPosts the staged reply by token. Idempotent via dedup DB. Token TTL 5 min.
bulk_draft_replies / send_approved_draftsFile-based offline review loop.
audit_search / dedup_statusRead the audit log + dedup counts.

LLM strategy

Two layers, both free:

  1. MCP-native (default). Host LLM drafts via propose_reply / confirm_reply. No env vars, no API key. Use this for interactive replies.
  2. 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:

  1. 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.
  2. 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 verifymedium-ops auth testmedium-ops auth setupmedium-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:

  1. Open medium.com in Chrome with devtools → Network panel.
  2. Reproduce the failing action (publish a draft, post a response, etc.).
  3. Right-click any request → "Save all as HAR with content".
  4. 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 writesMEDIUM_SID=1:...                      # optional, for readsMEDIUM_UID=...                        # optionalMEDIUM_USERNAME=yourhandle            # optional but recommended

Architecture

text
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 MediumClient

Endpoints used

ActionMethod + URL
Auth: integration tokenGET https://api.medium.com/v1/me
Auth: sid cookiePOST https://medium.com/_/graphql (Viewer)
User profilePOST /_/graphql (UserProfileQuery)
List storiesPOST /_/graphql (UserStreamOverview)
Story metadataPOST /_/graphql (PostViewer)
Story bodyPOST /_/graphql (PostContent)
Story searchPOST /_/graphql (SearchPosts)
ResponsesPOST /_/graphql (PostResponses)
FeedPOST /_/graphql (HomeFeed / FollowingFeed / TagFeed)
Publish storyPOST https://api.medium.com/v1/users/{id}/posts
Publish to pubPOST https://api.medium.com/v1/publications/{pub_id}/posts
Own pubsGET https://api.medium.com/v1/users/{id}/publications
ClapPOST https://medium.com/_/api/posts/{id}/clap (undocumented)
Post responsePOST https://medium.com/_/api/posts (undocumented)
StatsGET https://medium.com/@{username}/stats?count=... (undocumented)

Related MCPs

Tests

bash
uv run pytest -q

Coverage: 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_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.

License

MIT. See LICENSE.

來源:README.md,提交 94e22a4

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.1.2最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分