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.
- π 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
- Python 3.10+
- RapidAPI account with Medium API subscription
# Clone the repository
git clone https://github.com/marcus912/medium-mcp.git
cd medium-mcp
# Install the package
pip install -e .-
Get your RapidAPI Key:
- Sign up at RapidAPI
- Subscribe to Unofficial Medium API
- Copy your API key from the dashboard
-
Set environment variable:
export RAPIDAPI_KEY="your_rapidapi_key_here"
-
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
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.pywith your actual project path - Replace
"your_rapidapi_key_here"with your actual RapidAPI key - Adjust
/Library/Frameworks/Python.framework/Versions/3.10/bin/uvto match your uv installation path - Restart Claude Desktop after updating the configuration
# Tool: get_article_content
{
"article_id": "abc123def456",
"format": "markdown"
}# Tool: get_top_feeds
{
"tag": "ai",
"mode": "hot",
"count": 3
}# Tool: get_user_info
{
"username": "tim_cook"
}
β οΈ 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
}# Tool: search_articles
{
"query": "artificial intelligence",
"count": 3
}Here are some practical prompts you can use with Claude or other AI assistants when this MCP server is configured:
"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."
"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."
"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?"
"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."
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)# 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.pymedium-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
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
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes and add tests
- Run the test suite:
pytest - Format code:
black src/ && isort src/ - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with the official MCP Python SDK v1.13.1
- Built on the excellent medium-api library
- Powered by Model Context Protocol (MCP)
- Inspired by the need for seamless AI-powered content research
- π Documentation
- π Issues
- π¬ Discussions