Add MCP tools for funnels, goals, segments, annotations, and performance metrics

This commit is contained in:
Mike Cao committed 2026-09-09 23:36:55 -07:00
1 parent e0e60cbcb1
commit 97ba22623c
13 files changed
+904 -41

No files matched your search

+19
View File
@@ -15,4 +15,23 @@ describe('MCP dispatch table', () => {
expect(matchDispatchRoute('GET', '/api/admin/users')).toBeNull();
expect(matchDispatchRoute('DELETE', '/api/websites/abc')).toBeNull();
});
test('exposes saved definitions and performance as GET only', () => {
expect(matchDispatchRoute('GET', '/api/websites/abc/funnels/def/stats')?.params).toEqual({
websiteId: 'abc',
funnelId: 'def',
});
expect(matchDispatchRoute('GET', '/api/websites/abc/goals/def/stats')?.params).toEqual({
websiteId: 'abc',
goalId: 'def',
});
for (const path of ['goals', 'funnels', 'segments', 'annotations', 'performance/stats']) {
expect(matchDispatchRoute('GET', `/api/websites/abc/${path}`)).not.toBeNull();
expect(matchDispatchRoute('POST', `/api/websites/abc/${path}`)).toBeNull();
}
expect(matchDispatchRoute('GET', '/api/websites/abc/goals/def')).toBeNull();
expect(matchDispatchRoute('DELETE', '/api/websites/abc/segments/def')).toBeNull();
});
});
+45
View File
@@ -133,6 +133,51 @@ export const MCP_DISPATCH_ROUTES: readonly DispatchRoute[] = [
path: '/api/websites/{websiteId}/funnels/stats',
load: () => import('@/app/api/websites/[websiteId]/funnels/stats/route'),
},
{
method: 'GET',
path: '/api/websites/{websiteId}/funnels',
load: () => import('@/app/api/websites/[websiteId]/funnels/route'),
},
{
method: 'GET',
path: '/api/websites/{websiteId}/funnels/{funnelId}/stats',
load: () => import('@/app/api/websites/[websiteId]/funnels/[funnelId]/stats/route'),
},
{
method: 'GET',
path: '/api/websites/{websiteId}/goals',
load: () => import('@/app/api/websites/[websiteId]/goals/route'),
},
{
method: 'GET',
path: '/api/websites/{websiteId}/goals/{goalId}/stats',
load: () => import('@/app/api/websites/[websiteId]/goals/[goalId]/stats/route'),
},
{
method: 'GET',
path: '/api/websites/{websiteId}/segments',
load: () => import('@/app/api/websites/[websiteId]/segments/route'),
},
{
method: 'GET',
path: '/api/websites/{websiteId}/annotations',
load: () => import('@/app/api/websites/[websiteId]/annotations/route'),
},
{
method: 'GET',
path: '/api/websites/{websiteId}/performance/stats',
load: () => import('@/app/api/websites/[websiteId]/performance/stats/route'),
},
{
method: 'GET',
path: '/api/websites/{websiteId}/performance/chart',
load: () => import('@/app/api/websites/[websiteId]/performance/chart/route'),
},
{
method: 'GET',
path: '/api/websites/{websiteId}/performance/metrics',
load: () => import('@/app/api/websites/[websiteId]/performance/metrics/route'),
},
{
method: 'GET',
path: '/api/websites/{websiteId}/journeys',