Skip to content
This repository was archived by the owner on Jan 19, 2026. It is now read-only.
This repository was archived by the owner on Jan 19, 2026. It is now read-only.

mcp-wordpress-remote fails on local install: Unexpected token < in JSON at position 0 #109

Description

@nvelden

Bug Description

I am trying to use the @automattic/mcp-wordpress-remote@latest adapter on my local macOS machine to connect to a local WordPress installation. The adapter appears in the Claude tools list, but I am unable to toggle it on.

When I try to activate it, the logs show a persistent error: [ERROR] [API] Error in wpRequest: Unexpected token < in JSON at position 0.

This error, combined with the Response status: 200 in the logs, suggests the adapter is successfully making a request but receiving an HTML page (like the site's homepage) instead of the expected JSON response from the REST API.

Environment Details

OS: macOS
Local Server: MAMP
Web Server: Apache
PHP Version: 8.3.14
WordPress Version: 6.8.3
WordPress Plugin: WordPress MCP (Version 0.2.5, by Automattic AI & Ovidiu Galatan)
Adapter: @automattic/mcp-wordpress-remote@latest (via npx)

Troubleshooting Steps Completed

Permalink Settings: Confirmed Permalinks in WordPress settings are set to "Post name". My .htaccess file reflects this and is configured for the /wordpress/ subdirectory.
REST API Accessibility (Pretty Permalinks): Confirmed the REST API is working correctly via the "pretty permalink" structure.
Test: Accessing http://localhost:8888/wordpress/wp-json/ in a browser.
Result: Success. Returns a valid JSON response listing all available namespaces and routes.
REST API Accessibility (Plain Permalinks): Tested the "plain" permalink route (?rest_route=) for a specific endpoint, and it failed.
Test: Accessing http://localhost:8888/wordpress/?rest_route=/wp/v2/wpmcp
Result: Failure. Returns a 404 rest_no_route error:

{"code":"rest_no_route","message":"No route was found matching the URL and request method.","data":{"status":404}}

Error Logs

Here is the relevant output from my log file:

2025-10-21T17:46:58.671Z [DEBUG] [MCP] Processing ListResourcesRequest
2025-10-21T17:46:58.671Z [INFO] [API] Request method: resources/list (Simple)
2025-10-21T17:46:58.671Z [DEBUG] [API] Simple request: {"method":"resources/list"}
...
2025-10-21T17:46:58.671Z [DEBUG] [API] Base API URL: http://localhost:8888/wordpress/
2025-10-21T17:46:58.671Z [DEBUG] [API] Final requesting URL: http://localhost:8888/wordpress
...
2025-10-21T17:46:58.672Z [INFO] [API] Sending request to WordPress API...
2025-10-21T17:46:58.672Z [DEBUG] [API] Request URL: http://localhost:8888/wordpress
2025-10-21T17:46:58.672Z [DEBUG] [API] Request method: POST
2025-10-21T17:46:58.932Z [DEBUG] [API] Response status: 200
2025-10-21T17:46:58.935Z [ERROR] [API] Error in wpRequest: Unexpected token < in JSON at position 0
2025-10-21T17:46:58.935Z [ERROR] [CLIENT] ❌ Client Error: ListPrompts failed after 265ms
{
  "error": "Unexpected token < in JSON at position 0"
}

Configuration

Here is the wordpress-mcp section of my JSON configuration file:

"wordpress-mcp": {
      "command": "npx",
      "args": [ "-y", "@automattic/mcp-wordpress-remote@latest" ],
      "env": {
        "WP_API_URL": "http://localhost:8888/wordpress/",
        "LOG_LEVEL": "3",
        "LOG_FILE": "/Users/main/Downloads/logfile.log",
        "JWT_TOKEN": "[REDACTED_TOKEN]"
      }
    }

.htaccess File Content

# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
# END WordPress

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions