presskit-mcp

presskit-mcp

An MCP server for publishing markdown articles to Medium and Substack via unofficial APIs, with tools to list, create, and manage posts and drafts.

Category
访问服务器

README

presskit-mcp

A Python FastMCP server and CLI for publishing to Medium and Substack.

Stability warning: Both integrations rely on unofficial/deprecated access paths. Medium's REST API is frozen (no new tokens issued). Both platforms' internal endpoints are undocumented and may change without notice.


Install

pip install -e .

This installs two commands:

  • presskit — CLI for direct publishing from the terminal
  • publishing-mcp — MCP server for use with Claude Desktop/Claude Code

CLI Usage (presskit)

Publish a markdown file

# Publish to Medium as a draft
presskit publish medium --file docs/drafts/my-article.md

# Publish to Substack as a draft
presskit publish substack --file docs/drafts/my-article.md

# Publish to both platforms at once
presskit publish both --file docs/drafts/my-article.md

# Publish live (not draft)
presskit publish medium --file article.md --status public --tags "python,automation"

# Substack: publish to web only (no subscriber email)
presskit publish substack --file article.md --status public --no-email

The CLI reads YAML frontmatter from the markdown file:

---
title: "My Article Title"
subtitle: "Optional subtitle for Substack"
tags: [python, automation, infrastructure]
---

# My Article Title

Article body here...

If no frontmatter title is present, the first # Heading is used.

List posts

# List your Medium posts
presskit list medium --username alexander.g.moore1

# List Substack posts
presskit list substack --subdomain alexgmoore

# List Substack drafts
presskit drafts substack

CLI options reference

presskit publish <platform> [options]
  --file, -f       Markdown file to publish (required)
  --status, -s     draft | public | unlisted (default: draft)
  --tags, -t       Comma-separated tags, e.g. "python,devops" (Medium)
  --subtitle       Post subtitle (Substack)
  --no-email       Publish to web only, skip subscriber email (Substack)

presskit list <platform> [options]
  --username, -u   Medium username without @ (Medium)
  --subdomain, -d  Substack subdomain (Substack)
  --limit, -n      Max results (default: 10)

presskit drafts substack

MCP Server Usage

Run the server

# Direct
python server.py

# Or via installed entry point
publishing-mcp

Add to Claude Code (project-level)

Create .claude/mcp.json in your project:

{
  "mcpServers": {
    "publishing": {
      "command": "python3",
      "args": ["/absolute/path/to/presskit-mcp/server.py"],
      "env": {
        "MEDIUM_SESSION_COOKIE": "your_sid_cookie",
        "MEDIUM_AUTH_STATE_FILE": "/path/to/medium-auth.json",
        "SUBSTACK_EMAIL": "you@example.com",
        "SUBSTACK_PASSWORD": "your_substack_password",
        "SUBSTACK_PUBLICATION_URL": "https://yourpub.substack.com"
      }
    }
  }
}

Add to Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (Mac):

{
  "mcpServers": {
    "publishing": {
      "command": "python",
      "args": ["/absolute/path/to/presskit-mcp/server.py"],
      "env": {
        "MEDIUM_SESSION_COOKIE": "your_sid",
        "MEDIUM_AUTH_STATE_FILE": "/path/to/medium-auth.json",
        "SUBSTACK_EMAIL": "you@example.com",
        "SUBSTACK_PASSWORD": "your_password",
        "SUBSTACK_PUBLICATION_URL": "https://yourpub.substack.com"
      }
    }
  }
}

Restart Claude Desktop/Code after adding the config.


FastMCP Development & Testing

presskit-mcp is built on FastMCP. Here's how to work with it during development.

Inspect tools interactively

The MCP Inspector opens a browser UI where you can call any tool, see inputs/outputs, and debug:

# Using the mcp CLI (installed with mcp[cli])
mcp dev server.py

This starts the server and opens an interactive inspector at http://localhost:5173. You can:

  • Browse all 15 registered tools
  • Fill in parameters and execute them
  • See JSON responses in real-time
  • Test error handling

Run the server with stdio transport (default)

# FastMCP defaults to stdio transport (what Claude Desktop/Code expects)
python server.py

Run with SSE transport (for remote/HTTP access)

# Start as an HTTP server on port 8000
mcp run server.py --transport sse --port 8000

Then connect from any MCP client using http://localhost:8000/sse.

Call a tool directly via mcp call

# One-shot tool invocation without starting a persistent server
echo '{"username": "alexander.g.moore1", "limit": 5}' | \
  mcp call server.py medium_list_posts

List all registered tools

mcp tools server.py

Environment variables for testing

# Medium (session-based — no integration token needed)
export MEDIUM_SESSION_COOKIE="your_sid_value"
export MEDIUM_AUTH_STATE_FILE="/path/to/medium-auth.json"

# Medium (REST API — only if you have an existing token)
export MEDIUM_INTEGRATION_TOKEN="your_token"

# Substack
export SUBSTACK_EMAIL="you@example.com"
export SUBSTACK_PASSWORD="your_password"
export SUBSTACK_PUBLICATION_URL="https://yourpub.substack.com"

Running tests

python3 -m unittest discover -s tests -v

Tests use sys.modules patching to stub third-party deps — no external services needed.


Tools Reference

Medium (6 tools)

Tool Auth Method
medium_get_current_user Integration token REST API
medium_get_publications Integration token REST API
medium_create_post Integration token REST API
medium_create_post_session Session cookie GraphQL + Delta OT
medium_list_posts Session cookie Unofficial GraphQL
medium_get_post_stats Session cookie Unofficial GraphQL

Substack (9 tools)

Tool Auth Method
substack_get_publication_info Email/password or cookie python-substack
substack_get_all_publications Email/password or cookie python-substack
substack_list_posts None (public) Raw HTTP
substack_get_post None (public) Raw HTTP
substack_search_publications None (public) Raw HTTP
substack_get_subscriber_count Email/password or cookie python-substack
substack_list_drafts Email/password or cookie python-substack
substack_create_draft Email/password or cookie python-substack
substack_publish_post Email/password or cookie python-substack

Credentials

Medium session cookie

Medium no longer issues API tokens. The session-based tools use browser cookies:

  1. Log in to medium.com in a browser
  2. Extract the sid cookie from DevTools → Application → Cookies
  3. For full functionality, save the complete browser state with playwright-cli state-save medium-auth.json and set MEDIUM_AUTH_STATE_FILE

Substack

Use your Substack email and password directly. If your account uses magic links only:

  1. Sign out of Substack
  2. Click "Sign in with password"
  3. Click "Set a new password"

Architecture

presskit-mcp/
├── server.py          # FastMCP server entry point (15 tools)
├── cli.py             # CLI entry point (presskit command)
├── medium/
│   ├── client.py      # REST API + GraphQL + Delta OT HTTP layer
│   └── tools.py       # 6 MCP tools with Pydantic input models
├── substack/
│   ├── client.py      # python-substack wrapper + raw HTTP
│   └── tools.py       # 9 MCP tools with Pydantic input models
├── tests/
│   └── test_static.py # Unit tests (no external deps needed)
├── pyproject.toml     # pip installable, entry points
└── config.yaml        # Credential reference (not loaded by code)

How Medium session publishing works

Medium's web editor saves content via a delta-based Operational Transform system — not GraphQL or REST. The medium_create_post_session tool replicates this:

  1. GraphQL createPost → creates an empty draft, returns post_id
  2. POST /p/{post_id}/deltas → writes title + paragraphs as OT deltas
  3. GraphQL setPostTags → sets up to 5 tags
  4. GraphQL publishPost → publishes (optional)

This was discovered by decompiling Medium's Android APK and capturing network traffic from the web editor.


Known limitations

  • Medium session cookies expire — you'll need to refresh medium-auth.json periodically (re-login via browser)
  • Medium REST API — No new integration tokens. Only existing holders can use medium_create_post
  • Medium inline formatting — Bold/italic markup positions in the delta API need accurate character offsets; the current markdown parser sends plain text paragraphs
  • Substack — No official API. All endpoints are reverse-engineered. Keep requests under 1/sec
  • Images — Neither platform supports programmatic inline image upload via these tools yet

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选