@sealmetrics/mcp 0.1.0 → 1.2.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/README.md +149 -0
- package/dist/client.d.ts +45 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +136 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +10 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +55 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +1 -6
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +122 -781
- package/dist/index.js.map +1 -0
- package/dist/resources/tracking-guide.d.ts +13 -0
- package/dist/resources/tracking-guide.d.ts.map +1 -0
- package/dist/resources/tracking-guide.js +479 -0
- package/dist/resources/tracking-guide.js.map +1 -0
- package/dist/tools/alerts.d.ts +5 -0
- package/dist/tools/alerts.d.ts.map +1 -0
- package/dist/tools/alerts.js +80 -0
- package/dist/tools/alerts.js.map +1 -0
- package/dist/tools/audience.d.ts +7 -0
- package/dist/tools/audience.d.ts.map +1 -0
- package/dist/tools/audience.js +146 -0
- package/dist/tools/audience.js.map +1 -0
- package/dist/tools/bots.d.ts +4 -0
- package/dist/tools/bots.d.ts.map +1 -0
- package/dist/tools/bots.js +52 -0
- package/dist/tools/bots.js.map +1 -0
- package/dist/tools/channels.d.ts +5 -0
- package/dist/tools/channels.d.ts.map +1 -0
- package/dist/tools/channels.js +88 -0
- package/dist/tools/channels.js.map +1 -0
- package/dist/tools/content.d.ts +3 -0
- package/dist/tools/content.d.ts.map +1 -0
- package/dist/tools/content.js +47 -0
- package/dist/tools/content.js.map +1 -0
- package/dist/tools/conversions.d.ts +6 -0
- package/dist/tools/conversions.d.ts.map +1 -0
- package/dist/tools/conversions.js +178 -0
- package/dist/tools/conversions.js.map +1 -0
- package/dist/tools/funnel.d.ts +3 -0
- package/dist/tools/funnel.d.ts.map +1 -0
- package/dist/tools/funnel.js +27 -0
- package/dist/tools/funnel.js.map +1 -0
- package/dist/tools/index.d.ts +16 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +79 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/manage.d.ts +3 -0
- package/dist/tools/manage.d.ts.map +1 -0
- package/dist/tools/manage.js +55 -0
- package/dist/tools/manage.js.map +1 -0
- package/dist/tools/overview.d.ts +3 -0
- package/dist/tools/overview.d.ts.map +1 -0
- package/dist/tools/overview.js +26 -0
- package/dist/tools/overview.js.map +1 -0
- package/dist/tools/pages.d.ts +7 -0
- package/dist/tools/pages.d.ts.map +1 -0
- package/dist/tools/pages.js +207 -0
- package/dist/tools/pages.js.map +1 -0
- package/dist/tools/properties.d.ts +5 -0
- package/dist/tools/properties.d.ts.map +1 -0
- package/dist/tools/properties.js +107 -0
- package/dist/tools/properties.js.map +1 -0
- package/dist/tools/segments.d.ts +4 -0
- package/dist/tools/segments.d.ts.map +1 -0
- package/dist/tools/segments.js +49 -0
- package/dist/tools/segments.js.map +1 -0
- package/dist/tools/shared.d.ts +45 -0
- package/dist/tools/shared.d.ts.map +1 -0
- package/dist/tools/shared.js +139 -0
- package/dist/tools/shared.js.map +1 -0
- package/dist/tools/sites.d.ts +4 -0
- package/dist/tools/sites.d.ts.map +1 -0
- package/dist/tools/sites.js +36 -0
- package/dist/tools/sites.js.map +1 -0
- package/dist/tools/tracking.d.ts +3 -0
- package/dist/tools/tracking.d.ts.map +1 -0
- package/dist/tools/tracking.js +220 -0
- package/dist/tools/tracking.js.map +1 -0
- package/dist/tools/traffic.d.ts +10 -0
- package/dist/tools/traffic.d.ts.map +1 -0
- package/dist/tools/traffic.js +273 -0
- package/dist/tools/traffic.js.map +1 -0
- package/dist/tools/webhooks.d.ts +5 -0
- package/dist/tools/webhooks.d.ts.map +1 -0
- package/dist/tools/webhooks.js +101 -0
- package/dist/tools/webhooks.js.map +1 -0
- package/dist/types.d.ts +118 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +22 -0
- package/dist/types.js.map +1 -0
- package/package.json +35 -27
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import { PERIOD_SCHEMA, COMPARE_SCHEMA, LIMIT_SCHEMA, SORT_ORDER_SCHEMA, PAGE_SCHEMA, resolveSiteId, } from "./shared.js";
|
|
2
|
+
const TRAFFIC_SORT_BY = {
|
|
3
|
+
type: "string",
|
|
4
|
+
description: "Field to sort by.",
|
|
5
|
+
enum: ["entrances", "engaged_entrances", "page_views", "conversions", "revenue", "bounce_rate"],
|
|
6
|
+
default: "entrances",
|
|
7
|
+
};
|
|
8
|
+
function trafficParams(args) {
|
|
9
|
+
return {
|
|
10
|
+
site_id: resolveSiteId(args),
|
|
11
|
+
period: args.period ?? "30d",
|
|
12
|
+
compare: args.compare,
|
|
13
|
+
page_size: String(args.limit ?? 20),
|
|
14
|
+
page: args.page != null ? String(args.page) : undefined,
|
|
15
|
+
sort_by: args.sort_by ?? "entrances",
|
|
16
|
+
sort_order: args.sort_order ?? "desc",
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export const getTrafficSourcesTool = {
|
|
20
|
+
name: "get_traffic_sources",
|
|
21
|
+
description: "Get traffic broken down by source (utm_source): google, facebook, twitter, direct, etc. Shows entrances, pageviews, conversions, and revenue per source.",
|
|
22
|
+
inputSchema: {
|
|
23
|
+
type: "object",
|
|
24
|
+
properties: {
|
|
25
|
+
site_id: {
|
|
26
|
+
type: "string",
|
|
27
|
+
description: "Site ID. Optional if SEALMETRICS_SITE_ID env var is set.",
|
|
28
|
+
},
|
|
29
|
+
period: PERIOD_SCHEMA,
|
|
30
|
+
compare: COMPARE_SCHEMA,
|
|
31
|
+
limit: LIMIT_SCHEMA,
|
|
32
|
+
page: PAGE_SCHEMA,
|
|
33
|
+
sort_by: TRAFFIC_SORT_BY,
|
|
34
|
+
sort_order: SORT_ORDER_SCHEMA,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
handler: async (client, args) => {
|
|
38
|
+
return client.requestPaginated("/stats/sources", trafficParams(args));
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
export const getTrafficMediumsTool = {
|
|
42
|
+
name: "get_traffic_mediums",
|
|
43
|
+
description: "Get traffic broken down by medium (utm_medium): organic, cpc, email, referral, social, etc. Useful for understanding which marketing channels drive traffic.",
|
|
44
|
+
inputSchema: {
|
|
45
|
+
type: "object",
|
|
46
|
+
properties: {
|
|
47
|
+
site_id: {
|
|
48
|
+
type: "string",
|
|
49
|
+
description: "Site ID. Optional if SEALMETRICS_SITE_ID env var is set.",
|
|
50
|
+
},
|
|
51
|
+
period: PERIOD_SCHEMA,
|
|
52
|
+
compare: COMPARE_SCHEMA,
|
|
53
|
+
limit: LIMIT_SCHEMA,
|
|
54
|
+
page: PAGE_SCHEMA,
|
|
55
|
+
sort_by: TRAFFIC_SORT_BY,
|
|
56
|
+
sort_order: SORT_ORDER_SCHEMA,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
handler: async (client, args) => {
|
|
60
|
+
return client.requestPaginated("/stats/mediums", trafficParams(args));
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
export const getCampaignsTool = {
|
|
64
|
+
name: "get_campaigns",
|
|
65
|
+
description: "Get traffic and conversions broken down by campaign (utm_campaign). Shows performance of individual marketing campaigns including entrances, conversions, and revenue.",
|
|
66
|
+
inputSchema: {
|
|
67
|
+
type: "object",
|
|
68
|
+
properties: {
|
|
69
|
+
site_id: {
|
|
70
|
+
type: "string",
|
|
71
|
+
description: "Site ID. Optional if SEALMETRICS_SITE_ID env var is set.",
|
|
72
|
+
},
|
|
73
|
+
period: PERIOD_SCHEMA,
|
|
74
|
+
compare: COMPARE_SCHEMA,
|
|
75
|
+
limit: LIMIT_SCHEMA,
|
|
76
|
+
page: PAGE_SCHEMA,
|
|
77
|
+
sort_by: TRAFFIC_SORT_BY,
|
|
78
|
+
sort_order: SORT_ORDER_SCHEMA,
|
|
79
|
+
utm_source: {
|
|
80
|
+
type: "string",
|
|
81
|
+
description: "Filter by source (e.g. 'google').",
|
|
82
|
+
},
|
|
83
|
+
utm_medium: {
|
|
84
|
+
type: "string",
|
|
85
|
+
description: "Filter by medium (e.g. 'cpc').",
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
handler: async (client, args) => {
|
|
90
|
+
const params = trafficParams(args);
|
|
91
|
+
params.utm_source = args.utm_source;
|
|
92
|
+
params.utm_medium = args.utm_medium;
|
|
93
|
+
return client.requestPaginated("/stats/campaigns", params);
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
export const getTermsTool = {
|
|
97
|
+
name: "get_terms",
|
|
98
|
+
description: "Get traffic and conversions broken down by UTM term (keyword). Shows which search keywords or ad terms drive the most traffic. Supports filtering by source, medium, and campaign.",
|
|
99
|
+
inputSchema: {
|
|
100
|
+
type: "object",
|
|
101
|
+
properties: {
|
|
102
|
+
site_id: {
|
|
103
|
+
type: "string",
|
|
104
|
+
description: "Site ID. Optional if SEALMETRICS_SITE_ID env var is set.",
|
|
105
|
+
},
|
|
106
|
+
period: PERIOD_SCHEMA,
|
|
107
|
+
compare: COMPARE_SCHEMA,
|
|
108
|
+
limit: LIMIT_SCHEMA,
|
|
109
|
+
page: PAGE_SCHEMA,
|
|
110
|
+
sort_by: TRAFFIC_SORT_BY,
|
|
111
|
+
sort_order: SORT_ORDER_SCHEMA,
|
|
112
|
+
utm_source: {
|
|
113
|
+
type: "string",
|
|
114
|
+
description: "Filter by source (e.g. 'google').",
|
|
115
|
+
},
|
|
116
|
+
utm_medium: {
|
|
117
|
+
type: "string",
|
|
118
|
+
description: "Filter by medium (e.g. 'cpc').",
|
|
119
|
+
},
|
|
120
|
+
utm_campaign: {
|
|
121
|
+
type: "string",
|
|
122
|
+
description: "Filter by campaign name.",
|
|
123
|
+
},
|
|
124
|
+
country: {
|
|
125
|
+
type: "string",
|
|
126
|
+
description: "Filter by country code (e.g. 'ES', 'US').",
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
handler: async (client, args) => {
|
|
131
|
+
const params = trafficParams(args);
|
|
132
|
+
params.utm_source = args.utm_source;
|
|
133
|
+
params.utm_medium = args.utm_medium;
|
|
134
|
+
params.utm_campaign = args.utm_campaign;
|
|
135
|
+
params.country = args.country;
|
|
136
|
+
return client.requestPaginated("/stats/terms", params);
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
// --- Top N tools (non-paginated, client.request) ---
|
|
140
|
+
function topNParams(args) {
|
|
141
|
+
return {
|
|
142
|
+
site_id: resolveSiteId(args),
|
|
143
|
+
period: args.period ?? "30d",
|
|
144
|
+
limit: String(args.limit ?? 10),
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
export const getTopSourcesTool = {
|
|
148
|
+
name: "get_top_sources",
|
|
149
|
+
description: "Get top traffic sources ranked by entrances. Returns a compact list of the top N sources (utm_source) without pagination — ideal for quick rankings and summaries.",
|
|
150
|
+
inputSchema: {
|
|
151
|
+
type: "object",
|
|
152
|
+
properties: {
|
|
153
|
+
site_id: {
|
|
154
|
+
type: "string",
|
|
155
|
+
description: "Site ID. Optional if SEALMETRICS_SITE_ID env var is set.",
|
|
156
|
+
},
|
|
157
|
+
period: PERIOD_SCHEMA,
|
|
158
|
+
limit: LIMIT_SCHEMA,
|
|
159
|
+
utm_medium: {
|
|
160
|
+
type: "string",
|
|
161
|
+
description: "Filter by medium (e.g. 'cpc').",
|
|
162
|
+
},
|
|
163
|
+
country: {
|
|
164
|
+
type: "string",
|
|
165
|
+
description: "Filter by country code (e.g. 'ES', 'US').",
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
handler: async (client, args) => {
|
|
170
|
+
const params = topNParams(args);
|
|
171
|
+
params.utm_medium = args.utm_medium;
|
|
172
|
+
params.country = args.country;
|
|
173
|
+
return client.request("/stats/sources/top", params);
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
export const getTopCampaignsTool = {
|
|
177
|
+
name: "get_top_campaigns",
|
|
178
|
+
description: "Get top campaigns ranked by entrances. Returns a compact list of the top N campaigns (utm_campaign) — ideal for quick rankings.",
|
|
179
|
+
inputSchema: {
|
|
180
|
+
type: "object",
|
|
181
|
+
properties: {
|
|
182
|
+
site_id: {
|
|
183
|
+
type: "string",
|
|
184
|
+
description: "Site ID. Optional if SEALMETRICS_SITE_ID env var is set.",
|
|
185
|
+
},
|
|
186
|
+
period: PERIOD_SCHEMA,
|
|
187
|
+
limit: LIMIT_SCHEMA,
|
|
188
|
+
utm_source: {
|
|
189
|
+
type: "string",
|
|
190
|
+
description: "Filter by source (e.g. 'google').",
|
|
191
|
+
},
|
|
192
|
+
utm_medium: {
|
|
193
|
+
type: "string",
|
|
194
|
+
description: "Filter by medium (e.g. 'cpc').",
|
|
195
|
+
},
|
|
196
|
+
country: {
|
|
197
|
+
type: "string",
|
|
198
|
+
description: "Filter by country code (e.g. 'ES', 'US').",
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
handler: async (client, args) => {
|
|
203
|
+
const params = topNParams(args);
|
|
204
|
+
params.utm_source = args.utm_source;
|
|
205
|
+
params.utm_medium = args.utm_medium;
|
|
206
|
+
params.country = args.country;
|
|
207
|
+
return client.request("/stats/campaigns/top", params);
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
export const getTopTermsTool = {
|
|
211
|
+
name: "get_top_terms",
|
|
212
|
+
description: "Get top UTM terms (keywords) ranked by entrances. Returns a compact list of the top N terms — ideal for quick keyword rankings.",
|
|
213
|
+
inputSchema: {
|
|
214
|
+
type: "object",
|
|
215
|
+
properties: {
|
|
216
|
+
site_id: {
|
|
217
|
+
type: "string",
|
|
218
|
+
description: "Site ID. Optional if SEALMETRICS_SITE_ID env var is set.",
|
|
219
|
+
},
|
|
220
|
+
period: PERIOD_SCHEMA,
|
|
221
|
+
limit: LIMIT_SCHEMA,
|
|
222
|
+
utm_source: {
|
|
223
|
+
type: "string",
|
|
224
|
+
description: "Filter by source (e.g. 'google').",
|
|
225
|
+
},
|
|
226
|
+
utm_medium: {
|
|
227
|
+
type: "string",
|
|
228
|
+
description: "Filter by medium (e.g. 'cpc').",
|
|
229
|
+
},
|
|
230
|
+
utm_campaign: {
|
|
231
|
+
type: "string",
|
|
232
|
+
description: "Filter by campaign name.",
|
|
233
|
+
},
|
|
234
|
+
country: {
|
|
235
|
+
type: "string",
|
|
236
|
+
description: "Filter by country code (e.g. 'ES', 'US').",
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
handler: async (client, args) => {
|
|
241
|
+
const params = topNParams(args);
|
|
242
|
+
params.utm_source = args.utm_source;
|
|
243
|
+
params.utm_medium = args.utm_medium;
|
|
244
|
+
params.utm_campaign = args.utm_campaign;
|
|
245
|
+
params.country = args.country;
|
|
246
|
+
return client.request("/stats/terms/top", params);
|
|
247
|
+
},
|
|
248
|
+
};
|
|
249
|
+
export const getTopReferrersTool = {
|
|
250
|
+
name: "get_top_referrers",
|
|
251
|
+
description: "Get top referrer domains ranked by entrances. Shows which external sites send the most traffic.",
|
|
252
|
+
inputSchema: {
|
|
253
|
+
type: "object",
|
|
254
|
+
properties: {
|
|
255
|
+
site_id: {
|
|
256
|
+
type: "string",
|
|
257
|
+
description: "Site ID. Optional if SEALMETRICS_SITE_ID env var is set.",
|
|
258
|
+
},
|
|
259
|
+
period: PERIOD_SCHEMA,
|
|
260
|
+
limit: LIMIT_SCHEMA,
|
|
261
|
+
country: {
|
|
262
|
+
type: "string",
|
|
263
|
+
description: "Filter by country code (e.g. 'ES', 'US').",
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
handler: async (client, args) => {
|
|
268
|
+
const params = topNParams(args);
|
|
269
|
+
params.country = args.country;
|
|
270
|
+
return client.request("/stats/referrers/top", params);
|
|
271
|
+
},
|
|
272
|
+
};
|
|
273
|
+
//# sourceMappingURL=traffic.js.map
|
|
@@ -0,0 +1 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AA6B,CAAC;QACpD,OAAO,MAAM,CAAC,OAAO,CAAU,sBAAsB,EAAE,MAAM,CAAC,CAAC;IACjE,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../src/tools/webhooks.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,eAAO,MAAM,gBAAgB,EAAE,OA+B9B,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,OAsCvC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,OA8BjC,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { LIMIT_SCHEMA, resolveSiteId } from "./shared.js";
|
|
2
|
+
export const listWebhooksTool = {
|
|
3
|
+
name: "list_webhooks",
|
|
4
|
+
description: "List webhook endpoints configured for a site. Shows endpoint URL, subscribed event types, and active status. Webhooks send real-time HTTP notifications when events occur.",
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object",
|
|
7
|
+
properties: {
|
|
8
|
+
site_id: {
|
|
9
|
+
type: "string",
|
|
10
|
+
description: "Site ID (account_id). Optional if SEALMETRICS_SITE_ID env var is set.",
|
|
11
|
+
},
|
|
12
|
+
include_inactive: {
|
|
13
|
+
type: "boolean",
|
|
14
|
+
description: "Include inactive webhook endpoints (default: false).",
|
|
15
|
+
},
|
|
16
|
+
limit: LIMIT_SCHEMA,
|
|
17
|
+
offset: {
|
|
18
|
+
type: "number",
|
|
19
|
+
description: "Offset for pagination (default: 0).",
|
|
20
|
+
default: 0,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
handler: async (client, args) => {
|
|
25
|
+
return client.requestDirect("/webhooks", {
|
|
26
|
+
account_id: resolveSiteId(args),
|
|
27
|
+
include_inactive: args.include_inactive != null ? String(args.include_inactive) : undefined,
|
|
28
|
+
limit: String(args.limit ?? 50),
|
|
29
|
+
offset: args.offset != null ? String(args.offset) : undefined,
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
export const listWebhookDeliveriesTool = {
|
|
34
|
+
name: "list_webhook_deliveries",
|
|
35
|
+
description: "List delivery attempts for a specific webhook endpoint. Shows HTTP status, response time, and success/failure for each delivery. Useful for debugging webhook integration issues.",
|
|
36
|
+
inputSchema: {
|
|
37
|
+
type: "object",
|
|
38
|
+
properties: {
|
|
39
|
+
site_id: {
|
|
40
|
+
type: "string",
|
|
41
|
+
description: "Site ID (account_id). Optional if SEALMETRICS_SITE_ID env var is set.",
|
|
42
|
+
},
|
|
43
|
+
endpoint_id: {
|
|
44
|
+
type: "string",
|
|
45
|
+
description: "Webhook endpoint UUID.",
|
|
46
|
+
},
|
|
47
|
+
status: {
|
|
48
|
+
type: "string",
|
|
49
|
+
description: "Filter by delivery status.",
|
|
50
|
+
enum: ["pending", "success", "failed"],
|
|
51
|
+
},
|
|
52
|
+
limit: LIMIT_SCHEMA,
|
|
53
|
+
offset: {
|
|
54
|
+
type: "number",
|
|
55
|
+
description: "Offset for pagination (default: 0).",
|
|
56
|
+
default: 0,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
required: ["endpoint_id"],
|
|
60
|
+
},
|
|
61
|
+
handler: async (client, args) => {
|
|
62
|
+
const endpointId = args.endpoint_id;
|
|
63
|
+
return client.requestDirect(`/webhooks/${encodeURIComponent(endpointId)}/deliveries`, {
|
|
64
|
+
account_id: resolveSiteId(args),
|
|
65
|
+
status: args.status,
|
|
66
|
+
limit: String(args.limit ?? 50),
|
|
67
|
+
offset: args.offset != null ? String(args.offset) : undefined,
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
export const getWebhookStatsTool = {
|
|
72
|
+
name: "get_webhook_stats",
|
|
73
|
+
description: "Get delivery statistics for a specific webhook endpoint: total deliveries, success rate, average response time, and failure breakdown. Useful for monitoring webhook reliability.",
|
|
74
|
+
inputSchema: {
|
|
75
|
+
type: "object",
|
|
76
|
+
properties: {
|
|
77
|
+
site_id: {
|
|
78
|
+
type: "string",
|
|
79
|
+
description: "Site ID (account_id). Optional if SEALMETRICS_SITE_ID env var is set.",
|
|
80
|
+
},
|
|
81
|
+
endpoint_id: {
|
|
82
|
+
type: "string",
|
|
83
|
+
description: "Webhook endpoint UUID.",
|
|
84
|
+
},
|
|
85
|
+
hours: {
|
|
86
|
+
type: "number",
|
|
87
|
+
description: "Hours to look back for statistics (1-720, default: 24).",
|
|
88
|
+
default: 24,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
required: ["endpoint_id"],
|
|
92
|
+
},
|
|
93
|
+
handler: async (client, args) => {
|
|
94
|
+
const endpointId = args.endpoint_id;
|
|
95
|
+
return client.requestDirect(`/webhooks/${encodeURIComponent(endpointId)}/stats`, {
|
|
96
|
+
account_id: resolveSiteId(args),
|
|
97
|
+
hours: String(args.hours ?? 24),
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=webhooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../../src/tools/webhooks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG1D,MAAM,CAAC,MAAM,gBAAgB,GAAY;IACvC,IAAI,EAAE,eAAe;IACrB,WAAW,EACT,4KAA4K;IAC9K,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,uEAAuE;aACrF;YACD,gBAAgB,EAAE;gBAChB,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,sDAAsD;aACpE;YACD,KAAK,EAAE,YAAY;YACnB,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,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C;IACL,CAAC;CACF,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/** API response envelope. */
|
|
2
|
+
export interface APIResponse<T> {
|
|
3
|
+
success: boolean;
|
|
4
|
+
data: T;
|
|
5
|
+
meta?: Record<string, unknown>;
|
|
6
|
+
timestamp: string;
|
|
7
|
+
}
|
|
8
|
+
/** Paginated API response. */
|
|
9
|
+
export interface PaginatedResponse<T> {
|
|
10
|
+
success: boolean;
|
|
11
|
+
data: T[];
|
|
12
|
+
total: number;
|
|
13
|
+
page: number;
|
|
14
|
+
page_size: number;
|
|
15
|
+
has_next: boolean;
|
|
16
|
+
has_prev: boolean;
|
|
17
|
+
comparison?: Record<string, unknown> | null;
|
|
18
|
+
totals?: Record<string, unknown> | null;
|
|
19
|
+
timestamp: string;
|
|
20
|
+
}
|
|
21
|
+
/** Site info returned by GET /sites. */
|
|
22
|
+
export interface SiteInfo {
|
|
23
|
+
id: string;
|
|
24
|
+
name: string;
|
|
25
|
+
domains: string[];
|
|
26
|
+
timezone: string;
|
|
27
|
+
currency: string;
|
|
28
|
+
is_active: boolean;
|
|
29
|
+
created_at: string;
|
|
30
|
+
}
|
|
31
|
+
export interface SiteListResponse {
|
|
32
|
+
sites: SiteInfo[];
|
|
33
|
+
total: number;
|
|
34
|
+
}
|
|
35
|
+
/** Date range in overview response. */
|
|
36
|
+
export interface DateRange {
|
|
37
|
+
start_date: string;
|
|
38
|
+
end_date: string;
|
|
39
|
+
days: number;
|
|
40
|
+
}
|
|
41
|
+
/** Traffic metrics. */
|
|
42
|
+
export interface TrafficMetrics {
|
|
43
|
+
entrances: number;
|
|
44
|
+
engaged_entrances: number;
|
|
45
|
+
page_views: number;
|
|
46
|
+
microconversions: number;
|
|
47
|
+
conversions: number;
|
|
48
|
+
revenue: string;
|
|
49
|
+
bounce_rate: number;
|
|
50
|
+
pages_per_session: number;
|
|
51
|
+
}
|
|
52
|
+
/** Conversion metrics. */
|
|
53
|
+
export interface ConversionMetrics {
|
|
54
|
+
conversions: number;
|
|
55
|
+
revenue: string;
|
|
56
|
+
microconversions: number;
|
|
57
|
+
conversion_rate: number;
|
|
58
|
+
average_order_value: string;
|
|
59
|
+
}
|
|
60
|
+
/** Time series point. */
|
|
61
|
+
export interface TimeSeriesPoint {
|
|
62
|
+
date: string;
|
|
63
|
+
hour?: number | null;
|
|
64
|
+
day_of_week?: number | null;
|
|
65
|
+
value: number;
|
|
66
|
+
}
|
|
67
|
+
/** Time series data. */
|
|
68
|
+
export interface TimeSeries {
|
|
69
|
+
metric: string;
|
|
70
|
+
points: TimeSeriesPoint[];
|
|
71
|
+
total: number;
|
|
72
|
+
average: number;
|
|
73
|
+
}
|
|
74
|
+
/** Overview response. */
|
|
75
|
+
export interface StatsOverview {
|
|
76
|
+
date_range: DateRange;
|
|
77
|
+
traffic: TrafficMetrics;
|
|
78
|
+
conversions: ConversionMetrics;
|
|
79
|
+
traffic_change?: TrafficMetrics | null;
|
|
80
|
+
conversions_change?: ConversionMetrics | null;
|
|
81
|
+
entrances_series?: TimeSeries;
|
|
82
|
+
engaged_entrances_series?: TimeSeries;
|
|
83
|
+
page_views_series?: TimeSeries;
|
|
84
|
+
conversions_series?: TimeSeries;
|
|
85
|
+
microconversions_series?: TimeSeries;
|
|
86
|
+
revenue_series?: TimeSeries;
|
|
87
|
+
}
|
|
88
|
+
/** Devices breakdown response. */
|
|
89
|
+
export interface DevicesBreakdown {
|
|
90
|
+
by_device: DeviceMetric[];
|
|
91
|
+
by_browser: DeviceMetric[];
|
|
92
|
+
by_os: DeviceMetric[];
|
|
93
|
+
}
|
|
94
|
+
export interface DeviceMetric {
|
|
95
|
+
name: string;
|
|
96
|
+
entrances: number;
|
|
97
|
+
engaged_entrances: number;
|
|
98
|
+
page_views: number;
|
|
99
|
+
conversions: number;
|
|
100
|
+
revenue: string;
|
|
101
|
+
bounce_rate: number;
|
|
102
|
+
}
|
|
103
|
+
/** Funnel response. */
|
|
104
|
+
export interface FunnelStep {
|
|
105
|
+
name: string;
|
|
106
|
+
count: number;
|
|
107
|
+
rate: number;
|
|
108
|
+
dropoff: number;
|
|
109
|
+
}
|
|
110
|
+
export interface FunnelReport {
|
|
111
|
+
steps: FunnelStep[];
|
|
112
|
+
total_entrances: number;
|
|
113
|
+
overall_conversion_rate: number;
|
|
114
|
+
}
|
|
115
|
+
/** Valid period values. */
|
|
116
|
+
export declare const VALID_PERIODS: readonly ["today", "yesterday", "7d", "30d", "90d", "12m", "this_week", "wtd", "last_week", "this_month", "mtd", "last_month", "this_quarter", "qtd", "last_quarter", "this_year", "ytd", "last_year"];
|
|
117
|
+
export type Period = (typeof VALID_PERIODS)[number];
|
|
118
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,CAAC,CAAC;IACR,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,8BAA8B;AAC9B,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACxC,SAAS,EAAE,MAAM,CAAC;CACn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Ae,EAAE,MAAM,CAAC;IACxB,uBAAuB,EAAE,MAAM,CAAC;CACjC;AAED,2BAA2B;AAC3B,eAAO,MAAM,aAAa,wMAmBhB,CAAC;AAEX,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Valid period values. */
|
|
2
|
+
export const VALID_PERIODS = [
|
|
3
|
+
"today",
|
|
4
|
+
"yesterday",
|
|
5
|
+
"7d",
|
|
6
|
+
"30d",
|
|
7
|
+
"90d",
|
|
8
|
+
"12m",
|
|
9
|
+
"this_week",
|
|
10
|
+
"wtd",
|
|
11
|
+
"last_week",
|
|
12
|
+
"this_month",
|
|
13
|
+
"mtd",
|
|
14
|
+
"last_month",
|
|
15
|
+
"this_quarter",
|
|
16
|
+
"qtd",
|
|
17
|
+
"last_quarter",
|
|
18
|
+
"this_year",
|
|
19
|
+
"ytd",
|
|
20
|
+
"last_year",
|
|
21
|
+
];
|
|
22
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAgIA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,OAAO;IACP,WAAW;IACX,IAAI;IACJ,KAAK;IACL,KAAK;IACL,KAAK;IACL,WAAW;IACX,KAAK;IACL,WAAW;IACX,YAAY;IACZ,KAAK;IACL,YAAY;IACZ,cAAc;IACd,KAAK;IACL,cAAc;IACd,WAAW;IACX,KAAK;IACL,WAAW;CACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,43 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sealmetrics/mcp",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "SealMetrics MCP
|
|
5
|
-
"
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "SealMetrics analytics MCP server for Claude Code and Claude Desktop",
|
|
5
|
+
"author": "SealMetrics <dev@sealmetrics.com> (https://sealmetrics.com)",
|
|
6
|
+
"homepage": "https://github.com/adinton/sealmetrics2/tree/main/mcp-server#readme",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/adinton/sealmetrics2.git",
|
|
10
|
+
"directory": "mcp-server"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/adinton/sealmetrics2/issues"
|
|
14
|
+
},
|
|
6
15
|
"type": "module",
|
|
7
16
|
"bin": {
|
|
8
|
-
"sealmetrics-mcp": "dist/index.js"
|
|
17
|
+
"sealmetrics-mcp": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=18"
|
|
9
24
|
},
|
|
10
25
|
"scripts": {
|
|
11
26
|
"build": "tsc",
|
|
12
|
-
"dev": "
|
|
13
|
-
"
|
|
14
|
-
"
|
|
27
|
+
"dev": "tsx src/index.ts",
|
|
28
|
+
"test": "vitest run",
|
|
29
|
+
"test:watch": "vitest",
|
|
30
|
+
"prepublishOnly": "npm run build && chmod +x dist/index.js"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
34
|
+
"zod": "^3.25 || ^4.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/node": "^22.0.0",
|
|
38
|
+
"msw": "^2.7.0",
|
|
39
|
+
"tsx": "^4.0.0",
|
|
40
|
+
"typescript": "^5.7.0",
|
|
41
|
+
"vitest": "^3.0.0"
|
|
15
42
|
},
|
|
16
43
|
"keywords": [
|
|
17
44
|
"mcp",
|
|
18
45
|
"sealmetrics",
|
|
19
46
|
"analytics",
|
|
20
47
|
"claude",
|
|
21
|
-
"ai",
|
|
22
48
|
"model-context-protocol"
|
|
23
49
|
],
|
|
24
|
-
"
|
|
25
|
-
"license": "MIT",
|
|
26
|
-
"dependencies": {
|
|
27
|
-
"@modelcontextprotocol/sdk": "^1.0.0"
|
|
28
|
-
},
|
|
29
|
-
"devDependencies": {
|
|
30
|
-
"@types/node": "^20.0.0",
|
|
31
|
-
"typescript": "^5.0.0"
|
|
32
|
-
},
|
|
33
|
-
"engines": {
|
|
34
|
-
"node": ">=18.0.0"
|
|
35
|
-
},
|
|
36
|
-
"files": [
|
|
37
|
-
"dist"
|
|
38
|
-
],
|
|
39
|
-
"repository": {
|
|
40
|
-
"type": "git",
|
|
41
|
-
"url": "https://github.com/sealmetrics/mcp-server"
|
|
42
|
-
}
|
|
50
|
+
"license": "MIT"
|
|
43
51
|
}
|