Claude Code is a coding assistant that runs in your terminal. Connect it to WordPress through MCP and it can work with your site’s content while it also sees your theme or plugin code. That combination is useful for developers who maintain both.
This guide shows how to connect Claude Code to WordPress, using the commands Claude Code documents for adding MCP servers. As always, what Claude Code can do on your site depends on the tools your WordPress MCP plugin or server exposes.
What Is Claude Code?
Claude Code is Anthropic’s agentic coding tool. It works from the command line, reads your project, and can run commands and edit files. It can also act as an MCP client, which means it can connect to MCP servers and use the tools they provide.
How the Connection Works
| Piece | Role |
|---|---|
| Claude Code | The MCP client that reads your prompt and picks a tool. |
| MCP | The protocol that lets the client discover and call tools. |
| WordPress MCP plugin or server | Publishes the tools and runs them on your site. |
| WordPress | Your site, where the action happens. |
Before You Start
- A WordPress site with a working MCP server or plugin
- The MCP endpoint address and the authentication method your plugin uses
- A dedicated WordPress user with limited permissions
- Claude Code installed, following Anthropic’s current instructions
- A backup, and ideally a staging site
Step-by-Step: Add Your WordPress MCP Server
- Prepare the server. Install your WordPress MCP plugin, create a limited user, and enable only the tools you need.
- Copy the connection details. Note the endpoint URL and how the plugin expects you to authenticate.
- Add the server. For a remote server, Claude Code’s documented format is
claude mcp add --transport http <name> <url>. - Add credentials if required. Some servers accept a header. Claude Code supports a
--headeroption for this. - Check the connection. Run
claude mcp listin your terminal, or type/mcpinside a Claude Code session. - Authenticate if asked. If your plugin uses OAuth, the
/mcpscreen lets you start the sign-in.
Example Commands
These are placeholders. Your plugin’s documentation provides the real endpoint and any authentication details.
claude mcp add --transport http my-wordpress https://your-site.example/your-mcp-endpoint
# If your plugin uses a bearer token in a header
claude mcp add --transport http my-wordpress https://your-site.example/your-mcp-endpoint
--header "Authorization: Bearer YOUR_TOKEN"
# Check that it is connected
claude mcp list
Whether your server uses a bearer token, OAuth, or something else depends on the plugin. Do not assume the header above applies to yours.
Choosing a Scope
Claude Code can store an MCP server for just you in one project, for you in every project, or for a team through a project file. Pick carefully:
- Personal scope keeps credentials on your machine.
- Project scope writes to a
.mcp.jsonfile in the project so a team can share it. Never put real tokens in a file you commit.
Test the Connection
Start with a read-only request, such as:
“List my five most recent WordPress posts with their titles and status.”
Then try a low-risk write:
“Create a draft post titled ‘MCP Connection Test’. Do not publish it.”
Confirm in WordPress that the draft exists, then delete it.
What Claude Code Can Do With WordPress
Depending on your server, typical tasks include:
- Reading posts and pages
- Creating drafts and editing content
- Managing categories and tags
- Working with media details, where tools exist
- Combining content tasks with code work, such as updating a theme template and the post that uses it
Example Prompts
- “List posts that have no excerpt. Do not edit anything.”
- “Create a draft post explaining our plugin’s settings page, based on the README in this repository. Do not publish.”
- “Read this changelog file and draft a release-notes post.”
- “Find posts that mention the old plugin name and list them.”
- “Suggest categories for my ten newest drafts and wait for approval.”
Security and Permissions
- Least privilege. Use a limited WordPress user and only the tools you need.
- Protect credentials. Keep tokens out of repositories and shell history where possible.
- Be careful in shared projects. A project-scoped server is available to everyone who uses the project.
- Review before publishing. Keep publishing manual until you trust the workflow.
- Keep backups.
Troubleshooting
The Server Shows as Failed or Needs Authentication
Check the endpoint address, HTTPS, and credentials. If your plugin uses OAuth, complete the sign-in from the /mcp screen.
No Tools Appear
Confirm the tools are enabled in your plugin and that the WordPress user has the right role. Remove and re-add the server if needed.
Permission Errors
The WordPress user probably lacks the capability for that action.
Commands Behave Differently Than This Guide
Claude Code changes over time. Check Anthropic’s current Claude Code documentation for MCP.
Frequently Asked Questions
Can Claude Code connect to WordPress?
Yes, through an MCP server that exposes WordPress tools. Claude Code can act as an MCP client.
Do I need a WordPress MCP plugin?
You need an MCP server that exposes your site’s capabilities. A plugin is a common way to provide one.
Is it safe to give Claude Code access to my site?
It can be, with limited permissions, backups, and human review.
Can Claude Code publish posts?
Only if the server exposes a publishing tool and the connected user may publish.
Conclusion
Connecting Claude Code to WordPress gives developers one place to work on code and content. Start read-only, use a limited user, and keep publishing under your control.
See also our guide to connecting Claude to WordPress and our free MCP server for WordPress.
Explore ByteCore Stack Plugins
- MCP Manager β connect your WordPress site to AI assistants through MCP.
- SMTP Manager β reliable WordPress email delivery.
- Lightsail Manager β manage your AWS Lightsail CDN from WordPress.
