Back to Blog

Build an MCP Server for WordPress So AI Assistants Can Actually Use Your Site

Published on 21 July 2026

There’s a recurring problem with AI assistants: they’re brilliant reasoners with no hands. They can talk about your WordPress site all day, but they can’t actually search it, read a specific post, or check today’s stock — unless you build the connection yourself, over and over, for every assistant and every integration.

The Model Context Protocol (MCP) is the emerging standard that fixes this. Think of it as a universal adapter between AI assistants and the tools and data they need. Build one MCP server for your WordPress site, and any MCP-compatible assistant — Claude, an IDE agent, your own custom app — can use it. Write the integration once, not once per client.

What MCP actually is

MCP is a small, open protocol that lets an AI application discover and call capabilities exposed by a server. A server offers three things:

  • Tools — actions the assistant can invoke: search_posts, get_product, create_draft.
  • Resources — data the assistant can read: a specific page, a category listing, a product.
  • Prompts — reusable, parameterised instructions the assistant can pull in.

The assistant connects, asks “what can you do?”, and gets a machine-readable list. From there it decides which tool to call and when. You’re not writing bespoke glue for each AI product; you’re publishing a menu that any of them can read.

Why WordPress is a natural fit

WordPress already has the two things an MCP server needs: a clean data model (posts, pages, taxonomies, custom post types) and a mature API layer (the REST API and WPGraphQL). Your content is already structured and already queryable. An MCP server is a thin translation layer that turns those endpoints into tools an AI can reason about.

That means you can give an assistant genuinely useful capabilities without touching WordPress core: search the blog, fetch a page’s content for grounding, list products in a category, draft a post for review.

A minimal WordPress MCP server

Here’s the shape of it — a server that exposes content search and retrieval as tools, backed by the WordPress REST API:

import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';

const wp = (path) =>
  fetch(`${process.env.WP_URL}/wp-json/wp/v2/${path}`).then(r => r.json());

const server = new McpServer({ name: 'wordpress', version: '1.0.0' });

server.tool(
  'search_posts',
  'Search published blog posts by keyword.',
  { query: z.string() },
  async ({ query }) => {
    const posts = await wp(`posts?search=${encodeURIComponent(query)}&_fields=title,link,excerpt`);
    return { content: [{ type: 'text', text: JSON.stringify(posts) }] };
  }
);

server.tool(
  'get_post',
  'Fetch the full content of one post by slug.',
  { slug: z.string() },
  async ({ slug }) => {
    const [post] = await wp(`posts?slug=${slug}&_fields=title,content`);
    return { content: [{ type: 'text', text: post?.content?.rendered ?? 'Not found' }] };
  }
);

Two tools, and an assistant can already answer questions grounded in your real content: search for relevant posts, pull the winner, quote it accurately with a link. Add list_products and get_order_status and you’ve extended the same pattern to WooCommerce.

Keep it safe from the start

An MCP server is a door into your site, so it gets the same discipline as any agent tool:

  • Read-only by default. Search and fetch are low-risk. Anything that writes — create_draft, update_post — should use a scoped application password with the minimum role, and ideally require a human to approve the result.
  • Authenticate the server. Don’t expose an unauthenticated MCP endpoint to the open internet. Gate it behind a token, and run it server-side.
  • Expose only public content by default. Filter to published posts and public pages unless you deliberately, and carefully, decide otherwise.
  • Return structured, minimal data. Fetch only the fields you need. Smaller payloads are cheaper, faster, and leak less.

Where this goes

Once your WordPress site speaks MCP, it stops being a passive website and becomes a capability other systems can build on. You can point Claude at it to research and draft content from your own library. You can wire it into an internal tool that answers staff questions from your knowledge base. You can let a customer-facing agent use the exact same server, with a tighter permission set.

That’s the real shift: you build the connection to your content once, as a clean, well-guarded interface, and every AI application you adopt afterwards can plug straight in. In a world where new assistants appear every few months, writing the integration once is a genuine strategic advantage.


Want an MCP server built for your WordPress or WooCommerce site so AI tools can use it safely? Get in touch — I design the tools, the guardrails and the auth so it’s useful and secure from day one.

Let's Work Together

Got a project like this in mind?

I build bespoke AI agents, RAG systems, and high-performance WordPress & Next.js sites. Let's talk about what's possible.