Cover image
Try Now
2024-12-30

镜像://github.com/stefans71/wordpress-mcp-server

3 years

Works with Finder

0

Github Watches

5

Github Forks

5

Github Stars

WordPress MCP Server

License: MIT

A Model Context Protocol (MCP) server that enables AI assistants to interact with WordPress sites through the WordPress REST API. This server provides tools for managing WordPress content programmatically, including creating, retrieving, and updating posts.

Features

  • Create new WordPress posts with customizable titles, content, and status
  • Retrieve WordPress posts with pagination support
  • Update existing posts with new content or status
  • Secure authentication using WordPress application passwords
  • Error handling and detailed response messages

Prerequisites

  • Node.js v18 or higher
  • A WordPress site with REST API enabled
  • WordPress application password for authentication

Installation

  1. Clone this repository:
git clone https://github.com/stefans71/wordpress-mcp-server.git
cd wordpress-server
  1. Install dependencies:
npm install
  1. Build the server:
npm run build

WordPress Configuration

Before using the server, you need to set up your WordPress site:

  1. Ensure your WordPress site has REST API enabled (enabled by default in WordPress 4.7+)
  2. Create an application password:
    • Log in to your WordPress admin panel
    • Go to Users → Profile
    • Scroll down to "Application Passwords"
    • Enter a name for the application (e.g., "MCP Server")
    • Click "Add New Application Password"
    • Copy the generated password (you won't be able to see it again)

MCP Configuration

Add the server to your MCP settings file (usually located at ~/AppData/Roaming/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json):

{
  "mcpServers": {
    "wordpress": {
      "command": "node",
      "args": ["path/to/wordpress-server/build/index.js"]
    }
  }
}

Available Tools

1. create_post

Creates a new WordPress post.

Parameters:

  • siteUrl (required): Your WordPress site URL
  • username (required): WordPress username
  • password (required): WordPress application password
  • title (required): Post title
  • content (required): Post content
  • status (optional): Post status ('draft', 'publish', or 'private', defaults to 'draft')

Example:

{
  "tool": "create_post",
  "siteUrl": "https://example.com",
  "username": "admin",
  "password": "xxxx xxxx xxxx xxxx",
  "title": "My First Post",
  "content": "Hello, world!",
  "status": "draft"
}

2. get_posts

Retrieves WordPress posts with pagination.

Parameters:

  • siteUrl (required): Your WordPress site URL
  • username (required): WordPress username
  • password (required): WordPress application password
  • perPage (optional): Number of posts per page (default: 10)
  • page (optional): Page number (default: 1)

Example:

{
  "tool": "get_posts",
  "siteUrl": "https://example.com",
  "username": "admin",
  "password": "xxxx xxxx xxxx xxxx",
  "perPage": 5,
  "page": 1
}

3. update_post

Updates an existing WordPress post.

Parameters:

  • siteUrl (required): Your WordPress site URL
  • username (required): WordPress username
  • password (required): WordPress application password
  • postId (required): ID of the post to update
  • title (optional): New post title
  • content (optional): New post content
  • status (optional): New post status ('draft', 'publish', or 'private')

Example:

{
  "tool": "update_post",
  "siteUrl": "https://example.com",
  "username": "admin",
  "password": "xxxx xxxx xxxx xxxx",
  "postId": 123,
  "title": "Updated Title",
  "content": "Updated content",
  "status": "publish"
}

Response Format

All tools return responses in the following format:

Success Response

{
  "success": true,
  "data": {
    // WordPress API response data
  }
}

Error Response

{
  "success": false,
  "error": "Error message here"
}

Error Handling

The server handles various types of errors:

  • Invalid request format
  • Missing required parameters
  • WordPress API errors
  • Authentication failures
  • Network issues

Each error response includes a descriptive message to help diagnose the issue.

Security Considerations

  • Always use HTTPS URLs for your WordPress site
  • Use application passwords instead of your main WordPress password
  • Keep your application passwords secure and don't share them
  • Consider using WordPress roles and capabilities to limit access
  • Regularly rotate application passwords

Development

To contribute to the development:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests (when available)
  5. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. By contributing to this project, you agree to abide by its terms.

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Khalid kalib
  • Write professional emails

  • Callycode Limited
  • A geek-themed horoscope generator blending Bitcoin prices, tech jargon, and astrological whimsy.

  • ANGEL LEON
  • A world class elite tech co-founder entrepreneur, expert in software development, entrepreneurship, marketing, coaching style leadership and aligned with ambition for excellence, global market penetration and worldy perspectives.

  • https://tovuti.be
  • Oede knorrepot die vasthoudt an de goeie ouwe tied van 't boerenleven

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • INFOLAB OPERATIONS 2
  • A medical specialist offering assistance grounded in clinical guidelines. Disclaimer: This is intended for research and is NOT safe for clinical use!

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • OffchainLabs
  • 进行以太坊的实施

  • huahuayu
  • 统一的API网关,用于将多个Etherscan样区块链Explorer API与对AI助手的模型上下文协议(MCP)支持。

  • deemkeen
  • 用电源组合控制您的MBOT2:MQTT+MCP+LLM

  • zhaoyunxing92
  • MCP(消息连接器协议)服务

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

    Reviews

    4 (1)
    Avatar
    user_y4Z2hIU0
    2025-04-15

    I have been using Model Context Protocol (MCP) by Techiral, and it's truly transformative. The seamless integration and powerful features have significantly boosted my productivity and workflow. The user-friendly interface and robust performance make it a top-tier choice for anyone in need of reliable protocol management. Highly recommended!