@tmcp/transport-http 0.5.1 → 0.5.2
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/package.json +4 -4
- package/src/index.js +13 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tmcp/transport-http",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Transport for TMCP using HTTP",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"src/**/*"
|
|
17
17
|
],
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"tmcp": "^1.9.
|
|
19
|
+
"tmcp": "^1.9.1"
|
|
20
20
|
},
|
|
21
21
|
"keywords": [
|
|
22
22
|
"tmcp",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"valibot": "^1.1.0",
|
|
37
37
|
"vitest": "^3.2.4",
|
|
38
38
|
"@tmcp/adapter-valibot": "^0.1.3",
|
|
39
|
-
"@tmcp/auth": "^0.3.
|
|
40
|
-
"tmcp": "^1.9.
|
|
39
|
+
"@tmcp/auth": "^0.3.2",
|
|
40
|
+
"tmcp": "^1.9.1"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
package/src/index.js
CHANGED
|
@@ -47,6 +47,8 @@ export class HttpTransport {
|
|
|
47
47
|
*/
|
|
48
48
|
#oauth;
|
|
49
49
|
|
|
50
|
+
#text_encoder = new TextEncoder();
|
|
51
|
+
|
|
50
52
|
/**
|
|
51
53
|
*
|
|
52
54
|
* @param {McpServer<any>} server
|
|
@@ -74,13 +76,19 @@ export class HttpTransport {
|
|
|
74
76
|
const controller = this.#controller_storage.getStore();
|
|
75
77
|
if (!controller) return;
|
|
76
78
|
|
|
77
|
-
controller.enqueue(
|
|
79
|
+
controller.enqueue(
|
|
80
|
+
this.#text_encoder.encode(
|
|
81
|
+
'data: ' + JSON.stringify(request) + '\n\n',
|
|
82
|
+
),
|
|
83
|
+
);
|
|
78
84
|
return;
|
|
79
85
|
}
|
|
80
86
|
for (let [session_id, controller] of this.#session.entries()) {
|
|
81
87
|
if (sessions === undefined || sessions.includes(session_id)) {
|
|
82
88
|
controller.enqueue(
|
|
83
|
-
|
|
89
|
+
this.#text_encoder.encode(
|
|
90
|
+
'data: ' + JSON.stringify(request) + '\n\n',
|
|
91
|
+
),
|
|
84
92
|
);
|
|
85
93
|
}
|
|
86
94
|
}
|
|
@@ -214,7 +222,9 @@ export class HttpTransport {
|
|
|
214
222
|
);
|
|
215
223
|
|
|
216
224
|
controller?.enqueue(
|
|
217
|
-
|
|
225
|
+
this.#text_encoder.encode(
|
|
226
|
+
'data: ' + JSON.stringify(response) + '\n\n',
|
|
227
|
+
),
|
|
218
228
|
);
|
|
219
229
|
controller?.close();
|
|
220
230
|
};
|