How To Connect OpenCode to WordPress

  1. Install the MCP Adapter plugin on your WordPress site
  2. Create a new user named “mcp” and give it the subscriber role (you’ll change it later)
  3. On the “mcp” user profile, create an application password, name it “OpenCode” and copy it somewhere (it cannot be seen a second time)
  4. Go to the base62encode.org site and encode the text “mcp:[your app. password]”, without the double quotes
  5. Copy the encoded text

Now we configure OpenCode to use that MCP from a project.

  1. Create a folder “wp-management” and, inside that folder, the “.opencode” (this will be our project)
  2. Create a file inside the “.opencode” folder named “opencode.jsonc” with this content:
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "servers": {
      "wordpress": {
        "type": "remote",
        "url": "https://[your site domain]/wp-json/mcp/mcp-adapter-default-server",
        "oauth": false,
        "headers": {
          "Authorization": "Basic [the encoded text]"
        }
      }
    }
  }
}
  1. Start opencode from “wp-management” (if you use the UI change the project to that folder)
  2. Write /mcps and check if it connects to the standard MCP server provided by WordPress
  3. Write “list tools” and you should get the list of all the tools registered

That’s all. Next time we’ll see how to expose a selection of tools via MCP; not everything is registered in WordPress by itself and third-party plugins.

Subscribe to my newsletter (but only if you're interested about WP and plugins)

Similar Posts

Leave a Reply