@automattic/mcp-wordpress-remote 0.5.3 → 0.5.4

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/dist/lib.d.ts CHANGED
@@ -15,7 +15,7 @@ interface WordPressResponse {
15
15
  [key: string]: any;
16
16
  }
17
17
 
18
- declare const MCP_WORDPRESS_REMOTE_VERSION = "0.5.3";
18
+ declare const MCP_WORDPRESS_REMOTE_VERSION = "0.5.4";
19
19
  /**
20
20
  * Centralized configuration for MCP WordPress Remote
21
21
  * All default values are defined here and can be overridden via environment variables
package/dist/lib.js CHANGED
@@ -6498,7 +6498,7 @@ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
6498
6498
  const LAST_CHUNK = Buffer3.from("0\r\n\r\n");
6499
6499
  let isChunkedTransfer = false;
6500
6500
  let properLastChunkReceived = false;
6501
- let previousChunk;
6501
+ let trailingBytes = Buffer3.alloc(0);
6502
6502
  request.on("response", (response) => {
6503
6503
  const { headers } = response;
6504
6504
  isChunkedTransfer = headers["transfer-encoding"] === "chunked" && !headers["content-length"];
@@ -6512,11 +6512,15 @@ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
6512
6512
  }
6513
6513
  };
6514
6514
  const onData = (buf) => {
6515
- properLastChunkReceived = Buffer3.compare(buf.slice(-5), LAST_CHUNK) === 0;
6516
- if (!properLastChunkReceived && previousChunk) {
6517
- properLastChunkReceived = Buffer3.compare(previousChunk.slice(-3), LAST_CHUNK.slice(0, 3)) === 0 && Buffer3.compare(buf.slice(-2), LAST_CHUNK.slice(3)) === 0;
6515
+ if (buf.length === 0) return;
6516
+ if (buf.length >= LAST_CHUNK.length) {
6517
+ trailingBytes = Buffer3.from(buf.subarray(-LAST_CHUNK.length));
6518
+ } else {
6519
+ trailingBytes = Buffer3.from(
6520
+ Buffer3.concat([trailingBytes, buf]).subarray(-LAST_CHUNK.length)
6521
+ );
6518
6522
  }
6519
- previousChunk = buf;
6523
+ properLastChunkReceived = trailingBytes.equals(LAST_CHUNK);
6520
6524
  };
6521
6525
  socket.prependListener("close", onSocketClose);
6522
6526
  socket.on("data", onData);
@@ -75950,7 +75954,7 @@ async function selectCallbackPort(serverUrl, specifiedPort, _unused, host = "127
75950
75954
  }
75951
75955
 
75952
75956
  // src/lib/config.ts
75953
- var MCP_WORDPRESS_REMOTE_VERSION = "0.5.3";
75957
+ var MCP_WORDPRESS_REMOTE_VERSION = "0.5.4";
75954
75958
  function parsePositiveIntEnv(value, defaultValue) {
75955
75959
  if (!value) {
75956
75960
  return defaultValue;
package/dist/proxy.js CHANGED
@@ -6499,7 +6499,7 @@ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
6499
6499
  const LAST_CHUNK = Buffer3.from("0\r\n\r\n");
6500
6500
  let isChunkedTransfer = false;
6501
6501
  let properLastChunkReceived = false;
6502
- let previousChunk;
6502
+ let trailingBytes = Buffer3.alloc(0);
6503
6503
  request.on("response", (response) => {
6504
6504
  const { headers } = response;
6505
6505
  isChunkedTransfer = headers["transfer-encoding"] === "chunked" && !headers["content-length"];
@@ -6513,11 +6513,15 @@ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
6513
6513
  }
6514
6514
  };
6515
6515
  const onData = (buf) => {
6516
- properLastChunkReceived = Buffer3.compare(buf.slice(-5), LAST_CHUNK) === 0;
6517
- if (!properLastChunkReceived && previousChunk) {
6518
- properLastChunkReceived = Buffer3.compare(previousChunk.slice(-3), LAST_CHUNK.slice(0, 3)) === 0 && Buffer3.compare(buf.slice(-2), LAST_CHUNK.slice(3)) === 0;
6516
+ if (buf.length === 0) return;
6517
+ if (buf.length >= LAST_CHUNK.length) {
6518
+ trailingBytes = Buffer3.from(buf.subarray(-LAST_CHUNK.length));
6519
+ } else {
6520
+ trailingBytes = Buffer3.from(
6521
+ Buffer3.concat([trailingBytes, buf]).subarray(-LAST_CHUNK.length)
6522
+ );
6519
6523
  }
6520
- previousChunk = buf;
6524
+ properLastChunkReceived = trailingBytes.equals(LAST_CHUNK);
6521
6525
  };
6522
6526
  socket.prependListener("close", onSocketClose);
6523
6527
  socket.on("data", onData);
@@ -76615,7 +76619,7 @@ async function selectCallbackPort(serverUrl, specifiedPort, _unused, host = "127
76615
76619
  }
76616
76620
 
76617
76621
  // src/lib/config.ts
76618
- var MCP_WORDPRESS_REMOTE_VERSION = "0.5.3";
76622
+ var MCP_WORDPRESS_REMOTE_VERSION = "0.5.4";
76619
76623
  function parsePositiveIntEnv(value, defaultValue) {
76620
76624
  if (!value) {
76621
76625
  return defaultValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/mcp-wordpress-remote",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "MCP WordPress Remote proxy server",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"