@kya-os/mcp-i 1.6.1-canary.clientinfo.20251125183419 → 1.6.2-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.
- package/dist/295.js +1 -1
- package/dist/cli-adapter/index.d.ts +0 -2
- package/dist/cli-adapter/index.js +5 -9
- package/dist/cli-adapter/kta-registration.d.ts +0 -9
- package/dist/cli-adapter/kta-registration.js +0 -75
- package/dist/compiler/get-webpack-config/index.js +2 -11
- package/dist/index.js.LICENSE.txt +6 -0
- package/dist/runtime/adapter-express.js +1 -1
- package/dist/runtime/adapter-nextjs.js +1 -1
- package/dist/runtime/audit.d.ts +0 -4
- package/dist/runtime/audit.js +2 -6
- package/dist/runtime/http.js +1 -1
- package/dist/runtime/identity.d.ts +0 -12
- package/dist/runtime/identity.js +1 -15
- package/dist/runtime/mcpi-runtime-wrapper.d.ts +3 -2
- package/dist/runtime/mcpi-runtime-wrapper.js +17 -20
- package/dist/runtime/mcpi-runtime.js +1 -7
- package/dist/runtime/session.d.ts +0 -13
- package/dist/runtime/session.js +0 -43
- package/dist/runtime/stdio.js +1 -1
- package/dist/runtime/utils/tools.js +23 -196
- package/dist/test/examples/test-usage-example.d.ts +2 -2
- package/package.json +20 -19
|
@@ -111,18 +111,6 @@ export declare class IdentityManager {
|
|
|
111
111
|
* Default identity manager instance
|
|
112
112
|
*/
|
|
113
113
|
export declare const defaultIdentityManager: IdentityManager;
|
|
114
|
-
/**
|
|
115
|
-
* Extract agent ID from DID
|
|
116
|
-
* @deprecated Use extractAgentId from @kya-os/mcp-i-core/utils/did-helpers instead
|
|
117
|
-
* This re-export is maintained for backward compatibility
|
|
118
|
-
*/
|
|
119
|
-
export { extractAgentId } from '@kya-os/mcp-i-core/utils/did-helpers';
|
|
120
|
-
/**
|
|
121
|
-
* Extract agent slug from DID
|
|
122
|
-
* @deprecated Use extractAgentSlug from @kya-os/mcp-i-core/utils/did-helpers instead
|
|
123
|
-
* This re-export is maintained for backward compatibility
|
|
124
|
-
*/
|
|
125
|
-
export { extractAgentSlug } from '@kya-os/mcp-i-core/utils/did-helpers';
|
|
126
114
|
/**
|
|
127
115
|
* Convenience function to ensure identity
|
|
128
116
|
*/
|
package/dist/runtime/identity.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* and production environments according to requirements 4.1-4.4.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.defaultIdentityManager = exports.IdentityManager = exports.IDENTITY_ERRORS = void 0;
|
|
10
10
|
exports.ensureIdentity = ensureIdentity;
|
|
11
11
|
const promises_1 = require("fs/promises");
|
|
12
12
|
const fs_1 = require("fs");
|
|
@@ -291,20 +291,6 @@ exports.IdentityManager = IdentityManager;
|
|
|
291
291
|
* Default identity manager instance
|
|
292
292
|
*/
|
|
293
293
|
exports.defaultIdentityManager = new IdentityManager();
|
|
294
|
-
/**
|
|
295
|
-
* Extract agent ID from DID
|
|
296
|
-
* @deprecated Use extractAgentId from @kya-os/mcp-i-core/utils/did-helpers instead
|
|
297
|
-
* This re-export is maintained for backward compatibility
|
|
298
|
-
*/
|
|
299
|
-
var did_helpers_1 = require("@kya-os/mcp-i-core/utils/did-helpers");
|
|
300
|
-
Object.defineProperty(exports, "extractAgentId", { enumerable: true, get: function () { return did_helpers_1.extractAgentId; } });
|
|
301
|
-
/**
|
|
302
|
-
* Extract agent slug from DID
|
|
303
|
-
* @deprecated Use extractAgentSlug from @kya-os/mcp-i-core/utils/did-helpers instead
|
|
304
|
-
* This re-export is maintained for backward compatibility
|
|
305
|
-
*/
|
|
306
|
-
var did_helpers_2 = require("@kya-os/mcp-i-core/utils/did-helpers");
|
|
307
|
-
Object.defineProperty(exports, "extractAgentSlug", { enumerable: true, get: function () { return did_helpers_2.extractAgentSlug; } });
|
|
308
294
|
/**
|
|
309
295
|
* Convenience function to ensure identity
|
|
310
296
|
*/
|
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
* Node.js-specific runtime that extends the core runtime with Node.js providers.
|
|
5
5
|
* Provides backward compatibility by accepting legacy configuration format.
|
|
6
6
|
*/
|
|
7
|
-
import { MCPIRuntimeBase, AccessControlApiService, ProofVerifier } from
|
|
8
|
-
import type { MCPIRuntimeConfig } from
|
|
7
|
+
import { MCPIRuntimeBase, AccessControlApiService, ProofVerifier } from '@kya-os/mcp-i-core';
|
|
8
|
+
import type { MCPIRuntimeConfig } from './mcpi-runtime';
|
|
9
9
|
/**
|
|
10
10
|
* Node.js-specific runtime implementation
|
|
11
11
|
*/
|
|
12
12
|
export declare class MCPINodeRuntimeWrapper extends MCPIRuntimeBase {
|
|
13
13
|
private legacyConfig;
|
|
14
|
+
protected accessControlService?: AccessControlApiService;
|
|
14
15
|
constructor(config?: MCPIRuntimeConfig);
|
|
15
16
|
/**
|
|
16
17
|
* Set AccessControlApiService (for testing or manual injection)
|
|
@@ -21,7 +21,8 @@ function createProvidersFromConfig(config) {
|
|
|
21
21
|
const cryptoProvider = new node_providers_1.NodeCryptoProvider();
|
|
22
22
|
const clockProvider = new node_providers_1.NodeClockProvider();
|
|
23
23
|
const fetchProvider = new node_providers_1.NodeFetchProvider();
|
|
24
|
-
const identityPath = config.identity?.devIdentityPath ||
|
|
24
|
+
const identityPath = config.identity?.devIdentityPath ||
|
|
25
|
+
path_1.default.join(process.cwd(), '.mcp-i');
|
|
25
26
|
const storageProvider = new node_providers_1.FileStorageProvider(identityPath);
|
|
26
27
|
const identityProvider = new node_providers_1.FileIdentityProvider(identityPath, cryptoProvider);
|
|
27
28
|
const nonceCacheProvider = (0, node_providers_1.getNonceCacheProvider)();
|
|
@@ -32,25 +33,21 @@ function createProvidersFromConfig(config) {
|
|
|
32
33
|
storageProvider,
|
|
33
34
|
nonceCacheProvider,
|
|
34
35
|
identityProvider,
|
|
35
|
-
environment: config.identity?.environment ||
|
|
36
|
+
environment: config.identity?.environment || 'development',
|
|
36
37
|
session: {
|
|
37
38
|
timestampSkewSeconds: config.session?.timestampSkewSeconds || 120,
|
|
38
|
-
ttlMinutes: config.session?.sessionTtlMinutes || 30
|
|
39
|
+
ttlMinutes: config.session?.sessionTtlMinutes || 30
|
|
39
40
|
},
|
|
40
|
-
audit: config.audit
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
enabled: true,
|
|
51
|
-
serviceName: config.wellKnown.agentMetadata?.name,
|
|
52
|
-
}
|
|
53
|
-
: undefined,
|
|
41
|
+
audit: config.audit ? {
|
|
42
|
+
enabled: config.audit.enabled !== false,
|
|
43
|
+
logFunction: config.audit.logFunction,
|
|
44
|
+
includePayloads: config.audit.includePayloads,
|
|
45
|
+
includeProofHashes: config.audit.includeProofHashes
|
|
46
|
+
} : undefined,
|
|
47
|
+
wellKnown: config.wellKnown ? {
|
|
48
|
+
enabled: true,
|
|
49
|
+
serviceName: config.wellKnown.agentMetadata?.name
|
|
50
|
+
} : undefined
|
|
54
51
|
};
|
|
55
52
|
}
|
|
56
53
|
/**
|
|
@@ -58,7 +55,7 @@ function createProvidersFromConfig(config) {
|
|
|
58
55
|
*/
|
|
59
56
|
class MCPINodeRuntimeWrapper extends mcp_i_core_1.MCPIRuntimeBase {
|
|
60
57
|
legacyConfig;
|
|
61
|
-
|
|
58
|
+
accessControlService; // Access control API service
|
|
62
59
|
// proofVerifier is inherited from MCPIRuntimeBase (protected), no need to redeclare
|
|
63
60
|
constructor(config = {}) {
|
|
64
61
|
const coreConfig = createProvidersFromConfig(config);
|
|
@@ -75,14 +72,14 @@ class MCPINodeRuntimeWrapper extends mcp_i_core_1.MCPIRuntimeBase {
|
|
|
75
72
|
});
|
|
76
73
|
// Instantiate AccessControlApiService if API key is available
|
|
77
74
|
const apiKey = process.env.AGENTSHIELD_API_KEY;
|
|
78
|
-
const apiUrl = process.env.AGENTSHIELD_API_URL ||
|
|
75
|
+
const apiUrl = process.env.AGENTSHIELD_API_URL || 'https://kya.vouched.id';
|
|
79
76
|
if (apiKey) {
|
|
80
77
|
this.accessControlService = new mcp_i_core_1.AccessControlApiService({
|
|
81
78
|
baseUrl: apiUrl,
|
|
82
79
|
apiKey,
|
|
83
80
|
fetchProvider: coreConfig.fetchProvider,
|
|
84
81
|
logger: (msg, data) => {
|
|
85
|
-
if (coreConfig.environment ===
|
|
82
|
+
if (coreConfig.environment === 'development') {
|
|
86
83
|
console.log(`[AccessControl] ${msg}`, data);
|
|
87
84
|
}
|
|
88
85
|
},
|
|
@@ -208,13 +208,7 @@ class MCPIRuntime {
|
|
|
208
208
|
data = this.demoManager.addIdentityBadgeToResponse(data);
|
|
209
209
|
}
|
|
210
210
|
// Create response with proof
|
|
211
|
-
const
|
|
212
|
-
...options,
|
|
213
|
-
...(session && session.clientDid
|
|
214
|
-
? { clientDid: session.clientDid }
|
|
215
|
-
: {}),
|
|
216
|
-
};
|
|
217
|
-
const response = await (0, proof_1.createProofResponse)(request, data, this.cachedIdentity, session, proofOptions);
|
|
211
|
+
const response = await (0, proof_1.createProofResponse)(request, data, this.cachedIdentity, session, options);
|
|
218
212
|
// Update debug state with latest proof
|
|
219
213
|
if (this.debugManager && response.meta?.proof) {
|
|
220
214
|
this.debugManager.updateDebugState(response.meta.proof, session);
|
|
@@ -52,19 +52,6 @@ export declare class SessionManager {
|
|
|
52
52
|
* Generate a unique session ID
|
|
53
53
|
*/
|
|
54
54
|
private generateSessionId;
|
|
55
|
-
/**
|
|
56
|
-
* Generate a deterministic client identifier when the client
|
|
57
|
-
* does not provide one during the handshake.
|
|
58
|
-
*/
|
|
59
|
-
private generateClientId;
|
|
60
|
-
/**
|
|
61
|
-
* Normalize string fields from handshake metadata
|
|
62
|
-
*/
|
|
63
|
-
private normalizeClientInfoString;
|
|
64
|
-
/**
|
|
65
|
-
* Build MCP client metadata for the session when provided during handshake
|
|
66
|
-
*/
|
|
67
|
-
private buildClientInfo;
|
|
68
55
|
/**
|
|
69
56
|
* Generate a cryptographically secure nonce
|
|
70
57
|
*/
|
package/dist/runtime/session.js
CHANGED
|
@@ -76,7 +76,6 @@ class SessionManager {
|
|
|
76
76
|
await this.config.nonceCache.add(request.nonce, nonceTtlSeconds, request.agentDid);
|
|
77
77
|
// Generate session ID
|
|
78
78
|
const sessionId = this.generateSessionId();
|
|
79
|
-
const clientInfo = this.buildClientInfo(request);
|
|
80
79
|
// Create session context
|
|
81
80
|
const session = {
|
|
82
81
|
sessionId,
|
|
@@ -88,7 +87,6 @@ class SessionManager {
|
|
|
88
87
|
ttlMinutes: this.config.sessionTtlMinutes,
|
|
89
88
|
agentDid: request.agentDid, // Pass through agent DID for delegation verification
|
|
90
89
|
...(this.config.serverDid && { serverDid: this.config.serverDid }), // Include server DID if provided
|
|
91
|
-
...(clientInfo && { clientInfo }),
|
|
92
90
|
};
|
|
93
91
|
// Store session
|
|
94
92
|
this.sessions.set(sessionId, session);
|
|
@@ -145,47 +143,6 @@ class SessionManager {
|
|
|
145
143
|
const random = (0, crypto_1.randomBytes)(8).toString("hex");
|
|
146
144
|
return `sess_${timestamp}_${random}`;
|
|
147
145
|
}
|
|
148
|
-
/**
|
|
149
|
-
* Generate a deterministic client identifier when the client
|
|
150
|
-
* does not provide one during the handshake.
|
|
151
|
-
*/
|
|
152
|
-
generateClientId() {
|
|
153
|
-
return `client_${(0, crypto_1.randomBytes)(6).toString("hex")}`;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Normalize string fields from handshake metadata
|
|
157
|
-
*/
|
|
158
|
-
normalizeClientInfoString(value) {
|
|
159
|
-
if (typeof value !== "string") {
|
|
160
|
-
return undefined;
|
|
161
|
-
}
|
|
162
|
-
const trimmed = value.trim();
|
|
163
|
-
return trimmed.length > 0 ? trimmed : undefined;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Build MCP client metadata for the session when provided during handshake
|
|
167
|
-
*/
|
|
168
|
-
buildClientInfo(request) {
|
|
169
|
-
const hasMetadata = !!request.clientInfo ||
|
|
170
|
-
typeof request.clientProtocolVersion === "string" ||
|
|
171
|
-
request.clientCapabilities !== undefined;
|
|
172
|
-
if (!hasMetadata) {
|
|
173
|
-
return undefined;
|
|
174
|
-
}
|
|
175
|
-
const source = request.clientInfo;
|
|
176
|
-
return {
|
|
177
|
-
name: this.normalizeClientInfoString(source?.name) ?? "unknown",
|
|
178
|
-
title: this.normalizeClientInfoString(source?.title),
|
|
179
|
-
version: this.normalizeClientInfoString(source?.version),
|
|
180
|
-
platform: this.normalizeClientInfoString(source?.platform),
|
|
181
|
-
vendor: this.normalizeClientInfoString(source?.vendor),
|
|
182
|
-
persistentId: this.normalizeClientInfoString(source?.persistentId),
|
|
183
|
-
clientId: this.normalizeClientInfoString(source?.clientId) ??
|
|
184
|
-
this.generateClientId(),
|
|
185
|
-
protocolVersion: this.normalizeClientInfoString(request.clientProtocolVersion),
|
|
186
|
-
capabilities: request.clientCapabilities,
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
146
|
/**
|
|
190
147
|
* Generate a cryptographically secure nonce
|
|
191
148
|
*/
|