@kya-os/mcp-i 1.5.3-canary.1 → 1.5.4

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 (50) hide show
  1. package/dist/auth/jwt.d.ts +1 -1
  2. package/dist/auth/oauth/router.js +3 -8
  3. package/dist/cli-adapter/index.js +1 -1
  4. package/dist/cli-adapter/kta-registration.d.ts +1 -1
  5. package/dist/cli-adapter/kta-registration.js +2 -2
  6. package/dist/compiler/config/injection.js +2 -2
  7. package/dist/compiler/get-webpack-config/get-entries.js +12 -8
  8. package/dist/providers/node-providers.d.ts +1 -1
  9. package/dist/providers/node-providers.js +4 -4
  10. package/dist/runtime/adapter-express.js +1 -1
  11. package/dist/runtime/adapter-nextjs.js +1 -1
  12. package/dist/runtime/audit.d.ts +287 -3
  13. package/dist/runtime/audit.js +169 -4
  14. package/dist/runtime/auth-handshake.d.ts +1 -1
  15. package/dist/runtime/auth-handshake.js +1 -1
  16. package/dist/runtime/debug.d.ts +2 -2
  17. package/dist/runtime/debug.js +3 -3
  18. package/dist/runtime/delegation/index.d.ts +7 -0
  19. package/dist/runtime/delegation/index.js +23 -0
  20. package/dist/runtime/delegation/vc-issuer.d.ts +119 -0
  21. package/dist/runtime/delegation/vc-issuer.js +220 -0
  22. package/dist/runtime/delegation/vc-verifier.d.ts +193 -0
  23. package/dist/runtime/delegation/vc-verifier.js +387 -0
  24. package/dist/runtime/http.js +1 -1
  25. package/dist/runtime/identity.d.ts +10 -2
  26. package/dist/runtime/identity.js +68 -11
  27. package/dist/runtime/mcpi-runtime.d.ts +4 -1
  28. package/dist/runtime/mcpi-runtime.js +2 -2
  29. package/dist/runtime/migrate-identity.d.ts +16 -0
  30. package/dist/runtime/migrate-identity.js +118 -0
  31. package/dist/runtime/proof.js +2 -2
  32. package/dist/runtime/stdio.js +1 -1
  33. package/dist/runtime/transports/http/index.js +3 -1
  34. package/dist/runtime/utils/time.d.ts +80 -0
  35. package/dist/runtime/utils/time.js +117 -0
  36. package/dist/runtime/utils/tools.js +22 -3
  37. package/dist/runtime/verifier-middleware.js +1 -1
  38. package/dist/runtime/well-known.d.ts +0 -4
  39. package/dist/runtime/well-known.js +12 -26
  40. package/dist/storage/delegation.js +2 -2
  41. package/dist/test/deterministic-keys.d.ts +1 -1
  42. package/dist/test/deterministic-keys.js +6 -6
  43. package/dist/test/examples/test-usage-example.d.ts +6 -6
  44. package/dist/test/examples/test-usage-example.js +5 -5
  45. package/dist/test/local-verification.d.ts +1 -1
  46. package/dist/test/local-verification.js +10 -10
  47. package/dist/test/mock-identity-provider.d.ts +4 -4
  48. package/dist/test/mock-identity-provider.js +7 -7
  49. package/dist/test/runtime-integration.d.ts +2 -2
  50. package/package.json +4 -3
@@ -7,7 +7,7 @@ declare global {
7
7
  ctx?: {
8
8
  agent?: {
9
9
  did?: string;
10
- keyId?: string;
10
+ kid?: string;
11
11
  session?: string;
12
12
  scopes?: string[];
13
13
  delegationRef?: string;
@@ -3,18 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createOAuthRouter = createOAuthRouter;
4
4
  exports.createOAuthMiddleware = createOAuthMiddleware;
5
5
  const express_1 = require("express");
6
+ const mcp_i_core_1 = require("@kya-os/mcp-i-core");
6
7
  function createOAuthRouter(config) {
7
8
  const router = (0, express_1.Router)();
8
9
  const { provider, issuerUrl, baseUrl, serviceDocumentationUrl, pathPrefix = "/oauth2", } = config;
9
10
  router.use((req, res, next) => {
10
- // to do check: cors config from ts file is overriding and failing to add headers
11
- res.setHeader("Access-Control-Allow-Origin", "*");
12
- res.setHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
13
- res.setHeader("Access-Control-Allow-Headers",
14
- // should also pass the mcp-protocol-version header
15
- // probably only that one since the rest can be set from the config side
16
- "Content-Type, Authorization, Accept, mcp-protocol-version");
17
- res.setHeader("Access-Control-Expose-Headers", "Content-Type");
11
+ // Apply shared CORS headers for OAuth endpoints
12
+ (0, mcp_i_core_1.applyCORSHeaders)(res, mcp_i_core_1.OAUTH_CORS_HEADERS);
18
13
  if (req.method === "OPTIONS") {
19
14
  res.sendStatus(200);
20
15
  return;
@@ -55,7 +55,7 @@ async function enableMCPIdentityCLI(options = {}) {
55
55
  registrationResult = await (0, kta_registration_1.registerWithKTA)({
56
56
  did: identity.did,
57
57
  publicKey: identity.publicKey,
58
- keyId: identity.keyId,
58
+ kid: identity.kid,
59
59
  name: name || "My Agent",
60
60
  description: description || "XMCP-I agent with identity features",
61
61
  repository,
@@ -10,7 +10,7 @@
10
10
  export interface KTARegistrationOptions {
11
11
  did: string;
12
12
  publicKey: string;
13
- keyId: string;
13
+ kid: string;
14
14
  name: string;
15
15
  description: string;
16
16
  repository?: string;
@@ -28,7 +28,7 @@ const MCP_I_CAPABILITIES = [
28
28
  * Returns registration details including claim URL.
29
29
  */
30
30
  async function registerWithKTA(options) {
31
- const { did, publicKey, keyId, name, description, repository, endpoint = "https://knowthat.ai", } = options;
31
+ const { did, publicKey, kid, name, description, repository, endpoint = "https://knowthat.ai", } = options;
32
32
  try {
33
33
  // Construct verification endpoint from DID
34
34
  const verificationEndpoint = did.includes("localhost")
@@ -38,7 +38,7 @@ async function registerWithKTA(options) {
38
38
  const payload = {
39
39
  did,
40
40
  publicKey,
41
- keyId,
41
+ kid,
42
42
  name,
43
43
  description,
44
44
  repository: repository || undefined,
@@ -115,8 +115,8 @@ function injectRuntimeConfigPath(projectRoot) {
115
115
  break;
116
116
  }
117
117
  }
118
- // Double-stringify for webpack DefinePlugin
118
+ // Single-stringify for webpack DefinePlugin (path strings don't need double-stringify)
119
119
  return {
120
- RUNTIME_CONFIG_PATH: JSON.stringify(JSON.stringify(runtimeConfigPath)),
120
+ RUNTIME_CONFIG_PATH: JSON.stringify(runtimeConfigPath),
121
121
  };
122
122
  }
@@ -8,25 +8,29 @@ const path_1 = __importDefault(require("path"));
8
8
  /** Get what packages are gonna be built by xmcp */
9
9
  function getEntries(xmcpConfig) {
10
10
  const entries = {};
11
- // Point to SOURCE files in the mcp-i package, not pre-built runtime files
12
- // This allows webpack to compile them directly without double-wrapping
13
- // Cache bust: Updated adapter paths to correct locations (2025-10-09)
11
+ // Resolve to the mcp-i package root (works for both workspace and published packages)
14
12
  const mcpiPackageRoot = path_1.default.resolve(__dirname, "../../..");
15
- const runtimeSourcePath = path_1.default.join(mcpiPackageRoot, "src/runtime");
13
+ // Check if source files exist (workspace/development) or use dist files (published package)
14
+ const fs = require("fs");
15
+ const srcRuntimePath = path_1.default.join(mcpiPackageRoot, "src/runtime");
16
+ const distRuntimePath = path_1.default.join(mcpiPackageRoot, "dist/runtime");
17
+ const useSourceFiles = fs.existsSync(srcRuntimePath);
18
+ const runtimePath = useSourceFiles ? srcRuntimePath : distRuntimePath;
19
+ const fileExt = useSourceFiles ? ".ts" : ".js";
16
20
  if (xmcpConfig.stdio) {
17
- entries.stdio = path_1.default.join(runtimeSourcePath, "transports/stdio/index.ts");
21
+ entries.stdio = path_1.default.join(runtimePath, `transports/stdio/index${fileExt}`);
18
22
  }
19
23
  if (xmcpConfig["http"]) {
20
24
  // non adapter mode
21
25
  if (!xmcpConfig.experimental?.adapter) {
22
- entries["http"] = path_1.default.join(runtimeSourcePath, "transports/http/index.ts");
26
+ entries["http"] = path_1.default.join(runtimePath, `transports/http/index${fileExt}`);
23
27
  }
24
28
  // adapter mode enabled
25
29
  if (xmcpConfig.experimental?.adapter === "express") {
26
- entries["adapter"] = path_1.default.join(runtimeSourcePath, "adapters/express/index.ts");
30
+ entries["adapter"] = path_1.default.join(runtimePath, `adapters/express/index${fileExt}`);
27
31
  }
28
32
  if (xmcpConfig.experimental?.adapter === "nextjs") {
29
- entries["adapter"] = path_1.default.join(runtimeSourcePath, "adapters/nextjs/index.ts");
33
+ entries["adapter"] = path_1.default.join(runtimePath, `adapters/nextjs/index${fileExt}`);
30
34
  }
31
35
  }
32
36
  return entries;
@@ -34,7 +34,7 @@ export declare class NodeClockProvider extends ClockProvider {
34
34
  export declare class NodeFetchProvider extends FetchProvider {
35
35
  resolveDID(did: string): Promise<any>;
36
36
  fetchStatusList(url: string): Promise<any>;
37
- fetchDelegationChain(id: string): Promise<any[]>;
37
+ fetchDelegationChain(_id: string): Promise<any[]>;
38
38
  fetch(url: string, options?: any): Promise<Response>;
39
39
  }
40
40
  /**
@@ -166,7 +166,7 @@ class NodeFetchProvider extends mcp_i_core_1.FetchProvider {
166
166
  const response = await axios_1.default.get(url);
167
167
  return response.data;
168
168
  }
169
- async fetchDelegationChain(id) {
169
+ async fetchDelegationChain(_id) {
170
170
  // Would fetch from a delegation registry
171
171
  return [];
172
172
  }
@@ -287,7 +287,7 @@ class FileIdentityProvider extends mcp_i_core_1.IdentityProvider {
287
287
  process.env.MCP_IDENTITY_AGENT_DID) {
288
288
  return {
289
289
  did: process.env.MCP_IDENTITY_AGENT_DID,
290
- keyId: `${process.env.MCP_IDENTITY_AGENT_DID}#key-1`,
290
+ kid: `${process.env.MCP_IDENTITY_AGENT_DID}#key-1`,
291
291
  privateKey: process.env.MCP_IDENTITY_PRIVATE_KEY,
292
292
  publicKey: process.env.MCP_IDENTITY_PUBLIC_KEY,
293
293
  createdAt: new Date().toISOString(),
@@ -304,7 +304,7 @@ class FileIdentityProvider extends mcp_i_core_1.IdentityProvider {
304
304
  const did = this.generateDIDFromPublicKey(keyPair.publicKey);
305
305
  const identity = {
306
306
  did,
307
- keyId: `${did}#key-1`,
307
+ kid: `${did}#key-1`,
308
308
  privateKey: keyPair.privateKey,
309
309
  publicKey: keyPair.publicKey,
310
310
  createdAt: new Date().toISOString(),
@@ -321,7 +321,7 @@ class FileIdentityProvider extends mcp_i_core_1.IdentityProvider {
321
321
  const did = this.generateDIDFromPublicKey(keyPair.publicKey);
322
322
  const identity = {
323
323
  did,
324
- keyId: `${did}#key-1`,
324
+ kid: `${did}#key-1`,
325
325
  privateKey: keyPair.privateKey,
326
326
  publicKey: keyPair.publicKey,
327
327
  createdAt: new Date().toISOString(),