Ghost CMS内容API协议服务器

一个用于通过MCP协议与Ghost CMS内容API交互的服务器,使AI助手和应用程序能够读取和搜索Ghost CMS内容。

  • by dcmcshan
  • JavaScript
  • 本地部署
  • 更新于
在 GitHub 查看 dcmcshan/ghost-mcp-server

使用说明

Ghost MCP服务器

一种用于与Ghost CMS内容API交互的模型上下文协议(MCP)服务器。该服务器使AI助手和应用程序能够通过MCP协议从Ghost CMS读取和搜索内容。

特性

  • 通过过滤和分页阅读博客文章
  • 通过ID或slug获取帖子
  • 检索作者、标签和页面
  • 跨帖子和页面搜索内容
  • 完全支持Ghost Content API功能
  • 基于stdio的简单MCP传输

安装

git clone https://github.com/dcmcshan/ghost-mcp-server.git
cd ghost-mcp-server
npm install

配置

  1. 复制示例环境文件:

    cp .env.example .env
    
  2. 编辑 .env 使用您的Ghost API证书:

    GHOST_API_URL=https://your-ghost-site.com/ghost/api/content
    GHOST_API_KEY=your_content_api_key_here
    

获取Ghost API密钥

  1. 登录到Ghost管理面板(通常 https://your-ghost-site.com/ghost)
  2. 导航至 设置 ? 集成
  3. 点击 “添加自定义集成”
  4. 为其命名(例如,“MCP服务器”)
  5. 点击 “创建”
  6. 复制 内容API密钥 (只显示一次-安全保存!)

内容API密钥提供对Ghost内容的只读访问,非常适合MCP使用。

用法

运行服务器

npm start

服务器在用于MCP客户端通信的stdio传输上运行。

可用工具

  • get_posts -使用可选过滤器获取博客文章
  • get_post_by_id -通过ID获取帖子
  • get_post_by_slug -获取slug的帖子
  • get_authors -获取所有作者
  • get_tags -获取所有标签
  • get_pages -获取静态页面
  • search_content -跨帖子和页面搜索

MCP客户端中的示例用法

// Get latest 5 posts
{
  "tool": "get_posts",
  "arguments": {
    "limit": 5,
    "include": "authors,tags"
  }
}

// Search for posts about "AI"
{
  "tool": "search_content",
  "arguments": {
    "query": "AI",
    "contentTypes": ["posts"]
  }
}

// Get a specific post by slug
{
  "tool": "get_post_by_slug",
  "arguments": {
    "slug": "my-post-slug"
  }
}

游标/IDE中的配置

添加到您的MCP配置文件中(例如。, ~/.cursor/mcp.json):

{
  "mcpServers": {
    "ghost": {
      "command": "node",
      "args": ["/absolute/path/to/ghost-mcp-server/src/index.js"],
      "env": {
        "GHOST_API_URL": "https://your-ghost-site.com/ghost/api/content",
        "GHOST_API_KEY": "your_content_api_key_here"
      }
    }
  }
}

注: 使用绝对路径 args 阵列。

发展

# Run with auto-reload (requires Node.js 18+)
npm run dev

API 参考

服务器使用Ghost Content API。看 Ghost Content API文档 有关以下内容的详细信息:

  • 可用过滤器
  • 字段选择
  • 分页
  • 包括选项

许可证

麻省理工学院