@automattic/mcp-wordpress-remote 0.1.12 → 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.
Files changed (2) hide show
  1. package/dist/proxy.js +6 -3
  2. package/package.json +2 -2
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.12",
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"