← Back to Home

How MCP Works

A technical deep-dive into the Model Context Protocol for developers and the curious.

The Protocol

MCP (Model Context Protocol) is an open standard created by Anthropic that defines how AI assistants communicate with external services. Think of it as a standardized API that any AI can speak.

Under the hood, MCP uses:

  • JSON-RPC 2.0 - A lightweight remote procedure call protocol
  • HTTP Transport - Requests are sent as POST requests to an MCP endpoint
  • Streamable responses - For real-time feedback on long operations

The Flow

AI Agent
Claude, ChatGPT, Cursor...
MCP Protocol
JSON-RPC over HTTP
WordPress
MCP Server (Plugin)
  1. Discovery: The AI asks the MCP server "What tools do you have?" via tools/list
  2. Selection: The AI decides which tool to use based on the user's request
  3. Execution: The AI calls the tool via tools/call with the required parameters
  4. Response: The server executes the action and returns the result

Example Request

Here's what it looks like when an AI asks WordPress to create a post:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "create_post",
    "arguments": {
      "title": "My New Post",
      "content": "Hello world!",
      "status": "draft"
    }
  }
}

And the response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "content": [{
      "type": "text",
      "text": "Created post #123: My New Post (draft)"
    }]
  }
}

Tools vs Resources

MCP defines two main primitives:

🔧 Tools

Actions the AI can take. These do things:

  • create_post
  • update_post
  • delete_media
  • run_query

📄 Resources

Data the AI can read. These provide context:

  • site://posts
  • site://media
  • site://options

Authentication

MCP servers typically use bearer token authentication:

Authorization: Bearer your-secret-token

The token is configured in your WordPress plugin and added to your AI client's MCP configuration.