Automate WordPress Blog Posts with Claude and MCP SDK
Job to be done: Automate blog post creation by connecting an AI model to a WordPress site
🇳🇬 Ways to use this in Nigeria
Ideas to get you started, adapt to your situation.
- Entrepreneur
Automate daily product update posts on your WordPress blog using Claude and MCP SDK.
- Student
Generate weekly summary posts for your personal WordPress blog about course topics using Claude.
- 9-5 employee
Automatically publish company news summaries to your internal WordPress site using Claude and MCP SDK.
What you’ll get
A small custom “server” that connects Claude directly to your WordPress blog, so you can tell Claude “write this post and publish it” and it appears on your site, with categories and tags set. This is an advanced, build-it-yourself workflow: you will run a terminal, write a little TypeScript, and use Claude itself to generate most of the code. It is best for someone comfortable with developer tools.
Tools you need
- Claude (freemium): the AI that writes the posts and, with help, the server code. Free tier works for trying it.
- WordPress (freemium): your blog. You connect to it through its built-in REST API (the way programs create posts).
- MCP SDK (TypeScript) (free): the official Model Context Protocol toolkit. MCP is the standard way to give an AI new abilities (here, “create a WordPress post”). The package is
@modelcontextprotocol/sdk. - TypeScript (free): a safer version of JavaScript, used to write the server.
Steps
-
Create a WordPress Application Password: in your WordPress dashboard, open your user profile and find “Application Passwords”. Generate one and copy it. (An Application Password is a special password for programs, so you never expose your real login.) You should see a one-time string you can copy.
-
Install Node.js: download it from nodejs.org and install. This gives you
nodeandnpm(the tool that installs code packages), which you need to run TypeScript. -
Create a project folder: in your terminal, make and enter a new folder:
mkdir wordpress-mcp-server cd wordpress-mcp-server -
Start the project and add TypeScript:
npm init -y npm install typescript @types/node --save-devYou should see a
package.jsonfile appear and the packages download. -
Install the MCP SDK:
npm install @modelcontextprotocol/sdk -
Have Claude write the server code: create a file named
index.ts, then ask Claude to write the server for you. Paste this prompt:I am building a server using TypeScript and the official MCP SDK (@modelcontextprotocol/sdk) to connect to my WordPress site. I need functions that can: 1. Create a new WordPress post with HTML content, title, categories, and tags. 2. Automatically create new categories or tags if they don't exist. 3. Retrieve existing categories, tags, and recent posts from my WordPress site. 4. Update an existing post and change its publication status. Please provide example TypeScript code using @modelcontextprotocol/sdk. I will handle WordPress REST API authentication separately using an Application Password.Paste Claude’s code into
index.tsand fill in your WordPress site URL and Application Password where it asks. -
Compile and run the server: turn the TypeScript into runnable JavaScript and start it:
npx tsc node dist/index.jsYou should see a message that the server is running and ready.
-
Tell Claude to publish a post: connect Claude to your running MCP server (in the Claude desktop app’s connector settings), then prompt it:
Write a blog post about the benefits of using AI for content creation. Include at least two categories and three tags. Publish it directly to my WordPress blog using the MCP server.You should see the new post appear on your WordPress site, or a confirmation from the server.
Original source
Based on a Hacker News post by MaysonL describing an experiment to build a custom Model Context Protocol (MCP) server that connects Claude directly to a WordPress blog for automated posting.
Notes & variations
- Free-tier alternative: Claude’s free tier works, but heavy use hits rate limits. You can have Claude draft posts and publish less often to stay within them.
- Common pitfall: a wrong or mis-pasted Application Password is the usual reason the connection to WordPress fails. Copy it exactly, including spaces if shown.
- Tip for better results: keep editorial control. Have Claude draft the post first, review and edit it yourself, then publish the finalized version rather than auto-publishing unread.