@kya-os/mcp-i 1.6.15 → 1.6.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.
@@ -74,6 +74,13 @@ class StatelessHttpServerTransport extends base_streamable_http_1.BaseHttpServer
74
74
  const responseBody = collector.responses.length === 1
75
75
  ? collector.responses[0]
76
76
  : collector.responses;
77
+ // Extract session ID from response for Mcp-Session-Id header (MCP protocol spec)
78
+ const firstResponse = collector.responses[0];
79
+ const sessionId = firstResponse?.result?.proof?.meta?.sessionId ||
80
+ firstResponse?.result?.sessionId;
81
+ if (sessionId) {
82
+ headers["Mcp-Session-Id"] = sessionId;
83
+ }
77
84
  collector.res
78
85
  .writeHead(200, headers)
79
86
  .end(JSON.stringify(responseBody));
@@ -27,5 +27,6 @@ export declare function getPredefinedTestIdentities(): Record<string, MockIdenti
27
27
  export declare function generateTestNonce(seed?: string): string;
28
28
  /**
29
29
  * Generate session ID for testing (deterministic if seed provided)
30
+ * Uses mcpi_test_ prefix to match production format while being identifiable as test sessions
30
31
  */
31
32
  export declare function generateTestSessionId(seed?: string): string;
@@ -93,16 +93,21 @@ function generateTestNonce(seed) {
93
93
  }
94
94
  /**
95
95
  * Generate session ID for testing (deterministic if seed provided)
96
+ * Uses mcpi_test_ prefix to match production format while being identifiable as test sessions
96
97
  */
97
98
  function generateTestSessionId(seed) {
98
99
  (0, test_environment_1.ensureTestMode)();
99
100
  if (seed) {
100
- // Deterministic session ID for reproducible tests
101
- return `sess_test_${(0, crypto_1.createHash)("sha256")
101
+ // Deterministic session ID for reproducible tests (uses mcpi_test_ prefix)
102
+ const hash = (0, crypto_1.createHash)("sha256")
102
103
  .update(`session-${seed}-${(0, test_environment_1.getCurrentTestSeed)()}`)
103
104
  .digest("hex")
104
- .substring(0, 16)}`;
105
+ .substring(0, 32);
106
+ // Format as UUID-like structure for consistency with production format
107
+ return `mcpi_test_${hash.slice(0, 8)}-${hash.slice(8, 12)}-${hash.slice(12, 16)}-${hash.slice(16, 20)}-${hash.slice(20, 32)}`;
105
108
  }
106
109
  // Random session ID for general testing
107
- return `sess_test_${(0, crypto_1.randomBytes)(8).toString("hex")}`;
110
+ const bytes = (0, crypto_1.randomBytes)(16);
111
+ const hex = bytes.toString("hex");
112
+ return `mcpi_test_${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20, 32)}`;
108
113
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kya-os/mcp-i",
3
- "version": "1.6.15",
3
+ "version": "1.6.16",
4
4
  "description": "The TypeScript MCP framework with identity features built-in",
5
5
  "type": "commonjs",
6
6
  "main": "dist/index.js",
@@ -63,8 +63,8 @@
63
63
  "model-context-protocol"
64
64
  ],
65
65
  "dependencies": {
66
- "@kya-os/contracts": "^1.6.18",
67
- "@kya-os/mcp-i-core": "^1.3.25",
66
+ "@kya-os/contracts": "^1.6.19",
67
+ "@kya-os/mcp-i-core": "^1.3.27",
68
68
  "@modelcontextprotocol/sdk": "^1.11.4",
69
69
  "@swc/core": "^1.11.24",
70
70
  "@types/express": "^5.0.1",