tiny-http-mcp-server 0.1.14 → 0.1.16
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/composition.json +1 -1
- package/dist/http-transport.js +1 -1
- package/dist/parse-body.js +12 -5
- package/package.json +1 -1
package/dist/composition.json
CHANGED
package/dist/http-transport.js
CHANGED
|
@@ -754,7 +754,7 @@ export class StreamableHttpTransport {
|
|
|
754
754
|
const history = this.sseEventHistory.get(sessionId) ?? [];
|
|
755
755
|
for (const event of history) {
|
|
756
756
|
if (event.id > lastEventId && !res.writableEnded) {
|
|
757
|
-
|
|
757
|
+
this.writeToLiveGetStream(res, formatSseEvent({ id: String(event.id), data: event.data }));
|
|
758
758
|
}
|
|
759
759
|
}
|
|
760
760
|
}
|
package/dist/parse-body.js
CHANGED
|
@@ -64,12 +64,19 @@ async function readStreamBody(req, maxBytes) {
|
|
|
64
64
|
return Buffer.concat(chunks).toString("utf8");
|
|
65
65
|
}
|
|
66
66
|
async function readRawBody(req, preParsed, options) {
|
|
67
|
-
if (preParsed !== undefined) {
|
|
68
|
-
return preParsed;
|
|
69
|
-
}
|
|
70
67
|
const reqWithBody = req;
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
const body = preParsed !== undefined ? preParsed : reqWithBody.body;
|
|
69
|
+
if (body !== undefined) {
|
|
70
|
+
if (options.maxBytes !== undefined) {
|
|
71
|
+
const serialized = JSON.stringify(body);
|
|
72
|
+
if (serialized === undefined) {
|
|
73
|
+
throw new Error("Invalid Request");
|
|
74
|
+
}
|
|
75
|
+
if (Buffer.byteLength(serialized, "utf8") > options.maxBytes) {
|
|
76
|
+
throw new Error("Payload too large");
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return body;
|
|
73
80
|
}
|
|
74
81
|
const raw = await readStreamBody(req, options.maxBytes);
|
|
75
82
|
try {
|