Niwa View demo
Niwa
niwa@niwachat.comContact
The notebook
AI & E-Commerce

How to Connect Claude to WordPress with MCP

Configure Claude Code for Niwa's WordPress MCP endpoint, protect its bearer token and test page access. Understand how cloud connectors differ.

Laptop showing a conceptual terminal and website preview
Conceptual editorial illustration generated for this article.

You can connect Claude Code to WordPress through Niwa’s remote HTTP MCP endpoint and a Niwa bearer token. Register the server in Claude Code, check its status, discover the tools and read a known page before authorizing an edit. Claude’s account-based cloud connectors are a separate setup route with different network and authentication requirements.

This guide follows the Claude Code route shown in Niwa’s MCP settings. It connects your owner assistant to WordPress operations. It does not grant customers in the website chat the same access. The Niwa MCP overview explains the available owner workflows.

Prepare a known page and the correct endpoint

Use a WordPress installation with Niwa active. For your first edit, work on a staging site and a draft page whose ID and current content you have recorded.

In WordPress, open Niwa AI → Niwa MCP. Copy the displayed server URL. For a conventional installation it resembles https://example.com/wp-json/niwa-ai/v1/mcp. Use the actual URL for your site, not the homepage or an endpoint belonging to another plugin.

Generate a token with a suitable lifetime. It grants administrator access, so treat it as an administrative credential. Keep it out of public repositories and support screenshots. Niwa’s optional options-reading scope does not turn the connection into read-only access.

Register Niwa as an HTTP server in Claude Code

Niwa provides this command shape. Replace both placeholders privately with your site’s endpoint and token:

claude mcp add --transport http niwa-ai https://example.com/wp-json/niwa-ai/v1/mcp --header "Authorization: Bearer YOUR_TOKEN_HERE"

The example names the server niwa-ai; the name is a label in the client. The transport and URL identify the remote HTTP connection. The bearer header carries the Niwa credential.

A command containing a live token can be retained in terminal history. Use the client’s supported private configuration or credential approach where appropriate and keep the placeholder form in shared instructions. Check the current Claude Code MCP reference when applying the setup to your version.

Use JSON configuration when it fits your workflow

Claude Code can also read a .mcp.json configuration. A placeholder example is:

{
 "mcpServers": {
 "niwa-ai": {
 "type": "http",
 "url": "https://example.com/wp-json/niwa-ai/v1/mcp",
 "headers": {
 "Authorization": "Bearer ${NIWA_MCP_TOKEN}"
 }
 }
 }
}

Here NIWA_MCP_TOKEN names an environment variable containing your credential. Make it available to the Claude Code process before starting the session. Keep a configuration containing an actual credential private. A project configuration can involve Claude Code’s trust and server-approval controls; review it before loading.

Include the explicit HTTP type. A remote URL is not a command that launches a local stdio server. Use one registration route for the intended scope, then inspect the resulting server entry so you do not troubleshoot a different configuration with the same label.

Confirm connection status before asking for an edit

Run claude mcp list and inspect claude mcp get niwa-ai. Inside Claude Code, /mcp shows the server status and relevant connection controls. An “added” message confirms registration; successful tool discovery and a read provide stronger evidence that the connection works.

Ask Claude to list Niwa’s available tools. Read a known draft with get_page and its page_id, then compare the returned opening paragraph with WordPress. If you use Niwa’s whole-task agent route, retain its job ID and check the result until it finishes. An accepted job is not a completed page update.

Review the replacement before calling a write tool

A useful first request is:

Read my identified staging draft. Show the page ID, status and proposed replacement for its opening paragraph. Do not call an update tool yet.

Review the proposal, then explicitly authorize the edit. After saving, request a fresh read of the same page. Verify the text and draft status. For page-builder layouts, check the actual visible element; a stored page title can differ from the hero heading.

MCP discovery and write execution are separate operations. Niwa’s internal preview/action flow is not a promise that every Claude tool call will wait for a second confirmation. Your approval controls and the server’s permissions both matter.

Do not confuse Claude Code with a cloud connector

Claude’s account-based remote connectors reach servers from Anthropic’s cloud. They need a reachable remote address and an authentication method supported by that route. A server available only on your laptop cannot be reached simply by entering its local URL in a cloud connector.

Do not assume that a bearer-header example for Claude Code establishes compatibility with every Claude surface. Follow the current Claude remote connector instructions for that route and confirm the specific server’s authentication support.

Resolve errors without exposing the credential

If authentication fails, check token expiry, revocation and whether the header is actually sent. If the response is homepage HTML, check the copied endpoint and hosting rules. If discovery succeeds but a tool fails, inspect its schema and arguments.

Read the saved page before repeating any timed-out write. Share the client version, Niwa version, sanitized error and connection route when requesting help.

Existing WordPress owners can install the standalone Niwa plugin. Ask Niwa about your Claude connection with the site and one page task you want to complete. The Niwa setup guide covers the site’s own settings.

Leave a Reply

Your email address will not be published. Required fields are marked *

Niwa
How can I help?
Chat with Niwa