@kya-os/mcp-i 1.5.4 → 1.5.6-canary.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.
@@ -37,9 +37,12 @@ export interface ProdEnvironment {
37
37
  KYA_VOUCHED_API_KEY: string;
38
38
  }
39
39
  /**
40
- * Identity management configuration
40
+ * Runtime Identity Manager Configuration
41
+ *
42
+ * Configuration for the IdentityManager class in the MCP-I runtime.
43
+ * Controls how identity is loaded and managed at runtime.
41
44
  */
42
- export interface IdentityConfig {
45
+ export interface RuntimeIdentityManagerConfig {
43
46
  environment: "development" | "production";
44
47
  devIdentityPath?: string;
45
48
  privacyMode?: boolean;
@@ -58,7 +61,7 @@ export declare const IDENTITY_ERRORS: {
58
61
  export declare class IdentityManager {
59
62
  private config;
60
63
  private cachedIdentity?;
61
- constructor(config?: IdentityConfig);
64
+ constructor(config?: RuntimeIdentityManagerConfig);
62
65
  /**
63
66
  * Load or generate agent identity
64
67
  * Requirements: 4.1, 4.2, 4.3, 4.4
@@ -102,7 +105,7 @@ export declare class IdentityManager {
102
105
  /**
103
106
  * Get current configuration
104
107
  */
105
- getConfig(): IdentityConfig;
108
+ getConfig(): RuntimeIdentityManagerConfig;
106
109
  }
107
110
  /**
108
111
  * Default identity manager instance
@@ -111,4 +114,4 @@ export declare const defaultIdentityManager: IdentityManager;
111
114
  /**
112
115
  * Convenience function to ensure identity
113
116
  */
114
- export declare function ensureIdentity(config?: IdentityConfig): Promise<AgentIdentity>;
117
+ export declare function ensureIdentity(config?: RuntimeIdentityManagerConfig): Promise<AgentIdentity>;
@@ -4,9 +4,10 @@
4
4
  * Identity-aware MCP runtime with proof generation, session management,
5
5
  * audit logging, and well-known endpoints.
6
6
  */
7
- export { MCPIRuntimeWrapper as MCPIRuntime, createMCPIRuntime } from "./mcpi-runtime-wrapper";
7
+ export { MCPINodeRuntimeWrapper, MCPINodeRuntimeWrapper as MCPIRuntime, // Backward compatibility alias
8
+ createMCPIRuntime } from "./mcpi-runtime-wrapper";
8
9
  export { RuntimeFactory, RUNTIME_ERRORS, type MCPIRuntimeConfig, type RuntimeEnvironment, } from "./mcpi-runtime";
9
- export { IdentityManager, defaultIdentityManager, ensureIdentity, IDENTITY_ERRORS, type AgentIdentity, type DevIdentityFile, type ProdEnvironment, type IdentityConfig, } from "./identity";
10
+ export { IdentityManager, defaultIdentityManager, ensureIdentity, IDENTITY_ERRORS, type AgentIdentity, type DevIdentityFile, type ProdEnvironment, type RuntimeIdentityManagerConfig, } from "./identity";
10
11
  export { SessionManager, defaultSessionManager, createHandshakeRequest, validateHandshakeFormat, type SessionConfig, type HandshakeResult, } from "./session";
11
12
  export { ProofGenerator, createProofResponse, extractCanonicalData, type ToolRequest, type ToolResponse, type ProofOptions, } from "./proof";
12
13
  export { AuditLogger, defaultAuditLogger, logKeyRotationAudit, parseAuditLine, validateAuditRecord, type AuditConfig, type AuditContext, type KeyRotationAuditContext, } from "./audit";
@@ -6,11 +6,12 @@
6
6
  * audit logging, and well-known endpoints.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.AgentShieldToolProtectionSource = exports.FileToolProtectionSource = exports.InlineToolProtectionSource = exports.createToolProtectionResolver = exports.ToolProtectionResolver = exports.MemoryDelegationVerifier = exports.AgentShieldAPIDelegationVerifier = exports.CloudflareKVDelegationVerifier = exports.createProofBatchQueue = exports.AgentShieldProofDestination = exports.KTAProofDestination = exports.ProofBatchQueue = exports.MemoryResumeTokenStore = exports.hasSensitiveScopes = exports.verifyOrHints = exports.extractScopes = exports.validateDelegation = exports.checkScopes = exports.createDelegationVerifier = exports.formatVerifyLink = exports.DemoConsole = exports.createDemoManager = exports.DemoManager = exports.createDebugEndpoint = exports.DebugManager = exports.extractDIDFromPath = exports.validateAgentDocument = exports.validateDIDDocument = exports.createWellKnownHandler = exports.WellKnownManager = exports.validateAuditRecord = exports.parseAuditLine = exports.logKeyRotationAudit = exports.defaultAuditLogger = exports.AuditLogger = exports.extractCanonicalData = exports.createProofResponse = exports.ProofGenerator = exports.validateHandshakeFormat = exports.createHandshakeRequest = exports.defaultSessionManager = exports.SessionManager = exports.IDENTITY_ERRORS = exports.ensureIdentity = exports.defaultIdentityManager = exports.IdentityManager = exports.RUNTIME_ERRORS = exports.RuntimeFactory = exports.createMCPIRuntime = exports.MCPIRuntime = void 0;
10
- exports.getToolProtection = exports.isToolProtected = exports.toolProtectionRegistry = void 0;
11
- // Main runtime - now using core with Node.js providers
9
+ exports.FileToolProtectionSource = exports.InlineToolProtectionSource = exports.createToolProtectionResolver = exports.ToolProtectionResolver = exports.MemoryDelegationVerifier = exports.AgentShieldAPIDelegationVerifier = exports.CloudflareKVDelegationVerifier = exports.createProofBatchQueue = exports.AgentShieldProofDestination = exports.KTAProofDestination = exports.ProofBatchQueue = exports.MemoryResumeTokenStore = exports.hasSensitiveScopes = exports.verifyOrHints = exports.extractScopes = exports.validateDelegation = exports.checkScopes = exports.createDelegationVerifier = exports.formatVerifyLink = exports.DemoConsole = exports.createDemoManager = exports.DemoManager = exports.createDebugEndpoint = exports.DebugManager = exports.extractDIDFromPath = exports.validateAgentDocument = exports.validateDIDDocument = exports.createWellKnownHandler = exports.WellKnownManager = exports.validateAuditRecord = exports.parseAuditLine = exports.logKeyRotationAudit = exports.defaultAuditLogger = exports.AuditLogger = exports.extractCanonicalData = exports.createProofResponse = exports.ProofGenerator = exports.validateHandshakeFormat = exports.createHandshakeRequest = exports.defaultSessionManager = exports.SessionManager = exports.IDENTITY_ERRORS = exports.ensureIdentity = exports.defaultIdentityManager = exports.IdentityManager = exports.RUNTIME_ERRORS = exports.RuntimeFactory = exports.createMCPIRuntime = exports.MCPIRuntime = exports.MCPINodeRuntimeWrapper = void 0;
10
+ exports.getToolProtection = exports.isToolProtected = exports.toolProtectionRegistry = exports.AgentShieldToolProtectionSource = void 0;
11
+ // Main runtime - Node.js implementation with providers
12
12
  var mcpi_runtime_wrapper_1 = require("./mcpi-runtime-wrapper");
13
- Object.defineProperty(exports, "MCPIRuntime", { enumerable: true, get: function () { return mcpi_runtime_wrapper_1.MCPIRuntimeWrapper; } });
13
+ Object.defineProperty(exports, "MCPINodeRuntimeWrapper", { enumerable: true, get: function () { return mcpi_runtime_wrapper_1.MCPINodeRuntimeWrapper; } });
14
+ Object.defineProperty(exports, "MCPIRuntime", { enumerable: true, get: function () { return mcpi_runtime_wrapper_1.MCPINodeRuntimeWrapper; } });
14
15
  Object.defineProperty(exports, "createMCPIRuntime", { enumerable: true, get: function () { return mcpi_runtime_wrapper_1.createMCPIRuntime; } });
15
16
  // Legacy exports for compatibility
16
17
  var mcpi_runtime_1 = require("./mcpi-runtime");
@@ -1,19 +1,24 @@
1
1
  /**
2
- * MCPIRuntime Wrapper
2
+ * MCPINodeRuntimeWrapper
3
3
  *
4
- * Extends the core runtime with Node.js-specific providers while
5
- * maintaining the exact same API for backward compatibility.
4
+ * Node.js-specific runtime that extends the core runtime with Node.js providers.
5
+ * Provides backward compatibility by accepting legacy configuration format.
6
6
  */
7
7
  import { MCPIRuntimeBase } from '@kya-os/mcp-i-core';
8
8
  import type { MCPIRuntimeConfig } from './mcpi-runtime';
9
9
  /**
10
- * Enhanced MCPIRuntime using the core with Node.js providers
10
+ * Node.js-specific runtime implementation
11
11
  */
12
- export declare class MCPIRuntimeWrapper extends MCPIRuntimeBase {
12
+ export declare class MCPINodeRuntimeWrapper extends MCPIRuntimeBase {
13
13
  private legacyConfig;
14
14
  constructor(config?: MCPIRuntimeConfig);
15
15
  }
16
16
  /**
17
- * Factory function for creating runtime
17
+ * Factory function for creating Node.js runtime
18
18
  */
19
- export declare function createMCPIRuntime(config?: MCPIRuntimeConfig): MCPIRuntimeWrapper;
19
+ export declare function createMCPIRuntime(config?: MCPIRuntimeConfig): MCPINodeRuntimeWrapper;
20
+ /**
21
+ * Alias for backward compatibility
22
+ * @deprecated Use MCPINodeRuntimeWrapper
23
+ */
24
+ export declare const MCPIRuntimeWrapper: typeof MCPINodeRuntimeWrapper;
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  /**
3
- * MCPIRuntime Wrapper
3
+ * MCPINodeRuntimeWrapper
4
4
  *
5
- * Extends the core runtime with Node.js-specific providers while
6
- * maintaining the exact same API for backward compatibility.
5
+ * Node.js-specific runtime that extends the core runtime with Node.js providers.
6
+ * Provides backward compatibility by accepting legacy configuration format.
7
7
  */
8
8
  var __importDefault = (this && this.__importDefault) || function (mod) {
9
9
  return (mod && mod.__esModule) ? mod : { "default": mod };
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.MCPIRuntimeWrapper = void 0;
12
+ exports.MCPIRuntimeWrapper = exports.MCPINodeRuntimeWrapper = void 0;
13
13
  exports.createMCPIRuntime = createMCPIRuntime;
14
14
  const mcp_i_core_1 = require("@kya-os/mcp-i-core");
15
15
  const node_providers_1 = require("../providers/node-providers");
@@ -34,26 +34,26 @@ function createProvidersFromConfig(config) {
34
34
  nonceCacheProvider,
35
35
  identityProvider,
36
36
  environment: config.identity?.environment || 'development',
37
- timestampSkewSeconds: config.session?.timestampSkewSeconds || 120,
38
- sessionTtlMinutes: config.session?.sessionTtlMinutes || 30,
37
+ session: {
38
+ timestampSkewSeconds: config.session?.timestampSkewSeconds || 120,
39
+ ttlMinutes: config.session?.sessionTtlMinutes || 30
40
+ },
39
41
  audit: config.audit ? {
40
42
  enabled: config.audit.enabled !== false,
41
43
  logFunction: config.audit.logFunction,
42
- includePayloads: config.audit.includePayloads
44
+ includePayloads: config.audit.includePayloads,
45
+ includeProofHashes: config.audit.includeProofHashes
43
46
  } : undefined,
44
47
  wellKnown: config.wellKnown ? {
45
48
  enabled: true,
46
- serviceName: config.wellKnown.agentMetadata?.name,
47
- serviceEndpoint: config.wellKnown.baseUrl
48
- } : undefined,
49
- showVerifyLink: config.runtime?.showVerifyLink !== false,
50
- identityBadge: config.demo?.identityBadge || config.runtime?.identityBadge || false
49
+ serviceName: config.wellKnown.agentMetadata?.name
50
+ } : undefined
51
51
  };
52
52
  }
53
53
  /**
54
- * Enhanced MCPIRuntime using the core with Node.js providers
54
+ * Node.js-specific runtime implementation
55
55
  */
56
- class MCPIRuntimeWrapper extends mcp_i_core_1.MCPIRuntimeBase {
56
+ class MCPINodeRuntimeWrapper extends mcp_i_core_1.MCPIRuntimeBase {
57
57
  legacyConfig;
58
58
  constructor(config = {}) {
59
59
  const coreConfig = createProvidersFromConfig(config);
@@ -61,10 +61,15 @@ class MCPIRuntimeWrapper extends mcp_i_core_1.MCPIRuntimeBase {
61
61
  this.legacyConfig = config;
62
62
  }
63
63
  }
64
- exports.MCPIRuntimeWrapper = MCPIRuntimeWrapper;
64
+ exports.MCPINodeRuntimeWrapper = MCPINodeRuntimeWrapper;
65
65
  /**
66
- * Factory function for creating runtime
66
+ * Factory function for creating Node.js runtime
67
67
  */
68
68
  function createMCPIRuntime(config) {
69
- return new MCPIRuntimeWrapper(config);
69
+ return new MCPINodeRuntimeWrapper(config);
70
70
  }
71
+ /**
72
+ * Alias for backward compatibility
73
+ * @deprecated Use MCPINodeRuntimeWrapper
74
+ */
75
+ exports.MCPIRuntimeWrapper = MCPINodeRuntimeWrapper;
@@ -24,6 +24,8 @@ export interface RuntimeEnvironment {
24
24
  }
25
25
  /**
26
26
  * XMCP-I Runtime configuration
27
+ * @deprecated Use NodeRuntimeConfig from @kya-os/mcp-i/config instead.
28
+ * This interface is maintained for backward compatibility only.
27
29
  */
28
30
  export interface MCPIRuntimeConfig {
29
31
  identity?: {
@@ -40,6 +42,7 @@ export interface MCPIRuntimeConfig {
40
42
  enabled?: boolean;
41
43
  logFunction?: (record: string) => void;
42
44
  includePayloads?: boolean;
45
+ includeProofHashes?: boolean;
43
46
  };
44
47
  proofing?: {
45
48
  /** Enable proof generation and submission */
@@ -108,6 +111,10 @@ export interface MCPIRuntimeConfig {
108
111
  /**
109
112
  * XMCP-I Runtime class
110
113
  */
114
+ /**
115
+ * @deprecated Use MCPINodeRuntimeWrapper instead.
116
+ * This class is maintained for backward compatibility only.
117
+ */
111
118
  export declare class MCPIRuntime {
112
119
  private identityManager;
113
120
  private sessionManager;
@@ -22,6 +22,10 @@ const tool_protection_registry_1 = require("./tool-protection-registry");
22
22
  /**
23
23
  * XMCP-I Runtime class
24
24
  */
25
+ /**
26
+ * @deprecated Use MCPINodeRuntimeWrapper instead.
27
+ * This class is maintained for backward compatibility only.
28
+ */
25
29
  class MCPIRuntime {
26
30
  identityManager;
27
31
  sessionManager;
@@ -63,6 +67,8 @@ class MCPIRuntime {
63
67
  this.checkRuntimeEnvironment();
64
68
  // Ensure identity is loaded
65
69
  this.cachedIdentity = await this.identityManager.ensureIdentity();
70
+ // Set server DID in session manager (for session context)
71
+ this.sessionManager.setServerDid(this.cachedIdentity.did);
66
72
  // Create tool protection resolver NOW that we have the agent DID (NEW - Phase 1.5)
67
73
  if (this.config.delegation?.enabled) {
68
74
  this.toolProtectionResolver = (0, tool_protection_1.createToolProtectionResolver)({
@@ -30,6 +30,7 @@ export interface ToolResponse {
30
30
  export interface ProofOptions {
31
31
  scopeId?: string;
32
32
  delegationRef?: string;
33
+ clientDid?: string;
33
34
  }
34
35
  /**
35
36
  * Proof generator class
@@ -37,7 +37,7 @@ class ProofGenerator {
37
37
  sessionId: session.sessionId,
38
38
  requestHash: hashes.requestHash,
39
39
  responseHash: hashes.responseHash,
40
- ...options, // Include scopeId and delegationRef if provided
40
+ ...options, // Include scopeId, delegationRef, and clientDid if provided
41
41
  };
42
42
  // Generate JWS (compact format)
43
43
  const jws = await this.generateJWS(meta);
@@ -113,6 +113,7 @@ class ProofGenerator {
113
113
  // Optional claims
114
114
  ...(meta.scopeId && { scopeId: meta.scopeId }),
115
115
  ...(meta.delegationRef && { delegationRef: meta.delegationRef }),
116
+ ...(meta.clientDid && { clientDid: meta.clientDid }),
116
117
  };
117
118
  // Create and sign JWT (compact format: header.payload.signature)
118
119
  const jwt = await new jose_1.SignJWT(payload)
@@ -13,6 +13,7 @@ export interface SessionConfig {
13
13
  sessionTtlMinutes?: number;
14
14
  absoluteSessionLifetime?: number;
15
15
  nonceCache?: NonceCache;
16
+ serverDid?: string;
16
17
  }
17
18
  /**
18
19
  * Handshake validation result
@@ -33,6 +34,11 @@ export declare class SessionManager {
33
34
  private config;
34
35
  private sessions;
35
36
  constructor(config?: SessionConfig);
37
+ /**
38
+ * Set server DID for session creation
39
+ * Called after identity is loaded
40
+ */
41
+ setServerDid(serverDid: string): void;
36
42
  /**
37
43
  * Validate handshake and create or retrieve session
38
44
  * Requirements: 4.5, 4.6, 4.7, 4.8, 4.9
@@ -33,6 +33,13 @@ class SessionManager {
33
33
  "Consider using Redis, DynamoDB, or Cloudflare KV for production.");
34
34
  }
35
35
  }
36
+ /**
37
+ * Set server DID for session creation
38
+ * Called after identity is loaded
39
+ */
40
+ setServerDid(serverDid) {
41
+ this.config.serverDid = serverDid;
42
+ }
36
43
  /**
37
44
  * Validate handshake and create or retrieve session
38
45
  * Requirements: 4.5, 4.6, 4.7, 4.8, 4.9
@@ -79,6 +86,7 @@ class SessionManager {
79
86
  lastActivity: now,
80
87
  ttlMinutes: this.config.sessionTtlMinutes,
81
88
  agentDid: request.agentDid, // Pass through agent DID for delegation verification
89
+ ...(this.config.serverDid && { serverDid: this.config.serverDid }), // Include server DID if provided
82
90
  };
83
91
  // Store session
84
92
  this.sessions.set(sessionId, session);