@assemblyline-agents/metabase 2.0.0 → 3.0.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/LICENSE +1 -1
- package/README.md +1 -1
- package/dist/events.d.ts +3 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +28 -0
- package/dist/events.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -4
- package/skills/metabase/SKILL.md +0 -8
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Official Assembly Line Metabase connection plugin.
|
|
4
4
|
|
|
5
|
-
It connects agents to Metabase, exposing analytics and query tools through Metabase's MCP server. The package exports `defineMetabaseConnection(options)` to declare the connection in an agent definition and an `assemblyLinePlugin` module so the Assembly Line CLI and compiler can discover the plugin's connection metadata.
|
|
5
|
+
It connects agents to Metabase, exposing analytics and query tools through Metabase's MCP server. The package exports `defineMetabaseConnection(options)` to declare the connection in an agent definition and an `assemblyLinePlugin` module so the Assembly Line CLI and compiler can discover the plugin's connection metadata.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,4BAA4B,EAElC,MAAM,2BAA2B,CAAC;AAEnC,eAAO,MAAM,cAAc,EAAE,4BAqB5B,CAAC"}
|
package/dist/events.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createHash, timingSafeEqual } from "node:crypto";
|
|
2
|
+
import { ConnectionEventError, headerValue, parseConnectionEventJson, requireEnvironmentValue, stringField } from "@assemblyline-agents/core";
|
|
3
|
+
export const metabaseEvents = {
|
|
4
|
+
reconcile(context) {
|
|
5
|
+
requireEnvironmentValue(context.env, "METABASE_WEBHOOK_SECRET");
|
|
6
|
+
return {
|
|
7
|
+
status: "needs_setup",
|
|
8
|
+
instructions: `In Metabase Admin → Settings → Webhooks, create a Bearer-authenticated webhook for ${context.callbackUrl}, then select it on the alerts that should wake the agent. Use METABASE_WEBHOOK_SECRET as the bearer token.`,
|
|
9
|
+
detail: "Metabase alert webhook must be selected on at least one alert."
|
|
10
|
+
};
|
|
11
|
+
},
|
|
12
|
+
ingress(request, context) {
|
|
13
|
+
const expected = `Bearer ${requireEnvironmentValue(context.env, "METABASE_WEBHOOK_SECRET")}`;
|
|
14
|
+
const actual = headerValue(request.headers, "authorization") ?? "";
|
|
15
|
+
if (!safeEqual(expected, actual))
|
|
16
|
+
throw new ConnectionEventError("Metabase webhook bearer token is invalid.", 401);
|
|
17
|
+
const payload = parseConnectionEventJson(request.body);
|
|
18
|
+
if (stringField(payload, "type") !== "alert")
|
|
19
|
+
throw new ConnectionEventError("Metabase webhook is not an alert.");
|
|
20
|
+
const occurredAt = stringField(payload, "sent_at");
|
|
21
|
+
const eventId = stringField(payload, "alert_id")
|
|
22
|
+
? `${stringField(payload, "alert_id")}:${occurredAt ?? createHash("sha256").update(request.body).digest("hex")}`
|
|
23
|
+
: createHash("sha256").update(request.body).digest("hex");
|
|
24
|
+
return { events: [{ event: "alert.triggered", eventId, payload: payload, ...(occurredAt ? { occurredAt } : {}) }], response: { status: 200, body: { ok: true } }, audit: { event: "alert.triggered" } };
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
function safeEqual(left, right) { const a = Buffer.from(left); const b = Buffer.from(right); return a.length === b.length && timingSafeEqual(a, b); }
|
|
28
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EACL,oBAAoB,EAC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CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5D,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,OAAO,EAAE,OAAqB,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,EAAE,CAAC;IACxN,CAAC;CACF,CAAC;AAEF,SAAS,SAAS,CAAC,IAAY,EAAE,KAAa,IAAa,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,IAAI,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmG,KAAK,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAG7K,MAAM,MAAM,yBAAyB,GAAG,0BAA0B,CAAC;AACnE,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,yEAAoN;AAC/R,eAAO,MAAM,kBAAkB,kDAA0C,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { connectionPluginMetadata, defineMcpPluginConnection, definePlugin } from "@assemblyline-agents/core";
|
|
1
|
+
import { connectionPluginMetadata, defineConnectionPluginEvents, defineMcpPluginConnection, definePlugin } from "@assemblyline-agents/core";
|
|
2
|
+
import { metabaseEvents } from "./events.js";
|
|
2
3
|
const PLUGIN = connectionPluginMetadata("metabase");
|
|
3
|
-
export function defineMetabaseConnection(options) {
|
|
4
|
+
export function defineMetabaseConnection(options) { const definition = defineMcpPluginConnection(PLUGIN, options); const events = defineConnectionPluginEvents(PLUGIN, options.events, metabaseEvents); if (events)
|
|
5
|
+
definition.events = events; return definition; }
|
|
4
6
|
export const assemblyLinePlugin = definePlugin({ connections: [PLUGIN] });
|
|
5
7
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,YAAY,EAAmC,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,yBAAyB,EAAE,YAAY,EAAmC,MAAM,2BAA2B,CAAC;AAC7K,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,MAAM,MAAM,GAAG,wBAAwB,CAAC,UAAU,CAAE,CAAC;AAErD,MAAM,UAAU,wBAAwB,CAAC,OAAkC,IAAI,MAAM,UAAU,GAAG,yBAAyB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,MAAM,GAAG,4BAA4B,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,IAAI,MAAM;IAAE,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC;AAC/R,MAAM,CAAC,MAAM,kBAAkB,GAAG,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@assemblyline-agents/metabase",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -9,12 +9,11 @@
|
|
|
9
9
|
}
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@assemblyline-agents/core": "
|
|
12
|
+
"@assemblyline-agents/core": "3.0.0"
|
|
13
13
|
},
|
|
14
14
|
"description": "Official Assembly Line Metabase connection plugin.",
|
|
15
15
|
"files": [
|
|
16
|
-
"dist"
|
|
17
|
-
"skills"
|
|
16
|
+
"dist"
|
|
18
17
|
],
|
|
19
18
|
"engines": {
|
|
20
19
|
"node": ">=22.19.0"
|
package/skills/metabase/SKILL.md
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: metabase
|
|
3
|
-
description: Use a configured Metabase MCP endpoint for semantic queries, questions, and dashboards.
|
|
4
|
-
---
|
|
5
|
-
# Metabase
|
|
6
|
-
Prefer semantic-layer discovery and saved questions over raw SQL. Bound query dimensions, filters, and result sizes.
|
|
7
|
-
|
|
8
|
-
The deployment owner configures `METABASE_MCP_URL` for their instance and any OAuth or token requirements. Saving content or executing raw SQL requires writes to be enabled with the configured approval gate.
|