Ghost CMS MCP server providing comprehensive Ghost API access
Project description
Ghost MCP Server
A comprehensive Model Context Protocol (MCP) server for Ghost CMS, providing both read-only Content API and read/write Admin API access through FastMCP.
โก Quick Start
For Claude Code:
claude mcp add ghost --scope user \
-e GHOST_URL=http://localhost:2368 \
-e GHOST_CONTENT_API_KEY=your_key_here \
-e GHOST_ADMIN_API_KEY=your_key_here \
-- uvx ghost-mcp
๐ Getting Started
Standard Configuration
For most MCP clients, use this configuration:
{
"mcpServers": {
"ghost": {
"command": "uvx",
"args": [
"--refresh",
"--from",
"git+https://github.com/thenets/ghost-mcp.git",
"ghost-mcp"
],
"env": {
"GHOST_URL": "http://localhost:2368",
"GHOST_CONTENT_API_KEY": "your_content_api_key_here",
"GHOST_ADMIN_API_KEY": "your_admin_api_key_here"
}
}
}
}
Creating API Keys
To create the required API keys for your Ghost instance:
- Content API Key: In your Ghost admin panel, go to Settings โ Integrations โ Add custom integration
- Admin API Key: The same custom integration will provide both Content and Admin API keys
- Set the environment variables in your configuration as shown above
For local development, you can use the automated setup:
make setup # This will start Ghost, create tokens, and configure everything
๐ฏ Features
- Complete Ghost API Coverage: Both Content API (read-only) and Admin API (read/write)
- 15+ MCP Tools: Posts, pages, tags, authors, settings, and more
- Modern Python Implementation: FastMCP 2.12.3 with async/await
- JWT Authentication: Secure Admin API access with token caching
- Robust Error Handling: 5 error categories with comprehensive logging
- Configuration Management: Environment variables with precedence
- Development Tools: Complete Docker setup and automation scripts
๐ ๏ธ Development
Prerequisites
- Docker and Docker Compose
- Python 3.10+ (with uv recommended)
Setup
# Clone the repository
git clone https://github.com/thenets/ghost-mcp.git
cd ghost-mcp
# Complete setup from scratch
make setup
# Or step by step:
make install-uv # Install uv package manager
make install # Install Python dependencies
make start-ghost # Start Ghost and database
make setup-tokens # Extract API keys and create .env
make test # Test the implementation
Usage
# Run the MCP server
make run
# Development mode with auto-reload
make dev
# Check system status
make status
# View container logs
make logs
Project Structure
ghost-mcp/
โโโ src/ghost_mcp/
โ โโโ server.py # FastMCP server entry point
โ โโโ client.py # Ghost API client
โ โโโ config.py # Configuration management
โ โโโ auth/ # Authentication modules
โ โโโ tools/
โ โ โโโ content/ # Content API tools
โ โ โโโ admin/ # Admin API tools
โ โโโ types/ # Type definitions
โ โโโ utils/ # Utilities
โโโ scripts/ # Setup and test scripts
โโโ contracts/ # API documentation
โโโ docker-compose.yml # Ghost + MySQL setup
โโโ Makefile # Development commands
โโโ pyproject.toml # Python project config
Available Commands
make help # Show all commands
make setup # Complete setup from scratch
make install # Install dependencies with uv
make start-ghost # Start Ghost containers
make setup-tokens # Generate API keys
make test # Run tests
make test-connection # Test API connectivity
make run # Run MCP server
make status # Check system status
make clean # Clean up everything
๐ Available MCP Tools
Content API Tools (Read-only)
get_posts- Get published posts with filtering/paginationget_post_by_id- Get single post by IDget_post_by_slug- Get single post by slugsearch_posts- Search posts by title/contentget_pages- Get published pagesget_page_by_id- Get single page by IDget_page_by_slug- Get single page by slugget_tags- Get tags with filteringget_tag_by_id- Get single tag by IDget_tag_by_slug- Get single tag by slugget_authors- Get authorsget_author_by_id- Get single author by IDget_author_by_slug- Get single author by slugget_settings- Get public settingsget_site_info- Get basic site information
Admin API Tools (Read/Write)
create_post- Create new posts with full optionsupdate_post- Update existing postsdelete_post- Delete postsget_admin_posts- Get posts including draftscreate_page- Create new pagescreate_tag- Create new tags
Utility Tools
check_ghost_connection- Test connectivity and configuration
๐ง Configuration
Configuration is managed through environment variables with precedence:
- Environment variables
.envfile- Default values
Required Variables
GHOST_URL=http://localhost:2368
GHOST_CONTENT_API_KEY=your_content_api_key_here
GHOST_ADMIN_API_KEY=your_admin_api_key_here
Optional Variables
GHOST_VERSION=v5.0
GHOST_MODE=auto # auto, readonly, readwrite
GHOST_TIMEOUT=30
GHOST_MAX_RETRIES=3
GHOST_RETRY_BACKOFF_FACTOR=2.0
LOG_LEVEL=info # debug, info, warning, error
LOG_STRUCTURED=true
LOG_REQUEST_ID=true
๐ณ Docker Environment
The project includes a complete Docker Compose setup:
- Ghost: Latest Ghost 5.x with Alpine Linux
- MySQL 8.0: Database with health checks
- Development optimized: Logging, auto-restart, volume persistence
URLs
- Ghost Admin: http://localhost:2368/ghost/
- Ghost Site: http://localhost:2368/
- Database: localhost:3306
๐ API Authentication
Content API
- Uses query parameter authentication
- 26-character hex API key
- Read-only access to published content
Admin API
- Uses JWT token authentication
- Format:
id:secret(24-char + 64-char hex) - 5-minute token expiration with automatic renewal
- Full read/write access
๐ Error Handling
Comprehensive error handling with 5 categories:
- Network Errors: Connection timeouts, DNS failures
- Authentication Errors: Invalid keys, expired tokens
- Ghost API Errors: Ghost-specific errors with codes
- Validation Errors: Invalid parameters, malformed data
- File Upload Errors: Media upload failures
All errors include:
- Unique error ID
- Category classification
- Context information
- Request ID for tracing
๐งช Testing
# Test Ghost API connectivity
make test-connection
# Run all tests
make test
# Test specific functionality
make test-connection
๐ Logging
Structured logging with configurable levels:
- Request IDs: Track requests across components
- Structured format: JSON output for production
- Context preservation: Error context and debugging info
- Performance metrics: Request timing and retry information
๐ Retry Logic
Robust retry mechanism:
- Exponential backoff: Configurable base delay and multiplier
- Jitter: Prevents thundering herd problems
- Max retries: Configurable retry limits
- Circuit breaker: Fail fast after repeated failures
๐ Documentation
- API Contracts: Complete Ghost API documentation in
contracts/ - Type Definitions: Full type coverage with Pydantic models
- Examples: Working examples for all tools
- Development Guide: Step-by-step setup and usage
๐ค Contributing
- Fork the repository
- Create a feature branch
- Make changes with tests
- Run
make testto verify - Submit a pull request
๐ License
MIT License - see LICENSE file for details
๐ Support
- Issues: GitHub issues for bugs and features
- Documentation: Check
contracts/for API details - Logs: Use
make logsfor troubleshooting - Status: Use
make statusfor system health
Built with FastMCP 2.12.3 and Ghost 5.x ๐
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ghost_mcp-0.1.0.tar.gz.
File metadata
- Download URL: ghost_mcp-0.1.0.tar.gz
- Upload date:
- Size: 153.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c86604daf2b8586ba552b078f71f88b71606fb26d481dcae87998666491184e6
|
|
| MD5 |
0ddbb632369957bf77bcca59ecc8efed
|
|
| BLAKE2b-256 |
d85674f65e23bf256934a76c185c7c81f78289a840909b771dc81ef70df19f23
|
Provenance
The following attestation bundles were made for ghost_mcp-0.1.0.tar.gz:
Publisher:
pypi.yml on thenets/ghost-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ghost_mcp-0.1.0.tar.gz -
Subject digest:
c86604daf2b8586ba552b078f71f88b71606fb26d481dcae87998666491184e6 - Sigstore transparency entry: 553938523
- Sigstore integration time:
-
Permalink:
thenets/ghost-mcp@9c7641e8711247d375643d43e6228512b5121b35 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/thenets
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@9c7641e8711247d375643d43e6228512b5121b35 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ghost_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ghost_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 31.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ab6b2d21fa1adfe796831ee87e245c9c0b725b97ce0b043705a1fa3fa19317e
|
|
| MD5 |
07bf509c63fdf6ab216e75321f70b0b0
|
|
| BLAKE2b-256 |
f81b9bbec4afe4fb4505cd235eb649114dfa10bb2a4b7cd2804badc91cda8f27
|
Provenance
The following attestation bundles were made for ghost_mcp-0.1.0-py3-none-any.whl:
Publisher:
pypi.yml on thenets/ghost-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ghost_mcp-0.1.0-py3-none-any.whl -
Subject digest:
6ab6b2d21fa1adfe796831ee87e245c9c0b725b97ce0b043705a1fa3fa19317e - Sigstore transparency entry: 553938541
- Sigstore integration time:
-
Permalink:
thenets/ghost-mcp@9c7641e8711247d375643d43e6228512b5121b35 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/thenets
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@9c7641e8711247d375643d43e6228512b5121b35 -
Trigger Event:
push
-
Statement type: