Skip to content

How to Connect OpenCode to WordPress

Connecting OpenCode to your WordPress site brings your content into the terminal: the coding agent can read and update posts and pages, manage media, or inspect site configuration while you work on your project. Easy MCP AI runs the MCP server inside WordPress, and OpenCode connects to it as a remote MCP server with an API token.

In this article

Prerequisites

  • A WordPress site served over HTTPS with Easy MCP AI installed and activated (see the installation guide).
  • Pretty permalinks enabled (Settings > Permalinks set to anything other than "Plain").
  • OpenCode installed and signed in.
  • An Easy MCP AI API token. Create one in Easy MCP AI > API Token & OAuth and copy it when it's shown.

You'll need your site's MCP endpoint URL, which is always your domain followed by /wp-json/easy-mcp-ai/v1/mcp:

https://yoursite.com/wp-json/easy-mcp-ai/v1/mcp

You can copy it from Easy MCP AI > Dashboard in your WordPress admin, in the Quick Start: Connect Your AI Client section.

The Easy MCP AI Dashboard Quick Start card with the MCP endpoint URL and Copy button

Connect OpenCode to Your Site

  1. Open opencode.json in your project (create it if it doesn't exist).
  2. Add the WordPress server, replacing the URL with your endpoint and YOUR_API_TOKEN with your token:
json
{
  "mcp": {
    "wordpress": {
      "type": "remote",
      "url": "https://yoursite.com/wp-json/easy-mcp-ai/v1/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_TOKEN"
      }
    }
  }
}
  1. Save the file and restart OpenCode in that project.

Never commit a real token; keep it in a per-developer file or an environment reference.

Verify the Connection

Start OpenCode and check the MCP servers list. The wordpress server shows as connected with its tools available.

Then try a first prompt:

Which are the five most recent posts on my WordPress site, and which of them are still drafts?

What You Can Do Once Connected

Easy MCP AI exposes your site's capabilities as MCP tools, organized by area: posts, pages, media, comments, categories and tags, menus, custom post types, blocks, revisions, users, plugins, themes, site settings, and search. Integrations such as WooCommerce and SEO data sources are included when available. In the terminal, that pairs naturally with development work:

Create a draft page called "Pricing" using the block markup from the template file in this repo.

List the active plugins on my site and their versions.

Pull the content of the "About" page so I can refactor it into the new layout.

Control What OpenCode Can Access

Everything OpenCode does runs through your API token, so the token is your control point: it acts as the WordPress user you assigned, and you can limit it to specific tools. Site-wide guardrails (globally disabled tools, rate limits, forced drafts, audit log) apply on top. See Creating and Managing API Tokens for details.

Security

If you identify a potential security vulnerability in this plugin, please disclose it responsibly. Follow the protocols on the Themeisle Security Page.

Was this helpful?