supersonicwisd1/newsletter-mcp-server
If you are the rightful owner of newsletter-mcp-server 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.
The Newsletter MCP Server is designed to streamline the process of creating and distributing newsletters by integrating various tools and workflows.
slack_tool
Facilitates integration with Slack for message fetching and channel access.
gdocs_tool
Enables creation and management of Google Docs for newsletter content.
gmail_tool
Automates the distribution of newsletters via Gmail.
Newsletter MCP Server
A Model Context Protocol (MCP) server that generates newsletters from Slack conversations and creates Google Docs.
Features
Core Functionality
- Slack Integration: Fetch messages from multiple channels
- Google Docs Creation: Generate formatted newsletters in Google Docs
- Smart Filtering: Identify important messages based on engagement and content
- Multi-channel Support: Process multiple Slack channels simultaneously
Advanced Features (New!)
- User Mention Parsing: Convert Slack user mentions (
<@U123456>
ā@username
) for better readability - Topic-Based Organization: Automatically categorize messages into topics like:
- Scheduling (meetings, deadlines, appointments)
- Technical Discussions (code, bugs, features)
- Announcements (updates, news, important notices)
- Questions & Help (support, troubleshooting)
- Celebrations (birthdays, achievements)
- Project Updates (milestones, progress)
- Team Building (social events, culture)
- Tools & Resources (links, documentation)
- Date Extraction: Identify and highlight dates/deadlines mentioned in messages:
- Specific dates: "March 15th", "3/15/2024"
- Relative dates: "tomorrow", "next week", "in 2 days"
- Time references: "at 3pm", "by 5:30"
- Future/past references: "in 2 weeks", "2 days ago"
Setup
Prerequisites
- Python 3.8+
- Slack Bot Token
- Google OAuth credentials
Installation
# Clone the repository
git clone <repository-url>
cd mcp-server
# Install dependencies
pip install -r requirements.txt
# Set up environment variables
cp .env.example .env
# Edit .env with your Slack bot token
# Set up Google OAuth
# Download credentials.json from Google Cloud Console
# Place it in the project root
Environment Variables
SLACK_BOT_TOKEN=xoxb-your-slack-bot-token
Usage
Running the Server
# Run as a module (recommended)
python -m src.newsletter_mcp.server
# Or run the script directly
python src/newsletter_mcp/server.py
Available Tools
Basic Tools
get_slack_channels()
- List accessible Slack channelsget_channel_messages(channel_id, days_back=7)
- Fetch messages from a channelfilter_important_messages(channel_id, days_back=7)
- Get important messages onlycreate_simple_document(title, content)
- Create a Google Docgenerate_full_newsletter(days_back=7)
- Complete newsletter generation
New Advanced Tools
parse_user_mentions(text)
- Parse and resolve Slack user mentionsorganize_messages_by_topic(channel_id, days_back=7)
- Group messages by topic categoriesextract_dates_from_messages(channel_id, days_back=7)
- Extract dates and deadlines
Newsletter Output
The generated newsletters now include:
- Executive Summary - Overview of activity across channels
- Topic-Based Sections - Messages organized by category
- Date Highlights - Upcoming deadlines and important dates
- Engagement Metrics - Reaction and reply counts
- User Attribution - Real names instead of user IDs
Codebase Structure
newsletter-mcp-server/ āāā pyproject.toml āāā README.md āāā .env # Environment variables āāā src/ ā āāā newsletter_mcp/ ā āāā init.py ā āāā server.py # Main MCP server ā āāā tools/ ā ā āāā init.py ā ā āāā slack_tool.py # Slack integration ā ā āāā gdocs_tool.py # Google Docs integration ā ā āāā gmail_tool.py # Email distribution ā āāā workflows/ ā ā āāā init.py ā ā āāā newsletter_workflow.py # Orchestrates the flow ā āāā config/ ā āāā init.py ā āāā auth_config.py # Authentication management āāā tests/ āāā init.py āāā test_tools.py
Example Newsletter Structure
Weekly Development Newsletter
Generated on March 15, 2024
Report Period: Mar 8 - Mar 15, 2024
š SUMMARY
This week, our team was active across 3 channels with 156 total messages...
š¢ CHANNEL UPDATES
#GENERAL
Members: 25 | Important Updates: 12
š ORGANIZED BY TOPIC:
š¹ TECHNICAL DISCUSSIONS (8 updates)
1. @john: Fixed the authentication bug in the API [š3 š¬2]
2. @sarah: Deployed new feature to staging [š5]
3. @mike: Code review completed for PR #123 [š¬4]
š¹ SCHEDULING (3 updates)
1. @alice: Team meeting tomorrow at 3pm
2. @bob: Deadline for project milestone is March 20th
š
UPCOMING DATES & DEADLINES:
⢠@alice: tomorrow (Team meeting tomorrow at 3pm)
⢠@bob: March 20th (Deadline for project milestone is March 20th)
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Architecture
- SlackTool: Handles Slack API interactions and message processing
- GoogleDocsTool: Manages Google Docs creation and formatting
- GmailTool: Manages sending of email to recipients
- NewsletterWorkflow: Orchestrates the complete newsletter generation process
- MCP Server: Exposes tools via the Model Context Protocol
Troubleshooting
Common Issues
- Module Import Errors: Ensure you're running from the correct directory
- Slack API Errors: Verify your bot token has the necessary permissions
- Google OAuth Issues: Check that credentials.json is in the correct location
- Environment Variables: Make sure .env file is loaded properly
Debug Mode
The server includes debug logging. Check the console output for detailed information about the connection and processing steps.
Future Implement
-- make init function more async -- improve the error handling -- improve test by using mock -- remove file names from codebase, rather put it in an .env file