@tmcp/transport-http 0.5.5 → 0.5.6

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/package.json +5 -5
  2. package/src/index.js +9 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmcp/transport-http",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
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.10.2"
19
+ "tmcp": "^1.10.3"
20
20
  },
21
21
  "keywords": [
22
22
  "tmcp",
@@ -29,7 +29,7 @@
29
29
  "directory": "packages/transport-http"
30
30
  },
31
31
  "dependencies": {
32
- "@tmcp/session-manager": "^0.1.0"
32
+ "@tmcp/session-manager": "^0.1.1"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@modelcontextprotocol/sdk": "^1.17.1",
@@ -40,8 +40,8 @@
40
40
  "valibot": "^1.1.0",
41
41
  "vitest": "^3.2.4",
42
42
  "@tmcp/adapter-valibot": "^0.1.4",
43
- "tmcp": "^1.10.2",
44
- "@tmcp/auth": "^0.3.3"
43
+ "@tmcp/auth": "^0.3.3",
44
+ "tmcp": "^1.10.3"
45
45
  },
46
46
  "publishConfig": {
47
47
  "access": "public"
package/src/index.js CHANGED
@@ -78,7 +78,7 @@ export class HttpTransport {
78
78
 
79
79
  this.#options = { getSessionId, path, cors, sessionManager };
80
80
  this.#path = path;
81
- this.#server.on('send', ({ request, context: { sessions } }) => {
81
+ this.#server.on('send', async ({ request, context: { sessions } }) => {
82
82
  // use the current controller if the request has an id (it means it's a request and not a notification)
83
83
  if (request.id != null) {
84
84
  const controller = this.#controller_storage.getStore();
@@ -91,7 +91,7 @@ export class HttpTransport {
91
91
  );
92
92
  return;
93
93
  }
94
- this.#options.sessionManager.send(
94
+ await this.#options.sessionManager.send(
95
95
  sessions,
96
96
  'data: ' + JSON.stringify(request) + '\n\n',
97
97
  );
@@ -184,8 +184,8 @@ export class HttpTransport {
184
184
  /**
185
185
  * @param {string} session_id
186
186
  */
187
- #handle_delete(session_id) {
188
- this.#options.sessionManager.delete(session_id);
187
+ async #handle_delete(session_id) {
188
+ await this.#options.sessionManager.delete(session_id);
189
189
  return new Response(null, {
190
190
  status: 204,
191
191
  headers: {
@@ -226,11 +226,11 @@ export class HttpTransport {
226
226
 
227
227
  // Create new long-lived stream for notifications
228
228
  const stream = new ReadableStream({
229
- start(controller) {
230
- sessions.create(session_id, controller);
229
+ async start(controller) {
230
+ await sessions.create(session_id, controller);
231
231
  },
232
- cancel() {
233
- sessions.delete(session_id);
232
+ async cancel() {
233
+ await sessions.delete(session_id);
234
234
  },
235
235
  });
236
236
 
@@ -433,7 +433,7 @@ export class HttpTransport {
433
433
  }
434
434
  // Handle DELETE request - disconnect session
435
435
  else if (method === 'DELETE') {
436
- response = this.#handle_delete(session_id);
436
+ response = await this.#handle_delete(session_id);
437
437
  }
438
438
  // Handle GET request - establish long-lived connection for notifications
439
439
  else if (method === 'GET') {