convez.ai
MCP ServerIntegração & APIsIntermediário
sadaigm

WordPress MCP Server

sadaigm/wp-mcp

Gerencie WordPress via MCP com CRUD completo de posts, páginas e conteúdo

Ver no GitHub
InicialPluginScore · de 0 a 100

Servidor MCP para integração com a API REST do WordPress, permitindo gerenciar posts, páginas, categorias, tags e comentários via protocolo padronizado. Oferece autenticação segura, busca no site e prompts pré-configurados para otimização de conteúdo e SEO.

Instalação

$npx convez-ai sadaigm/wp-mcp

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
0
Forks
0
Acompanhando
0
Saúde
28%
Último commit
há 5 meses
Versão
—
Issues abertas
0
Contribuidores
1

Casos de uso

  • Automação de publicação e gerenciamento de rascunhos em bulk
  • Integração de WordPress com fluxos de trabalho Claude e agentes IA
  • Busca e moderação de conteúdo (posts, páginas, comentários) de forma programática
  • Criação e otimização de conteúdo com sugestões de SEO

Veredito

Solução sólida para quem precisa expor funcionalidades WordPress via MCP. Bem estruturada com Docker e autenticação via Application Passwords. Recomendada para automação de conteúdo e integrações com agentes Claude, mas requer WordPress ativo e configurado.

README

A tradução para o português deste README ainda está na fila.

WordPress MCP Server

A Model Context Protocol (MCP) server for interacting with the WordPress REST API. This server provides tools for managing WordPress posts, pages, categories, tags, comments, and site search through a standardized MCP interface.

Features

  • Posts Management: Create, read, update, and delete WordPress posts with bulk publishing
  • Pages Management: Create, read, update, and delete WordPress pages with hierarchical support and bulk publishing
  • Categories Management: Create, read, update, and delete WordPress categories with parent-child relationships
  • Tags Management: Create, read, update, and delete WordPress tags for content labeling
  • Comments Management: Create, read, update, moderate, and delete WordPress comments with bulk approval
  • Site Search: Search across posts, pages, categories, and tags
  • Authentication: Basic authentication using WordPress Application Passwords
  • Resources: Quick access to posts, pages, categories, tags, and comments
  • Prompts: Pre-built prompts for content creation and SEO optimization

Installation

Option 1: Docker (Recommended)

  1. Configure environment variables:
cp .env.example .env
# Edit .env with your WordPress credentials
  1. Build and run with Docker:
# Build the image
./build-image.sh

# Or with docker-compose
docker-compose up -d
  1. The server will be available at http://localhost:8000

Option 2: Local Python

  1. Install dependencies:
pip install -r requirements.txt
  1. Configure environment variables (see Configuration section below)

  2. Run the server:

python wordpress_server.py

Configuration

The server requires the following environment variables:

Required Environment Variables

Create a .env file or set these in your environment:

# WordPress site URL (without trailing slash)
WP_URL=https://example.com

# WordPress username
WP_USERNAME=admin

# WordPress Application Password (create in WP Admin > Users > Profile > Application Passwords)
WP_APP_PASSWORD=abcd-efgh-ijkl-mnop-1234-5678

Creating an Application Password in WordPress

  1. Log in to your WordPress admin dashboard
  2. Go to Users > Profile
  3. Scroll down to Application Passwords section
  4. Enter a name (e.g., "MCP Server")
  5. Click Add New Application Password
  6. Copy the generated password (you'll only see it once!)

Available Tools

Posts

ToolDescription
list_postsList posts with filtering options
get_postRetrieve a single post by ID
create_postCreate a new post
update_postUpdate an existing post
delete_postDelete a post (move to trash or force delete)
list_draft_postsList all draft posts
publish_postPublish a single draft post
publish_bulk_postsPublish multiple posts at once
publish_all_draftsPublish ALL draft posts at once

Pages

ToolDescription
list_pagesList pages with filtering options
get_pageRetrieve a single page by ID
create_pageCreate a new page
update_pageUpdate an existing page
delete_pageDelete a page (move to trash or force delete)
list_draft_pagesList all draft pages
publish_pagePublish a single draft page
publish_bulk_pagesPublish multiple pages at once
publish_all_draft_pagesPublish ALL draft pages at once

Categories

ToolDescription
list_categoriesList categories with filtering options
get_categoryRetrieve a single category by ID
create_categoryCreate a new category
update_categoryUpdate an existing category
delete_categoryDelete a category

Tags

ToolDescription
list_tagsList tags with filtering options
get_tagRetrieve a single tag by ID
create_tagCreate a new tag
update_tagUpdate an existing tag
delete_tagDelete a tag

Comments

ToolDescription
list_commentsList comments with filtering options
get_commentRetrieve a single comment by ID
create_commentCreate a new comment
update_commentUpdate an existing comment
delete_commentDelete a comment
approve_commentApprove a comment immediately
spam_commentMark a comment as spam
list_pending_commentsList pending comments for moderation
bulk_approve_commentsApprove multiple comments at once

Search

ToolDescription
search_siteSite-wide search across all content
search_postsSearch only posts
search_pagesSearch only pages

Usage Examples

Creating a Post

# Via MCP client
result = await create_post(
    title="My New Post",
    content="This is the post content with <strong>HTML</strong>.",
    status="draft",
    categories=[5, 10],
    tags=[15]
)

Draft to Publish Workflow

# 1. Create posts as drafts
post1 = await create_post(
    title="First Draft",
    content="Content for first post",
    status="draft"
)

post2 = await create_post(
    title="Second Draft",
    content="Content for second post",
    status="draft"
)

# 2. Review your draft posts
drafts = await list_draft_posts()
print(f"Found {len(drafts)} draft posts to review")

# 3. Publish a single post
await publish_post(post_id=post1["id"])

# 4. Or publish multiple specific posts
await publish_bulk_posts(post_ids=[post1["id"], post2["id"]])

# 5. Or publish ALL drafts at once
result = await publish_all_drafts()
print(f"Published {len(result['successful'])} posts")
if result['failed']:
    print(f"Failed to publish {len(result['failed'])} posts")

Creating a Page Hierarchy

# Create parent page
parent = await create_page(
    title="Services",
    content="Our services overview",
    status="publish"
)

# Create child pages
await create_page(
    title="Web Development",
    content="Web development services",
    parent=parent["id"],
    menu_order=1
)

Managing Categories

# Create a category with children
tech = await create_category(
    name="Technology",
    description="Tech-related posts"
)

await create_category(
    name="Python",
    parent=tech["id"]
)

Managing Tags

# Create multiple tags for content organization
javascript = await create_tag(
    name="JavaScript",
    description="JavaScript programming posts"
)

tutorial = await create_tag(
    name="Tutorial",
    description="Tutorial and how-to content"
)

# Assign tags to posts
await update_post(
    post_id=42,
    tags=[javascript["id"], tutorial["id"]]
)

Managing Comments

# Get comments for moderation
pending = await list_pending_comments()

# Approve a comment
await approve_comment(comment_id=157)

# Create a reply to a comment
reply = await create_comment(
    post=42,
    content="Thanks for your feedback!",
    parent=157
)

# Bulk approve comments
result = await bulk_approve_comments(comment_ids=[157, 158, 159])
print(f"Approved {len(result['successful'])} comments")

Site Search

# Search all content
results = await search_site(search="wordpress tutorial")

# Search only posts
posts = await search_posts(search="javascript")

# Search only pages  
pages = await search_pages(search="about")

# Filter by content type
categories = await search_site(
    search="technology",
    type="term",
    subtype="category"
)

Server Configuration

The server uses FastMCP with streamable HTTP transport by default. You can customize the host and port by modifying the server initialization:

mcp = FastMCP("WordPress", host="0.0.0.0", port=8000, json_response=True)

Security Notes

  • Always use HTTPS for your WordPress site URL
  • Keep Application Passwords secure and never commit them to version control
  • Create dedicated Application Passwords for each integration
  • Rotate Application Passwords periodically
  • The server requires authentication for write operations (POST, PUT, DELETE)

Error Handling

The server returns error information in the following format:

{
  "error": true,
  "status_code": 401,
  "message": "Sorry, you are not allowed to do that."
}

Common HTTP status codes:

  • 401 - Authentication failed or missing
  • 400 - Invalid request parameters
  • 404 - Resource not found
  • 403 - Forbidden (insufficient permissions)

Development

Project Structure

wp-mcp/
├── wordpress_server.py      # Main server implementation
├── pyproject.toml           # Project configuration
├── requirements.txt         # Python dependencies
├── Dockerfile               # Docker image configuration
├── docker-compose.yml       # Docker Compose configuration
├── build-image.sh           # Build script for Docker image
├── .dockerignore            # Files to exclude from Docker build
├── README.md                # This file
├── .env.example             # Example environment variables
└── docs/                    # API documentation

Docker Deployment

The Docker setup includes:

  • Health checks: Monitors server availability
  • Auto-restart: Container restarts on failure
  • Environment variables: Loaded from .env file
  • Exposed port: 8000 (configurable via docker-compose.yml)

Docker Commands

# Build the image
docker build -t wp-mcp:latest .

# Run with docker-compose
docker-compose up -d

# View logs
docker-compose logs -f

# Stop the container
docker-compose down

# Rebuild after changes
docker-compose up -d --build

Adding New Tools

To add a new tool, decorate a function with @mcp.tool():

@mcp.tool()
async def my_new_tool(param: str) -> Dict[str, Any]:
    """Tool description."""
    # Implementation
    return result

License

MIT

Resources

Ver o original no GitHub

Bom para

Relacionados