# @elementor/wp-search-mcp 中文文档

规范地址：https://npmcn.com/package/%40elementor/wp-search-mcp/

版本：1\.2\.2
npm 元数据更新时间：2026-11-11T09:50:26.585Z
中文译文更新时间：2026-11-13T18:59:57.167Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40elementor/wp-search-mcp
原文对照：https://npmcn.com/package/%40elementor/wp-search-mcp/?lang=original
项目主页：https://github.com/elementor/angie-mcp-utils#readme
源码仓库：https://github.com/elementor/angie-mcp-utils

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：723 kB，21 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- 运行依赖：4 个
- 首次发布：2026-06-17T15:41:20.869Z
- 最新版本发布：2026-11-11T09:50:26.332Z
- 近 30 天下载量：3139（2026-10-14 至 2026-11-12，npm 官方下载统计）
- 已发布版本数：6（近 12 个月 6 个）

## 中文简介

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

## 安装

```sh
npm install @elementor/wp-search-mcp
```

也可以使用：`pnpm add @elementor/wp-search-mcp`、`yarn add @elementor/wp-search-mcp`、`bun add @elementor/wp-search-mcp`

## README

# @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 应用程序](https://github.com/modelcontextprotocol/ext-apps) (对 `response` 工具 UI )

## 安装

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

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

## 快开始

```typescript
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等) .

## 配置

```typescript
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 路径.

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

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

## 工具

### `search`

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

| 参数 | 类型 | 默认 | 说明 |
| --- | --- | --- | --- |
| `keywords` | `string[]` | —— 说 | 1至3个关键字的变式 |
| `perPage` | `number` | `5` | 每个关键词的结果(最多100个) |

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

### `read`

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

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

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

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

### `response`

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

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

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

## 代理工作流程

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

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

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

## 许可证

麻省理工学院

## 常见问题

### @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 和提交记录判断。

