medium-mcp

marcus912/medium-mcp

3.2

If you are the rightful owner of medium-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

MCP server enabling AI assistants to fetch Medium articles, including members-only content.

Medium MCP Server

A Model Context Protocol (MCP) server that enables AI assistants to seamlessly fetch Medium articles and user data. Built with the official MCP Python SDK and the medium-api library for robust integration with Claude, ChatGPT, and other MCP-compatible AI tools.

āš ļø WARNING: This is an experimental MCP server for educational purposes. Use responsibly and respect Medium's Terms of Service and rate limits. Not recommended for production use.

🚫 RATE LIMITING NOTICE: This server does NOT implement automatic rate limiting, throttling, or retry mechanisms. It only detects rate limit errors and reports them. Users must manually manage API usage to avoid exceeding RapidAPI quotas.

Features

  • šŸ” User Information: Get detailed user profiles, follower counts, and bio information
  • šŸ“° Article Access: Fetch articles with full content in text, HTML, or Markdown formats
  • šŸ”„ Trending Content: Get top feeds and trending articles by tags
  • šŸ”Ž Search Functionality: Search articles by keywords
  • šŸ›”ļø Error Handling: Comprehensive error handling with meaningful messages
  • ⚔ Error Detection: Rate limit error detection and user-friendly messages
  • šŸ” Secure Configuration: Environment-based API key management
  • šŸš€ MCP CLI Support: Easy deployment with the official MCP command-line interface

Quick Start

Prerequisites

  • Python 3.10+
  • RapidAPI account with Medium API subscription

Installation

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

# Install the package
pip install -e .

Configuration

  1. Get your RapidAPI Key:

  2. Set environment variable:

    export RAPIDAPI_KEY="your_rapidapi_key_here"
    
  3. Install dependencies and run the server:

    Option 1: Using uv (Recommended):

    # Install dependencies and create virtual environment
    uv sync
    
    # Run with inspector for development
    uv run mcp dev main.py
    
    # Or run without inspector
    uv run mcp run main.py
    

    Option 2: Using pip:

    # Install with CLI support
    pip install -e ".[cli]"
    
    # Run with inspector for development
    mcp dev main.py
    
    # Or run without inspector
    mcp run main.py
    

MCP Server Configuration

To use this server with Claude Desktop or other MCP clients, add the following configuration to your claude_desktop_config.json:

{
  "mcpServers": {
    "medium-mcp": {
      "command": "/Library/Frameworks/Python.framework/Versions/3.10/bin/uv",
      "args": [
        "run",
        "--with",
        "mcp[cli]",
        "--with",
        "pydantic",
        "--with",
        "medium-api",
        "mcp",
        "run",
        "/path/to/medium-mcp/main.py"
      ],
      "env": {
        "RAPIDAPI_KEY": "your_rapidapi_key_here",
        "MAX_ARTICLES_PER_REQUEST": "3"
      }
    }
  }
}

Configuration Notes:

  • Replace /path/to/medium-mcp/main.py with your actual project path
  • Replace "your_rapidapi_key_here" with your actual RapidAPI key
  • Adjust /Library/Frameworks/Python.framework/Versions/3.10/bin/uv to match your uv installation path
  • Restart Claude Desktop after updating the configuration

Usage Examples

Get Article Content

# Tool: get_article_content
{
  "article_id": "abc123def456",
  "format": "markdown"
}

Get Trending Articles

# Tool: get_top_feeds
{
  "tag": "ai",
  "mode": "hot",
  "count": 3
}

Get User Information

# Tool: get_user_info
{
  "username": "tim_cook"
}

Fetch User Articles

āš ļø API Usage Warning: This function will consume API requests proportional to the number of articles published by the user. The cost increases significantly for prolific authors with hundreds or thousands of published articles.

# Tool: get_user_articles  
{
  "username": "username_here",
  "count": 3
}

Search Articles

# Tool: search_articles
{
  "query": "artificial intelligence",
  "count": 3
}

Example Prompts for AI Assistants

Here are some practical prompts you can use with Claude or other AI assistants when this MCP server is configured:

Research and Analysis

"Find the latest trending articles about machine learning on Medium and summarize the key insights from the top 3 articles."
"Get information about the Medium user @andrewng including his profile details, follower count, and bio information."

Content Discovery

"I'm interested in learning about GPT models. Search Medium for recent articles about GPT and give me the full content of the most promising one in markdown format."
"Show me what's trending in the 'programming' tag this week and help me identify the most practical tutorial among them."

Member-Only Content Access

"I found this Medium article but it's behind a paywall: https://medium.com/coding-nexus/no-more-guesswork-how-autorag-finds-the-best-rag-setup-for-you-6cda0e7c6dca 
Can you get the full content for me and provide a detailed summary?"

Topic Deep Dive

"Search for articles about 'transformer architecture' and get the full content of the 3 most comprehensive ones. Then create a learning roadmap based on the combined insights."

Configuration Options

Set these environment variables to customize behavior:

RAPIDAPI_KEY=your_key_here           # Required: Your RapidAPI key
MAX_ARTICLES_PER_REQUEST=3           # Optional: Max articles per request (1-100)

Development

Setup Development Environment

# Clone and install in development mode
git clone https://github.com/yourusername/medium-mcp.git
cd medium-mcp
pip install -e ".[dev,cli]"

# Run tests
pytest

# Format code
black src/
isort src/

# Type checking
mypy src/

# Test with MCP CLI and Inspector
mcp dev main.py

Project Structure

medium-mcp/
ā”œā”€ā”€ main.py                 # Standalone MCP server entry point
ā”œā”€ā”€ src/medium_mcp/
│   ā”œā”€ā”€ __init__.py          # Package initialization
│   ā”œā”€ā”€ __main__.py          # CLI entry point
│   ā”œā”€ā”€ server.py            # Main MCP server implementation
│   ā”œā”€ā”€ client.py            # Medium API client wrapper
│   ā”œā”€ā”€ config.py            # Configuration management
│   ā”œā”€ā”€ models.py            # Pydantic data models and types
│   ā”œā”€ā”€ formatting.py        # String formatting utilities
│   └── utils.py             # General utility functions
ā”œā”€ā”€ tests/
│   ā”œā”€ā”€ __init__.py          # Test package initialization
│   ā”œā”€ā”€ test_server.py       # Server function tests
│   ā”œā”€ā”€ test_client.py       # Client wrapper tests
│   ā”œā”€ā”€ test_config.py       # Configuration tests
│   ā”œā”€ā”€ test_types.py        # Data model tests
│   ā”œā”€ā”€ test_formatting.py   # Formatting utility tests
│   └── test_utils.py        # General utility tests
ā”œā”€ā”€ .env.example            # Environment variables template
ā”œā”€ā”€ Makefile               # Development shortcuts
ā”œā”€ā”€ pyproject.toml         # Project configuration and dependencies
ā”œā”€ā”€ pytest.ini            # Test configuration
ā”œā”€ā”€ uv.lock               # Dependency lock file
└── README.md             # This file

Error Handling

The server provides comprehensive error handling for common scenarios:

  • Invalid API Key: Clear message with setup instructions
  • Rate Limiting: Rate limit error detection with user-friendly messages (no automatic retries or throttling)
  • Network Issues: Timeout and connectivity error handling
  • Not Found: Graceful handling of missing users/articles
  • Validation Errors: Input parameter validation with helpful messages

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Make your changes and add tests
  4. Run the test suite: pytest
  5. Format code: black src/ && isort src/
  6. Submit a pull request

License

This project is licensed under the MIT License - see the file for details.

Acknowledgments

Support