WordPress MCP Server

WordPress MCP Server

A Model Context Protocol (MCP) server that bridges AI assistants to WordPress, enabling natural-language management of posts, pages, media, comments, users, plugins, and settings across multiple sites simultaneously.

Category
访问服务器

README

WordPress MCP Server

A Model Context Protocol (MCP) server that bridges AI assistants to WordPress, enabling natural-language management of posts, pages, media, comments, users, plugins, and settings across multiple sites simultaneously.

What is MCP?

The Model Context Protocol is an open standard that lets AI clients (like Claude Desktop and Claude Code) interact with external tools and data sources through a unified interface. This server implements MCP to expose WordPress REST API operations as callable tools, so an AI assistant can manage your WordPress sites through conversation.

AI Client (Claude)  --MCP-->  WordPress MCP Server  --REST API-->  WordPress Sites

Features

  • 23 tools covering the full WordPress content lifecycle
  • Multi-site support -- manage multiple WordPress installations from a single server
  • Tag-based filtering -- organize sites by tag and run operations against groups
  • Bulk execution -- execute any tool across multiple sites in one call
  • Fleet health monitoring -- check reachability and status of all configured sites
  • Async architecture -- built on Python's asyncio for non-blocking API calls
  • Structured logging -- SQLite-backed request/response logging for auditability

Available Tools

Tool Description
wp-list-sites List all configured WordPress sites, optionally filtered by tag
wp-site-status Check the health/reachability of a single WordPress site
wp-fleet-status Check the health of all configured sites (or those matching a tag)
wp-list-posts List posts on a WordPress site
wp-create-post Create a new post on a WordPress site
wp-update-post Update an existing post on a WordPress site
wp-delete-post Delete a post on a WordPress site
wp-list-pages List pages on a WordPress site
wp-create-page Create a new page on a WordPress site
wp-update-page Update an existing page on a WordPress site
wp-delete-page Delete a page on a WordPress site
wp-list-media List media items on a WordPress site
wp-update-media Update a media item on a WordPress site
wp-list-comments List comments on a WordPress site
wp-update-comment Update a comment on a WordPress site
wp-delete-comment Delete a comment on a WordPress site
wp-list-categories List categories on a WordPress site
wp-create-category Create a new category on a WordPress site
wp-list-tags List tags on a WordPress site
wp-create-tag Create a new tag on a WordPress site
wp-list-users List users on a WordPress site
wp-list-plugins List installed plugins on a WordPress site
wp-get-settings Get WordPress site settings
wp-bulk-execute Execute a tool across multiple sites (filtered by tag)

Tech Stack

  • Python 3.10+
  • MCP SDK (mcp) -- Model Context Protocol framework
  • httpx -- async HTTP client for WordPress REST API calls
  • aiosqlite -- async SQLite for structured logging
  • python-dotenv -- environment-based credential management
  • pytest / pytest-asyncio / respx -- testing with async support and HTTP mocking

Installation

git clone https://github.com/ad02/WP-MCP-project.git
cd WP-MCP-project
pip install -e .

For development (includes test dependencies):

pip install -e ".[dev]"

Configuration

1. Site Configuration

Copy the example and edit it to register your WordPress sites:

cp config/sites.json.example config/sites.json
{
  "sites": [
    {
      "id": "my-site",
      "name": "My WordPress Site",
      "url": "https://example.com",
      "username": "mcp-agent",
      "app_password_env": "SITE_MY_SITE_APP_PASSWORD",
      "tags": ["production"],
      "enabled": true
    }
  ]
}

2. Credentials

Copy the example environment file and add your WordPress Application Passwords:

cp config/.env.example config/.env

Then edit config/.env:

SITE_MY_SITE_APP_PASSWORD=abcd efgh ijkl mnop qrst uvwx

Note: Application Passwords require WordPress 5.6+ and HTTPS. Generate them from Users > Profile > Application Passwords in the WordPress admin dashboard.

3. Connect to Claude

Claude Desktop -- add to your claude_desktop_config.json:

{
  "mcpServers": {
    "wp-mcp-hub": {
      "command": "python",
      "args": ["-m", "src"],
      "cwd": "/path/to/WP-MCP-project"
    }
  }
}

Claude Code -- add to your .claude/settings.json or project config:

{
  "mcpServers": {
    "wp-mcp-hub": {
      "command": "python",
      "args": ["-m", "src"],
      "cwd": "/path/to/WP-MCP-project"
    }
  }
}

Usage

Once connected, your AI client can call any of the 23 tools through natural conversation:

  • "List all posts on my-site" -- calls wp-list-posts
  • "Create a draft post titled 'Hello World' on my-site" -- calls wp-create-post
  • "Check the status of all production sites" -- calls wp-fleet-status with tag filter
  • "Delete comment 42 on my-site" -- calls wp-delete-comment
  • "Run wp-list-plugins across all sites tagged 'production'" -- calls wp-bulk-execute

Testing

The test suite uses pytest with async support and HTTP response mocking (respx):

pytest -v

Tests cover configuration loading, WordPress API client behavior, tool registration, connection handling, batch execution, and structured logging.

Project Structure

WP-MCP-project/
├── src/
│   ├── __init__.py
│   ├── server.py        # MCP server entry point
│   ├── tools.py         # 23 tool definitions and handlers
│   ├── wp_client.py     # Async WordPress REST API client
│   ├── config.py        # Site configuration loader
│   ├── connection.py    # Connection/health checking
│   ├── batch.py         # Multi-site bulk execution
│   └── logger.py        # SQLite-backed structured logging
├── config/
│   ├── .env.example         # Template for credentials
│   └── sites.json.example   # Template for site registry
├── tests/               # pytest test suite
├── pyproject.toml
└── README.md

License

This project is licensed under the MIT License.

Author

Roland Dalaguit -- github.com/ad02

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选