@crowdstrike/aidr-mcp-proxy 1.2.1 → 1.3.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 (2) hide show
  1. package/dist/proxy.mjs +17 -4
  2. package/package.json +1 -1
package/dist/proxy.mjs CHANGED
@@ -9,6 +9,12 @@ import { defineCommand, runMain } from "citty";
9
9
  import { consola } from "consola";
10
10
 
11
11
  //#region src/proxy.ts
12
+ function isTextContent(x) {
13
+ return x.type === "text";
14
+ }
15
+ function isImageContent(x) {
16
+ return x.type === "image";
17
+ }
12
18
  runMain(defineCommand({
13
19
  args: {},
14
20
  async run({ args }) {
@@ -21,7 +27,10 @@ runMain(defineCommand({
21
27
  const clientTransport = new StdioClientTransport({
22
28
  command: args._[0],
23
29
  args: args._.slice(1),
24
- env: process.env
30
+ env: {
31
+ ...process.env,
32
+ CS_AIDR_TOKEN: void 0
33
+ }
25
34
  });
26
35
  const client = new Client({
27
36
  name: "cs-aidr-mcp-proxy-client",
@@ -147,11 +156,15 @@ runMain(defineCommand({
147
156
  }];
148
157
  }
149
158
  }
150
- } else for (const contentItem of content.filter((c) => c.type === "text")) {
159
+ } else for (const contentItem of content.filter((c) => isTextContent(c) || isImageContent(c))) {
160
+ const content$1 = isTextContent(contentItem) ? contentItem.text : [{
161
+ type: "image_url",
162
+ image_url: { url: `data:${contentItem.mimeType};base64,${contentItem.data}` }
163
+ }];
151
164
  const guardedOutput = await aiGuard.guardChatCompletions({
152
165
  guard_input: { messages: [{
153
166
  role: "tool",
154
- content: contentItem.text
167
+ content: content$1
155
168
  }] },
156
169
  app_id: process.env.APP_ID,
157
170
  event_type: "tool_output",
@@ -172,7 +185,7 @@ runMain(defineCommand({
172
185
  isError: true
173
186
  };
174
187
  }
175
- if (guardedOutput.result?.transformed) contentItem.text = (guardedOutput.result.guard_output?.messages)[0].content;
188
+ if (isTextContent(contentItem) && guardedOutput.result?.transformed) contentItem.text = (guardedOutput.result.guard_output?.messages)[0].content;
176
189
  }
177
190
  return response;
178
191
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowdstrike/aidr-mcp-proxy",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "description": "Protect any MCP server from malicious entities and confidential PII.",
5
5
  "publishConfig": {
6
6
  "access": "public"