@recapt/mcp 0.0.8-beta → 0.0.10-beta

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.
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * HTTP client for calling external-api query endpoints.
3
3
  */
4
- const API_URL = process.env.EXTERNAL_API_URL || "https://api.recapt.app";
4
+ const API_URL = process.env.RECAPT_API_URL ||
5
+ process.env.EXTERNAL_API_URL ||
6
+ "https://api.recapt.app";
5
7
  const SECRET_KEY = process.env.RECAPT_SECRET_KEY;
6
8
  const REQUEST_TIMEOUT_MS = 120_000;
7
9
  export function isApiConfigured() {
package/dist/index.js CHANGED
@@ -48,30 +48,20 @@ function createApiHandler(method, endpoint, buildParams) {
48
48
  }
49
49
  const url = typeof endpoint === "function" ? endpoint(args) : endpoint;
50
50
  const params = buildParams ? buildParams(args) : args;
51
- let result;
52
- switch (method) {
53
- case "GET":
54
- result = await apiGet(url, params);
55
- break;
56
- case "POST":
57
- result = await apiPost(url, params);
58
- break;
59
- case "PATCH":
60
- result = await apiPatch(url, params);
61
- break;
62
- case "DELETE":
63
- result = await apiDelete(url);
64
- break;
65
- }
66
- if (result.error) {
51
+ const apiCall = {
52
+ GET: () => apiGet(url, params),
53
+ POST: () => apiPost(url, params),
54
+ PATCH: () => apiPatch(url, params),
55
+ DELETE: () => apiDelete(url),
56
+ }[method];
57
+ const { data, error } = await apiCall();
58
+ if (error) {
67
59
  return {
68
- content: [
69
- { type: "text", text: JSON.stringify({ error: result.error }) },
70
- ],
60
+ content: [{ type: "text", text: JSON.stringify({ error }) }],
71
61
  isError: true,
72
62
  };
73
63
  }
74
- return { content: [{ type: "text", text: JSON.stringify(result.data) }] };
64
+ return { content: [{ type: "text", text: JSON.stringify(data) }] };
75
65
  };
76
66
  }
77
67
  function registerHiddenTools() {
@@ -132,20 +122,12 @@ function registerHiddenTools() {
132
122
  isError: true,
133
123
  };
134
124
  }
135
- if (session_id && !session_ids) {
136
- const { data, error } = await apiGet(`/sessions/${session_id}`);
137
- if (error) {
138
- return {
139
- content: [{ type: "text", text: JSON.stringify({ error }) }],
140
- isError: true,
141
- };
142
- }
143
- return { content: [{ type: "text", text: JSON.stringify(data) }] };
144
- }
145
- const ids = session_ids ?? [session_id];
146
- const { data, error } = await apiPost("/sessions/details", {
147
- session_ids: ids,
148
- });
125
+ const isSingleSession = session_id && !session_ids;
126
+ const { data, error } = isSingleSession
127
+ ? await apiGet(`/sessions/${session_id}`)
128
+ : await apiPost("/sessions/details", {
129
+ session_ids: session_ids ?? [session_id],
130
+ });
149
131
  if (error) {
150
132
  return {
151
133
  content: [{ type: "text", text: JSON.stringify({ error }) }],
@@ -209,10 +191,19 @@ call_tool({ tool_name: "analyze_flow", arguments: { start_page: "/pricing", end_
209
191
 
210
192
  These tools are always visible (no search needed):
211
193
  - **get_domains** — List tracked domains (good starting point)
212
- - **run_full_diagnostic** — Comprehensive site analysis with prioritized issues
194
+ - **run_full_diagnostic** — Quick site health overview (lightweight, fast)
213
195
  - **triage_sessions** — Find sessions needing attention
214
196
  - **memory_*** — Store/retrieve intermediate results
215
197
 
198
+ ## Comprehensive Site Analysis
199
+
200
+ For a full site analysis, run these tools in sequence:
201
+ 1. **run_full_diagnostic** — Get health score, issues, problem pages
202
+ 2. **detect_regressions** — Check for recent behavioral regressions (separate call)
203
+ 3. **get_ux_health_report** — Detailed per-page breakdown if needed
204
+
205
+ This split approach is faster and more reliable than a single heavy query.
206
+
216
207
  ## Metric Interpretation
217
208
 
218
209
  All behavioral scores are 0-1 where higher = more of that signal:
@@ -231,6 +222,14 @@ All behavioral scores are 0-1 where higher = more of that signal:
231
222
  - High frustration + low confusion = users know what to do but can't (broken UI)
232
223
  - Use \`memory_save\` to store intermediate results when doing multi-step analysis
233
224
 
225
+ ## Tool Limits
226
+
227
+ Some tools have built-in limits for performance:
228
+ - **detect_regressions**: Default 50 pages per call, 200 snapshots per page. Use \`offset\` and \`limit\` to paginate. Use \`sort_by='low_traffic'\` to check overlooked pages.
229
+ - **discover_personas**: Max 8 personas
230
+ - **list_pages**: Default 50 pages, configurable
231
+ - **get_session_details**: Max 20 sessions per batch
232
+
234
233
  ## Installable Skills
235
234
 
236
235
  For guided workflows (self-healing, deep-dive analysis, regression hunting), install recapt skills:
@@ -6484,400 +6484,415 @@
6484
6484
  },
6485
6485
  {
6486
6486
  "name": "detect_regressions",
6487
- "description": "Detect behavioral regressions by comparing recent data against rolling 7-day baselines. Returns pages where frustration, confusion, or rage click rate have deviated significantly.",
6487
+ "description": "Detect behavioral regressions by comparing recent data against rolling 7-day baselines. By default analyzes top 50 pages by traffic. Use sort_by='low_traffic' to check low-traffic pages that might otherwise be missed. Use offset/limit to paginate through all pages. Returns pages where frustration, confusion, or rage click rate have deviated significantly.",
6488
6488
  "category": "monitoring",
6489
6489
  "parameters": {
6490
6490
  "window_hours": {
6491
6491
  "type": "number",
6492
6492
  "required": false,
6493
6493
  "description": "How many recent hours to compare against baseline (default 24)"
6494
+ },
6495
+ "limit": {
6496
+ "type": "number",
6497
+ "required": false,
6498
+ "description": "Number of pages to check per request (default 50, max 100)"
6499
+ },
6500
+ "offset": {
6501
+ "type": "number",
6502
+ "required": false,
6503
+ "description": "Skip this many pages for pagination (default 0)"
6504
+ },
6505
+ "sort_by": {
6506
+ "type": "string",
6507
+ "required": false,
6508
+ "description": "Sort order: 'traffic' (default, high-traffic first) or 'low_traffic' (check overlooked pages)"
6494
6509
  }
6495
6510
  },
6496
6511
  "embedding": [
6497
- 0.000011,
6498
- -0.084606,
6499
- 0.001591,
6500
- 0.078133,
6501
- 0.091491,
6502
- 0.003382,
6503
- -0.03171,
6504
- -0.030145,
6505
- -0.040675,
6506
- -0.019577,
6507
- 0.002829,
6508
- 0.010849,
6509
- 0.010026,
6510
- 0.056925,
6511
- -0.020273,
6512
- 0.007328,
6513
- 0.002924,
6514
- -0.004754,
6515
- 0.025738,
6516
- -0.023942,
6517
- -0.018301,
6518
- 0.001583,
6519
- -0.015177,
6520
- 0.022537,
6521
- -0.025155,
6522
- 0.065546,
6523
- -0.056236,
6524
- -0.040427,
6525
- -0.031485,
6526
- -0.019129,
6527
- -0.008007,
6528
- 0.051389,
6529
- 0.041649,
6530
- 0.01401,
6531
- -0.00668,
6532
- -0.083701,
6533
- 0.008091,
6534
- -0.014093,
6535
- 0.053841,
6536
- -0.011324,
6537
- -0.052931,
6538
- -0.105487,
6539
- 0.050694,
6540
- -0.001094,
6541
- 0.004072,
6542
- -0.027514,
6543
- -0.038166,
6544
- 0.013453,
6545
- -0.084733,
6546
- 0.016732,
6547
- -0.037371,
6548
- -0.084957,
6549
- 0.074391,
6550
- -0.055364,
6551
- -0.018399,
6552
- -0.039906,
6553
- 0.044713,
6554
- 0.004805,
6555
- 0.035781,
6556
- 0.066356,
6557
- 0.003914,
6558
- -0.032175,
6559
- -0.062067,
6560
- 0.063061,
6561
- -0.045265,
6562
- 0.128767,
6563
- -0.048591,
6564
- -0.035052,
6565
- 0.020813,
6566
- 0.021567,
6567
- -0.055207,
6568
- -0.002772,
6569
- -0.011765,
6570
- -0.015748,
6571
- 0.089807,
6572
- -0.07693,
6573
- -0.008157,
6574
- 0.003664,
6575
- 0.067731,
6576
- -0.113338,
6577
- -0.067135,
6578
- 0.016385,
6579
- 0.001775,
6580
- -0.011202,
6581
- 0.076363,
6582
- -0.016472,
6583
- 0.023474,
6584
- 0.045758,
6585
- -0.091523,
6586
- 0.060628,
6587
- 0.047019,
6588
- -0.036401,
6589
- -0.028421,
6590
- 0.019263,
6591
- -0.075914,
6592
- 0.01695,
6593
- -0.088695,
6594
- -0.036792,
6595
- 0.024585,
6596
- 0.05091,
6597
- -0.042816,
6598
- 0.070805,
6599
- -0.019256,
6600
- 0.034998,
6601
- 0.013947,
6602
- -0.000311,
6603
- 0.034003,
6604
- -0.015612,
6605
- -0.049331,
6606
- 0.005741,
6607
- -0.103982,
6608
- 0.039591,
6609
- 0.040582,
6610
- -0.020481,
6611
- 0.031166,
6612
- -0.061541,
6613
- -0.06415,
6614
- -0.006132,
6615
- 0.085319,
6616
- 0.008508,
6617
- 0.166461,
6618
- 0.00143,
6619
- 0.039644,
6620
- -0.008834,
6621
- 0.050216,
6622
- 0.112576,
6623
- -0.161324,
6512
+ 0.029739,
6513
+ -0.037854,
6514
+ -0.007498,
6515
+ 0.050917,
6516
+ 0.06084,
6517
+ -0.016029,
6518
+ -0.019992,
6519
+ -0.006213,
6520
+ -0.077974,
6521
+ 0.024877,
6522
+ -0.026286,
6523
+ 0.046091,
6524
+ 0.001876,
6525
+ 0.025006,
6526
+ -0.055402,
6527
+ 0.024394,
6528
+ -0.00967,
6529
+ 0.015183,
6530
+ 0.048272,
6531
+ -0.074896,
6532
+ -0.005384,
6533
+ 0.062265,
6534
+ -0.00324,
6535
+ 0.022973,
6536
+ -0.040664,
6537
+ 0.067751,
6538
+ -0.073004,
6539
+ -0.03681,
6540
+ 0.002883,
6541
+ -0.022037,
6542
+ -0.004448,
6543
+ 0.055557,
6544
+ -0.029818,
6545
+ 0.06324,
6546
+ -0.015527,
6547
+ -0.091029,
6548
+ -0.025808,
6549
+ -0.090558,
6550
+ 0.0871,
6551
+ 0.002504,
6552
+ 0.003779,
6553
+ -0.063624,
6554
+ 0.006187,
6555
+ 0.006841,
6556
+ -0.002103,
6557
+ -0.044959,
6558
+ -0.061788,
6559
+ 0.01194,
6560
+ -0.003896,
6561
+ -0.052659,
6562
+ -0.038156,
6563
+ -0.020247,
6564
+ 0.052098,
6565
+ -0.035897,
6566
+ -0.035624,
6567
+ -0.064473,
6568
+ 0.012612,
6569
+ -0.059332,
6570
+ -0.000848,
6571
+ 0.008588,
6572
+ 0.004709,
6573
+ -0.043208,
6574
+ -0.010858,
6575
+ 0.021742,
6576
+ -0.100977,
6577
+ 0.088991,
6578
+ -0.01991,
6579
+ 0.043597,
6580
+ 0.055709,
6581
+ 0.099795,
6582
+ -0.035567,
6583
+ 0.023794,
6584
+ -0.040071,
6585
+ -0.013235,
6586
+ 0.077832,
6587
+ -0.130459,
6588
+ 0.007821,
6589
+ -0.052328,
6590
+ -0.003133,
6591
+ -0.100751,
6592
+ -0.096811,
6593
+ -0.064354,
6594
+ -0.008996,
6595
+ 0.022161,
6596
+ 0.06765,
6597
+ -0.028383,
6598
+ 0.044112,
6599
+ 0.021452,
6600
+ -0.078971,
6601
+ 0.032096,
6602
+ 0.03627,
6603
+ 0.011746,
6604
+ -0.027071,
6605
+ 0.033822,
6606
+ -0.048214,
6607
+ 0.028052,
6608
+ -0.054125,
6609
+ -0.059643,
6610
+ 0.035839,
6611
+ 0.082955,
6612
+ -0.036822,
6613
+ 0.066503,
6614
+ 0.01187,
6615
+ 0.006232,
6616
+ -0.009584,
6617
+ 0.01431,
6618
+ 0.094968,
6619
+ -0.016097,
6620
+ -0.088064,
6621
+ 0.054678,
6622
+ -0.065112,
6623
+ 0.046471,
6624
+ 0.033751,
6625
+ -0.026071,
6626
+ 0.014287,
6627
+ -0.04657,
6628
+ -0.013398,
6629
+ -0.043076,
6630
+ -0.003179,
6631
+ 0.026761,
6632
+ 0.137574,
6633
+ 0.024168,
6634
+ 0.005613,
6635
+ 0.036922,
6636
+ 0.055716,
6637
+ 0.140864,
6638
+ -0.111314,
6624
6639
  0,
6625
- 0.041207,
6626
- 0.031339,
6627
- -0.029592,
6628
- -0.041209,
6629
- -0.059992,
6630
- 0.009539,
6631
- -0.052576,
6632
- -0.000639,
6633
- 0.069108,
6634
- 0.045734,
6635
- -0.055957,
6636
- 0.06485,
6637
- -0.052147,
6638
- 0.077693,
6639
- 0.042915,
6640
- 0.033694,
6641
- -0.016117,
6642
- 0.099307,
6643
- -0.054162,
6644
- 0.010393,
6645
- 0.013537,
6646
- -0.06288,
6647
- -0.023222,
6648
- -0.000762,
6649
- -0.045244,
6650
- 0.020773,
6651
- -0.040263,
6652
- 0.034897,
6653
- -0.057078,
6654
- 0.020128,
6655
- 0.001984,
6656
- 0.003468,
6657
- -0.067339,
6658
- -0.010592,
6659
- 0.019514,
6660
- 0.046394,
6661
- 0.037474,
6662
- 0.00658,
6663
- -0.026385,
6664
- -0.020456,
6665
- -0.019172,
6666
- -0.00229,
6667
- -0.013537,
6668
- -0.011342,
6669
- -0.040101,
6670
- 0.056954,
6671
- -0.015175,
6672
- -0.077402,
6673
- 0.011002,
6674
- 0.056746,
6675
- 0.016636,
6676
- 0.024669,
6677
- 0.054436,
6678
- 0.006026,
6679
- -0.075588,
6680
- 0.061711,
6681
- -0.039959,
6682
- -0.072256,
6683
- -0.0068,
6684
- -0.022149,
6685
- 0.055915,
6686
- -0.103902,
6687
- 0.047846,
6688
- -0.203337,
6689
- -0.025649,
6690
- 0.06845,
6691
- 0.019189,
6692
- 0.013701,
6693
- 0.000082,
6694
- 0.070318,
6695
- 0.046845,
6696
- 0.075055,
6697
- -0.020022,
6698
- -0.107917,
6699
- 0.053563,
6700
- -0.059377,
6701
- 0.034091,
6702
- -0.044758,
6703
- 0.004994,
6704
- -0.094046,
6705
- 0.119542,
6706
- -0.102817,
6707
- -0.020345,
6708
- -0.07705,
6709
- 0.000667,
6710
- -0.029178,
6711
- 0.013994,
6712
- -0.06415,
6713
- -0.10744,
6714
- 0.04325,
6715
- -0.078293,
6716
- -0.000961,
6717
- -0.031229,
6718
- 0.091067,
6719
- -0.014786,
6640
+ 0.041824,
6641
+ 0.019412,
6642
+ -0.033757,
6643
+ -0.080961,
6644
+ -0.062727,
6645
+ 0.075514,
6646
+ -0.012199,
6647
+ 0.004653,
6648
+ 0.051502,
6649
+ 0.027879,
6650
+ -0.047042,
6651
+ 0.063608,
6652
+ -0.060384,
6653
+ 0.077243,
6654
+ 0.042728,
6655
+ 0.02025,
6656
+ -0.000889,
6657
+ 0.074956,
6658
+ -0.015263,
6659
+ 0.022017,
6660
+ 0.026597,
6661
+ -0.072091,
6662
+ -0.068947,
6663
+ 0.002572,
6664
+ 0.017823,
6665
+ 0.028407,
6666
+ -0.062443,
6667
+ 0.042962,
6668
+ -0.034435,
6669
+ 0.013257,
6670
+ 0.001228,
6671
+ 0.017691,
6672
+ -0.036305,
6673
+ 0.009104,
6674
+ 0.011312,
6675
+ 0.016391,
6676
+ -0.032245,
6677
+ 0.036844,
6678
+ -0.030212,
6679
+ -0.019025,
6680
+ -0.062218,
6681
+ 0.01787,
6682
+ -0.035959,
6683
+ -0.07145,
6684
+ -0.082602,
6685
+ 0.058847,
6686
+ -0.032067,
6687
+ -0.002645,
6688
+ 0.034337,
6689
+ 0.072578,
6690
+ 0.013094,
6691
+ -0.04352,
6692
+ 0.007624,
6693
+ 0.065604,
6694
+ -0.094586,
6695
+ -0.015157,
6696
+ -0.043702,
6697
+ -0.036224,
6698
+ 0.040929,
6699
+ -0.011489,
6700
+ 0.063186,
6701
+ -0.130861,
6702
+ 0.040064,
6703
+ -0.152796,
6704
+ 0.003327,
6705
+ 0.024565,
6706
+ 0.020197,
6707
+ 0.090647,
6708
+ 0.005792,
6709
+ 0.072089,
6710
+ 0.016977,
6711
+ 0.062858,
6712
+ 0.040581,
6713
+ -0.046475,
6714
+ 0.075046,
6715
+ -0.048003,
6716
+ 0.005048,
6717
+ -0.043309,
6718
+ 0.007499,
6719
+ -0.045662,
6720
+ 0.107233,
6721
+ -0.080935,
6722
+ 0.018719,
6723
+ -0.112389,
6724
+ -0.032005,
6725
+ -0.02721,
6726
+ 0.034682,
6727
+ -0.003679,
6728
+ -0.090258,
6729
+ -0.003373,
6730
+ -0.111179,
6731
+ 0.022778,
6732
+ -0.015117,
6733
+ 0.034344,
6734
+ -0.038471,
6720
6735
  0,
6721
- -0.036133,
6722
- 0.038392,
6723
- 0.038619,
6724
- 0.090789,
6725
- -0.08728,
6726
- 0.02369,
6727
- 0.059473,
6728
- 0.04821,
6729
- -0.009456,
6730
- -0.003994,
6731
- 0.061806,
6732
- -0.037924,
6733
- -0.006271,
6734
- 0.072305,
6735
- 0.050815,
6736
- 0.026702,
6737
- 0.001673,
6738
- -0.05819,
6739
- 0.019152,
6740
- 0.036359,
6741
- -0.032496,
6742
- 0.051887,
6743
- -0.037092,
6744
- -0.053097,
6745
- -0.02636,
6746
- -0.009707,
6747
- -0.017974,
6748
- 0.016462,
6749
- 0.000993,
6750
- -0.026924,
6751
- 0.013095,
6752
- 0.079399,
6753
- -0.059147,
6754
- 0.031969,
6755
- 0.027656,
6756
- 0.037213,
6757
- -0.05038,
6758
- -0.031062,
6759
- -0.045464,
6760
- -0.00484,
6761
- 0.055861,
6762
- 0.066009,
6763
- -0.051092,
6764
- -0.033393,
6765
- 0.001737,
6766
- 0.105645,
6767
- 0.018786,
6768
- 0.044871,
6769
- -0.040624,
6770
- -0.007657,
6771
- -0.020113,
6772
- 0.048647,
6773
- -0.012597,
6774
- -0.004991,
6775
- -0.05409,
6776
- -0.019942,
6777
- -0.033143,
6778
- -0.079024,
6779
- -0.13515,
6780
- -0.003692,
6781
- -0.034318,
6782
- 0.052774,
6783
- -0.103217,
6784
- 0.033086,
6785
- 0.024527,
6786
- -0.057731,
6787
- 0.036294,
6788
- -0.029131,
6789
- 0.020744,
6790
- 0.036442,
6791
- 0.003712,
6792
- -0.017951,
6793
- -0.009231,
6794
- -0.045027,
6795
- -0.019593,
6796
- 0.004364,
6797
- -0.039851,
6798
- -0.036465,
6799
- -0.070976,
6800
- 0.007695,
6801
- -0.005989,
6802
- -0.031751,
6803
- 0.081286,
6804
- -0.01977,
6805
- -0.117024,
6806
- 0.065602,
6807
- -0.008891,
6808
- 0.059404,
6809
- 0.023798,
6810
- -0.010117,
6811
- -0.001963,
6812
- 0.044821,
6813
- -0.106961,
6814
- -0.002225,
6815
- 0.038506,
6736
+ -0.018613,
6737
+ 0.060067,
6738
+ 0.076554,
6739
+ 0.091139,
6740
+ -0.063117,
6741
+ 0.002999,
6742
+ 0.067232,
6743
+ 0.029988,
6744
+ 0.023469,
6745
+ 0.009471,
6746
+ 0.068124,
6747
+ -0.042212,
6748
+ 0.033127,
6749
+ 0.040537,
6750
+ 0.062643,
6751
+ 0.028672,
6752
+ 0.017383,
6753
+ -0.126003,
6754
+ 0.023249,
6755
+ 0.039692,
6756
+ -0.080872,
6757
+ 0.068036,
6758
+ -0.020448,
6759
+ -0.1032,
6760
+ -0.057613,
6761
+ -0.018752,
6762
+ -0.022018,
6763
+ 0.041261,
6764
+ -0.019029,
6765
+ -0.036425,
6766
+ 0.012815,
6767
+ 0.066957,
6768
+ -0.044481,
6769
+ 0.007088,
6770
+ 0.004556,
6771
+ 0.091268,
6772
+ -0.034935,
6773
+ -0.008851,
6774
+ -0.017086,
6775
+ 0.004428,
6776
+ 0.067171,
6777
+ 0.091273,
6778
+ -0.033939,
6779
+ -0.035174,
6780
+ -0.033943,
6781
+ 0.092928,
6782
+ -0.011711,
6783
+ 0.036215,
6784
+ -0.047752,
6785
+ -0.03928,
6786
+ -0.033228,
6787
+ 0.040336,
6788
+ 0.030886,
6789
+ 0.008587,
6790
+ -0.050917,
6791
+ 0.017539,
6792
+ -0.031221,
6793
+ -0.034651,
6794
+ -0.135003,
6795
+ -0.010527,
6796
+ -0.013776,
6797
+ 0.064495,
6798
+ -0.118187,
6799
+ 0.043506,
6800
+ 0.016505,
6801
+ -0.057416,
6802
+ 0.005695,
6803
+ -0.051382,
6804
+ 0.014019,
6805
+ 0.031513,
6806
+ -0.039971,
6807
+ 0.051711,
6808
+ 0.033309,
6809
+ -0.005771,
6810
+ -0.034043,
6811
+ -0.007335,
6812
+ -0.060966,
6813
+ -0.008036,
6814
+ 0.000716,
6815
+ 0.015842,
6816
+ -0.003319,
6817
+ 0.022808,
6818
+ 0.038986,
6819
+ -0.061263,
6820
+ -0.092411,
6821
+ 0.072051,
6822
+ -0.066806,
6823
+ 0.018686,
6824
+ 0.021136,
6825
+ -0.022717,
6826
+ -0.035412,
6827
+ 0.013526,
6828
+ -0.095462,
6829
+ 0.008459,
6830
+ 0.025815,
6816
6831
  0,
6817
- -0.03337,
6818
- -0.033004,
6819
- 0.083005,
6820
- 0.021407,
6821
- 0.012878,
6822
- 0.054637,
6823
- 0.070143,
6824
- 0.070999,
6825
- -0.079972,
6826
- -0.046404,
6827
- 0.074651,
6828
- -0.012591,
6829
- 0.004531,
6830
- 0.007187,
6831
- -0.013604,
6832
- 0.000272,
6833
- -0.020952,
6834
- 0.078295,
6835
- -0.021379,
6836
- 0.019214,
6837
- 0.035589,
6838
- 0.06693,
6839
- 0.04398,
6840
- -0.06156,
6841
- -0.016194,
6842
- -0.017498,
6843
- -0.075011,
6844
- 0.11856,
6845
- 0.034839,
6846
- -0.023829,
6847
- 0.0978,
6848
- 0.0626,
6849
- -0.039829,
6850
- -0.111578,
6851
- 0.076659,
6852
- 0.057937,
6853
- 0.034415,
6854
- -0.024282,
6855
- 0.044927,
6856
- 0.054342,
6857
- -0.034757,
6858
- 0.013514,
6859
- -0.04463,
6860
- -0.00035,
6861
- -0.019053,
6862
- -0.010321,
6863
- 0.061773,
6864
- -0.085876,
6865
- 0.059112,
6866
- -0.024498,
6867
- 0.073528,
6868
- 0.006073,
6869
- -0.024021,
6870
- 0.080467,
6871
- 0.00316,
6872
- -0.020915,
6873
- -0.022035,
6874
- 0.047111,
6875
- -0.029479,
6876
- 0.034648,
6877
- 0.074681,
6878
- -0.023871,
6879
- -0.003548,
6880
- -0.005969
6832
+ -0.011153,
6833
+ -0.04058,
6834
+ 0.121199,
6835
+ 0.058841,
6836
+ 0.015953,
6837
+ 0.016097,
6838
+ 0.078313,
6839
+ 0.107461,
6840
+ -0.086684,
6841
+ -0.017774,
6842
+ 0.072035,
6843
+ -0.011303,
6844
+ -0.025372,
6845
+ 0.01933,
6846
+ 0.038669,
6847
+ -0.037395,
6848
+ -0.003818,
6849
+ 0.020909,
6850
+ -0.066188,
6851
+ -0.00551,
6852
+ -0.01575,
6853
+ 0.038126,
6854
+ 0.04159,
6855
+ -0.044173,
6856
+ 0.032946,
6857
+ 0.001453,
6858
+ -0.03071,
6859
+ 0.082091,
6860
+ 0.030543,
6861
+ -0.071939,
6862
+ 0.103283,
6863
+ 0.036915,
6864
+ -0.070866,
6865
+ -0.097545,
6866
+ 0.078654,
6867
+ 0.094637,
6868
+ -0.013259,
6869
+ 0.00627,
6870
+ -0.00367,
6871
+ 0.021725,
6872
+ -0.057931,
6873
+ 0.004171,
6874
+ -0.00183,
6875
+ -0.001362,
6876
+ 0.021022,
6877
+ -0.027248,
6878
+ -0.004775,
6879
+ -0.07134,
6880
+ 0.099328,
6881
+ -0.054879,
6882
+ 0.068009,
6883
+ -0.044679,
6884
+ -0.009519,
6885
+ 0.077423,
6886
+ -0.005144,
6887
+ -0.029991,
6888
+ 0.004407,
6889
+ 0.062962,
6890
+ -0.040132,
6891
+ 0.010847,
6892
+ 0.045873,
6893
+ -0.042232,
6894
+ -0.018729,
6895
+ 0.018884
6881
6896
  ]
6882
6897
  },
6883
6898
  {
@@ -8,19 +8,33 @@ import { apiGet, isApiConfigured } from "../api/client.js";
8
8
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
9
  export function registerDetectRegressions(server) {
10
10
  server.registerTool("detect_regressions", {
11
- description: "Detect behavioral regressions by comparing recent data (last 24h by default) against " +
12
- "rolling 7-day baselines. Returns pages where frustration, confusion, or rage click rate " +
13
- "have deviated significantly from normal levels, with z-scores indicating severity. " +
14
- "Critical (z>3) means an extreme deviation, high (z>2) is notable, medium (z>1.5) is worth monitoring. " +
15
- "Use this to catch deployments or changes that degraded user experience.",
11
+ description: "Detect behavioral regressions by comparing recent data against rolling 7-day baselines. " +
12
+ "By default analyzes top 50 pages by traffic. Use sort_by='low_traffic' to check low-traffic " +
13
+ "pages that might otherwise be missed. Use offset/limit to paginate through all pages. " +
14
+ "Returns pages where frustration, confusion, or rage click rate have deviated significantly.",
16
15
  inputSchema: z.object({
17
16
  window_hours: z
18
17
  .number()
19
18
  .optional()
20
19
  .default(24)
21
20
  .describe("How many recent hours to compare against baseline (default 24)"),
21
+ limit: z
22
+ .number()
23
+ .optional()
24
+ .default(50)
25
+ .describe("Number of pages to check per request (default 50, max 100)"),
26
+ offset: z
27
+ .number()
28
+ .optional()
29
+ .default(0)
30
+ .describe("Skip this many pages for pagination (default 0)"),
31
+ sort_by: z
32
+ .enum(["traffic", "low_traffic"])
33
+ .optional()
34
+ .default("traffic")
35
+ .describe("Sort order: 'traffic' (default) or 'low_traffic' to check overlooked pages"),
22
36
  }),
23
- }, async ({ window_hours }) => {
37
+ }, async ({ window_hours, limit, offset, sort_by, }) => {
24
38
  if (!isApiConfigured()) {
25
39
  return {
26
40
  content: [
@@ -34,6 +48,9 @@ export function registerDetectRegressions(server) {
34
48
  }
35
49
  const { data, error } = await apiGet("/regressions", {
36
50
  window_hours: window_hours ?? 24,
51
+ limit: limit ?? 50,
52
+ offset: offset ?? 0,
53
+ sort_by: sort_by ?? "traffic",
37
54
  });
38
55
  if (error) {
39
56
  return {
@@ -8,7 +8,10 @@ import { apiGet, apiPost, isApiConfigured } from "../api/client.js";
8
8
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
9
  export function registerDiagnosticTools(server) {
10
10
  server.registerTool("run_full_diagnostic", {
11
- description: "Run a comprehensive site diagnostic. Returns prioritized issues, problem pages, regressions, and recommended investigation order. Use this as the first step in a self-healing workflow.",
11
+ description: "Get a quick site health overview with prioritized issues and problem pages. " +
12
+ "This is a lightweight entry point — it does NOT include regression detection. " +
13
+ "For a complete analysis, call detect_regressions separately after this. " +
14
+ "Returns: health score, top issues, pages needing attention, and investigation order.",
12
15
  inputSchema: z.object({
13
16
  days: z
14
17
  .number()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@recapt/mcp",
3
- "version": "0.0.8-beta",
3
+ "version": "0.0.10-beta",
4
4
  "description": "MCP exposing recapt behavioral intelligence to AI coding agents",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Recapt Skills CLI
4
- *
5
- * Installs recapt workflow skills to .agents/recapt/ and manages AGENTS.md references.
6
- * Works across all AI IDEs that support the AGENTS.md standard.
7
- *
8
- * Usage:
9
- * npx @recapt/mcp skill list
10
- * npx @recapt/mcp skill install self-healing
11
- * npx @recapt/mcp skill install --all
12
- * npx @recapt/mcp skill uninstall self-healing
13
- */
14
- export {};
package/dist/cli/skill.js DELETED
@@ -1,249 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Recapt Skills CLI
4
- *
5
- * Installs recapt workflow skills to .agents/recapt/ and manages AGENTS.md references.
6
- * Works across all AI IDEs that support the AGENTS.md standard.
7
- *
8
- * Usage:
9
- * npx @recapt/mcp skill list
10
- * npx @recapt/mcp skill install self-healing
11
- * npx @recapt/mcp skill install --all
12
- * npx @recapt/mcp skill uninstall self-healing
13
- */
14
- import fs from "fs";
15
- import path from "path";
16
- import { fileURLToPath } from "url";
17
- const __filename = fileURLToPath(import.meta.url);
18
- const __dirname = path.dirname(__filename);
19
- const SKILLS_DIR = path.resolve(__dirname, "../../skills");
20
- const AGENTS_DIR = ".agents/recapt";
21
- const AGENTS_MD = "AGENTS.md";
22
- const MARKER_START = "<!-- recapt:skills -->";
23
- const MARKER_END = "<!-- /recapt:skills -->";
24
- function getAvailableSkills() {
25
- if (!fs.existsSync(SKILLS_DIR)) {
26
- console.error(`Skills directory not found: ${SKILLS_DIR}`);
27
- process.exit(1);
28
- }
29
- const files = fs.readdirSync(SKILLS_DIR).filter((f) => f.endsWith(".md"));
30
- return files.map((file) => {
31
- const content = fs.readFileSync(path.join(SKILLS_DIR, file), "utf-8");
32
- const firstLine = content.split("\n")[0];
33
- const description = firstLine.startsWith("# ")
34
- ? firstLine.slice(2).trim()
35
- : file.replace(".md", "");
36
- return {
37
- name: file.replace(".md", ""),
38
- file,
39
- description,
40
- };
41
- });
42
- }
43
- function getInstalledSkills(cwd) {
44
- const agentsDir = path.join(cwd, AGENTS_DIR);
45
- if (!fs.existsSync(agentsDir)) {
46
- return [];
47
- }
48
- return fs
49
- .readdirSync(agentsDir)
50
- .filter((f) => f.endsWith(".md"))
51
- .map((f) => f.replace(".md", ""));
52
- }
53
- function ensureAgentsDir(cwd) {
54
- const agentsDir = path.join(cwd, AGENTS_DIR);
55
- if (!fs.existsSync(agentsDir)) {
56
- fs.mkdirSync(agentsDir, { recursive: true });
57
- console.log(`Created ${AGENTS_DIR}/`);
58
- }
59
- }
60
- function readAgentsMd(cwd) {
61
- const agentsMdPath = path.join(cwd, AGENTS_MD);
62
- if (!fs.existsSync(agentsMdPath)) {
63
- return "";
64
- }
65
- return fs.readFileSync(agentsMdPath, "utf-8");
66
- }
67
- function writeAgentsMd(cwd, content) {
68
- const agentsMdPath = path.join(cwd, AGENTS_MD);
69
- fs.writeFileSync(agentsMdPath, content);
70
- }
71
- function getSkillDisplayName(skillName) {
72
- const skills = getAvailableSkills();
73
- const skill = skills.find((s) => s.name === skillName);
74
- return skill?.description ?? skillName;
75
- }
76
- function updateAgentsMdReferences(cwd) {
77
- const installed = getInstalledSkills(cwd);
78
- let content = readAgentsMd(cwd);
79
- if (installed.length === 0) {
80
- if (content.includes(MARKER_START)) {
81
- const regex = new RegExp(`\\n?${MARKER_START}[\\s\\S]*?${MARKER_END}\\n?`, "g");
82
- content = content.replace(regex, "").trim();
83
- if (content) {
84
- writeAgentsMd(cwd, content + "\n");
85
- }
86
- else {
87
- const agentsMdPath = path.join(cwd, AGENTS_MD);
88
- if (fs.existsSync(agentsMdPath)) {
89
- fs.unlinkSync(agentsMdPath);
90
- console.log(`Removed empty ${AGENTS_MD}`);
91
- }
92
- }
93
- }
94
- return;
95
- }
96
- const skillLinks = installed
97
- .map((name) => `- [${getSkillDisplayName(name)}](${AGENTS_DIR}/${name}.md)`)
98
- .join("\n");
99
- const newBlock = `${MARKER_START}
100
- For recapt behavioral intelligence workflows, see:
101
- ${skillLinks}
102
- ${MARKER_END}`;
103
- if (content.includes(MARKER_START)) {
104
- const regex = new RegExp(`${MARKER_START}[\\s\\S]*?${MARKER_END}`, "g");
105
- content = content.replace(regex, newBlock);
106
- }
107
- else {
108
- if (content.trim()) {
109
- content = content.trim() + "\n\n" + newBlock;
110
- }
111
- else {
112
- content = `# Project Agent Instructions\n\n${newBlock}`;
113
- }
114
- }
115
- writeAgentsMd(cwd, content + "\n");
116
- }
117
- function installSkill(cwd, skillName) {
118
- const skills = getAvailableSkills();
119
- const skill = skills.find((s) => s.name === skillName);
120
- if (!skill) {
121
- console.error(`Unknown skill: ${skillName}`);
122
- console.error(`Available skills: ${skills.map((s) => s.name).join(", ")}`);
123
- return false;
124
- }
125
- ensureAgentsDir(cwd);
126
- const sourcePath = path.join(SKILLS_DIR, skill.file);
127
- const destPath = path.join(cwd, AGENTS_DIR, skill.file);
128
- if (fs.existsSync(destPath)) {
129
- console.log(`Skill already installed: ${skillName}`);
130
- return true;
131
- }
132
- fs.copyFileSync(sourcePath, destPath);
133
- console.log(`Installed: ${skillName} → ${AGENTS_DIR}/${skill.file}`);
134
- updateAgentsMdReferences(cwd);
135
- return true;
136
- }
137
- function uninstallSkill(cwd, skillName) {
138
- const skillPath = path.join(cwd, AGENTS_DIR, `${skillName}.md`);
139
- if (!fs.existsSync(skillPath)) {
140
- console.error(`Skill not installed: ${skillName}`);
141
- return false;
142
- }
143
- fs.unlinkSync(skillPath);
144
- console.log(`Uninstalled: ${skillName}`);
145
- updateAgentsMdReferences(cwd);
146
- const agentsDir = path.join(cwd, AGENTS_DIR);
147
- const remaining = fs.readdirSync(agentsDir);
148
- if (remaining.length === 0) {
149
- fs.rmdirSync(agentsDir);
150
- const parentDir = path.dirname(agentsDir);
151
- if (fs.existsSync(parentDir) &&
152
- fs.readdirSync(parentDir).length === 0) {
153
- fs.rmdirSync(parentDir);
154
- }
155
- console.log(`Removed empty ${AGENTS_DIR}/`);
156
- }
157
- return true;
158
- }
159
- function listSkills(cwd) {
160
- const available = getAvailableSkills();
161
- const installed = new Set(getInstalledSkills(cwd));
162
- console.log("\nAvailable recapt skills:\n");
163
- for (const skill of available) {
164
- const status = installed.has(skill.name) ? "[installed]" : "";
165
- console.log(` ${skill.name.padEnd(20)} ${skill.description} ${status}`);
166
- }
167
- console.log("\nUsage:");
168
- console.log(" npx @recapt/mcp skill install <name>");
169
- console.log(" npx @recapt/mcp skill install --all");
170
- console.log(" npx @recapt/mcp skill uninstall <name>\n");
171
- }
172
- function printHelp() {
173
- console.log(`
174
- Recapt Skills CLI
175
-
176
- Installs workflow skills to .agents/recapt/ for use with any AI IDE.
177
-
178
- Commands:
179
- list Show available skills
180
- install <name> Install a skill
181
- install --all Install all skills
182
- uninstall <name> Remove a skill
183
-
184
- Examples:
185
- npx @recapt/mcp skill list
186
- npx @recapt/mcp skill install self-healing
187
- npx @recapt/mcp skill install --all
188
- npx @recapt/mcp skill uninstall deep-dive
189
- `);
190
- }
191
- function main() {
192
- const args = process.argv.slice(2);
193
- const cwd = process.cwd();
194
- if (args[0] === "skill") {
195
- args.shift();
196
- }
197
- const command = args[0];
198
- switch (command) {
199
- case "list":
200
- listSkills(cwd);
201
- break;
202
- case "install": {
203
- const target = args[1];
204
- if (!target) {
205
- console.error("Usage: npx @recapt/mcp skill install <name|--all>");
206
- process.exit(1);
207
- }
208
- if (target === "--all") {
209
- const skills = getAvailableSkills();
210
- let success = true;
211
- for (const skill of skills) {
212
- if (!installSkill(cwd, skill.name)) {
213
- success = false;
214
- }
215
- }
216
- if (success) {
217
- console.log(`\nAll skills installed. See ${AGENTS_MD} for references.`);
218
- }
219
- }
220
- else {
221
- if (installSkill(cwd, target)) {
222
- console.log(`\nSkill reference added to ${AGENTS_MD}`);
223
- }
224
- }
225
- break;
226
- }
227
- case "uninstall": {
228
- const target = args[1];
229
- if (!target) {
230
- console.error("Usage: npx @recapt/mcp skill uninstall <name>");
231
- process.exit(1);
232
- }
233
- uninstallSkill(cwd, target);
234
- break;
235
- }
236
- case "help":
237
- case "--help":
238
- case "-h":
239
- printHelp();
240
- break;
241
- default:
242
- if (command) {
243
- console.error(`Unknown command: ${command}`);
244
- }
245
- printHelp();
246
- process.exit(command ? 1 : 0);
247
- }
248
- }
249
- main();
@@ -1,6 +0,0 @@
1
- /**
2
- * Organization context for the MCP server.
3
- * Reads RECAPT_ORG_ID from environment and validates it.
4
- */
5
- export declare function getOrgId(): string;
6
- export declare function hasOrgId(): boolean;
@@ -1,22 +0,0 @@
1
- /**
2
- * Organization context for the MCP server.
3
- * Reads RECAPT_ORG_ID from environment and validates it.
4
- */
5
- let cachedOrgId = null;
6
- export function getOrgId() {
7
- if (cachedOrgId)
8
- return cachedOrgId;
9
- const orgId = process.env.RECAPT_ORG_ID;
10
- if (!orgId) {
11
- throw new Error('RECAPT_ORG_ID environment variable is required. ' +
12
- 'Set it to the MongoDB ObjectId of the organization to query.');
13
- }
14
- if (!/^[a-f0-9]{24}$/i.test(orgId)) {
15
- throw new Error(`RECAPT_ORG_ID must be a valid 24-character MongoDB ObjectId. Got: ${orgId}`);
16
- }
17
- cachedOrgId = orgId;
18
- return orgId;
19
- }
20
- export function hasOrgId() {
21
- return !!process.env.RECAPT_ORG_ID;
22
- }