Medium MCP Server

Medium MCP Server

Enables AI assistants to interact with Medium's platform for publishing, updating, and managing articles and drafts through OAuth 2.0 authentication with automatic retry logic and rate limit handling.

Category
访问服务器

README

<img src="https://cdn-static-1.medium.com/_/fp/icons/Medium-Avatar-500x500.svg" alt="Medium Logo" width="32" height="32"> Medium MCP Server

Version 2.0.0 - Production-ready MCP server for Medium API integration

Overview

Medium MCP (Model Context Protocol) server enables AI assistants to interact with Medium's content platform programmatically. Publish, update, delete articles, manage drafts, and more - all through a unified MCP interface with robust error handling and automatic retries.

🎯 Key Features

  • Complete CRUD Operations - Publish, update, delete, and retrieve articles
  • OAuth 2.0 Authentication - Secure token management with automatic refresh
  • Smart Retry Logic - Exponential backoff for failed requests
  • Rate Limit Handling - Automatic detection and waiting
  • Draft Management - Create, retrieve, and manage drafts
  • User Profile Access - Get user information and publications
  • Search Functionality - Find articles by keywords and tags
  • Type Safety - Full TypeScript support with validation
  • Comprehensive Tests - Jest test suite with 92% coverage

🛠️ Technology Stack

  • TypeScript - Type-safe development
  • Model Context Protocol (MCP) - AI assistant integration
  • Axios - HTTP client with interceptors
  • Zod - Schema validation
  • Jest - Testing framework

🚀 Quick Start

Prerequisites

  • Node.js v16 or later
  • npm or yarn
  • Medium account

Installation

# 1. Clone the repository
git clone https://github.com/aliiqbal208/medium-mcp.git
cd medium-mcp-server

# 2. Install dependencies
npm install

# 3. Configure environment
cp .env.example .env

# 4. Get your Medium integration token
# Visit: https://medium.com/me/settings/security
# Scroll to "Integration tokens" → Enter description → Click "Get integration token"
# Add to .env as: MEDIUM_ACCESS_TOKEN=your_token_here

# 5. Build the project
npm run build

# 6. Run the server
npm start

Development Mode

npm run dev  # Hot reload enabled

Run Tests

npm test              # Run all tests
npm run test:watch    # Watch mode
npm run test:coverage # With coverage report

📚 Available Tools

Article Management

publish-article

Publish a new article on Medium.

Parameters:

  • title (string, required): Article title
  • content (string, required): Article content in Markdown format
  • tags (string[], optional): Up to 5 tags
  • publishStatus ('public' | 'draft' | 'unlisted', optional): Publication status (default: 'draft')
  • publicationId (string, optional): Publish to a specific publication
  • notifyFollowers (boolean, optional): Notify followers when publishing

Example:

{
  "title": "Getting Started with AI",
  "content": "# Introduction\n\nThis is my article about AI...",
  "tags": ["ai", "machine-learning", "tech"],
  "publishStatus": "public"
}

update-article

Update an existing article.

Parameters:

  • articleId (string, required): ID of the article to update
  • title (string, optional): New title
  • content (string, optional): New content
  • tags (string[], optional): New tags
  • publishStatus ('public' | 'draft' | 'unlisted', optional): New status

delete-article

Delete an article or draft.

Parameters:

  • articleId (string, required): ID of the article to delete

get-article

Get details of a specific article.

Parameters:

  • articleId (string, required): ID of the article

User & Profile

get-user-profile

Retrieve authenticated user's profile information.

Returns: User ID, username, name, URL, and image URL.

get-drafts

Retrieve all draft articles for the authenticated user.

get-publications

Retrieve all publications the user contributes to.

Search

search-articles

Search and filter Medium articles.

Parameters:

  • keywords (string[], optional): Search keywords
  • publicationId (string, optional): Filter by publication
  • tags (string[], optional): Filter by tags

🔧 Development

Run in Development Mode

npm run dev

Run Tests

npm test

Build the Project

npm run build

🏗️ Architecture

medium-mcp-server/
├── src/
│   ├── index.ts       # MCP server and tool registration (8 tools)
│   ├── auth.ts        # OAuth 2.0 & token management with refresh
│   └── client.ts      # API client with retry logic & rate limiting
├── tests/
│   ├── auth.test.ts   # Authentication tests
│   └── client.test.ts # API client tests
├── .env.example       # Environment configuration template
├── .gitignore         # Git ignore rules
├── tsconfig.json      # TypeScript configuration
├── jest.config.js     # Test configuration
└── package.json       # Dependencies and scripts

🔒 Authentication

Option 1: Integration Token (Recommended)

  1. Visit Medium Settings - Security
  2. Scroll to "Integration tokens"
  3. Enter description: "MCP Server"
  4. Click "Get integration token"
  5. Add to .env: MEDIUM_ACCESS_TOKEN=your_token_here

Option 2: OAuth (For Applications)

  1. Register at Medium Developers
  2. Get Client ID and Client Secret
  3. Add to .env:
    MEDIUM_CLIENT_ID=your_client_id
    MEDIUM_CLIENT_SECRET=your_client_secret
    MEDIUM_AUTH_CODE=authorization_code
    

⚡ Features in Detail

Error Handling

  • Exponential Backoff: Automatic retry with 1s → 2s → 4s delays
  • Rate Limit Detection: Monitors API limits and waits automatically
  • Detailed Error Messages: Clear error info with status codes

Token Management

  • Persistent Storage: Tokens saved in .medium-tokens.json
  • Auto Refresh: Expired tokens refreshed automatically
  • Security: Token files excluded from git

Type Safety

  • Full TypeScript implementation
  • Zod schema validation
  • Comprehensive interfaces

🐛 Troubleshooting

Authentication Errors

# Verify token is set
cat .env | grep MEDIUM_ACCESS_TOKEN

# Clear stored tokens
rm -f .medium-tokens.json

# Restart server
npm start

Build Errors

# Clean and rebuild
rm -rf dist node_modules
npm install
npm run build

Rate Limiting

The client automatically handles rate limits. Check rate limit status:

const rateLimitInfo = client.getRateLimitInfo();
console.log(`Remaining: ${rateLimitInfo.remaining}`);

📊 What's New in v2.0.0

Added

  • ✅ Real OAuth 2.0 authentication with token refresh
  • ✅ Update article tool
  • ✅ Delete article tool
  • ✅ Get article details tool
  • ✅ Get user profile tool
  • ✅ Get drafts tool
  • ✅ Exponential backoff retry logic
  • ✅ Rate limit detection and handling
  • ✅ Comprehensive test suite (Jest)
  • ✅ Token persistence

Enhanced

  • ✅ Publish article tool (added status & notify options)
  • ✅ Better error messages
  • ✅ Improved type safety
  • ✅ Enhanced documentation

🚀 Roadmap

Phase 2 (Coming Soon)

  • 📊 Analytics and article statistics
  • 🖼️ Image upload support
  • 🔍 Advanced search filters
  • 🎯 SEO optimization tools
  • 📝 Draft scheduling

Phase 3 (Future)

  • 🤖 AI-powered content suggestions
  • 📦 Bulk operations
  • 🔄 Import/export functionality
  • 👥 Collaboration features
  • 🔔 Webhook support

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📞 Support

  • Medium API Docs: https://github.com/Medium/medium-api-docs
  • MCP Protocol: https://github.com/modelcontextprotocol/sdk
  • Issues: Create a GitHub issue for bugs or feature requests

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选