Ghost MCP Server

repository·main·Indexed 42 days ago

https://github.com/mfydev/ghost-mcp

A Model Context Protocol (MCP) server that enables LLMs to interact with a Ghost CMS instance via the Ghost Admin API. It provides tools and resource templates to manage posts, members, newsletters, offers, invites, roles, tags, tiers, users, and webhooks. Supports version v5.0 of the Ghost API and includes built-in prompts such as 'summarize-post'.

Tokens
7.6K
Snippets
22
Records
44
Agent score
52%

What's inside Ghost MCP

  1. Configure Ghost MCP Server for Claude Desktop

    main

    To use the Ghost MCP server with MCP clients like Claude Desktop, you must add a configuration entry to your claude_desktop_config.json file. You need to provide your Ghost blog URL, your Admin API key, and the API version. The server is executed via npx using the @fanyangmeng/ghost-mcp package.

    {
      "mcpServers": {
          "ghost-mcp": {
            "command": "npx",
            "args": ["-y", "@fanyangmeng/ghost-mcp"],
            "env": {
                "GHOST_API_URL": "https://yourblog.com",
                "GHOST_ADMIN_API_KEY": "your_admin_api_key",
                "GHOST_API_VERSION": "v5.0"
            }
          }
        }
    }
  2. Configure Ghost MCP Server environment variables

    main

    The Ghost MCP server requires the following environment variables to authenticate and connect to your Ghost instance:

    • GHOST_API_URL: The base URL of your Ghost blog (e.g., https://yourblog.com).
    • GHOST_ADMIN_API_KEY: Your Ghost Admin API key for secure access.
    • GHOST_API_VERSION: The version of the Ghost API to use (e.g., v5.0).
  3. Manage Ghost newsletters via MCP tools

    main
    The ghost-mcp server provides a set of tools for managing Ghost newsletters. These tools allow you to browse, read, create, edit, and delete newsletter configurations. These tools are registered to an McpServer instance via registerNewsletterTools.
  4. Run the Ghost MCP Server via stdio

    main

    The Ghost MCP server is designed to run using the StdioServerTransport, which communicates via standard input/output. This is the standard way to connect MCP servers to host applications like Claude Desktop. The server initializes several resource templates and tools to interact with a Ghost CMS instance.

    To run the server, ensure it is compiled and executed in an environment where stdio is available. The server logs operational messages to stderr to avoid interfering with the stdout data stream used by the MCP protocol.

    # Example of how an MCP host might invoke the server
    node /path/to/ghost-mcp/dist/server.js
  5. Troubleshoot Ghost MCP Server errors

    main
    The server uses a custom GhostError exception to handle API communication errors and processing issues. When an operation fails, the server provides descriptive error messages to help identify whether the issue is related to authentication, network connectivity, or invalid parameters.
  6. Configure the Ghost Admin API client

    main

    The ghostApiClient is an instance of GhostAdminAPI initialized using environment-based configuration. To ensure the client connects correctly, the following configuration parameters must be provided (typically via environment variables or a config file):

    • GHOST_API_URL: The base URL of your Ghost instance.
    • GHOST_ADMIN_API_KEY: A valid Admin API key generated from your Ghost admin dashboard.
    • GHOST_API_VERSION: The specific version of the Ghost Admin API to target.
    import GhostAdminAPI from '@tryghost/admin-api';
    import { GHOST_API_URL, GHOST_ADMIN_API_KEY, GHOST_API_VERSION } from './config';
    
    export const ghostApiClient = new GhostAdminAPI({
        url: GHOST_API_URL,
        key: GHOST_ADMIN_API_KEY,
        version: GHOST_API_VERSION
    });
  7. Configure Ghost MCP via environment variables

    main

    The Ghost MCP server requires specific environment variables to connect to your Ghost instance. If these are missing, the server will fail to start with an error message.

    Required variables:

    • GHOST_API_URL: The base URL of your Ghost instance (e.g., https://your-blog.com).
    • GHOST_ADMIN_API_KEY: Your Ghost Admin API key used for authenticated requests.

    Optional variables:

    • GHOST_API_VERSION: The version of the Ghost API to use. Defaults to v5.0 if not provided.
    export const GHOST_API_URL: string = process.env.GHOST_API_URL as string;
    export const GHOST_ADMIN_API_KEY: string = process.env.GHOST_ADMIN_API_KEY as string;
    export const GHOST_API_VERSION: string = process.env.GHOST_API_VERSION as string || 'v5.0';
  8. Available Ghost CMS resources and tools

    main

    The Ghost MCP server provides tools to manage various Ghost CMS entities. Most resources support a standard set of operations: browsing, reading, creating, editing, and deleting.

    Supported Resources and Operations

    ResourceOperations
    PostsBrowse Posts, Read Post, Add Post, Edit Post, Delete Post
    MembersBrowse Members, Read Member, Add Member, Edit Member, Delete Member
    NewslettersBrowse Newsletters, Read Newsletter, Add Newsletter, Edit Newsletter, Delete Newsletter
    OffersBrowse Offers, Read Offer, Add Offer, Edit Offer, Delete Offer
    InvitesBrowse Invites, Add Invite, Delete Invite
    RolesBrowse Roles, Read Role
    TagsBrowse Tags, Read Tag, Add Tag, Edit Tag, Delete Tag
    TiersBrowse Tiers, Read Tier, Add Tier, Edit Tier, Delete Tier
    UsersBrowse Users, Read User, Edit User, Delete User
    WebhooksBrowse Webhooks, Add Webhook, Delete Webhook

    Note: For specific parameter schemas for each tool, refer to the source code in src/tools/.

  9. Manage Ghost invites via MCP tools

    main

    The ghost-mcp server provides three tools for managing member invites in Ghost. These tools allow you to browse existing invites, create new ones for specific roles, and delete existing invites.

    Available Tools

    invites_browse

    Retrieves a list of invites. Use this to inspect current pending invitations.

    • Arguments:
      • filter (string, optional): Filter criteria.
      • limit (number, optional): Number of results to return.
      • page (number, optional): The page number to retrieve.
      • order (string, optional): Sorting order.

    invites_add

    Creates a new invite for a specific user email and role.

    • Arguments:
      • role_id (string): The unique identifier of the role to invite the user to.
      • email (string): The email address of the invitee.

    invites_delete

    Removes an existing invite.

    • Arguments:
      • id (string): The unique identifier of the invite to delete.