WordPress Gutenberg MCP server

Enables WordPress site management and development through a TypeScript-powered REST API and WP-CLI toolkit for automating administrative tasks and plugin interactions
Back to servers
Provider
Michael Tomala
Release date
Feb 16, 2025
Language
TypeScript
Stats
3 stars

MCP server is a lightweight, containerized AI assistant server that implements the Model Context Protocol. It allows you to integrate AI assistants into WordPress through a Gutenberg block, enabling seamless interaction with AI models directly in your WordPress content.

Installation

Prerequisites

  • Docker (for running the containerized server)
  • WordPress site with Gutenberg editor
  • API key for your preferred AI model

Quick Start with Docker

The easiest way to run the MCP server is using Docker:

docker run --rm -p 8080:8080 \
  -e OPENAI_API_KEY=your-openai-api-key \
  ghcr.io/fern4lvarez/mcp:latest

Replace your-openai-api-key with your actual OpenAI API key.

Environment Variables

Configure the server using the following environment variables:

  • OPENAI_API_KEY: Your OpenAI API key (required)
  • MCP_HOST: Host address (default: 0.0.0.0)
  • MCP_PORT: Port number (default: 8080)
  • MCP_LOG_LEVEL: Logging level (default: info)
  • MCP_DEFAULT_MODEL: Default AI model (default: gpt-4-turbo-preview)

Using the MCP Server

Basic Usage

After starting the server, it will be available at http://localhost:8080. You can test if it's running properly with:

curl http://localhost:8080/health

Server Endpoints

The server exposes several endpoints:

  • /health: Health check endpoint
  • /v1/chat: Main chat endpoint for interacting with AI models
  • /v1/models: Lists available models
  • /v1/contexts: Manages conversation contexts

Integrating with WordPress

  1. Install the MCP Gutenberg block plugin in your WordPress site
  2. Add the MCP block to your page or post
  3. Configure the block to connect to your MCP server URL
  4. Set options for the assistant's behavior and appearance

Example API Request

Here's how to make a basic chat request to the server:

curl -X POST http://localhost:8080/v1/chat \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      {"role": "user", "content": "Hello, how can you help me with my WordPress site?"}
    ],
    "model": "gpt-4-turbo-preview"
  }'

Troubleshooting

Common Issues

  • Connection Refused: Ensure Docker is running and the port is correctly mapped
  • Authentication Error: Verify your API key is correctly set in the environment variables
  • Model Not Available: Check that you're using a model that's available with your API key

Checking Logs

View server logs for debugging:

docker logs $(docker ps | grep mcp | awk '{print $1}')

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later