Ghost MCP Server
A Model Context Protocol (MCP) server for interacting with Ghost CMS through LLM interfaces like Claude. This server provides secure and comprehensive access to your Ghost blog, leveraging JWT authentication and a rich set of MCP tools for managing posts, users, members, tiers, offers, and newsletters.
Features
- Secure JWT Authentication for Ghost Admin API requests
- Comprehensive entity access including posts, users, members, tiers, offers, and newsletters
- Advanced search functionality with both fuzzy and exact matching options
- Detailed, human-readable output for Ghost entities
- Robust error handling using custom
GhostError
exceptions - Integrated logging support via MCP context for enhanced troubleshooting
Installation
Installing via Smithery
To install Ghost MCP Server for Claude Desktop automatically via Smithery:
1npx -y @smithery/cli install @MFYDev/ghost-mcp --client claude
Manual Installation
1# Clone repository 2git clone [email protected]/mfydev/ghost-mcp.git 3cd ghost-mcp 4 5# Create virtual environment and install 6uv venv 7source .venv/bin/activate # On Windows: .venv\Scripts\activate 8uv pip install -e .
Requirements
- Python ≥ 3.12
- Running Ghost instance with Admin API access (v5.x+ recommended)
- Node.js (for testing with MCP Inspector)
Usage
Environment Variables
1GHOST_API_URL=https://yourblog.com # Your Ghost Admin API URL 2GHOST_STAFF_API_KEY=your_staff_api_key # Your Ghost Staff API key
Usage with MCP Clients
To use this with MCP clients, for instance, Claude Desktop, add the following to your claude_desktop_config.json
:
1{ 2 "mcpServers": { 3 "ghost": { 4 "command": "/Users/username/.local/bin/uv", 5 "args": [ 6 "--directory", 7 "/path/to/ghost-mcp", 8 "run", 9 "src/main.py" 10 ], 11 "env": { 12 "GHOST_API_URL": "your_ghost_api_url", 13 "GHOST_STAFF_API_KEY": "your_staff_api_key" 14 } 15 } 16 } 17}
Testing with MCP Inspector
1GHOST_API_URL=your_ghost_api_url GHOST_STAFF_API_KEY=your_staff_api_key npx @modelcontextprotocol/inspector uv --directory /path/to/ghost-mcp run src/main.py
Available Tools
Ghost MCP now provides a single unified tool that provides access to all Ghost CMS functionality:
Main Tool
ghost
: Central tool for accessing all Ghost CMS functionality
Using the Ghost Tool
The ghost tool accepts two main parameters:
action
: The specific Ghost operation to performparams
: A dictionary of parameters for the specified action
Example usage:
1# List posts 2ghost(action="list_posts", params={"format": "text", "page": 1, "limit": 15}) 3 4# Search posts by title 5ghost(action="search_posts_by_title", params={"query": "Welcome", "exact": False}) 6 7# Create a post 8ghost(action="create_post", params={ 9 "post_data": { 10 "title": "New Post via MCP", 11 "status": "draft", 12 "lexical": "{\"root\":{\"children\":[{\"children\":[{\"detail\":0,\"format\":0,\"mode\":\"normal\",\"style\":\"\",\"text\":\"Hello World\",\"type\":\"text\",\"version\":1}],\"direction\":\"ltr\",\"format\":\"\",\"indent\":0,\"type\":\"paragraph\",\"version\":1}],\"direction\":\"ltr\",\"format\":\"\",\"indent\":0,\"type\":\"root\",\"version\":1}}" 13 } 14})
Available Actions
The ghost tool supports all the same actions as before, but now through a unified interface:
Posts Actions
list_posts
: List blog posts with paginationsearch_posts_by_title
: Search for posts by titleread_post
: Retrieve full content of a specific postcreate_post
: Create a new postupdate_post
: Update a specific postdelete_post
: Delete a specific postbatchly_update_posts
: Update multiple posts in a single request
Tags Actions
browse_tags
: List all tagsread_tag
: Retrieve specific tag informationcreate_tag
: Create a new tagupdate_tag
: Update an existing tagdelete_tag
: Delete a specific tag
Users Actions
list_roles
: List all available rolescreate_invite
: Create a new user invitationlist_users
: List all usersread_user
: Get details of a specific userdelete_user
: Delete a specific user
Members Actions
list_members
: List membersread_member
: Retrieve specific member informationcreate_member
: Create a new memberupdate_member
: Update an existing member
Tiers Actions
list_tiers
: List all membership tiersread_tier
: Retrieve specific tier informationcreate_tier
: Create a new tierupdate_tier
: Update an existing tier
Offers Actions
list_offers
: List promotional offersread_offer
: Get specific offer informationcreate_offer
: Create a new offerupdate_offer
: Update an existing offer
Newsletters Actions
list_newsletters
: List all newslettersread_newsletter
: Retrieve specific newsletter informationcreate_newsletter
: Create a new newsletterupdate_newsletter
: Update an existing newsletter
Webhooks Actions
create_webhook
: Create a new webhookupdate_webhook
: Update an existing webhookdelete_webhook
: Delete a specific webhook
Available Resources
All resources follow the URI pattern: [type]://[id]
user://{user_id}
: User profiles and rolesmember://{member_id}
: Member details and subscriptionstier://{tier_id}
: Tier configurationsoffer://{offer_id}
: Offer detailsnewsletter://{newsletter_id}
: Newsletter settingspost://{post_id}
: Post content and metadatablog://info
: General blog information
Error Handling
Ghost MCP Server employs a custom GhostError
exception to handle API communication errors and processing issues. This ensures clear and descriptive error messages to assist with troubleshooting.
Contributing
- Fork repository
- Create feature branch
- Commit changes
- Create pull request
License
MIT