@elementor/wp-search-mcp

中文文档
1.2.2发布于 2026/11/11MITTypeScriptES Module近 30 天下载 3139

配置 WordPress REST 搜索 MCP 服务器并附带搜索、读取和响应工具

中文使用文档
文档目录12 节
  1. 概览
  2. 所需资源
  3. 安装
  4. 快开始
  5. 配置
  6. 员额类型
  7. 工具
  8. search
  9. read
  10. response
  11. 代理工作流程
  12. 许可证

@elementor/wp-search-mcp (英语)

允许AI代理搜索并读取已发布的WordPress内容的MCP服务器,然后在一个内置的MCP App UI中给出答案.

概览

WpSearchMcpServer 将 WordPress REST API 包起来,并曝光出三个 MCP 工具:

工具目的
search按关键词查找已发布内容
read为所选文章获取已完全完成的 HTML
response在内置的UI卡(markdown, media, source link)中渲染最后的答案

服务器还注册了 MCP App 指令,通过一个 search → read → response 工作流程.

所需资源

  • 启用 REST API 的 WordPress 站点
  • 核心内容 /wp/v2/search 已配置的员额类型可用的端点
  • 支持的 MCP 主机 MCP 应用程序 (对 response 工具 UI )

安装

npm install @elementor/wp-search-mcp
# or
pnpm add @elementor/wp-search-mcp

依赖性 : @modelcontextprotocol/sdk ^1.29.0 (作为过渡性依赖自动安装).

快开始

import { WpSearchMcpServer } from '@elementor/wp-search-mcp';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';

const wpSearch = new WpSearchMcpServer({
  url: 'https://example.com',
  server: {
    name: 'my-wp-search',
    title: 'My Site Docs',
  },
});

const transport = new StdioServerTransport();
await wpSearch.server.connect(transport);

过 wpSearch.server 到任何 MCP 传输您的主机用途( stdio, SSE, 可流的 HTTP等) .

配置

type WpSearchMcpConfig = {
  /** WordPress site root URL, e.g. https://example.com */
  url: string;
  /**
   * Maps search subtype → REST collection segment.
   * Defaults to { post: 'posts' }.
   */
  postTypes?: Record<string, string>;
  server?: {
    name?: string;    // default: 'wp-search'
    version?: string; // default: '1.0.0'
    title?: string;   // default: 'WordPress Search'
  };
};

员额类型

postTypes 控制搜索 WordPress 内容类型以及如何搜索 read 解决 REST 路径.

const wpSearch = new WpSearchMcpServer({
  url: 'https://example.com',
  postTypes: {
    post: 'posts',
    page: 'pages',
  },
});

键被传递到 /wp/v2/search 作为 subtype[] 数值。 值是 REST 收集部分 /wp/v2/{segment}/{id}。 。 。 .

工具

使用一个或多个关键词搜索所发布的内容.

参数类型默认说明
keywordsstring[]—— 说1至3个关键字的变式
perPagenumber5每个关键词的结果(最多100个)

JSON回归: [{ id, title, type }, ...]

read

获取最多三篇文章的完整内容 .

参数类型说明
articles{ id: number; type: string }[]1至3篇搜索结果

JSON回归: [{ title, content, link }, ...]

type 必须是配置在 postTypes。 。 。 .

response

代理工作流程的最后一步. 在聊天上方的一行MCP App卡中渲染答案.

参数类型默认说明
responsestring—— 说标记下回答文本
mediaUrls{ url, type }[][]图像、视频或YouTube嵌入
sourceLinks{ title, url }[][]归属链接

type 用于媒体: 'image' | 'video' | 'youtube'

代理工作流程

服务器会注射指示,指示代理商:

  1. 搜索 - 从用户的问题中得出2至3个单词关键词的变体(如有需要,翻译成英文)
  2. 读取 获取最相关的1至3篇文章
  3. 回应 ——用平分标记、媒体URL和源链接合成一个答案

打电话后 response,代理回复时应当用一短句指向答题卡(如"参见以上步骤").

许可证

麻省理工学院

版本与发布记录

@elementor/wp-search-mcp 共发布 6 个版本,首次发布于 2026/06/17;过去 12 个月发布了 6 个版本。

版本发布日期距今
1.2.2latest2026/11/112 天前
1.2.12026/11/094 天前
1.2.02026/07/263 个月前
1.1.12026/07/263 个月前
1.1.02026/06/184 个月前
1.0.02026/06/174 个月前

关于 @elementor/wp-search-mcp 的常见问题

@elementor/wp-search-mcp 是什么?

配置 WordPress REST 搜索 MCP 服务器并附带搜索、读取和响应工具

如何安装 @elementor/wp-search-mcp?

在项目目录运行 npm install @elementor/wp-search-mcp,或使用 pnpm add / yarn add / bun add。

@elementor/wp-search-mcp 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@elementor/wp-search-mcp 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@elementor/wp-search-mcp 可以商用吗?

@elementor/wp-search-mcp 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@elementor/wp-search-mcp 的下载量有多少?

根据 npm 官方下载统计,@elementor/wp-search-mcp 在 2026/10/14 – 2026/11/12 这 30 天内被下载 3,139 次,日均约 105 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@elementor/wp-search-mcp 还在维护吗?

最新版本 1.2.2 发布于 2026/11/11(2 天前);至今共发布 6 个版本,其中过去 12 个月发布了 6 个;首次发布于 2026/06/17。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。