Ghost CMS MCP服务器

Ghost CMS MCP服务器是一个非官方的MCP兼容服务器,用于通过兼容MCP的客户端管理Ghost CMS中的文章、页面、标签和图片。

  • by matveev-pavel
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 matveev-pavel/ghost-mcp

使用说明

幽灵cms mcp

非官方 MCP服务器 Ghost CMS不隶属于幽灵基金会。

通过任何兼容MCP的客户端(Claude Code、Claude Desktop、Cursor、OpenCode等)管理帖子、页面、标签和图像。

安装

uvx ghost-cms-mcp

或者用pip安装:

pip install ghost-cms-mcp

配置

您需要一个Ghost Admin API密钥。从Ghost管理面板获取:

  1. 首选 设置→ 集成
  2. 创建新的 自定义集成
  3. 复制 管理员API密钥 (格式: id:secret)

克劳德代码

claude mcp add ghost \
  -e GHOST_URL=https://your-blog.com \
  -e GHOST_ADMIN_KEY=your-id:your-secret \
  -- uvx ghost-cms-mcp

或添加到您的项目 .mcp.json:

{
  "mcpServers": {
    "ghost": {
      "command": "uvx",
      "args": ["ghost-cms-mcp"],
      "env": {
        "GHOST_URL": "https://your-blog.com",
        "GHOST_ADMIN_KEY": "your-id:your-secret"
      }
    }
  }
}

克劳德桌面

添加到 claude_desktop_config.json:

{
  "mcpServers": {
    "ghost": {
      "command": "uvx",
      "args": ["ghost-cms-mcp"],
      "env": {
        "GHOST_URL": "https://your-blog.com",
        "GHOST_ADMIN_KEY": "your-id:your-secret"
      }
    }
  }
}

光标

添加到 .cursor/mcp.json 在项目根目录中:

{
  "mcpServers": {
    "ghost": {
      "command": "uvx",
      "args": ["ghost-cms-mcp"],
      "env": {
        "GHOST_URL": "https://your-blog.com",
        "GHOST_ADMIN_KEY": "your-id:your-secret"
      }
    }
  }
}

命令行界面

ghost-cms-mcp --url https://your-blog.com --key "your-id:your-secret"

环境变量优先于CLI参数。

工具选择

默认情况下,所有工具都已启用。您可以使用预设或手动选择来控制哪些工具可用。

预设

预设 工具 说明
all 帖子、页面、标签、图像 所有工具(默认)
writer 帖子、标签、图片 作者:撰写、标记、上传图片
content 帖子、页面、标签、图像 所有内容工具
readonly 帖子、页面、标签、图像 仅列表/获取操作,无创建/更新/删除

通过env变量或CLI参数进行配置:

{
  "mcpServers": {
    "ghost": {
      "command": "uvx",
      "args": ["ghost-cms-mcp"],
      "env": {
        "GHOST_URL": "https://your-blog.com",
        "GHOST_ADMIN_KEY": "your-id:your-secret",
        "GHOST_PRESET": "writer"
      }
    }
  }
}

或者通过CLI:

ghost-cms-mcp --url https://your-blog.com --key "id:secret" --preset readonly

手动工具选择

仅启用特定的工具组:

{
  "env": {
    "GHOST_URL": "https://your-blog.com",
    "GHOST_ADMIN_KEY": "your-id:your-secret",
    "GHOST_TOOLS": "posts,tags"
  }
}

或者通过CLI:

ghost-cms-mcp --url https://your-blog.com --key "id:secret" --tools posts,tags

可用组: posts, pages, tags, images

GHOST_TOOLS / --tools 优先于 GHOST_PRESET / --preset.

可用工具

帖子

  • ghost_list_posts --列出按状态和标签筛选的帖子
  • ghost_get_post --通过ID或slug获取帖子
  • ghost_create_post --从Markdown创建帖子
  • ghost_update_post --更新帖子字段(标题、内容、标签、SEO元数据等)
  • ghost_delete_post --删除帖子
  • ghost_publish_post --发表草稿
  • ghost_unpublish_post --恢复到草稿

页面

  • ghost_list_pages --列表页面
  • ghost_get_page --按ID或slug获取页面
  • ghost_create_page --从Markdown创建页面
  • ghost_update_page --更新页面字段
  • ghost_delete_page --删除页面

标签

  • ghost_list_tags --列出所有标签
  • ghost_create_tag --创建新标记
  • ghost_delete_tag --删除标签

图片和网站

  • ghost_upload_image --上传图片并获取URL
  • ghost_site_info --获取站点元数据(标题、版本等)

发展

git clone https://github.com/matveev-pavel/ghost-mcp.git
cd ghost-mcp
uv sync --dev
uv run pytest

许可证

麻省理工学院