@automattic/mcp-wordpress-remote 0.1.9 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -22,7 +22,7 @@ The following environment variables are required:
22
22
 
23
23
  - `WP_API_URL`: The URL of your WordPress site (e.g., `https://example.com`)
24
24
  - `WP_API_USERNAME`: Your WordPress username
25
- - `WP_API_PASSWORD`: Your WordPress API password
25
+ - `WP_API_PASSWORD`: Your WordPress [application password](https://make.wordpress.org/core/2020/11/05/application-passwords-integration-guide/#Getting-Credentials)
26
26
  - `WOO_CUSTOMER_KEY`: Your Woocommerce customer key (optional, if you intend to use WooCommerce MCP assets)
27
27
  - `WOO_CUSTOMER_SECRET`: Your WooCommerce customer secret (optional, if you intend to use WooCommerce MCP assets)
28
28
  - `LOG_FILE`: Optional full path to a log file
@@ -43,7 +43,7 @@ Example configuration:
43
43
  "mcpServers": {
44
44
  "wordpress-mcp": {
45
45
  "command": "npx",
46
- "args": ["@automattic/mcp-wordpress-remote"],
46
+ "args": ["-y", "@automattic/mcp-wordpress-remote"],
47
47
  "env": {
48
48
  "WP_API_URL": "https://your-wordpress-site.com",
49
49
  "WP_API_USERNAME": "your-username",
@@ -70,7 +70,7 @@ Example configuration:
70
70
  "mcpServers": {
71
71
  "wordpress-mcp": {
72
72
  "command": "npx",
73
- "args": ["@automattic/mcp-wordpress-remote"],
73
+ "args": ["-y", "@automattic/mcp-wordpress-remote"],
74
74
  "env": {
75
75
  "WP_API_URL": "https://your-wordpress-site.com",
76
76
  "WP_API_USERNAME": "your-username",
package/dist/proxy.js CHANGED
@@ -38,11 +38,14 @@ function validateEnvironment() {
38
38
  );
39
39
  }
40
40
  }
41
+ function removeTrailingSlash(url) {
42
+ return url.replace(/\/+$/, "");
43
+ }
41
44
  async function wpRequest(params = { method: "init" }) {
42
45
  validateEnvironment();
43
- const endpoint = "wp/v2/wpmcp";
46
+ const endpoint = "/wp/v2/wpmcp";
44
47
  const method = "POST";
45
- const baseUrl = process.env.WP_API_URL;
48
+ const baseUrl = removeTrailingSlash(process.env.WP_API_URL);
46
49
  log(`Request method: ${params.method || "init"}`);
47
50
  log(`Request args: ${JSON.stringify(params.args || {})}`);
48
51
  let username;
@@ -67,7 +70,7 @@ async function wpRequest(params = { method: "init" }) {
67
70
  log(`API URL: ${baseUrl}`);
68
71
  const auth = Buffer.from(`${username}:${password}`).toString("base64");
69
72
  log(`Auth header length: ${auth.length}`);
70
- const url = new URL(`/wp-json/${endpoint}`, baseUrl).toString();
73
+ const url = new URL(`/?rest_route=${endpoint}`, baseUrl).toString();
71
74
  log(`Requesting URL: ${url}`);
72
75
  const headers = {
73
76
  Authorization: `Basic ${auth}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/mcp-wordpress-remote",
3
- "version": "0.1.9",
3
+ "version": "0.1.13",
4
4
  "description": "MCP WordPress Remote proxy server",
5
5
  "keywords": [
6
6
  "mcp",
@@ -27,7 +27,7 @@
27
27
  "build": "tsup",
28
28
  "build:watch": "tsup --watch",
29
29
  "check": "prettier --check . && tsc",
30
- "start": "node dist/proxy.js",
30
+ "start": "NODE_ENV=development tsup --watch",
31
31
  "dev": "NODE_ENV=development node dist/proxy.js",
32
32
  "test": "jest",
33
33
  "test:watch": "jest --watch"