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.
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.
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
)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
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 contextsHere'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"
}'
View server logs for debugging:
docker logs $(docker ps | grep mcp | awk '{print $1}')
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.
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"
]
}
}
}
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.
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.