MCP Setup Help

Setup Guide for WebSamurai

Connect your WordPress site to your AI chatbots using the Model Context Protocol. Manage posts, pages, and custom content directly from Claude Desktop or other MCP-compatible clients. These instructions are only if you are using your own chatbot to access the site, if you have the premium, all you need to do is login on the WordPress admin (under “WebSamurai”) menu item.


๐Ÿ“‹ What You’ll Need

โœ“ WebSamurai Plugin

The WebSamurai plugin installed and activated on your WordPress site. You can download the zip from here or download it from the plugin repository

โœ“ API Key

Generate an API key from your WordPress admin panel (Settings โ†’ WebSamurai)

โœ“ MCP Client

Claude Desktop, Claude Code, or another MCP-compatible AI assistant


๐Ÿ”‘ Step 1: Generate Your API Key

  1. Navigate to Settings โ†’ WebSamurai in your WordPress admin panel
  2. Click on the API Keys tab
  3. Enter a name for your key (e.g., “Claude Desktop” or “My Local Development”)
  4. Click Generate API Key
  5. Important: Copy the API key immediately – you won’t be able to see it again!

๐Ÿ’ก Pro Tip: Store your API key in a password manager or secure note. If you lose it, you’ll need to generate a new one.


โš™๏ธ Step 2: Configure Your MCP Client

Choose your AI chatbot below for specific setup instructions:

Claude Desktop Setup

1. Locate your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%Claudeclaude_desktop_config.json
  • Linux: ~/.config/claude/claude_desktop_config.json

2. Edit the configuration file and add the WebSamurai MCP server:

{
  "mcpServers": {
    "websamurai": {
      "command": "npx",
      "args": [
        "-y",
        "@websamurai/mcp-wp-remote",
        "https://yoursite.com",
        "your-api-key-here"
      ]
    }
  }
}

3. Replace the placeholders:

  • Replace https://yoursite.com with your actual WordPress site URL
  • Replace your-api-key-here with the API key you generated in Step 1

4. Restart Claude Desktop for the changes to take effect.

Claude Code (CLI) Setup

In the directory you’re coding from, execute the following at the command line:

claude mcp add -t http wordpress_site_name https://wp_site_url.com/wp-json/websamurai/v1/mcp --header "X-API-Key: <YOUR_API_KEY>"

If you are using a local install, and/or your certificate is invalid, you can add on an enviroment variable to allow it to connect:

claude mcp add -t http wordpress_site_name https://wp_site_url.com/wp-json/websamurai/v1/mcp --header "X-API-Key: <YOUR_API_KEY>" -e "NODE_TLS_REJECT_UNAUTHORIZED=0"

You may also need to add a enviroment variable for “NODE_TLS_REJECT_UNAUTHORIZED=0” at your command line using:

Linux or Mac OS:

export NODE_TLS_REJECT_UNAUTHORIZED=0

or windows:

set NODE_TLS_REJECT_UNAUTHORIZED=0

Restart Claude Code or reload the configuration.

ChatGPT Setup

Current Status: OpenAI ChatGPT does not natively support the Model Context Protocol (MCP) as of early 2025.

Alternative: Custom GPT Actions

You can create a Custom GPT with Actions that connect to your WordPress site’s REST API:

  1. Go to ChatGPT and create a new Custom GPT
  2. In the Actions section, add your WordPress REST API endpoint:
    https://yoursite.com/wp-json/websamurai/v1/mcp
  3. Configure authentication using your API key:
    • Authentication Type: API Key
    • Header Name: X-API-Key
    • API Key: Your generated API key
  4. Define the available actions (create post, update page, etc.)
  5. Test the connection and save your Custom GPT

Note: This approach provides similar functionality to MCP but requires manual configuration of each action in the Custom GPT interface.

Cursor

1. Open Cursor

2. Open Cursor settings (gear icon in Cursor panel)

3. Navigate to MCP Servers section

4. Add the WebSamurai server configuration:

{
  "mcpServers": {
    "websamurai": {
      "url": "https://www.Your.site/wp-json/websamurai/v1/mcp",
      "headers": {
        "API_KEY": "YOUR API KEY"
      }
    }
  }
}

5. Save the settings and restart the Cursor extension

You should now see WebSamurai tools available in Cursor’s tool list.

Other MCP-Compatible Clients

Many AI tools are adding MCP support. The configuration is generally similar across all clients:

General Configuration Pattern

  1. Locate the MCP configuration file for your client
  2. Add a server configuration in JSON format
  3. Specify the command (npx), package (@websamurai/mcp-wp-remote), and your site URL
  4. Set the WEBSAMURAI_API_KEY environment variable
  5. Restart the application

Template Configuration

{
  "mcpServers": {
    "websamurai": {
      "command": "npx",
      "args": [
        "-y",
        "@websamurai/mcp-wp-remote",
        "https://yoursite.com",
        "your-api-key-here"
      ],
    }
  }
}

Known Compatible Clients

  • Continue.dev – AI coding assistant with MCP support
  • Zed Editor – Modern code editor with built-in AI
  • Cursor – AI-first code editor
  • LibreChat – Open source chat platform

Check your specific client’s documentation for exact configuration paths and formatting requirements.


๐ŸŽฏ What You Can Do

Once connected, you can ask Claude to manage your WordPress content using natural language:

๐Ÿ“„ Manage Pages

  • List all pages
  • Create new pages
  • Update existing pages
  • Delete pages
  • Get page content

๐Ÿ“ Manage Posts

  • List all posts
  • Create new posts
  • Update existing posts
  • Delete posts
  • Manage categories & tags

๐Ÿ”ง Custom Post Types

  • List custom posts
  • Create custom content
  • Update custom posts
  • Delete custom posts
  • Manage custom taxonomies

๐Ÿ“„ List Plugins

  • List the plugins on your site, so the AI can use their resources to build your pages

๐Ÿ“ Custom CSS

  • Read CSS from the customizer
  • Update CSS in the customizer

๐Ÿ’ฌ Example Commands

Here are some example requests you can make to Claude once the MCP server is connected:

“List all pages on my WordPress site”

“Create a new blog post about MCP setup with title ‘Getting Started with MCP'”

“Update the About page to include information about our new services”

“Get the content of the page with slug ‘contact'”

“Delete the draft post with ID 42”


Local Development

For local WordPress installations, use your local URL:

{
  "mcpServers": {
    "websamurai-local": {
      "command": "npx",
      "args": ["-y", "@websamurai/mcp-wp-remote", "http://localhost:8080"],
      "env": {
        "WEBSAMURAI_API_KEY": "local-api-key"
      }
    }
  }
}

โ“ Troubleshooting

Server Not Appearing in Claude

  • Verify the JSON syntax in your config file (use JSONLint to validate)
  • Make sure you’ve restarted your local Chat program (i.e. Claude Desktop) completely
  • Check that npx is installed (run npx --version in terminal)
  • Ensure your WordPress site URL is correct and accessible

Authentication Errors

  • Double-check your API key is correct
  • Verify the API key hasn’t been deleted from WordPress
  • Check for extra spaces or quotes around the API key

Connection Failures

  • In the examples above, you need to make sure your replace the url of the site and the API key within them.
  • Check you have the exact URL correct. If your site starts with “www” you must use that url, if the url specified has a redirect, it will not work.
  • Confirm your WordPress site is online and accessible
  • Check if your site has SSL issues, it may not connect if your certificate is not valid.
  • if your site is https://yoursite.com/, you can specify either the site url (https://yoursite.com/) or your full MCP url (https://yoursite.com/wp-json/websamurai/v1/mcp), but not other urls on your site
  • Verify no firewall is blocking the connection to the REST API. This includes if you have password protect plugins or REST API blocking, these will need a whitelist for https://yoursite.com/wp-json/websamurai/v1/mcp
  • If you have curl on your command line, test the MCP endpoint directly:
curl -k -X POST -H "Content-Type: application/json" \
   -H "X-API-Key: <Replace with API KEY>" \
   -d '{"jsonrpc": "2.0", "method": "tools/call", "params":{"name":"echo","arguments":{"message":"test"}}}' \
   'https://<replacewithyoursite.com>/wp-json/websamurai/v1/mcp/'

Should Return:
{"jsonrpc":"2.0","id":null,"result":{"content":[{"type":"text","text":"test"}]}}

Viewing Logs

To debug issues, check Claude Desktop’s logs:

  • macOS: ~/Library/Logs/Claude/
  • Windows: %APPDATA%Claudelogs
  • Linux: ~/.config/claude/logs/

๐Ÿ”’ Security Best Practices

  • Never commit API keys to version control – Keep them in your local config only
  • Use different keys for different environments – Separate keys for production, staging, and local
  • Rotate keys regularly – Generate new API keys periodically and delete old ones
  • Monitor API usage – Check the “Last Used” column in your API Keys list
  • Use descriptive key names – This helps you identify which key is used where
  • Delete unused keys – Remove API keys you’re no longer using

๐Ÿ“š Additional Resources


Ready to Get Started?

Head to your WordPress admin panel and generate your first API key to begin managing your content with AI.