@wrongstack/mcp 1.0.11 → 1.0.12
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/client.d.ts +8 -0
- package/dist/index.js +13 -1
- package/package.json +2 -2
package/dist/client.d.ts
CHANGED
|
@@ -71,6 +71,14 @@ export declare class MCPClient {
|
|
|
71
71
|
private readonly pending;
|
|
72
72
|
private rxBuffer;
|
|
73
73
|
private rxBufferBytes;
|
|
74
|
+
/**
|
|
75
|
+
* Incremental UTF-8 decoder for the stdio rx path. A pipe read boundary can
|
|
76
|
+
* land inside a multi-byte sequence; decoding each chunk with
|
|
77
|
+
* `chunk.toString()` would replace it with U+FFFD and silently corrupt the
|
|
78
|
+
* JSON-RPC payload. StringDecoder withholds the partial sequence until the
|
|
79
|
+
* chunk that completes it (same remedy as `readFileHead` in core utils).
|
|
80
|
+
*/
|
|
81
|
+
private rxDecoder;
|
|
74
82
|
private _tools;
|
|
75
83
|
/** Server-declared handshake metadata. Populated for stdio in the first protocol slice. */
|
|
76
84
|
private _serverMetadata?;
|
package/dist/index.js
CHANGED
|
@@ -828,6 +828,7 @@ function boundedServerName(value) {
|
|
|
828
828
|
|
|
829
829
|
// src/client.ts
|
|
830
830
|
import { spawn as spawn2 } from "node:child_process";
|
|
831
|
+
import { StringDecoder } from "node:string_decoder";
|
|
831
832
|
import { buildChildEnv as buildChildEnv2, buildWin32CmdShimInvocation, toErrorMessage } from "@wrongstack/core/utils";
|
|
832
833
|
|
|
833
834
|
// src/client-process.ts
|
|
@@ -2544,6 +2545,14 @@ var MCPClient = class _MCPClient {
|
|
|
2544
2545
|
pending = /* @__PURE__ */ new Map();
|
|
2545
2546
|
rxBuffer = "";
|
|
2546
2547
|
rxBufferBytes = 0;
|
|
2548
|
+
/**
|
|
2549
|
+
* Incremental UTF-8 decoder for the stdio rx path. A pipe read boundary can
|
|
2550
|
+
* land inside a multi-byte sequence; decoding each chunk with
|
|
2551
|
+
* `chunk.toString()` would replace it with U+FFFD and silently corrupt the
|
|
2552
|
+
* JSON-RPC payload. StringDecoder withholds the partial sequence until the
|
|
2553
|
+
* chunk that completes it (same remedy as `readFileHead` in core utils).
|
|
2554
|
+
*/
|
|
2555
|
+
rxDecoder = new StringDecoder("utf8");
|
|
2547
2556
|
_tools = [];
|
|
2548
2557
|
/** Server-declared handshake metadata. Populated for stdio in the first protocol slice. */
|
|
2549
2558
|
_serverMetadata;
|
|
@@ -2638,6 +2647,7 @@ var MCPClient = class _MCPClient {
|
|
|
2638
2647
|
}
|
|
2639
2648
|
this.rxBuffer = "";
|
|
2640
2649
|
this.rxBufferBytes = 0;
|
|
2650
|
+
this.rxDecoder = new StringDecoder("utf8");
|
|
2641
2651
|
const extraEnv = { ...this.opts.env };
|
|
2642
2652
|
if (this.opts.passthroughEnv) {
|
|
2643
2653
|
for (const name of this.opts.passthroughEnv) {
|
|
@@ -2669,8 +2679,10 @@ var MCPClient = class _MCPClient {
|
|
|
2669
2679
|
...this.opts.cwd ? { cwd: this.opts.cwd } : {}
|
|
2670
2680
|
});
|
|
2671
2681
|
this.child = child;
|
|
2672
|
-
child.stdout?.on("data", (chunk) => this.onData(
|
|
2682
|
+
child.stdout?.on("data", (chunk) => this.onData(this.rxDecoder.write(chunk)));
|
|
2673
2683
|
child.stdout?.on("end", () => {
|
|
2684
|
+
const tail = this.rxDecoder.end();
|
|
2685
|
+
if (tail) this.onData(tail);
|
|
2674
2686
|
if (this.rxBuffer.trim()) {
|
|
2675
2687
|
const line = this.rxBuffer.trim();
|
|
2676
2688
|
this.rxBuffer = "";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wrongstack/mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "WrongStack Model Context Protocol client and registry: stdio, SSE, and streamable HTTP transports.",
|
|
6
6
|
"repository": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"!dist/**/*.map"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@wrongstack/core": "1.0.
|
|
29
|
+
"@wrongstack/core": "1.0.12",
|
|
30
30
|
"undici": "^8.10.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|