@tmcp/transport-http 0.2.1 → 0.3.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @tmcp/transport-http
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 3847654: fix: answer with conflict for second SSE connection
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [1b50780]
12
+ - tmcp@1.7.1
13
+
3
14
  ## 0.2.1
4
15
 
5
16
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmcp/transport-http",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Transport for TMCP using HTTP",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -13,7 +13,7 @@
13
13
  "./package.json": "./package.json"
14
14
  },
15
15
  "peerDependencies": {
16
- "tmcp": "^1.7.0"
16
+ "tmcp": "^1.7.1"
17
17
  },
18
18
  "keywords": [
19
19
  "tmcp",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "devDependencies": {
29
29
  "publint": "^0.3.12",
30
- "tmcp": "^1.7.0"
30
+ "tmcp": "^1.7.1"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"
package/src/index.js CHANGED
@@ -87,15 +87,24 @@ export class HttpTransport {
87
87
  // If session already exists, return existing stream
88
88
  const existing_stream = this.#streams.get(session_id);
89
89
  if (existing_stream) {
90
- return new Response(existing_stream, {
91
- headers: {
92
- 'Content-Type': 'text/event-stream',
93
- 'Cache-Control': 'no-cache',
94
- Connection: 'keep-alive',
95
- 'mcp-session-id': session_id,
90
+ return new Response(
91
+ JSON.stringify({
92
+ jsonrpc: '2.0',
93
+ error: {
94
+ code: -32000,
95
+ message:
96
+ 'Conflict: Only one SSE stream is allowed per session',
97
+ },
98
+ id: null,
99
+ }),
100
+ {
101
+ headers: {
102
+ 'Content-Type': 'application/json',
103
+ 'mcp-session-id': session_id,
104
+ },
105
+ status: 409,
96
106
  },
97
- status: 200,
98
- });
107
+ );
99
108
  }
100
109
 
101
110
  // Create new long-lived stream for notifications