@elementor/wp-search-mcp

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

Configurable WordPress REST search MCP server with search, read, and response tools

原始使用文档
文档目录12 节
  1. Overview
  2. Requirements
  3. Installation
  4. Quick start
  5. Configuration
  6. Post types
  7. Tools
  8. search
  9. read
  10. response
  11. Agent workflow
  12. License

@elementor/wp-search-mcp

MCP server that lets AI agents search and read published WordPress content, then render answers in an inline MCP App UI.

Overview

WpSearchMcpServer wraps the WordPress REST API and exposes three MCP tools:

ToolPurpose
searchFind published content by keyword
readFetch full rendered HTML for selected articles
responseRender the final answer in an inline UI card (markdown, media, source links)

The server also registers MCP App instructions that guide agents through a search → read → response workflow.

Requirements

  • A WordPress site with the REST API enabled
  • The core /wp/v2/search endpoint available for the configured post types
  • An MCP host that supports MCP Apps (required for the response tool UI)

Installation

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

Dependency: @modelcontextprotocol/sdk ^1.29.0 (installed automatically as a transitive dependency).

Quick start

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);

Pass wpSearch.server to any MCP transport your host uses (stdio, SSE, streamable HTTP, etc.).

Configuration

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'
  };
};

Post types

postTypes controls which WordPress content types are searched and how read resolves REST paths.

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

Keys are passed to /wp/v2/search as subtype[] values. Values are the REST collection segments used by /wp/v2/{segment}/{id}.

Tools

Searches published content using one or more keywords.

ParameterTypeDefaultDescription
keywordsstring[]—1–3 keyword variations
perPagenumber5Results per keyword (max 100)

Returns JSON: [{ id, title, type }, ...]

read

Fetches full rendered content for up to three articles.

ParameterTypeDescription
articles{ id: number; type: string }[]1–3 articles from search results

Returns JSON: [{ title, content, link }, ...]

type must be one of the keys configured in postTypes.

response

Final step in the agent workflow. Renders the answer in an inline MCP App card above the chat.

ParameterTypeDefaultDescription
responsestring—Markdown answer text
mediaUrls{ url, type }[][]Images, videos, or YouTube embeds
sourceLinks{ title, url }[][]Attribution links

type for media: 'image' | 'video' | 'youtube'

Agent workflow

The server injects instructions telling agents to:

  1. Search — derive 2–3 single-word keyword variations from the user's question (translate to English if needed)
  2. Read — fetch the 1–3 most relevant articles
  3. Response — synthesize an answer with markdown, media URLs, and source links

After calling response, the agent should reply with one short sentence pointing at the answer card (e.g. "See the steps above.").

License

MIT

版本与发布记录

@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 是什么?

Configurable WordPress REST search MCP server with search, read, and response tools

如何安装 @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 和提交记录判断。