ghost-cms-mcp-server
v1.0.0
Published
A comprehensive Model Context Protocol (MCP) server for Ghost CMS with full CRUD operations, bulk actions, and advanced features
Downloads
6
Maintainers
Readme
Ghost CMS MCP Server
A comprehensive Model Context Protocol (MCP) server for Ghost CMS that provides full automation capabilities for Ghost blogs through AI assistants like Claude Desktop, Cursor, and other MCP-compatible clients.
✨ Features
- 🚀 Complete Ghost API Coverage - All major Ghost operations supported
- 🔐 Secure Authentication - JWT tokens for Admin API, key-based for Content API
- ⚡ Smart Rate Limiting - Built-in queue management with exponential backoff
- 🎯 Bulk Operations - Efficient mass updates and deletions
- 📝 Content Management - Full CRUD for posts, pages, members, and more
- 🏷️ Rich Metadata - SEO optimization, social media, and custom fields
- 🧪 Test-Driven Development - Comprehensive test suite with 80%+ coverage
- 📊 TypeScript - Full type safety and IntelliSense support
- 🔄 Real-time Sync - Instant updates and conflict resolution
📦 Installation
Quick Start
NPM (Recommended)
npm install -g @ghost-cms/mcp-serverFor Claude Desktop
macOS/Linux:
# Install package
npm install -g @ghost-cms/mcp-server
# Add to Claude Desktop config
echo '{
"mcpServers": {
"ghost-cms": {
"command": "npx",
"args": ["-y", "@ghost-cms/mcp-server"],
"env": {
"GHOST_URL": "https://your-site.ghost.io",
"GHOST_ADMIN_API_KEY": "your-admin-key",
"GHOST_CONTENT_API_KEY": "your-content-key"
}
}
}
}' >> ~/Library/Application\ Support/Claude/claude_desktop_config.jsonWindows (PowerShell):
# Install package
npm install -g @ghost-cms/mcp-server
# Add to Claude Desktop config
$config = @{
mcpServers = @{
"ghost-cms" = @{
command = "npx"
args = @("-y", "@ghost-cms/mcp-server")
env = @{
GHOST_URL = "https://your-site.ghost.io"
GHOST_ADMIN_API_KEY = "your-admin-key"
GHOST_CONTENT_API_KEY = "your-content-key"
}
}
}
} | ConvertTo-Json -Depth 4
Add-Content -Path "$env:APPDATA\Claude\claude_desktop_config.json" -Value $configFor Claude Code CLI
# Linux/macOS/Windows
claude mcp add ghost-cms -- npx -y @ghost-cms/mcp-serverFor Cursor IDE
# Install globally
npm install -g @ghost-cms/mcp-server
# Configure in Cursor settings
# Add MCP server configuration in Settings > Extensions > MCPManual Installation
git clone https://github.com/ghost-cms/mcp-server.git
cd mcp-server
npm install
npm run build
npm start⚙️ Configuration
Environment Variables
Create a .env file or set environment variables:
# Required
GHOST_URL=https://your-site.ghost.io
GHOST_ADMIN_API_KEY=your-admin-key-id:your-admin-secret
GHOST_CONTENT_API_KEY=your-content-api-key
# Optional Performance Settings
RATE_LIMIT_MAX_REQUESTS=100
RATE_LIMIT_WINDOW_MS=60000
CACHE_TTL_MS=300000
CACHE_ENABLED=true
# Optional Advanced Settings
MAX_RETRY_ATTEMPTS=3
RETRY_DELAY_MS=1000
MAX_RETRY_DELAY_MS=30000
ENABLE_BULK_OPERATIONS=true
BULK_OPERATION_LIMIT=100
# Logging
LOG_LEVEL=info
LOG_FILE=ghost-mcp.log
DEBUG=falseGetting Ghost API Keys
- Go to Ghost Admin → Integrations → Add custom integration
- Copy the Admin API Key (format:
id:secret) - Copy the Content API Key
- Set your Ghost URL (your site's URL)
🛠️ Available Tools
📝 Content Management
Posts
ghost_posts_list- List posts with advanced filtersghost_posts_get- Get single post by ID or slugghost_posts_create- Create new post with full metadataghost_posts_update- Update existing postghost_posts_delete- Delete post permanentlyghost_posts_publish- Publish draft post with email optionsghost_posts_unpublish- Convert published post to draftghost_posts_search- Search posts by contentghost_posts_bulk_update- Mass update multiple postsghost_posts_bulk_delete- Mass delete posts (with confirmation)
Pages
ghost_pages_list- List all pagesghost_pages_get- Get single pageghost_pages_create- Create new pageghost_pages_update- Update existing pageghost_pages_delete- Delete page
👥 Member Management
ghost_members_list- List members with filtersghost_members_get- Get member detailsghost_members_create- Create new memberghost_members_update- Update member infoghost_members_delete- Delete memberghost_members_import- Bulk import membersghost_members_export- Export member data
🏷️ Content Organization
ghost_tags_list- List all tagsghost_tags_create- Create new tagghost_tags_update- Update tag detailsghost_tags_delete- Delete tag
💰 Subscription Management
ghost_tiers_list- List membership tiersghost_tiers_create- Create new tierghost_tiers_update- Update tier pricing/featuresghost_tiers_archive- Archive tier
📧 Newsletter Management
ghost_newsletters_list- List newslettersghost_newsletters_create- Create newsletterghost_newsletters_update- Update newsletter settingsghost_newsletters_archive- Archive newsletter
🖼️ Media Management
ghost_media_upload- Upload images and filesghost_media_upload_from_url- Upload from URL
⚙️ Site Management
ghost_settings_get- Get site settingsghost_settings_update- Update site configurationghost_users_list- List users/authorsghost_users_update- Update user profilesghost_webhooks_create- Create webhooksghost_site_info- Get site information
📋 Usage Examples
Create a Blog Post
// Use the ghost_posts_create tool
{
"title": "My Awesome Post",
"html": "<p>This is my post content with <strong>formatting</strong>.</p>",
"status": "published",
"tags": ["technology", "tutorial"],
"meta_title": "SEO Optimized Title",
"meta_description": "This post teaches you amazing things.",
"featured": true,
"custom_excerpt": "A brief summary of the post...",
"published_at": "2024-12-25T00:00:00.000Z"
}Bulk Update Posts
// Use the ghost_posts_bulk_update tool
{
"filter": "status:draft+created_at:>2024-01-01",
"data": {
"status": "published",
"featured": true,
"tags": ["bulk-updated"]
}
}Search and Filter
// Use the ghost_posts_list tool
{
"filter": "status:published+featured:true",
"order": "published_at desc",
"limit": 10,
"include": "tags,authors",
"fields": "title,slug,published_at,featured"
}Create Member with Subscription
// Use the ghost_members_create tool
{
"email": "[email protected]",
"name": "New Subscriber",
"labels": ["vip", "newsletter"],
"note": "Premium subscriber",
"subscribed": true,
"comped": false
}🧪 Testing
Run Tests
# All tests
npm test
# Unit tests only
npm run test:unit
# Integration tests
npm run test:integration
# With coverage
npm run test:coverage
# Watch mode for development
npm run test:watchTest Coverage
- Unit Tests: All tools and utilities
- Integration Tests: Full API workflows
- E2E Tests: Real Ghost API interactions
- Performance Tests: Rate limiting and caching
- Security Tests: Authentication and validation
🚀 Development
Local Development
git clone https://github.com/ghost-cms/mcp-server.git
cd mcp-server
npm install
cp .env.example .env
# Edit .env with your Ghost credentials
npm run devContributing
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Write tests for your changes
- Ensure all tests pass:
npm test - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
Code Quality
npm run lint # ESLint checking
npm run lint:fix # Auto-fix issues
npm run format # Prettier formatting
npm run build # TypeScript compilation🔧 Advanced Usage
Custom Rate Limiting
// Set custom rate limits per environment
process.env.RATE_LIMIT_MAX_REQUESTS = '200';
process.env.RATE_LIMIT_WINDOW_MS = '30000';Bulk Operations
// Safe bulk operations with confirmation
{
"filter": "status:draft+created_at:<2024-01-01",
"confirm": true // Required for destructive operations
}Error Handling
The server provides detailed error messages:
- 400: Invalid request parameters
- 401: Authentication failed
- 403: Permission denied
- 404: Resource not found
- 409: Conflict (e.g., concurrent edit)
- 422: Validation error
- 429: Rate limit exceeded
📊 Performance & Monitoring
Metrics
- Request rate limiting with queue management
- Automatic retry with exponential backoff
- Response caching for read operations
- Connection pooling for optimal throughput
Logging
Structured logging with configurable levels:
LOG_LEVEL=debug # error, warn, info, debug
LOG_FILE=ghost.log # Optional file output🔒 Security
- API Key Protection: Keys never logged or exposed
- Request Validation: All inputs validated before API calls
- Rate Limiting: Prevents API abuse
- Secure Defaults: Conservative permissions and timeouts
- Audit Trail: Comprehensive logging of all operations
🤝 Community & Support
Getting Help
Related Projects
- Ghost CMS - The headless CMS platform
- Model Context Protocol - The protocol specification
- Claude Desktop - AI assistant with MCP support
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- The Ghost team for the excellent CMS platform
- Anthropic for the Model Context Protocol specification
- The open source community for tools and inspiration
Built with ❤️ for the Ghost and AI community
⭐ Star this repo if you find it useful!
