BlogPublisher

BlogPublisher

Multi-platform blog publishing tool that enables users to save, schedule, and publish SEO-optimized articles to platforms like websites, LinkedIn, Twitter, and Substack directly from Claude.

Category
访问服务器

README

BlogPublisher

Multi-platform blog publishing system that integrates with ResearchAgent for automated content distribution.

Overview

BlogPublisher receives SEO-optimized articles from ResearchAgent and publishes them to multiple platforms:

  • Personal website blog
  • LinkedIn
  • Twitter/X (as threads)
  • Substack (email newsletter)
  • Facebook (planned)
  • Instagram (planned)

Architecture

ResearchAgent (SEO writing) → BlogPublisher (distribution) → Multiple Platforms

Features

Article Management

  • Save articles with SEO metadata
  • Draft/scheduled/published status tracking
  • PostgreSQL storage

Multi-Platform Publishing

  • Publish to 4+ platforms simultaneously
  • Platform-specific content formatting
  • Publication tracking and analytics

Scheduling

  • Schedule posts for future publication
  • Automated cron-based publishing
  • Retry logic for failures

MCP Integration

  • 7 MCP tools for Claude Desktop
  • Seamless integration with ResearchAgent
  • Single conversation workflow

Quick Start

1. Prerequisites

  • Python 3.10+
  • PostgreSQL 14+
  • Platform API credentials (see API Setup below)

2. Installation

cd ~/1_REPOS/BlogPublisher

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Setup environment
cp .env.example .env
# Edit .env with your credentials

3. Database Setup

# Create PostgreSQL database
createdb blogpublisher

# Update DATABASE_URL in .env
DATABASE_URL=postgresql://user:password@localhost:5432/blogpublisher

# Initialize database (tables auto-created on first run)
python backend/app.py  # Runs migrations

4. Claude Desktop Configuration

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "research-agent": {
      "command": "python",
      "args": ["/Users/tmac/1_REPOS/ResearchAgent/backend/mcp_server.py"]
    },
    "blogpublisher": {
      "command": "python",
      "args": ["/Users/tmac/1_REPOS/BlogPublisher/backend/mcp_server.py"],
      "env": {
        "DATABASE_URL": "postgresql://localhost:5432/blogpublisher"
      }
    }
  }
}

Restart Claude Desktop.

Usage

Daily Blogging Workflow

In Claude Desktop:

1. "Write SEO article about [topic]"
   → ResearchAgent creates optimized article

2. "Save this article to BlogPublisher"
   → Returns article_id

3. "Publish to website and LinkedIn immediately"
   → Publishes to both platforms

4. "Schedule Twitter thread for tomorrow at 10 AM"
   → Queues Twitter publication

MCP Tools

save_article

{
  "title": "Article Title",
  "content": "Markdown content...",
  "summary": "Brief summary",
  "keywords": ["seo", "keywords"],
  "seo_score": {"score": 85}
}

Returns: article_id

publish_article

{
  "article_id": "uuid",
  "platforms": ["website", "linkedin", "twitter", "substack"]
}

Returns: Publication results per platform

schedule_article

{
  "article_id": "uuid",
  "platforms": ["linkedin", "twitter"],
  "publish_time": "tomorrow at 6 AM"
}

Returns: Schedule confirmation

get_article

{
  "article_id": "uuid"
}

Returns: Full article with publication status

list_articles

{
  "status": "published",
  "limit": 10
}

Returns: List of articles

format_for_platform

{
  "article_id": "uuid",
  "platform": "twitter"
}

Returns: Platform-optimized content

generate_social_posts

{
  "article_id": "uuid"
}

Returns: Social media variants for all platforms

API Setup

Required Credentials

Website Blog

  • WEBSITE_API_URL: Your blog API endpoint
  • WEBSITE_API_KEY: API authentication key

LinkedIn

  1. Create LinkedIn App: https://www.linkedin.com/developers/apps
  2. Get OAuth 2.0 access token
  3. Set LINKEDIN_ACCESS_TOKEN

Twitter/X

  1. Create Twitter Developer account: https://developer.twitter.com
  2. Create App and get API keys
  3. Set:
    • TWITTER_API_KEY
    • TWITTER_API_SECRET
    • TWITTER_ACCESS_TOKEN
    • TWITTER_ACCESS_SECRET

Substack

  1. Get Substack API credentials from your publication settings
  2. Set:
    • SUBSTACK_API_KEY
    • SUBSTACK_PUBLICATION_ID

Optional: Facebook & Instagram

  • FACEBOOK_ACCESS_TOKEN
  • FACEBOOK_PAGE_ID
  • INSTAGRAM_USERNAME
  • INSTAGRAM_PASSWORD

Platform-Specific Formatting

LinkedIn

  • First 3 sentences as hook
  • Professional tone
  • 1-3 hashtags
  • Link at end

Twitter/X

  • Converts to thread (280 chars/tweet)
  • Numbered tweets (1/N)
  • Link in last tweet
  • Key points extracted

Substack

  • Full article as HTML email
  • Subject line from title
  • Preview text from summary
  • Created as draft (manual publish)

Website

  • Markdown to HTML conversion
  • SEO frontmatter
  • Categories/tags
  • Featured image support

Automation

Scheduler (Cron Jobs)

Start the scheduler:

python backend/scheduler/cron.py

Or run as background service:

# Using systemd (Linux)
sudo systemctl enable blogpublisher-scheduler
sudo systemctl start blogpublisher-scheduler

# Using launchd (macOS)
# See docs/deployment/macos-launchd.md

The scheduler runs every minute and publishes any pending scheduled posts.

REST API

Optional REST API for programmatic access:

# Start API server
python backend/app.py
# Runs on http://localhost:8001

# API docs
open http://localhost:8001/docs

Endpoints

  • POST /articles - Create article
  • GET /articles - List articles
  • GET /articles/{id} - Get article
  • GET /health - Health check

Development

Project Structure

BlogPublisher/
├── backend/
│   ├── database/
│   │   ├── models.py      # SQLAlchemy models
│   │   └── db.py          # Database connection
│   ├── publishers/
│   │   ├── base.py        # Abstract publisher
│   │   ├── website.py     # Website publisher
│   │   ├── linkedin.py    # LinkedIn publisher
│   │   ├── twitter.py     # Twitter publisher
│   │   └── substack.py    # Substack publisher
│   ├── scheduler/
│   │   └── cron.py        # Automated publishing
│   ├── mcp_server.py      # MCP integration
│   └── app.py             # FastAPI server
├── data/
│   ├── articles/          # Article storage
│   └── media/             # Images
├── requirements.txt
├── .env.example
└── README.md

Adding New Platforms

  1. Create publisher class in backend/publishers/yourplatform.py
  2. Inherit from BasePublisher
  3. Implement required methods:
    • validate_config()
    • format_content()
    • publish()
  4. Add to Platform enum in models.py
  5. Update get_publisher() in mcp_server.py and cron.py

Example:

from .base import BasePublisher

class NewPlatformPublisher(BasePublisher):
    def validate_config(self):
        if "api_key" not in self.config:
            raise ValueError("Missing api_key")

    def format_content(self, content, metadata=None):
        # Platform-specific formatting
        return formatted_content

    def publish(self, title, content, metadata=None):
        # API call to publish
        return {
            "success": True,
            "post_id": "...",
            "url": "..."
        }

Troubleshooting

Database Connection Issues

# Check PostgreSQL is running
pg_isready

# Test connection
psql -U user -d blogpublisher

MCP Tools Not Showing

  1. Check Claude Desktop config file location
  2. Verify Python path in config
  3. Restart Claude Desktop
  4. Check logs: ~/Library/Logs/Claude/mcp.log

Publishing Failures

Check platform API credentials:

# Test LinkedIn token
curl -H "Authorization: Bearer $LINKEDIN_ACCESS_TOKEN" \
  https://api.linkedin.com/v2/me

# Test Twitter credentials
# Use backend/publishers/test_publisher.py

Testing

# Test database
python backend/database/db.py

# Test publishers
python backend/publishers/test_publisher.py

# Test MCP tools (requires running server)
python backend/mcp_server.py

Roadmap

  • [x] Core article storage
  • [x] Website/LinkedIn/Twitter/Substack publishers
  • [x] MCP integration
  • [x] Scheduling system
  • [ ] Facebook & Instagram publishers
  • [ ] Analytics dashboard
  • [ ] Content calendar UI
  • [ ] Image optimization
  • [ ] Link shortening
  • [ ] A/B testing
  • [ ] Performance metrics

License

MIT

Support

For issues or questions:

  • Create GitHub issue
  • Check documentation in /docs
  • See ResearchAgent integration guide

推荐服务器

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

官方
精选