@kya-os/mcp-i-core 1.1.3 → 1.1.7

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.
@@ -22,7 +22,7 @@ export declare class ToolProtectionService {
22
22
  * Get tool protection configuration for the agent
23
23
  *
24
24
  * Flow:
25
- * 1. Check cache
25
+ * 1. Check cache (project-scoped if projectId available)
26
26
  * 2. If cache miss, fetch from API
27
27
  * 3. If API fails, use fallback config
28
28
  * 4. Cache successful API responses
@@ -40,15 +40,18 @@ export declare class ToolProtectionService {
40
40
  checkToolProtection(toolName: string, agentDid: string): Promise<ToolProtection | null>;
41
41
  /**
42
42
  * Fetch tool protection config from AgentShield API
43
- * Calls /api/v1/bouncer/config?agent_did={agentDid}
43
+ * Uses projectId endpoint if available (preferred, project-scoped), otherwise falls back to agent_did query param
44
44
  *
45
45
  * @param agentDid DID of the agent to fetch config for
46
46
  */
47
47
  private fetchFromApi;
48
48
  /**
49
- * Clear the cache for a specific agent (useful for testing or manual refresh)
49
+ * Clear the cache for a project or agent (useful for testing or manual refresh)
50
50
  *
51
- * @param agentDid DID of the agent to clear cache for
51
+ * If projectId is configured, clears project-scoped cache.
52
+ * Otherwise, clears agent-scoped cache.
53
+ *
54
+ * @param agentDid DID of the agent (used for fallback if projectId not available)
52
55
  */
53
56
  clearCache(agentDid: string): Promise<void>;
54
57
  }
@@ -1 +1 @@
1
- {"version":3,"file":"tool-protection.service.d.ts","sourceRoot":"","sources":["../../src/services/tool-protection.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,2BAA2B,EAE5B,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAsB7E;;GAEG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,MAAM,CAA8B;IAC5C,OAAO,CAAC,KAAK,CAAsB;gBAGjC,MAAM,EAAE,2BAA2B,EACnC,KAAK,EAAE,mBAAmB;IAM5B;;;;;;;;;;OAUG;IACG,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IA2F9E;;;;;;OAMG;IACG,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAW7F;;;;;OAKG;YACW,YAAY;IA+B1B;;;;OAIG;IACG,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAIlD"}
1
+ {"version":3,"file":"tool-protection.service.d.ts","sourceRoot":"","sources":["../../src/services/tool-protection.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,2BAA2B,EAE5B,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AA+C7E;;GAEG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,MAAM,CAA8B;IAC5C,OAAO,CAAC,KAAK,CAAsB;gBAGjC,MAAM,EAAE,2BAA2B,EACnC,KAAK,EAAE,mBAAmB;IAM5B;;;;;;;;;;OAUG;IACG,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAmJ9E;;;;;;OAMG;IACG,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAsB7F;;;;;OAKG;YACW,YAAY;IA2D1B;;;;;;;OAOG;IACG,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAgBlD"}
@@ -26,7 +26,7 @@ class ToolProtectionService {
26
26
  * Get tool protection configuration for the agent
27
27
  *
28
28
  * Flow:
29
- * 1. Check cache
29
+ * 1. Check cache (project-scoped if projectId available)
30
30
  * 2. If cache miss, fetch from API
31
31
  * 3. If API fails, use fallback config
32
32
  * 4. Cache successful API responses
@@ -34,44 +34,97 @@ class ToolProtectionService {
34
34
  * @param agentDid DID of the agent to fetch config for
35
35
  */
36
36
  async getToolProtectionConfig(agentDid) {
37
- // Use agentDid directly as the cache key
37
+ // Use project-scoped cache key if projectId is available (preferred)
38
+ // Falls back to agent-scoped key for backward compatibility
38
39
  // The cache implementation (KVToolProtectionCache) will add any necessary prefix
39
- const cacheKey = agentDid;
40
+ const cacheKey = this.config.projectId
41
+ ? `config:tool-protections:${this.config.projectId}`
42
+ : `agent:${agentDid}`;
40
43
  // 1. Check cache
41
44
  const cached = await this.cache.get(cacheKey);
42
45
  if (cached) {
43
46
  if (this.config.debug) {
44
- console.log('[ToolProtectionService] Cache hit', { agentDid: agentDid.slice(0, 20) + '...' });
47
+ console.log('[ToolProtectionService] Cache hit', {
48
+ cacheKey,
49
+ agentDid: agentDid.slice(0, 20) + '...',
50
+ projectId: this.config.projectId || 'none',
51
+ toolCount: Object.keys(cached.toolProtections).length,
52
+ });
45
53
  }
46
54
  return cached;
47
55
  }
48
56
  if (this.config.debug) {
49
57
  console.log('[ToolProtectionService] Cache miss, fetching from API', {
58
+ cacheKey,
50
59
  agentDid: agentDid.slice(0, 20) + '...',
60
+ projectId: this.config.projectId || 'none',
51
61
  });
52
62
  }
53
63
  // 2. Fetch from API
54
64
  try {
55
65
  const response = await this.fetchFromApi(agentDid);
56
66
  // Transform API response format to internal format
57
- // API returns: { data: { tools: { greet: { required_scopes: [...], requires_delegation: true } } } }
58
- // We need: { toolProtections: { greet: { requiredScopes: [...], requiresDelegation: true } } }
67
+ // Supports multiple response formats:
68
+ // 1. New endpoint: { data: { toolProtections: { greet: { requiresDelegation: true, ... } } } }
69
+ // 2. Old endpoint (array): { data: { tools: [{ name: "greet", requiresDelegation: true, ... }] } }
70
+ // 3. Old endpoint (object): { data: { tools: { greet: { requiresDelegation: true, ... } } } }
59
71
  const toolProtections = {};
60
- if (response.data.tools) {
61
- for (const [toolName, toolConfig] of Object.entries(response.data.tools)) {
62
- // Handle both snake_case (API) and camelCase (legacy) formats
72
+ // Check for new endpoint format first (toolProtections)
73
+ if (response.data.toolProtections) {
74
+ // New endpoint format: object with tool names as keys
75
+ for (const [toolName, toolConfig] of Object.entries(response.data.toolProtections)) {
63
76
  const requiresDelegation = toolConfig.requires_delegation ?? toolConfig.requiresDelegation ?? false;
64
- const requiredScopes = toolConfig.required_scopes ?? toolConfig.scopes ?? [];
77
+ const requiredScopes = toolConfig.required_scopes ?? toolConfig.requiredScopes ?? toolConfig.scopes ?? [];
65
78
  toolProtections[toolName] = {
66
79
  requiresDelegation,
67
80
  requiredScopes,
68
81
  };
69
82
  }
70
83
  }
84
+ else if (response.data.tools) {
85
+ // Old endpoint format: array or object
86
+ if (Array.isArray(response.data.tools)) {
87
+ // Array format: [{ name: "greet", requiresDelegation: true, ... }]
88
+ for (const tool of response.data.tools) {
89
+ const toolName = tool.name;
90
+ if (!toolName) {
91
+ if (this.config.debug) {
92
+ console.warn('[ToolProtectionService] Tool missing name in array format', tool);
93
+ }
94
+ continue;
95
+ }
96
+ const requiresDelegation = tool.requires_delegation ?? tool.requiresDelegation ?? false;
97
+ const requiredScopes = tool.required_scopes ?? tool.scopes ?? [];
98
+ toolProtections[toolName] = {
99
+ requiresDelegation,
100
+ requiredScopes,
101
+ };
102
+ }
103
+ }
104
+ else {
105
+ // Object format: { greet: { requiresDelegation: true, ... } }
106
+ for (const [toolName, toolConfig] of Object.entries(response.data.tools)) {
107
+ const requiresDelegation = toolConfig.requires_delegation ?? toolConfig.requiresDelegation ?? false;
108
+ const requiredScopes = toolConfig.required_scopes ?? toolConfig.scopes ?? [];
109
+ toolProtections[toolName] = {
110
+ requiresDelegation,
111
+ requiredScopes,
112
+ };
113
+ }
114
+ }
115
+ }
71
116
  const config = { toolProtections };
72
117
  // 3. Cache the response
73
118
  const ttl = this.config.cacheTtl ?? 300000; // Default 5 minutes
74
119
  await this.cache.set(cacheKey, config, ttl);
120
+ // Always log tool count and protection status (critical for debugging)
121
+ console.log('[ToolProtectionService] Config loaded', {
122
+ toolCount: Object.keys(toolProtections).length,
123
+ protectedTools: Object.entries(toolProtections)
124
+ .filter(([_, config]) => config.requiresDelegation)
125
+ .map(([name]) => name),
126
+ agentDid: agentDid.slice(0, 20) + '...',
127
+ });
75
128
  if (this.config.debug) {
76
129
  console.log('[ToolProtectionService] API fetch successful, cached', {
77
130
  agentDid: agentDid.slice(0, 20) + '...',
@@ -87,27 +140,27 @@ class ToolProtectionService {
87
140
  return config;
88
141
  }
89
142
  catch (error) {
143
+ const errorMessage = error instanceof Error ? error.message : String(error);
90
144
  if (this.config.debug) {
91
145
  console.error('[ToolProtectionService] API fetch failed', {
92
146
  agentDid: agentDid.slice(0, 20) + '...',
93
- error: error instanceof Error ? error.message : String(error),
147
+ error: errorMessage,
94
148
  });
95
149
  }
96
150
  // 4. Fallback to local config
97
151
  if (this.config.fallbackConfig) {
98
- if (this.config.debug) {
99
- console.log('[ToolProtectionService] Using fallback config', {
100
- agentDid: agentDid.slice(0, 20) + '...',
101
- });
102
- }
103
- return this.config.fallbackConfig;
104
- }
105
- // 5. No fallback available - return empty config (allow all tools)
106
- if (this.config.debug) {
107
- console.warn('[ToolProtectionService] No fallback config, allowing all tools', {
152
+ // Always warn when using fallback (not just debug mode)
153
+ console.warn('[ToolProtectionService] API fetch failed, using fallback config', {
108
154
  agentDid: agentDid.slice(0, 20) + '...',
155
+ error: errorMessage,
109
156
  });
157
+ return this.config.fallbackConfig;
110
158
  }
159
+ // 5. No fallback available - return empty config (allow all tools)
160
+ console.warn('[ToolProtectionService] No fallback config, allowing all tools', {
161
+ agentDid: agentDid.slice(0, 20) + '...',
162
+ error: errorMessage,
163
+ });
111
164
  return { toolProtections: {} };
112
165
  }
113
166
  }
@@ -121,6 +174,16 @@ class ToolProtectionService {
121
174
  async checkToolProtection(toolName, agentDid) {
122
175
  const config = await this.getToolProtectionConfig(agentDid);
123
176
  const protection = config.toolProtections[toolName];
177
+ // Always log the check result (critical for debugging)
178
+ if (this.config.debug || !protection || protection.requiresDelegation) {
179
+ console.log('[ToolProtectionService] Protection check', {
180
+ tool: toolName,
181
+ agentDid: agentDid.slice(0, 20) + '...',
182
+ found: !!protection,
183
+ requiresDelegation: protection?.requiresDelegation ?? false,
184
+ availableTools: Object.keys(config.toolProtections),
185
+ });
186
+ }
124
187
  if (!protection || !protection.requiresDelegation) {
125
188
  return null;
126
189
  }
@@ -128,21 +191,48 @@ class ToolProtectionService {
128
191
  }
129
192
  /**
130
193
  * Fetch tool protection config from AgentShield API
131
- * Calls /api/v1/bouncer/config?agent_did={agentDid}
194
+ * Uses projectId endpoint if available (preferred, project-scoped), otherwise falls back to agent_did query param
132
195
  *
133
196
  * @param agentDid DID of the agent to fetch config for
134
197
  */
135
198
  async fetchFromApi(agentDid) {
136
- const url = `${this.config.apiUrl}/api/v1/bouncer/config?agent_did=${encodeURIComponent(agentDid)}`;
199
+ // Prefer new project-scoped endpoint: /api/v1/bouncer/projects/{projectId}/tool-protections
200
+ // Falls back to old endpoint: /api/v1/bouncer/config?agent_did={did} for backward compatibility
201
+ let url;
202
+ let useNewEndpoint = false;
203
+ if (this.config.projectId) {
204
+ // ✅ NEW ENDPOINT: Project-scoped, returns toolProtections object
205
+ url = `${this.config.apiUrl}/api/v1/bouncer/projects/${encodeURIComponent(this.config.projectId)}/tool-protections`;
206
+ useNewEndpoint = true;
207
+ }
208
+ else {
209
+ // ⚠️ OLD ENDPOINT: Agent-scoped, returns tools array (backward compatibility)
210
+ url = `${this.config.apiUrl}/api/v1/bouncer/config?agent_did=${encodeURIComponent(agentDid)}`;
211
+ }
137
212
  if (this.config.debug) {
138
- console.log('[ToolProtectionService] Fetching from API:', url);
213
+ console.log('[ToolProtectionService] Fetching from API:', url, {
214
+ method: useNewEndpoint ? 'projects/{projectId}/tool-protections (new)' : 'config?agent_did (old)',
215
+ projectId: this.config.projectId || 'none',
216
+ });
217
+ }
218
+ // Build headers - new endpoint uses X-API-Key, old endpoint uses Authorization Bearer
219
+ const headers = {
220
+ 'Content-Type': 'application/json',
221
+ };
222
+ if (useNewEndpoint) {
223
+ // ✅ New endpoint headers
224
+ headers['X-API-Key'] = this.config.apiKey;
225
+ if (this.config.projectId) {
226
+ headers['X-Project-Id'] = this.config.projectId;
227
+ }
228
+ }
229
+ else {
230
+ // ⚠️ Old endpoint headers (backward compatibility)
231
+ headers['Authorization'] = `Bearer ${this.config.apiKey}`;
139
232
  }
140
233
  const response = await fetch(url, {
141
234
  method: 'GET',
142
- headers: {
143
- 'Content-Type': 'application/json',
144
- 'Authorization': `Bearer ${this.config.apiKey}`,
145
- },
235
+ headers,
146
236
  });
147
237
  if (!response.ok) {
148
238
  const errorText = await response.text().catch(() => 'Unknown error');
@@ -155,12 +245,25 @@ class ToolProtectionService {
155
245
  return data;
156
246
  }
157
247
  /**
158
- * Clear the cache for a specific agent (useful for testing or manual refresh)
248
+ * Clear the cache for a project or agent (useful for testing or manual refresh)
159
249
  *
160
- * @param agentDid DID of the agent to clear cache for
250
+ * If projectId is configured, clears project-scoped cache.
251
+ * Otherwise, clears agent-scoped cache.
252
+ *
253
+ * @param agentDid DID of the agent (used for fallback if projectId not available)
161
254
  */
162
255
  async clearCache(agentDid) {
163
- const cacheKey = `tool-protection:${agentDid}`;
256
+ // Use same cache key strategy as getToolProtectionConfig
257
+ const cacheKey = this.config.projectId
258
+ ? `config:tool-protections:${this.config.projectId}`
259
+ : `agent:${agentDid}`;
260
+ if (this.config.debug) {
261
+ console.log('[ToolProtectionService] Clearing cache', {
262
+ cacheKey,
263
+ projectId: this.config.projectId || 'none',
264
+ agentDid: agentDid.slice(0, 20) + '...',
265
+ });
266
+ }
164
267
  await this.cache.delete(cacheKey);
165
268
  }
166
269
  }
@@ -1 +1 @@
1
- {"version":3,"file":"tool-protection.service.js","sourceRoot":"","sources":["../../src/services/tool-protection.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,MAAM,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;CACF;AAlLD,sDAkLC"}
1
+ {"version":3,"file":"tool-protection.service.js","sourceRoot":"","sources":["../../src/services/tool-protection.service.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAuDH;;GAEG;AACH,MAAa,qBAAqB;IACxB,MAAM,CAA8B;IACpC,KAAK,CAAsB;IAEnC,YACE,MAAmC,EACnC,KAA0B;QAE1B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,uBAAuB,CAAC,QAAgB;QAC5C,qEAAqE;QACrE,4DAA4D;QAC5D,iFAAiF;QACjF,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS;YACpC,CAAC,CAAC,2BAA2B,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;YACpD,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC;QAExB,iBAAiB;QACjB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC9C,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;gBACtB,OAAO,CAAC,GAAG,CAAC,mCAAmC,EAAE;oBAC/C,QAAQ;oBACR,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK;oBACvC,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,MAAM;oBAC1C,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,MAAM;iBACtD,CAAC,CAAC;YACL,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACtB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,EAAE,CAAC;YACtB,OAAO,CAAC,GAAG,CAAC,wCAAwC,EAAE;gBACpD,QAAQ;gBACR,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,MAAM;gBAC1C,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK;aACxC,CAAC,CAAC;QACL,CAAC;QAED,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;CACF;AAhSD,sDAgSC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kya-os/mcp-i-core",
3
- "version": "1.1.3",
3
+ "version": "1.1.7",
4
4
  "description": "Core provider-based architecture for MCP-I framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -42,11 +42,11 @@
42
42
  "@types/node": "^20.0.0",
43
43
  "@typescript-eslint/eslint-plugin": "^6.0.0",
44
44
  "@typescript-eslint/parser": "^6.0.0",
45
- "@vitest/coverage-v8": "^3.2.4",
45
+ "@vitest/coverage-v8": "^4.0.5",
46
46
  "eslint": "^8.0.0",
47
47
  "tsx": "^4.7.0",
48
48
  "typescript": "^5.3.0",
49
- "vitest": "^3.2.4"
49
+ "vitest": "^4.0.5"
50
50
  },
51
51
  "engines": {
52
52
  "node": ">=20.0.0"