mcp-server

The mcp-server is a WordPress plugin that implements an MCP (Model Context Protocol) server using the WordPress REST API. This plugin aims to implement the new Streamable HTTP transport as described in the latest MCP specification. Under the hood, it utilizes the logiscape/mcp-sdk-php package to set up a fully functioning MCP server, exposing this functionality through a new REST API route in WordPress. Note that the Streamable HTTP transport is not fully implemented yet, and there are no tests, so it may not work as expected.

GitHub Stars

51

User Rating

Not Rated

Favorites

0

Views

21

Forks

12

Issues

6

Installation
Difficulty
Intermediate
Estimated Time
10-20 minutes
Requirements
WordPress: 最新版
WP-CLI: 最新版

Installation

Installation

Prerequisites

WordPress: Latest version
WP-CLI: Latest version

Installation Steps

1. Install the Plugin

bash
wp plugin install --activate https://github.com/mcp-wp/mcp-server/archive/refs/heads/main.zip

2. Install AI Services Plugin

bash
wp plugin install --activate ai-services

3. Install MCP Command

bash
wp package install mcp-wp/ai-command:dev-main

4. Add MCP Server

bash
wp mcp server add "mysite" "https://example.com/wp-json/mcp/v1/mcp"

5. Execute AI Command

bash
wp ai "Greet my friend Pascal"

Troubleshooting

Common Issues

Issue: Plugin is not functioning correctly Solution: Check the versions of WordPress and WP-CLI.

Configuration

Configuration

Basic Configuration

The configuration for the MCP server is done through the WordPress admin panel. No special configuration files are required, but it is recommended to set API keys and other environment variables as needed.

Security Settings

Store API keys securely.
Set appropriate file access permissions.

Configuration Example

No special configuration is required, but environment variables can be set as needed.

Examples

Examples

Basic Usage

Here are basic usage examples for the MCP server:

Using with WP-CLI

1Verify MCP Server Startup
bash
   wp mcp server add "mysite" "https://example.com/wp-json/mcp/v1/mcp"
   
2Execute AI Command
bash
   wp ai "Greet my friend Pascal"
   

Programmatic Usage

javascript
// JavaScript example (Node.js)
const { MCPClient } = require('@modelcontextprotocol/client');

const client = new MCPClient();
await client.connect();

// Execute tool
const result = await client.callTool('toolName', {
  parameter1: 'value1',
  parameter2: 'value2'
});

console.log(result);

Use Cases

Build an MCP server on a WordPress site and integrate it with AI tools.
Use WP-CLI to add new endpoints to the MCP server.
Integrate with AI services to generate responses based on user requests.
Use the MCP server to retrieve and process data from the file system.