@kya-os/mcp-i 1.7.13 → 1.10.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.
Files changed (52) hide show
  1. package/dist/225.js +1 -0
  2. package/dist/227.js +1 -0
  3. package/dist/242.js +1 -0
  4. package/dist/283.js +1 -0
  5. package/dist/295.js +1 -1
  6. package/dist/354.js +1 -0
  7. package/dist/361.js +1 -0
  8. package/dist/452.js +1 -0
  9. package/dist/533.js +1 -0
  10. package/dist/622.js +1 -0
  11. package/dist/65.js +1 -0
  12. package/dist/843.js +1 -0
  13. package/dist/861.js +1 -0
  14. package/dist/866.js +1 -1
  15. package/dist/914.js +1 -0
  16. package/dist/95.js +1 -0
  17. package/dist/{941.js → 966.js} +1 -1
  18. package/dist/providers/node-providers.d.ts +1 -1
  19. package/dist/providers/node-providers.js +2 -2
  20. package/dist/runtime/adapter-express.js +6 -6
  21. package/dist/runtime/adapter-nextjs.js +6 -6
  22. package/dist/runtime/auth-handshake.d.ts +4 -159
  23. package/dist/runtime/auth-handshake.js +8 -249
  24. package/dist/runtime/http.js +6 -6
  25. package/dist/runtime/mcpi-runtime.d.ts +4 -0
  26. package/dist/runtime/mcpi-runtime.js +58 -43
  27. package/dist/runtime/outbound-delegation.d.ts +34 -0
  28. package/dist/runtime/outbound-delegation.js +134 -0
  29. package/dist/runtime/proof.d.ts +13 -88
  30. package/dist/runtime/proof.js +11 -225
  31. package/dist/runtime/request-context.d.ts +41 -0
  32. package/dist/runtime/request-context.js +48 -0
  33. package/dist/runtime/session.d.ts +13 -104
  34. package/dist/runtime/session.js +31 -267
  35. package/dist/runtime/stdio.js +6 -6
  36. package/dist/runtime/utils/tools.js +17 -3
  37. package/dist/runtime/verifier-middleware.js +4 -4
  38. package/package.json +19 -19
  39. package/dist/207.js +0 -1
  40. package/dist/25.js +0 -1
  41. package/dist/360.js +0 -1
  42. package/dist/387.js +0 -1
  43. package/dist/406.js +0 -1
  44. package/dist/448.js +0 -1
  45. package/dist/478.js +0 -1
  46. package/dist/575.js +0 -1
  47. package/dist/67.js +0 -1
  48. package/dist/743.js +0 -1
  49. package/dist/784.js +0 -1
  50. package/dist/844.js +0 -1
  51. package/dist/936.js +0 -1
  52. package/dist/988.js +0 -1
@@ -8,8 +8,9 @@ const tool_protection_registry_1 = require("../tool-protection-registry");
8
8
  const auth_handshake_1 = require("../auth-handshake");
9
9
  const session_1 = require("../session");
10
10
  const request_context_1 = require("../request-context");
11
- const proof_batch_queue_1 = require("../proof-batch-queue");
12
11
  const mcp_i_core_1 = require("@kya-os/mcp-i-core");
12
+ const proof_batch_queue_1 = require("../proof-batch-queue");
13
+ const mcp_i_core_2 = require("@kya-os/mcp-i-core");
13
14
  /**
14
15
  * Format authorization info for error messages.
15
16
  * Safely handles discriminated union types by checking for property existence.
@@ -512,7 +513,7 @@ async function addToolsToServer(server, toolModules, identityConfig, clientMessa
512
513
  // Format human-readable message using DelegationErrorFormatter
513
514
  // Supports client-specific messages via clientMessagesConfig
514
515
  // The formatter may modify the URL (e.g., adding extraParams from config)
515
- const formatter = new mcp_i_core_1.DelegationErrorFormatter(clientMessagesConfig);
516
+ const formatter = new mcp_i_core_2.DelegationErrorFormatter(clientMessagesConfig);
516
517
  const { message: displayMessage, consentUrl } = formatter.format({
517
518
  toolName: name,
518
519
  consentUrl: verifyResult.authError?.authorizationUrl,
@@ -583,7 +584,7 @@ async function addToolsToServer(server, toolModules, identityConfig, clientMessa
583
584
  };
584
585
  }
585
586
  // Compare authorization types using the helper function
586
- if (!(0, mcp_i_core_1.authorizationMatches)(delegationAuth, toolAuth)) {
587
+ if (!(0, mcp_i_core_2.authorizationMatches)(delegationAuth, toolAuth)) {
587
588
  if (identityConfig?.debug) {
588
589
  console.error(`[MCPI] Tool "${name}" blocked - authorization method mismatch`);
589
590
  }
@@ -615,6 +616,19 @@ async function addToolsToServer(server, toolModules, identityConfig, clientMessa
615
616
  if (identityConfig?.debug) {
616
617
  console.error(`[MCPI] Tool "${name}" authorized - executing handler`);
617
618
  }
619
+ // Populate delegation context in AsyncLocalStorage so outbound
620
+ // fetch calls made by the tool handler can inject delegation headers.
621
+ if (verifyResult.delegation) {
622
+ const identity = identityManager
623
+ ? await identityManager.ensureIdentity()
624
+ : null;
625
+ (0, request_context_1.setDelegationContextFromIdentity)({
626
+ delegationId: verifyResult.delegation.id,
627
+ delegationChain: (0, mcp_i_core_1.buildChainString)(verifyResult.delegation),
628
+ delegationScopes: toolProtection.requiredScopes || [],
629
+ identity: identity ?? null,
630
+ });
631
+ }
618
632
  }
619
633
  try {
620
634
  // Execute the tool handler
@@ -338,7 +338,7 @@ async function parseProofFromHeaders(request) {
338
338
  // This would typically look for proof in headers or request body
339
339
  // Placeholder implementation
340
340
  // Handle both Fetch API Request and Node.js IncomingMessage
341
- const proofHeader = getHeaderValue(request.headers, "X-XMCP-I-Proof");
341
+ const proofHeader = getHeaderValue(request.headers, "KYA-Proof");
342
342
  if (!proofHeader) {
343
343
  return null;
344
344
  }
@@ -362,7 +362,7 @@ async function parseReceiptFromHeaders(request) {
362
362
  // TODO: Implement actual receipt extraction from request
363
363
  // This would typically look for receipt reference in headers
364
364
  // Handle both Fetch API Request and Node.js IncomingMessage
365
- const receiptRef = getHeaderValue(request.headers, "X-XMCP-I-Receipt-Ref");
365
+ const receiptRef = getHeaderValue(request.headers, "KYA-Receipt-Ref");
366
366
  if (!receiptRef) {
367
367
  return null;
368
368
  }
@@ -381,7 +381,7 @@ async function parseReceiptFromHeaders(request) {
381
381
  async function parseProofFromExpressHeaders(req) {
382
382
  // TODO: Implement actual proof extraction from Express request
383
383
  // This would typically look for proof in headers or request body
384
- const proofHeader = req.headers["x-xmcp-i-proof"];
384
+ const proofHeader = req.headers["kya-proof"];
385
385
  if (!proofHeader) {
386
386
  return null;
387
387
  }
@@ -407,7 +407,7 @@ async function parseProofFromExpressHeaders(req) {
407
407
  async function parseReceiptFromExpressHeaders(req) {
408
408
  // TODO: Implement actual receipt extraction from Express request
409
409
  // This would typically look for receipt reference in headers
410
- const receiptRef = req.headers["x-xmcp-i-receipt-ref"];
410
+ const receiptRef = req.headers["kya-receipt-ref"];
411
411
  if (!receiptRef) {
412
412
  return null;
413
413
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kya-os/mcp-i",
3
- "version": "1.7.13",
3
+ "version": "1.10.0",
4
4
  "description": "The TypeScript MCP framework with identity features built-in",
5
5
  "type": "commonjs",
6
6
  "main": "dist/index.js",
@@ -63,14 +63,14 @@
63
63
  "model-context-protocol"
64
64
  ],
65
65
  "dependencies": {
66
- "@kya-os/contracts": "^1.7.21",
67
- "@kya-os/mcp-i-core": "^1.4.19",
66
+ "@kya-os/contracts": "^1.8.0",
67
+ "@kya-os/mcp-i-core": "^1.7.0",
68
68
  "@modelcontextprotocol/sdk": "^1.11.4",
69
- "@swc/core": "^1.11.24",
70
- "@types/express": "^5.0.1",
69
+ "@swc/core": "^1.15.11",
70
+ "@types/express": "^5.0.6",
71
71
  "@types/webpack-node-externals": "^3.0.4",
72
72
  "@vercel/mcp-adapter": "^0.11.1",
73
- "axios": "^1.12.0",
73
+ "axios": "^1.15.0",
74
74
  "base-x": "^5.0.1",
75
75
  "chalk": "^5.2.0",
76
76
  "chokidar": "^3.6.0",
@@ -79,45 +79,45 @@
79
79
  "cross-env": "^7.0.3",
80
80
  "del": "^8.0.1",
81
81
  "dotenv": "^16.5.0",
82
- "esbuild": "^0.25.0",
83
- "execa": "^9.6.0",
82
+ "esbuild": "^0.27.3",
83
+ "execa": "^9.6.1",
84
84
  "express": "^4.18.0",
85
85
  "fork-ts-checker-webpack-plugin": "^8.0.0",
86
- "fs-extra": "^11.3.0",
87
- "glob": "^11.1.0",
88
- "handlebars": "^4.7.7",
86
+ "fs-extra": "^11.3.3",
87
+ "glob": "^13.0.3",
88
+ "handlebars": "^4.7.9",
89
89
  "jose": "^5.2.0",
90
90
  "json-canonicalize": "^2.0.0",
91
91
  "json5": "^2.2.3",
92
- "jsonwebtoken": "^9.0.2",
92
+ "jsonwebtoken": "^9.0.3",
93
93
  "memfs": "^4.17.2",
94
94
  "raw-body": "^3.0.0",
95
- "swc-loader": "^0.2.6",
95
+ "swc-loader": "^0.2.7",
96
96
  "tsx": "^4.19.4",
97
97
  "webpack": "^5.99.7",
98
98
  "webpack-node-externals": "^3.0.0",
99
- "webpack-virtual-modules": "^0.5.0"
99
+ "webpack-virtual-modules": "^0.6.2"
100
100
  },
101
101
  "optionalDependencies": {
102
- "@modelcontextprotocol/inspector": "^0.16.6"
102
+ "@modelcontextprotocol/inspector": "^0.20.0"
103
103
  },
104
104
  "devDependencies": {
105
- "@aws-sdk/client-dynamodb": "^3.0.0",
105
+ "@aws-sdk/client-dynamodb": "^3.992.0",
106
106
  "@types/content-type": "^1.1.9",
107
107
  "@types/fs-extra": "^11.0.4",
108
108
  "@types/jsonwebtoken": "^9.0.9",
109
109
  "@types/node": "^20.0.0",
110
110
  "@typescript-eslint/eslint-plugin": "^8.19.1",
111
111
  "@typescript-eslint/parser": "^8.19.1",
112
- "@vitest/coverage-v8": "^4.0.5",
112
+ "@vitest/coverage-v8": "^4.0.18",
113
113
  "copy-webpack-plugin": "^12.0.2",
114
114
  "eslint": "^9.26.0",
115
115
  "node-loader": "^1.0.1",
116
116
  "redis": "^4.0.0",
117
117
  "ts-loader": "^9.4.2",
118
118
  "typescript": "^5.3.0",
119
- "vitest": "^4.0.5",
120
- "zod": "^3.25.76"
119
+ "vitest": "^4.0.18",
120
+ "zod": "^3.25.67"
121
121
  },
122
122
  "engines": {
123
123
  "node": ">=20.0.0"