@asif2bd/umami-mcp 0.1.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 +21 -0
- package/README.md +400 -0
- package/dist/client.d.ts +43 -0
- package/dist/client.js +163 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +37 -0
- package/dist/config.js +121 -0
- package/dist/config.js.map +1 -0
- package/dist/envfile.d.ts +21 -0
- package/dist/envfile.js +72 -0
- package/dist/envfile.js.map +1 -0
- package/dist/http.d.ts +7 -0
- package/dist/http.js +133 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +72 -0
- package/dist/index.js.map +1 -0
- package/dist/oauth/consent.d.ts +13 -0
- package/dist/oauth/consent.js +99 -0
- package/dist/oauth/consent.js.map +1 -0
- package/dist/oauth/router.d.ts +27 -0
- package/dist/oauth/router.js +329 -0
- package/dist/oauth/router.js.map +1 -0
- package/dist/oauth/seal.d.ts +22 -0
- package/dist/oauth/seal.js +82 -0
- package/dist/oauth/seal.js.map +1 -0
- package/dist/oauth/store.d.ts +40 -0
- package/dist/oauth/store.js +48 -0
- package/dist/oauth/store.js.map +1 -0
- package/dist/redact.d.ts +14 -0
- package/dist/redact.js +54 -0
- package/dist/redact.js.map +1 -0
- package/dist/server.d.ts +12 -0
- package/dist/server.js +47 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/admin.d.ts +1 -0
- package/dist/tools/admin.js +99 -0
- package/dist/tools/admin.js.map +1 -0
- package/dist/tools/analytics.d.ts +1 -0
- package/dist/tools/analytics.js +141 -0
- package/dist/tools/analytics.js.map +1 -0
- package/dist/tools/common.d.ts +46 -0
- package/dist/tools/common.js +86 -0
- package/dist/tools/common.js.map +1 -0
- package/dist/tools/index.d.ts +3 -0
- package/dist/tools/index.js +7 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/reports.d.ts +1 -0
- package/dist/tools/reports.js +122 -0
- package/dist/tools/reports.js.map +1 -0
- package/dist/tools/websites.d.ts +1 -0
- package/dist/tools/websites.js +194 -0
- package/dist/tools/websites.js.map +1 -0
- package/package.json +54 -0
package/dist/server.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { UmamiClient } from './client.js';
|
|
3
|
+
import { redactUnknown } from './redact.js';
|
|
4
|
+
import { allTools, isAllowed } from './tools/index.js';
|
|
5
|
+
export const SERVER_NAME = 'umami-mcp';
|
|
6
|
+
export const SERVER_VERSION = '0.1.0';
|
|
7
|
+
export function buildServer(config, client = new UmamiClient(config)) {
|
|
8
|
+
const server = new McpServer({ name: SERVER_NAME, version: SERVER_VERSION });
|
|
9
|
+
const ctx = { client, config };
|
|
10
|
+
const registered = [];
|
|
11
|
+
const withheld = [];
|
|
12
|
+
for (const tool of allTools) {
|
|
13
|
+
if (!isAllowed(tool, config)) {
|
|
14
|
+
withheld.push(tool);
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
registered.push(tool);
|
|
18
|
+
server.registerTool(tool.name, {
|
|
19
|
+
title: tool.title,
|
|
20
|
+
description: tool.description,
|
|
21
|
+
inputSchema: tool.schema,
|
|
22
|
+
annotations: {
|
|
23
|
+
readOnlyHint: tool.tier === 'read',
|
|
24
|
+
destructiveHint: Boolean(tool.destructive),
|
|
25
|
+
idempotentHint: tool.tier === 'read',
|
|
26
|
+
openWorldHint: true,
|
|
27
|
+
},
|
|
28
|
+
}, async (args) => {
|
|
29
|
+
try {
|
|
30
|
+
const result = await tool.handler(ctx, args ?? {});
|
|
31
|
+
return {
|
|
32
|
+
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
// Surface the failure to the model as an error result rather than
|
|
37
|
+
// throwing, so it can correct course -- but scrub it first.
|
|
38
|
+
return {
|
|
39
|
+
isError: true,
|
|
40
|
+
content: [{ type: 'text', text: `${tool.name} failed: ${redactUnknown(err)}` }],
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return { server, registered, withheld };
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAkC,MAAM,kBAAkB,CAAC;AAEvF,MAAM,CAAC,MAAM,WAAW,GAAG,WAAW,CAAC;AACvC,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC;AAQtC,MAAM,UAAU,WAAW,CAAC,MAAc,EAAE,MAAM,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC;IAC1E,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,CAAC;IAC7E,MAAM,GAAG,GAAgB,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAE5C,MAAM,UAAU,GAAc,EAAE,CAAC;IACjC,MAAM,QAAQ,GAAc,EAAE,CAAC;IAE/B,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;QAC5B,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC;YAC7B,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACpB,SAAS;QACX,CAAC;QACD,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEtB,MAAM,CAAC,YAAY,CACjB,IAAI,CAAC,IAAI,EACT;YACE,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,WAAW,EAAE,IAAI,CAAC,MAAM;YACxB,WAAW,EAAE;gBACX,YAAY,EAAE,IAAI,CAAC,IAAI,KAAK,MAAM;gBAClC,eAAe,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC;gBAC1C,cAAc,EAAE,IAAI,CAAC,IAAI,KAAK,MAAM;gBACpC,aAAa,EAAE,IAAI;aACpB;SACF,EACD,KAAK,EAAE,IAAyB,EAAE,EAAE;YAClC,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;gBACnD,OAAO;oBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;iBAC5E,CAAC;YACJ,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,kEAAkE;gBAClE,4DAA4D;gBAC5D,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,YAAY,aAAa,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;iBACzF,CAAC;YACJ,CAAC;QACH,CAAC,CACF,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const adminTools: import("./common.js").ToolDef[];
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineTool } from './common.js';
|
|
3
|
+
export const adminTools = [
|
|
4
|
+
defineTool({
|
|
5
|
+
name: 'umami_list_users',
|
|
6
|
+
title: 'List users',
|
|
7
|
+
description: 'List Umami user accounts with their roles. Admin only.',
|
|
8
|
+
tier: 'admin',
|
|
9
|
+
schema: {
|
|
10
|
+
query: z.string().optional().describe('Filter by username (substring match).'),
|
|
11
|
+
page: z.number().int().min(1).optional(),
|
|
12
|
+
pageSize: z.number().int().min(1).max(200).optional(),
|
|
13
|
+
},
|
|
14
|
+
handler: async ({ client }, args) => client.get('/api/admin/users', { query: args.query, page: args.page, pageSize: args.pageSize }),
|
|
15
|
+
}),
|
|
16
|
+
defineTool({
|
|
17
|
+
name: 'umami_create_user',
|
|
18
|
+
title: 'Create user',
|
|
19
|
+
description: 'Create a Umami user account. The password you supply is sent only to your own Umami instance. ' +
|
|
20
|
+
'Prefer a generated password that the new user changes on first login.',
|
|
21
|
+
tier: 'admin',
|
|
22
|
+
schema: {
|
|
23
|
+
username: z.string().min(1),
|
|
24
|
+
password: z.string().min(8).describe('At least 8 characters.'),
|
|
25
|
+
role: z.enum(['admin', 'user', 'view-only']).optional().describe('Default "user".'),
|
|
26
|
+
},
|
|
27
|
+
handler: async ({ client }, args) => {
|
|
28
|
+
const created = await client.post('/api/users', {
|
|
29
|
+
username: args.username,
|
|
30
|
+
password: args.password,
|
|
31
|
+
role: args.role ?? 'user',
|
|
32
|
+
});
|
|
33
|
+
// Never echo the password back into the transcript.
|
|
34
|
+
return { id: created?.id, username: created?.username, role: created?.role, created: true };
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
defineTool({
|
|
38
|
+
name: 'umami_delete_user',
|
|
39
|
+
title: 'Delete user',
|
|
40
|
+
description: 'PERMANENTLY DELETE a user account and the websites they own. Cannot be undone. ' +
|
|
41
|
+
'Requires admin mode with destructive operations enabled.',
|
|
42
|
+
tier: 'admin',
|
|
43
|
+
destructive: true,
|
|
44
|
+
schema: {
|
|
45
|
+
userId: z.string().min(1).describe('User UUID from umami_list_users.'),
|
|
46
|
+
confirmUsername: z.string().min(1).describe('Type the exact username to confirm.'),
|
|
47
|
+
},
|
|
48
|
+
handler: async ({ client }, args) => {
|
|
49
|
+
const user = await client.get(`/api/users/${encodeURIComponent(args.userId)}`);
|
|
50
|
+
if (!user?.username)
|
|
51
|
+
throw new Error(`User ${args.userId} not found.`);
|
|
52
|
+
if (user.username !== args.confirmUsername) {
|
|
53
|
+
throw new Error(`Refusing to delete: confirmUsername ${JSON.stringify(args.confirmUsername)} does not match ` +
|
|
54
|
+
`the account's actual username ${JSON.stringify(user.username)}.`);
|
|
55
|
+
}
|
|
56
|
+
await client.del(`/api/users/${encodeURIComponent(args.userId)}`);
|
|
57
|
+
return { deleted: true, userId: args.userId, username: user.username };
|
|
58
|
+
},
|
|
59
|
+
}),
|
|
60
|
+
defineTool({
|
|
61
|
+
name: 'umami_list_teams',
|
|
62
|
+
title: 'List teams',
|
|
63
|
+
description: 'List teams and their members.',
|
|
64
|
+
tier: 'read',
|
|
65
|
+
schema: {
|
|
66
|
+
query: z.string().optional(),
|
|
67
|
+
page: z.number().int().min(1).optional(),
|
|
68
|
+
pageSize: z.number().int().min(1).max(200).optional(),
|
|
69
|
+
},
|
|
70
|
+
handler: async ({ client }, args) => client.get('/api/teams', { query: args.query, page: args.page, pageSize: args.pageSize }),
|
|
71
|
+
}),
|
|
72
|
+
defineTool({
|
|
73
|
+
name: 'umami_create_team',
|
|
74
|
+
title: 'Create team',
|
|
75
|
+
description: 'Create a team so websites can be shared between users.',
|
|
76
|
+
tier: 'write',
|
|
77
|
+
schema: { name: z.string().min(1).describe('Team display name.') },
|
|
78
|
+
handler: async ({ client }, args) => client.post('/api/teams', { name: args.name }),
|
|
79
|
+
}),
|
|
80
|
+
defineTool({
|
|
81
|
+
name: 'umami_whoami',
|
|
82
|
+
title: 'Check connection',
|
|
83
|
+
description: 'Verify that this MCP server can reach the configured Umami instance and report which account it is ' +
|
|
84
|
+
'authenticated as, plus the permission mode the server is running in. Good first call for diagnosing setup.',
|
|
85
|
+
tier: 'read',
|
|
86
|
+
schema: {},
|
|
87
|
+
handler: async ({ client, config }) => {
|
|
88
|
+
const user = await client.verify();
|
|
89
|
+
return {
|
|
90
|
+
instance: config.url,
|
|
91
|
+
authenticatedAs: user.username,
|
|
92
|
+
role: user.role,
|
|
93
|
+
serverMode: config.mode,
|
|
94
|
+
destructiveOperations: config.allowDestructive ? 'enabled' : 'disabled',
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
}),
|
|
98
|
+
];
|
|
99
|
+
//# sourceMappingURL=admin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin.js","sourceRoot":"","sources":["../../src/tools/admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,UAAU,CAAC;QACT,IAAI,EAAE,kBAAkB;QACxB,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,wDAAwD;QACrE,IAAI,EAAE,OAAO;QACb,MAAM,EAAE;YACN,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;YAC9E,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;YACxC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;SACtD;QACD,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,CAClC,MAAM,CAAC,GAAG,CAAC,kBAAkB,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EA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,IAAI,CAAC,IAAI;gBACf,UAAU,EAAE,MAAM,CAAC,IAAI;gBACvB,qBAAqB,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU;aACxE,CAAC;QACJ,CAAC;KACF,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const analyticsTools: import("./common.js").ToolDef[];
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineTool, periodSchema, resolveRange, websiteIdSchema, METRIC_TYPES } from './common.js';
|
|
3
|
+
export const analyticsTools = [
|
|
4
|
+
defineTool({
|
|
5
|
+
name: 'umami_get_stats',
|
|
6
|
+
title: 'Get summary stats',
|
|
7
|
+
description: 'Headline totals for a website over a period: pageviews, visitors, visits, bounces and total time on site. ' +
|
|
8
|
+
'The response also includes a "comparison" block for the equally-long preceding period, so you can report trends.',
|
|
9
|
+
tier: 'read',
|
|
10
|
+
schema: { ...websiteIdSchema, ...periodSchema },
|
|
11
|
+
handler: async ({ client }, args) => {
|
|
12
|
+
const { startAt, endAt } = resolveRange(args);
|
|
13
|
+
const data = await client.get(`/api/websites/${encodeURIComponent(args.websiteId)}/stats`, { startAt, endAt });
|
|
14
|
+
return { range: { startAt, endAt }, ...data };
|
|
15
|
+
},
|
|
16
|
+
}),
|
|
17
|
+
defineTool({
|
|
18
|
+
name: 'umami_get_pageviews',
|
|
19
|
+
title: 'Get pageview time series',
|
|
20
|
+
description: 'Pageviews and sessions bucketed over time, for charting traffic. Returns two parallel series.',
|
|
21
|
+
tier: 'read',
|
|
22
|
+
schema: {
|
|
23
|
+
...websiteIdSchema,
|
|
24
|
+
...periodSchema,
|
|
25
|
+
unit: z.enum(['hour', 'day', 'month', 'year']).optional().describe('Bucket size, default "day".'),
|
|
26
|
+
timezone: z.string().optional().describe('IANA timezone for bucket boundaries, e.g. "Asia/Dhaka". Default UTC.'),
|
|
27
|
+
},
|
|
28
|
+
handler: async ({ client }, args) => {
|
|
29
|
+
const { startAt, endAt } = resolveRange(args);
|
|
30
|
+
const data = await client.get(`/api/websites/${encodeURIComponent(args.websiteId)}/pageviews`, {
|
|
31
|
+
startAt,
|
|
32
|
+
endAt,
|
|
33
|
+
unit: args.unit ?? 'day',
|
|
34
|
+
timezone: args.timezone ?? 'UTC',
|
|
35
|
+
});
|
|
36
|
+
return { range: { startAt, endAt }, unit: args.unit ?? 'day', ...data };
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
39
|
+
defineTool({
|
|
40
|
+
name: 'umami_get_metrics',
|
|
41
|
+
title: 'Get metric breakdown',
|
|
42
|
+
description: 'Top values for one dimension, ranked by visitor count -- top pages, referrers, countries, browsers and so on. ' +
|
|
43
|
+
'Returns [{x, y}] where x is the value and y is the count. ' +
|
|
44
|
+
'Note: Umami v3 renamed the v2 "url" type to "path" and "host" to "hostname".',
|
|
45
|
+
tier: 'read',
|
|
46
|
+
schema: {
|
|
47
|
+
...websiteIdSchema,
|
|
48
|
+
...periodSchema,
|
|
49
|
+
type: z.enum(METRIC_TYPES).describe('Dimension to break down by.'),
|
|
50
|
+
limit: z.number().int().min(1).max(500).optional().describe('Maximum rows, default 20.'),
|
|
51
|
+
},
|
|
52
|
+
handler: async ({ client }, args) => {
|
|
53
|
+
const { startAt, endAt } = resolveRange(args);
|
|
54
|
+
const data = await client.get(`/api/websites/${encodeURIComponent(args.websiteId)}/metrics`, {
|
|
55
|
+
startAt,
|
|
56
|
+
endAt,
|
|
57
|
+
type: args.type,
|
|
58
|
+
limit: args.limit ?? 20,
|
|
59
|
+
});
|
|
60
|
+
return { range: { startAt, endAt }, type: args.type, data };
|
|
61
|
+
},
|
|
62
|
+
}),
|
|
63
|
+
defineTool({
|
|
64
|
+
name: 'umami_get_active_visitors',
|
|
65
|
+
title: 'Get active visitors',
|
|
66
|
+
description: 'Number of visitors active on the site in the last few minutes. Cheap; good for a live check.',
|
|
67
|
+
tier: 'read',
|
|
68
|
+
schema: { ...websiteIdSchema },
|
|
69
|
+
handler: async ({ client }, args) => client.get(`/api/websites/${encodeURIComponent(args.websiteId)}/active`),
|
|
70
|
+
}),
|
|
71
|
+
defineTool({
|
|
72
|
+
name: 'umami_get_realtime',
|
|
73
|
+
title: 'Get realtime activity',
|
|
74
|
+
description: 'Live snapshot of current activity: recent events with country, URL, browser and device, plus rollups ' +
|
|
75
|
+
'by country, URL and referrer. Use this to answer "what is happening on the site right now".',
|
|
76
|
+
tier: 'read',
|
|
77
|
+
schema: { websiteId: websiteIdSchema.websiteId },
|
|
78
|
+
handler: async ({ client }, args) => client.get(`/api/realtime/${encodeURIComponent(args.websiteId)}`),
|
|
79
|
+
}),
|
|
80
|
+
defineTool({
|
|
81
|
+
name: 'umami_get_event_stats',
|
|
82
|
+
title: 'Get custom event stats',
|
|
83
|
+
description: 'Totals for custom tracked events over a period: event count, unique event names, visitors and visits, ' +
|
|
84
|
+
'with a comparison against the preceding period.',
|
|
85
|
+
tier: 'read',
|
|
86
|
+
schema: {
|
|
87
|
+
...websiteIdSchema,
|
|
88
|
+
...periodSchema,
|
|
89
|
+
unit: z.enum(['hour', 'day', 'month', 'year']).optional().describe('Bucket size, default "day".'),
|
|
90
|
+
timezone: z.string().optional().describe('IANA timezone, default UTC.'),
|
|
91
|
+
},
|
|
92
|
+
handler: async ({ client }, args) => {
|
|
93
|
+
const { startAt, endAt } = resolveRange(args);
|
|
94
|
+
const data = await client.get(`/api/websites/${encodeURIComponent(args.websiteId)}/events/stats`, {
|
|
95
|
+
startAt,
|
|
96
|
+
endAt,
|
|
97
|
+
unit: args.unit ?? 'day',
|
|
98
|
+
timezone: args.timezone ?? 'UTC',
|
|
99
|
+
});
|
|
100
|
+
return { range: { startAt, endAt }, ...data };
|
|
101
|
+
},
|
|
102
|
+
}),
|
|
103
|
+
defineTool({
|
|
104
|
+
name: 'umami_list_sessions',
|
|
105
|
+
title: 'List sessions',
|
|
106
|
+
description: 'Individual visitor sessions with browser, OS, device, country and region. ' +
|
|
107
|
+
'Useful for drilling into who visited rather than aggregate counts.',
|
|
108
|
+
tier: 'read',
|
|
109
|
+
schema: {
|
|
110
|
+
...websiteIdSchema,
|
|
111
|
+
...periodSchema,
|
|
112
|
+
page: z.number().int().min(1).optional(),
|
|
113
|
+
pageSize: z.number().int().min(1).max(200).optional().describe('Default 20.'),
|
|
114
|
+
},
|
|
115
|
+
handler: async ({ client }, args) => {
|
|
116
|
+
const { startAt, endAt } = resolveRange(args);
|
|
117
|
+
return client.get(`/api/websites/${encodeURIComponent(args.websiteId)}/sessions`, {
|
|
118
|
+
startAt,
|
|
119
|
+
endAt,
|
|
120
|
+
page: args.page,
|
|
121
|
+
pageSize: args.pageSize,
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
}),
|
|
125
|
+
defineTool({
|
|
126
|
+
name: 'umami_get_session_activity',
|
|
127
|
+
title: 'Get session activity',
|
|
128
|
+
description: 'The ordered sequence of pageviews and events for one visitor session -- their path through the site.',
|
|
129
|
+
tier: 'read',
|
|
130
|
+
schema: {
|
|
131
|
+
...websiteIdSchema,
|
|
132
|
+
sessionId: z.string().min(1).describe('Session UUID from umami_list_sessions.'),
|
|
133
|
+
...periodSchema,
|
|
134
|
+
},
|
|
135
|
+
handler: async ({ client }, args) => {
|
|
136
|
+
const { startAt, endAt } = resolveRange(args);
|
|
137
|
+
return client.get(`/api/websites/${encodeURIComponent(args.websiteId)}/sessions/${encodeURIComponent(args.sessionId)}/activity`, { startAt, endAt });
|
|
138
|
+
},
|
|
139
|
+
}),
|
|
140
|
+
];
|
|
141
|
+
//# sourceMappingURL=analytics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../src/tools/analytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,YAAY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O,EAAE,KAAK,EAAE,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;YAC9C,OAAO,MAAM,CAAC,GAAG,CAAC,iBAAiB,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE;gBAChF,OAAO;gBACP,KAAK;gBACL,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;aACxB,CAAC,CAAC;QACL,CAAC;KACF,CAAC;IAEF,UAAU,CAAC;QACT,IAAI,EAAE,4BAA4B;QAClC,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EAAE,sGAAsG;QACnH,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE;YACN,GAAG,eAAe;YAClB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,wCAAwC,CAAC;YAC/E,GAAG,YAAY;SAChB;QACD,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE;YAClC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;YAC9C,OAAO,MAAM,CAAC,GAAG,CACf,iBAAiB,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,aAAa,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,EAC7G,EAAE,OAAO,EAAE,KAAK,EAAE,CACnB,CAAC;QACJ,CAAC;KACF,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { UmamiClient } from '../client.js';
|
|
3
|
+
import type { Config } from '../config.js';
|
|
4
|
+
/**
|
|
5
|
+
* Tools declare the privilege they need. The server registers only the tools
|
|
6
|
+
* the operator has enabled, so a tool the operator did not permit is not
|
|
7
|
+
* merely refused at call time -- it is never advertised to the model at all,
|
|
8
|
+
* and therefore cannot be invoked by a prompt-injected instruction.
|
|
9
|
+
*/
|
|
10
|
+
export type Tier = 'read' | 'write' | 'admin';
|
|
11
|
+
export interface ToolContext {
|
|
12
|
+
client: UmamiClient;
|
|
13
|
+
config: Config;
|
|
14
|
+
}
|
|
15
|
+
export interface ToolDef {
|
|
16
|
+
name: string;
|
|
17
|
+
title: string;
|
|
18
|
+
description: string;
|
|
19
|
+
tier: Tier;
|
|
20
|
+
/** Irreversible: deleting a site, wiping its data, removing a user. */
|
|
21
|
+
destructive?: boolean;
|
|
22
|
+
schema: z.ZodRawShape;
|
|
23
|
+
handler: (ctx: ToolContext, args: Record<string, any>) => Promise<unknown>;
|
|
24
|
+
}
|
|
25
|
+
export declare function defineTool(def: ToolDef): ToolDef;
|
|
26
|
+
/** Is `tool` permitted under the operator's configuration? */
|
|
27
|
+
export declare function isAllowed(tool: ToolDef, config: Config): boolean;
|
|
28
|
+
export declare const periodSchema: {
|
|
29
|
+
period: z.ZodOptional<z.ZodString>;
|
|
30
|
+
startAt: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
endAt: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
};
|
|
33
|
+
export interface Range {
|
|
34
|
+
startAt: number;
|
|
35
|
+
endAt: number;
|
|
36
|
+
}
|
|
37
|
+
export declare function resolveRange(args: {
|
|
38
|
+
period?: string;
|
|
39
|
+
startAt?: number;
|
|
40
|
+
endAt?: number;
|
|
41
|
+
}, now?: number): Range;
|
|
42
|
+
/** Metric dimensions accepted by Umami v3's /metrics endpoint. */
|
|
43
|
+
export declare const METRIC_TYPES: readonly ["path", "title", "referrer", "query", "browser", "os", "device", "screen", "country", "region", "city", "language", "hostname", "event", "tag", "channel"];
|
|
44
|
+
export declare const websiteIdSchema: {
|
|
45
|
+
websiteId: z.ZodString;
|
|
46
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function defineTool(def) {
|
|
3
|
+
return def;
|
|
4
|
+
}
|
|
5
|
+
const RANK = { read: 0, write: 1, admin: 2 };
|
|
6
|
+
/** Is `tool` permitted under the operator's configuration? */
|
|
7
|
+
export function isAllowed(tool, config) {
|
|
8
|
+
if (RANK[tool.tier] > RANK[config.mode])
|
|
9
|
+
return false;
|
|
10
|
+
if (tool.destructive && !config.allowDestructive)
|
|
11
|
+
return false;
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
/* ------------------------------------------------------------------ *
|
|
15
|
+
* Date handling
|
|
16
|
+
*
|
|
17
|
+
* Umami expects epoch milliseconds. Models are far better at "last 7
|
|
18
|
+
* days" than at arithmetic on timestamps, and a model that miscalculates
|
|
19
|
+
* an epoch silently returns data for the wrong period. Accepting a
|
|
20
|
+
* shorthand removes that whole class of error.
|
|
21
|
+
* ------------------------------------------------------------------ */
|
|
22
|
+
const RELATIVE = /^(\d+)(h|d|w|m|y)$/i;
|
|
23
|
+
const UNIT_MS = {
|
|
24
|
+
h: 3_600_000,
|
|
25
|
+
d: 86_400_000,
|
|
26
|
+
w: 604_800_000,
|
|
27
|
+
m: 2_592_000_000, // 30d
|
|
28
|
+
y: 31_536_000_000, // 365d
|
|
29
|
+
};
|
|
30
|
+
export const periodSchema = {
|
|
31
|
+
period: z
|
|
32
|
+
.string()
|
|
33
|
+
.optional()
|
|
34
|
+
.describe('Relative time range: "24h", "7d", "30d", "12m", or "today"/"yesterday". ' +
|
|
35
|
+
'Defaults to "7d". Ignored if startAt/endAt are given.'),
|
|
36
|
+
startAt: z.number().int().optional().describe('Range start, epoch milliseconds. Overrides period.'),
|
|
37
|
+
endAt: z.number().int().optional().describe('Range end, epoch milliseconds. Overrides period.'),
|
|
38
|
+
};
|
|
39
|
+
export function resolveRange(args, now = Date.now()) {
|
|
40
|
+
if (args.startAt !== undefined && args.endAt !== undefined) {
|
|
41
|
+
if (args.endAt < args.startAt)
|
|
42
|
+
throw new Error('endAt must be greater than or equal to startAt');
|
|
43
|
+
return { startAt: args.startAt, endAt: args.endAt };
|
|
44
|
+
}
|
|
45
|
+
const period = (args.period ?? '7d').trim().toLowerCase();
|
|
46
|
+
if (period === 'today') {
|
|
47
|
+
const d = new Date(now);
|
|
48
|
+
d.setUTCHours(0, 0, 0, 0);
|
|
49
|
+
return { startAt: d.getTime(), endAt: now };
|
|
50
|
+
}
|
|
51
|
+
if (period === 'yesterday') {
|
|
52
|
+
const end = new Date(now);
|
|
53
|
+
end.setUTCHours(0, 0, 0, 0);
|
|
54
|
+
return { startAt: end.getTime() - UNIT_MS.d, endAt: end.getTime() };
|
|
55
|
+
}
|
|
56
|
+
const m = RELATIVE.exec(period);
|
|
57
|
+
if (!m) {
|
|
58
|
+
throw new Error(`Unrecognised period ${JSON.stringify(args.period)}. Use e.g. "24h", "7d", "30d", "12m", "today", "yesterday", ` +
|
|
59
|
+
'or pass explicit startAt/endAt epoch milliseconds.');
|
|
60
|
+
}
|
|
61
|
+
const span = Number(m[1]) * UNIT_MS[m[2].toLowerCase()];
|
|
62
|
+
return { startAt: now - span, endAt: now };
|
|
63
|
+
}
|
|
64
|
+
/** Metric dimensions accepted by Umami v3's /metrics endpoint. */
|
|
65
|
+
export const METRIC_TYPES = [
|
|
66
|
+
'path',
|
|
67
|
+
'title',
|
|
68
|
+
'referrer',
|
|
69
|
+
'query',
|
|
70
|
+
'browser',
|
|
71
|
+
'os',
|
|
72
|
+
'device',
|
|
73
|
+
'screen',
|
|
74
|
+
'country',
|
|
75
|
+
'region',
|
|
76
|
+
'city',
|
|
77
|
+
'language',
|
|
78
|
+
'hostname',
|
|
79
|
+
'event',
|
|
80
|
+
'tag',
|
|
81
|
+
'channel',
|
|
82
|
+
];
|
|
83
|
+
export const websiteIdSchema = {
|
|
84
|
+
websiteId: z.string().min(1).describe('Umami website UUID. Use umami_list_websites to find it.'),
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/tools/common.ts"],"names":[],"mappings":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;YAC9G,oDAAoD,CACvD,CAAC;IACJ,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;IACxD,OAAO,EAAE,OAAO,EAAE,GAAG,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;AAC7C,CAAC;AAED,kEAAkE;AAClE,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,MAAM;IACN,OAAO;IACP,UAAU;IACV,OAAO;IACP,SAAS;IACT,IAAI;IACJ,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,MAAM;IACN,UAAU;IACV,UAAU;IACV,OAAO;IACP,KAAK;IACL,SAAS;CACD,CAAC;AAEX,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,yDAAyD,CAAC;CACjG,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { websiteTools } from './websites.js';
|
|
2
|
+
import { analyticsTools } from './analytics.js';
|
|
3
|
+
import { reportTools } from './reports.js';
|
|
4
|
+
import { adminTools } from './admin.js';
|
|
5
|
+
export const allTools = [...websiteTools, ...analyticsTools, ...reportTools, ...adminTools];
|
|
6
|
+
export * from './common.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,CAAC,MAAM,QAAQ,GAAc,CAAC,GAAG,YAAY,EAAE,GAAG,cAAc,EAAE,GAAG,WAAW,EAAE,GAAG,UAAU,CAAC,CAAC;AAEvG,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const reportTools: import("./common.js").ToolDef[];
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineTool, periodSchema, resolveRange, websiteIdSchema } from './common.js';
|
|
3
|
+
async function runReport({ client }, type, args, parameters) {
|
|
4
|
+
const { startAt, endAt } = resolveRange(args);
|
|
5
|
+
const body = {
|
|
6
|
+
websiteId: args.websiteId,
|
|
7
|
+
type,
|
|
8
|
+
filters: args.filters ?? {},
|
|
9
|
+
parameters: {
|
|
10
|
+
startDate: new Date(startAt).toISOString(),
|
|
11
|
+
endDate: new Date(endAt).toISOString(),
|
|
12
|
+
...parameters,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
const data = await client.post(`/api/reports/${type}`, body);
|
|
16
|
+
return { report: type, range: { startAt, endAt }, data };
|
|
17
|
+
}
|
|
18
|
+
const filtersSchema = {
|
|
19
|
+
filters: z
|
|
20
|
+
.record(z.any())
|
|
21
|
+
.optional()
|
|
22
|
+
.describe('Optional Umami filter object to narrow the report, e.g. {"country":"BD"}.'),
|
|
23
|
+
};
|
|
24
|
+
export const reportTools = [
|
|
25
|
+
defineTool({
|
|
26
|
+
name: 'umami_report_utm',
|
|
27
|
+
title: 'UTM campaign report',
|
|
28
|
+
description: 'Breakdown of traffic by UTM parameters: source, medium, campaign, term and content. ' +
|
|
29
|
+
'In Umami v3 UTM data lives here, not in the /metrics endpoint.',
|
|
30
|
+
tier: 'read',
|
|
31
|
+
schema: { ...websiteIdSchema, ...periodSchema, ...filtersSchema },
|
|
32
|
+
handler: (ctx, a) => runReport(ctx, 'utm', a, {}),
|
|
33
|
+
}),
|
|
34
|
+
defineTool({
|
|
35
|
+
name: 'umami_report_funnel',
|
|
36
|
+
title: 'Funnel report',
|
|
37
|
+
description: 'Step-by-step conversion funnel. Give an ordered list of steps; the report returns visitors reaching ' +
|
|
38
|
+
'each step plus the drop-off between them.',
|
|
39
|
+
tier: 'read',
|
|
40
|
+
schema: {
|
|
41
|
+
...websiteIdSchema,
|
|
42
|
+
...periodSchema,
|
|
43
|
+
...filtersSchema,
|
|
44
|
+
steps: z
|
|
45
|
+
.array(z.object({
|
|
46
|
+
type: z.enum(['path', 'event']).describe('Match a page path or a custom event name.'),
|
|
47
|
+
value: z.string().min(1).describe('The path (e.g. "/pricing") or event name.'),
|
|
48
|
+
}))
|
|
49
|
+
.min(2)
|
|
50
|
+
.describe('Ordered funnel steps, at least two.'),
|
|
51
|
+
window: z.number().int().min(1).optional().describe('Conversion window in minutes, default 60.'),
|
|
52
|
+
},
|
|
53
|
+
handler: (ctx, a) => runReport(ctx, 'funnel', a, { steps: a.steps, window: a.window ?? 60 }),
|
|
54
|
+
}),
|
|
55
|
+
defineTool({
|
|
56
|
+
name: 'umami_report_retention',
|
|
57
|
+
title: 'Retention report',
|
|
58
|
+
description: 'Cohort retention: of the visitors first seen on a given day, how many returned on each subsequent day.',
|
|
59
|
+
tier: 'read',
|
|
60
|
+
schema: { ...websiteIdSchema, ...periodSchema, ...filtersSchema },
|
|
61
|
+
handler: (ctx, a) => runReport(ctx, 'retention', a, {}),
|
|
62
|
+
}),
|
|
63
|
+
defineTool({
|
|
64
|
+
name: 'umami_report_journey',
|
|
65
|
+
title: 'User journey report',
|
|
66
|
+
description: 'Most common ordered paths visitors take through the site, as sequences of pages with a count for each.',
|
|
67
|
+
tier: 'read',
|
|
68
|
+
schema: {
|
|
69
|
+
...websiteIdSchema,
|
|
70
|
+
...periodSchema,
|
|
71
|
+
...filtersSchema,
|
|
72
|
+
steps: z.number().int().min(2).max(10).optional().describe('Journey length in pages, default 5.'),
|
|
73
|
+
},
|
|
74
|
+
handler: (ctx, a) => runReport(ctx, 'journey', a, { steps: a.steps ?? 5 }),
|
|
75
|
+
}),
|
|
76
|
+
defineTool({
|
|
77
|
+
name: 'umami_report_goal',
|
|
78
|
+
title: 'Goal report',
|
|
79
|
+
description: 'Progress toward a single goal: how many visitors hit a given path or custom event.',
|
|
80
|
+
tier: 'read',
|
|
81
|
+
schema: {
|
|
82
|
+
...websiteIdSchema,
|
|
83
|
+
...periodSchema,
|
|
84
|
+
...filtersSchema,
|
|
85
|
+
type: z.enum(['path', 'event']).describe('Whether the goal is a page path or a custom event.'),
|
|
86
|
+
value: z.string().min(1).describe('The path (e.g. "/thank-you") or event name.'),
|
|
87
|
+
operator: z.string().optional().describe('Optional comparison operator supported by Umami.'),
|
|
88
|
+
},
|
|
89
|
+
handler: (ctx, a) => runReport(ctx, 'goal', a, { type: a.type, value: a.value, operator: a.operator }),
|
|
90
|
+
}),
|
|
91
|
+
defineTool({
|
|
92
|
+
name: 'umami_report_revenue',
|
|
93
|
+
title: 'Revenue report',
|
|
94
|
+
description: 'Revenue over time from events carrying a revenue property, broken down by country, region, referrer and channel. ' +
|
|
95
|
+
'Requires revenue tracking to be set up in Umami.',
|
|
96
|
+
tier: 'read',
|
|
97
|
+
schema: {
|
|
98
|
+
...websiteIdSchema,
|
|
99
|
+
...periodSchema,
|
|
100
|
+
...filtersSchema,
|
|
101
|
+
currency: z.string().length(3).optional().describe('ISO 4217 currency code, default "USD".'),
|
|
102
|
+
},
|
|
103
|
+
handler: (ctx, a) => runReport(ctx, 'revenue', a, { currency: a.currency ?? 'USD' }),
|
|
104
|
+
}),
|
|
105
|
+
defineTool({
|
|
106
|
+
name: 'umami_report_attribution',
|
|
107
|
+
title: 'Attribution report',
|
|
108
|
+
description: 'Credits conversions to acquisition channels -- referrer, paid ads and UTM parameters -- under either a ' +
|
|
109
|
+
'first-click or last-click model.',
|
|
110
|
+
tier: 'read',
|
|
111
|
+
schema: {
|
|
112
|
+
...websiteIdSchema,
|
|
113
|
+
...periodSchema,
|
|
114
|
+
...filtersSchema,
|
|
115
|
+
model: z.enum(['first-click', 'last-click']).describe('Attribution model.'),
|
|
116
|
+
type: z.enum(['path', 'event']).describe('Whether the conversion is a page path or a custom event.'),
|
|
117
|
+
step: z.string().min(1).describe('The converting path (e.g. "/checkout") or event name.'),
|
|
118
|
+
},
|
|
119
|
+
handler: (ctx, a) => runReport(ctx, 'attribution', a, { model: a.model, type: a.type, step: a.step }),
|
|
120
|
+
}),
|
|
121
|
+
];
|
|
122
|
+
//# sourceMappingURL=reports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reports.js","sourceRoot":"","sources":["../../src/tools/reports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAsBtF,KAAK,UAAU,SAAS,CACtB,EAAE,MAAM,EAAe,EACvB,IAAY,EACZ,IAAgB,EAChB,UAAmC;IAEnC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAC9C,MAAM,IAAI,GAAG;QACX,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,IAAI;QACJ,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,EAAE;QAC3B,UAAU,EAAE;YACV,SAAS,EAAE,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE;YAC1C,OAAO,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE;YACtC,GAAG,UAAU;SACd;KACF,CAAC;IACF,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,gBAAgB,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC;IAC7D,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC;AAC3D,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