@mcp-shark/mcp-shark 1.4.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.
Files changed (212) hide show
  1. package/LICENSE +85 -0
  2. package/README.md +724 -0
  3. package/bin/mcp-shark.js +93 -0
  4. package/mcp-server/.editorconfig +15 -0
  5. package/mcp-server/.prettierignore +11 -0
  6. package/mcp-server/.prettierrc +12 -0
  7. package/mcp-server/README.md +280 -0
  8. package/mcp-server/commitlint.config.cjs +42 -0
  9. package/mcp-server/eslint.config.js +131 -0
  10. package/mcp-server/lib/auditor/audit.js +228 -0
  11. package/mcp-server/lib/common/error.js +15 -0
  12. package/mcp-server/lib/server/external/all.js +32 -0
  13. package/mcp-server/lib/server/external/config.js +59 -0
  14. package/mcp-server/lib/server/external/kv.js +102 -0
  15. package/mcp-server/lib/server/external/single/client.js +35 -0
  16. package/mcp-server/lib/server/external/single/request.js +49 -0
  17. package/mcp-server/lib/server/external/single/run.js +75 -0
  18. package/mcp-server/lib/server/external/single/transport.js +57 -0
  19. package/mcp-server/lib/server/internal/handlers/common.js +20 -0
  20. package/mcp-server/lib/server/internal/handlers/error.js +7 -0
  21. package/mcp-server/lib/server/internal/handlers/prompts-get.js +22 -0
  22. package/mcp-server/lib/server/internal/handlers/prompts-list.js +12 -0
  23. package/mcp-server/lib/server/internal/handlers/resources-list.js +12 -0
  24. package/mcp-server/lib/server/internal/handlers/resources-read.js +19 -0
  25. package/mcp-server/lib/server/internal/handlers/tools-call.js +37 -0
  26. package/mcp-server/lib/server/internal/handlers/tools-list.js +14 -0
  27. package/mcp-server/lib/server/internal/run.js +49 -0
  28. package/mcp-server/lib/server/internal/server.js +63 -0
  29. package/mcp-server/lib/server/internal/session.js +39 -0
  30. package/mcp-server/mcp-shark.js +72 -0
  31. package/mcp-server/package-lock.json +4784 -0
  32. package/mcp-server/package.json +30 -0
  33. package/package.json +103 -0
  34. package/ui/README.md +212 -0
  35. package/ui/index.html +16 -0
  36. package/ui/package-lock.json +3574 -0
  37. package/ui/package.json +12 -0
  38. package/ui/paths.js +282 -0
  39. package/ui/public/og-image.png +0 -0
  40. package/ui/server/routes/backups.js +251 -0
  41. package/ui/server/routes/composite.js +244 -0
  42. package/ui/server/routes/config.js +175 -0
  43. package/ui/server/routes/conversations.js +25 -0
  44. package/ui/server/routes/help.js +43 -0
  45. package/ui/server/routes/logs.js +32 -0
  46. package/ui/server/routes/playground.js +152 -0
  47. package/ui/server/routes/requests.js +235 -0
  48. package/ui/server/routes/sessions.js +27 -0
  49. package/ui/server/routes/smartscan/discover.js +117 -0
  50. package/ui/server/routes/smartscan/scans/clearCache.js +22 -0
  51. package/ui/server/routes/smartscan/scans/createBatchScans.js +123 -0
  52. package/ui/server/routes/smartscan/scans/createScan.js +42 -0
  53. package/ui/server/routes/smartscan/scans/getCachedResults.js +51 -0
  54. package/ui/server/routes/smartscan/scans/getScan.js +41 -0
  55. package/ui/server/routes/smartscan/scans/listScans.js +24 -0
  56. package/ui/server/routes/smartscan/scans.js +13 -0
  57. package/ui/server/routes/smartscan/token.js +56 -0
  58. package/ui/server/routes/smartscan/transport.js +53 -0
  59. package/ui/server/routes/smartscan.js +24 -0
  60. package/ui/server/routes/statistics.js +83 -0
  61. package/ui/server/utils/config-update.js +212 -0
  62. package/ui/server/utils/config.js +98 -0
  63. package/ui/server/utils/paths.js +23 -0
  64. package/ui/server/utils/port.js +28 -0
  65. package/ui/server/utils/process.js +80 -0
  66. package/ui/server/utils/scan-cache/all-results.js +180 -0
  67. package/ui/server/utils/scan-cache/directory.js +35 -0
  68. package/ui/server/utils/scan-cache/file-operations.js +104 -0
  69. package/ui/server/utils/scan-cache/hash.js +47 -0
  70. package/ui/server/utils/scan-cache/server-operations.js +80 -0
  71. package/ui/server/utils/scan-cache.js +12 -0
  72. package/ui/server/utils/serialization.js +13 -0
  73. package/ui/server/utils/smartscan-token.js +42 -0
  74. package/ui/server.js +199 -0
  75. package/ui/src/App.jsx +153 -0
  76. package/ui/src/CompositeLogs.jsx +164 -0
  77. package/ui/src/CompositeSetup.jsx +285 -0
  78. package/ui/src/HelpGuide/HelpGuideContent.jsx +118 -0
  79. package/ui/src/HelpGuide/HelpGuideFooter.jsx +58 -0
  80. package/ui/src/HelpGuide/HelpGuideHeader.jsx +56 -0
  81. package/ui/src/HelpGuide.jsx +65 -0
  82. package/ui/src/IntroTour.jsx +140 -0
  83. package/ui/src/LogDetail.jsx +122 -0
  84. package/ui/src/LogTable.jsx +242 -0
  85. package/ui/src/PacketDetail.jsx +190 -0
  86. package/ui/src/PacketFilters.jsx +222 -0
  87. package/ui/src/PacketList.jsx +183 -0
  88. package/ui/src/SmartScan.jsx +178 -0
  89. package/ui/src/TabNavigation.jsx +143 -0
  90. package/ui/src/components/App/HelpButton.jsx +64 -0
  91. package/ui/src/components/App/TrafficTab.jsx +69 -0
  92. package/ui/src/components/App/useAppState.js +163 -0
  93. package/ui/src/components/BackupList.jsx +192 -0
  94. package/ui/src/components/CollapsibleSection.jsx +82 -0
  95. package/ui/src/components/ConfigFileSection.jsx +84 -0
  96. package/ui/src/components/ConfigViewerModal.jsx +141 -0
  97. package/ui/src/components/ConfirmationModal.jsx +129 -0
  98. package/ui/src/components/DetailsTab/BodySection.jsx +27 -0
  99. package/ui/src/components/DetailsTab/CollapsibleRequestResponse.jsx +70 -0
  100. package/ui/src/components/DetailsTab/HeadersSection.jsx +25 -0
  101. package/ui/src/components/DetailsTab/InfoSection.jsx +28 -0
  102. package/ui/src/components/DetailsTab/NetworkInfoSection.jsx +63 -0
  103. package/ui/src/components/DetailsTab/ProtocolInfoSection.jsx +75 -0
  104. package/ui/src/components/DetailsTab/RequestDetailsSection.jsx +46 -0
  105. package/ui/src/components/DetailsTab/ResponseDetailsSection.jsx +66 -0
  106. package/ui/src/components/DetailsTab.jsx +31 -0
  107. package/ui/src/components/DetectedPathsList.jsx +171 -0
  108. package/ui/src/components/FileInput.jsx +144 -0
  109. package/ui/src/components/GroupHeader.jsx +76 -0
  110. package/ui/src/components/GroupedByMcpView.jsx +103 -0
  111. package/ui/src/components/GroupedByServerView.jsx +134 -0
  112. package/ui/src/components/GroupedBySessionView.jsx +127 -0
  113. package/ui/src/components/GroupedViews.jsx +2 -0
  114. package/ui/src/components/HexTab.jsx +188 -0
  115. package/ui/src/components/LogsDisplay.jsx +93 -0
  116. package/ui/src/components/LogsToolbar.jsx +193 -0
  117. package/ui/src/components/McpPlayground/LoadingModal.jsx +113 -0
  118. package/ui/src/components/McpPlayground/PromptsSection/PromptCallPanel.jsx +125 -0
  119. package/ui/src/components/McpPlayground/PromptsSection/PromptItem.jsx +48 -0
  120. package/ui/src/components/McpPlayground/PromptsSection/PromptsList.jsx +45 -0
  121. package/ui/src/components/McpPlayground/PromptsSection.jsx +106 -0
  122. package/ui/src/components/McpPlayground/ResourcesSection/ResourceCallPanel.jsx +89 -0
  123. package/ui/src/components/McpPlayground/ResourcesSection/ResourceItem.jsx +59 -0
  124. package/ui/src/components/McpPlayground/ResourcesSection/ResourcesList.jsx +45 -0
  125. package/ui/src/components/McpPlayground/ResourcesSection.jsx +91 -0
  126. package/ui/src/components/McpPlayground/ToolsSection/ToolCallPanel.jsx +125 -0
  127. package/ui/src/components/McpPlayground/ToolsSection/ToolItem.jsx +48 -0
  128. package/ui/src/components/McpPlayground/ToolsSection/ToolsList.jsx +45 -0
  129. package/ui/src/components/McpPlayground/ToolsSection.jsx +107 -0
  130. package/ui/src/components/McpPlayground/common/EmptyState.jsx +17 -0
  131. package/ui/src/components/McpPlayground/common/ErrorState.jsx +17 -0
  132. package/ui/src/components/McpPlayground/common/LoadingState.jsx +17 -0
  133. package/ui/src/components/McpPlayground/useMcpPlayground.js +280 -0
  134. package/ui/src/components/McpPlayground.jsx +171 -0
  135. package/ui/src/components/MessageDisplay.jsx +28 -0
  136. package/ui/src/components/PacketDetailHeader.jsx +88 -0
  137. package/ui/src/components/PacketFilters/ExportControls.jsx +126 -0
  138. package/ui/src/components/PacketFilters/FilterInput.jsx +59 -0
  139. package/ui/src/components/RawTab.jsx +142 -0
  140. package/ui/src/components/RequestRow/OrphanedResponseRow.jsx +155 -0
  141. package/ui/src/components/RequestRow/RequestRowMain.jsx +240 -0
  142. package/ui/src/components/RequestRow/ResponseRow.jsx +158 -0
  143. package/ui/src/components/RequestRow.jsx +70 -0
  144. package/ui/src/components/ServerControl.jsx +133 -0
  145. package/ui/src/components/ServiceSelector.jsx +209 -0
  146. package/ui/src/components/SetupHeader.jsx +30 -0
  147. package/ui/src/components/SharkLogo.jsx +21 -0
  148. package/ui/src/components/SmartScan/AnalysisResult.jsx +64 -0
  149. package/ui/src/components/SmartScan/BatchResultsDisplay/BatchResultItem.jsx +215 -0
  150. package/ui/src/components/SmartScan/BatchResultsDisplay/BatchResultsHeader.jsx +94 -0
  151. package/ui/src/components/SmartScan/BatchResultsDisplay.jsx +26 -0
  152. package/ui/src/components/SmartScan/DebugInfoSection.jsx +53 -0
  153. package/ui/src/components/SmartScan/EmptyState.jsx +57 -0
  154. package/ui/src/components/SmartScan/ErrorDisplay.jsx +48 -0
  155. package/ui/src/components/SmartScan/ExpandableSection.jsx +93 -0
  156. package/ui/src/components/SmartScan/FindingsTable.jsx +257 -0
  157. package/ui/src/components/SmartScan/ListViewContent.jsx +75 -0
  158. package/ui/src/components/SmartScan/NotablePatternsSection.jsx +75 -0
  159. package/ui/src/components/SmartScan/OverallSummarySection.jsx +72 -0
  160. package/ui/src/components/SmartScan/RawDataSection.jsx +52 -0
  161. package/ui/src/components/SmartScan/RecommendationsSection.jsx +78 -0
  162. package/ui/src/components/SmartScan/ScanDetailHeader.jsx +92 -0
  163. package/ui/src/components/SmartScan/ScanDetailView.jsx +141 -0
  164. package/ui/src/components/SmartScan/ScanListView/ScanListHeader.jsx +49 -0
  165. package/ui/src/components/SmartScan/ScanListView/ScanListItem.jsx +201 -0
  166. package/ui/src/components/SmartScan/ScanListView.jsx +73 -0
  167. package/ui/src/components/SmartScan/ScanOverviewSection.jsx +123 -0
  168. package/ui/src/components/SmartScan/ScanResultsDisplay.jsx +35 -0
  169. package/ui/src/components/SmartScan/ScanViewContent.jsx +68 -0
  170. package/ui/src/components/SmartScan/ScanningProgress.jsx +47 -0
  171. package/ui/src/components/SmartScan/ServerInfoSection.jsx +43 -0
  172. package/ui/src/components/SmartScan/ServerSelectionRow.jsx +207 -0
  173. package/ui/src/components/SmartScan/SingleResultDisplay.jsx +269 -0
  174. package/ui/src/components/SmartScan/SmartScanControls.jsx +290 -0
  175. package/ui/src/components/SmartScan/SmartScanHeader.jsx +77 -0
  176. package/ui/src/components/SmartScan/ViewModeTabs.jsx +57 -0
  177. package/ui/src/components/SmartScan/hooks/useCacheManagement.js +34 -0
  178. package/ui/src/components/SmartScan/hooks/useMcpDiscovery.js +121 -0
  179. package/ui/src/components/SmartScan/hooks/useScanList.js +193 -0
  180. package/ui/src/components/SmartScan/hooks/useScanOperations.js +87 -0
  181. package/ui/src/components/SmartScan/hooks/useServerStatus.js +26 -0
  182. package/ui/src/components/SmartScan/hooks/useTokenManagement.js +53 -0
  183. package/ui/src/components/SmartScan/scanDataUtils.js +98 -0
  184. package/ui/src/components/SmartScan/useSmartScan.js +72 -0
  185. package/ui/src/components/SmartScan/utils.js +19 -0
  186. package/ui/src/components/SmartScanIcons.jsx +58 -0
  187. package/ui/src/components/TabNavigation/DesktopTabs.jsx +111 -0
  188. package/ui/src/components/TabNavigation/MobileDropdown.jsx +140 -0
  189. package/ui/src/components/TabNavigation.jsx +97 -0
  190. package/ui/src/components/TabNavigationIcons.jsx +40 -0
  191. package/ui/src/components/TableHeader.jsx +164 -0
  192. package/ui/src/components/TourOverlay.jsx +117 -0
  193. package/ui/src/components/TourTooltip/TourTooltipButtons.jsx +117 -0
  194. package/ui/src/components/TourTooltip/TourTooltipHeader.jsx +70 -0
  195. package/ui/src/components/TourTooltip/TourTooltipIcons.jsx +45 -0
  196. package/ui/src/components/TourTooltip/useTooltipPosition.js +108 -0
  197. package/ui/src/components/TourTooltip.jsx +83 -0
  198. package/ui/src/components/ViewModeTabs.jsx +91 -0
  199. package/ui/src/components/WhatThisDoesSection.jsx +61 -0
  200. package/ui/src/config/tourSteps.jsx +141 -0
  201. package/ui/src/hooks/useAnimation.js +92 -0
  202. package/ui/src/hooks/useConfigManagement.js +124 -0
  203. package/ui/src/hooks/useServiceExtraction.js +51 -0
  204. package/ui/src/index.css +42 -0
  205. package/ui/src/main.jsx +10 -0
  206. package/ui/src/theme.js +65 -0
  207. package/ui/src/utils/animations.js +170 -0
  208. package/ui/src/utils/groupingUtils.js +93 -0
  209. package/ui/src/utils/hexUtils.js +24 -0
  210. package/ui/src/utils/mcpGroupingUtils.js +262 -0
  211. package/ui/src/utils/requestUtils.js +297 -0
  212. package/ui/vite.config.js +18 -0
@@ -0,0 +1,117 @@
1
+ import { colors, fonts } from '../../theme';
2
+ import { ChevronLeft, ChevronRight } from './TourTooltipIcons';
3
+
4
+ export default function TourTooltipButtons({
5
+ currentStep,
6
+ totalSteps,
7
+ onNext,
8
+ onPrevious,
9
+ onSkip,
10
+ }) {
11
+ return (
12
+ <div
13
+ style={{
14
+ display: 'flex',
15
+ alignItems: 'center',
16
+ justifyContent: 'space-between',
17
+ gap: '12px',
18
+ pointerEvents: 'none',
19
+ }}
20
+ >
21
+ <button
22
+ onClick={(e) => {
23
+ e.stopPropagation();
24
+ onSkip();
25
+ }}
26
+ onMouseDown={(e) => e.stopPropagation()}
27
+ style={{
28
+ background: 'transparent',
29
+ border: `1px solid ${colors.borderMedium}`,
30
+ color: colors.textSecondary,
31
+ padding: '8px 16px',
32
+ borderRadius: '8px',
33
+ cursor: 'pointer',
34
+ fontSize: '13px',
35
+ fontFamily: fonts.body,
36
+ flex: 1,
37
+ pointerEvents: 'auto',
38
+ }}
39
+ onMouseEnter={(e) => {
40
+ e.currentTarget.style.background = colors.bgHover;
41
+ e.currentTarget.style.color = colors.textPrimary;
42
+ e.currentTarget.style.borderColor = colors.borderMedium;
43
+ }}
44
+ onMouseLeave={(e) => {
45
+ e.currentTarget.style.background = 'transparent';
46
+ e.currentTarget.style.color = colors.textSecondary;
47
+ e.currentTarget.style.borderColor = colors.borderMedium;
48
+ }}
49
+ >
50
+ Skip Tour
51
+ </button>
52
+ <div style={{ display: 'flex', gap: '8px', pointerEvents: 'auto' }}>
53
+ {currentStep > 0 && (
54
+ <button
55
+ onClick={(e) => {
56
+ e.stopPropagation();
57
+ onPrevious();
58
+ }}
59
+ onMouseDown={(e) => e.stopPropagation()}
60
+ style={{
61
+ background: colors.buttonSecondary,
62
+ border: `1px solid ${colors.borderMedium}`,
63
+ color: colors.textPrimary,
64
+ padding: '8px 12px',
65
+ borderRadius: '8px',
66
+ cursor: 'pointer',
67
+ fontSize: '13px',
68
+ fontFamily: fonts.body,
69
+ display: 'flex',
70
+ alignItems: 'center',
71
+ gap: '4px',
72
+ }}
73
+ onMouseEnter={(e) => {
74
+ e.currentTarget.style.background = colors.buttonSecondaryHover;
75
+ }}
76
+ onMouseLeave={(e) => {
77
+ e.currentTarget.style.background = colors.buttonSecondary;
78
+ }}
79
+ >
80
+ <ChevronLeft size={14} />
81
+ Previous
82
+ </button>
83
+ )}
84
+ <button
85
+ onClick={(e) => {
86
+ e.stopPropagation();
87
+ onNext();
88
+ }}
89
+ onMouseDown={(e) => e.stopPropagation()}
90
+ style={{
91
+ background: colors.buttonPrimary,
92
+ border: 'none',
93
+ color: colors.textInverse,
94
+ padding: '8px 16px',
95
+ borderRadius: '8px',
96
+ cursor: 'pointer',
97
+ fontSize: '13px',
98
+ fontFamily: fonts.body,
99
+ display: 'flex',
100
+ alignItems: 'center',
101
+ gap: '4px',
102
+ fontWeight: '500',
103
+ }}
104
+ onMouseEnter={(e) => {
105
+ e.currentTarget.style.background = colors.buttonPrimaryHover;
106
+ }}
107
+ onMouseLeave={(e) => {
108
+ e.currentTarget.style.background = colors.buttonPrimary;
109
+ }}
110
+ >
111
+ {currentStep === totalSteps - 1 ? 'Finish' : 'Next'}
112
+ {currentStep < totalSteps - 1 && <ChevronRight size={14} />}
113
+ </button>
114
+ </div>
115
+ </div>
116
+ );
117
+ }
@@ -0,0 +1,70 @@
1
+ import { colors, fonts } from '../../theme';
2
+ import { CloseIcon } from './TourTooltipIcons';
3
+
4
+ export default function TourTooltipHeader({ step, currentStep, totalSteps, isDragging, onSkip }) {
5
+ return (
6
+ <div
7
+ style={{
8
+ display: 'flex',
9
+ alignItems: 'flex-start',
10
+ justifyContent: 'space-between',
11
+ marginBottom: '12px',
12
+ }}
13
+ >
14
+ <div style={{ flex: 1, pointerEvents: 'none' }}>
15
+ <h3
16
+ style={{
17
+ margin: 0,
18
+ color: colors.accentBlue,
19
+ fontSize: '16px',
20
+ fontWeight: '600',
21
+ fontFamily: fonts.body,
22
+ }}
23
+ >
24
+ {step.title}
25
+ </h3>
26
+ <p
27
+ style={{
28
+ margin: '4px 0 0 0',
29
+ color: colors.textTertiary,
30
+ fontSize: '12px',
31
+ fontFamily: fonts.body,
32
+ }}
33
+ >
34
+ Step {currentStep + 1} of {totalSteps}
35
+ {isDragging && <span style={{ marginLeft: '8px', fontSize: '11px' }}>• Dragging</span>}
36
+ </p>
37
+ </div>
38
+ <button
39
+ onClick={(e) => {
40
+ e.stopPropagation();
41
+ onSkip();
42
+ }}
43
+ onMouseDown={(e) => e.stopPropagation()}
44
+ style={{
45
+ background: 'transparent',
46
+ border: 'none',
47
+ color: colors.textTertiary,
48
+ cursor: 'pointer',
49
+ padding: '4px',
50
+ display: 'flex',
51
+ alignItems: 'center',
52
+ borderRadius: '8px',
53
+ marginLeft: '12px',
54
+ pointerEvents: 'auto',
55
+ }}
56
+ onMouseEnter={(e) => {
57
+ e.currentTarget.style.background = colors.bgHover;
58
+ e.currentTarget.style.color = colors.textPrimary;
59
+ }}
60
+ onMouseLeave={(e) => {
61
+ e.currentTarget.style.background = 'transparent';
62
+ e.currentTarget.style.color = colors.textTertiary;
63
+ }}
64
+ title="Skip tour"
65
+ >
66
+ <CloseIcon size={18} />
67
+ </button>
68
+ </div>
69
+ );
70
+ }
@@ -0,0 +1,45 @@
1
+ export const CloseIcon = ({ size = 16, color = 'currentColor' }) => (
2
+ <svg
3
+ width={size}
4
+ height={size}
5
+ viewBox="0 0 24 24"
6
+ fill="none"
7
+ stroke={color}
8
+ strokeWidth="2"
9
+ strokeLinecap="round"
10
+ strokeLinejoin="round"
11
+ >
12
+ <line x1="18" y1="6" x2="6" y2="18" />
13
+ <line x1="6" y1="6" x2="18" y2="18" />
14
+ </svg>
15
+ );
16
+
17
+ export const ChevronRight = ({ size = 16, color = 'currentColor' }) => (
18
+ <svg
19
+ width={size}
20
+ height={size}
21
+ viewBox="0 0 24 24"
22
+ fill="none"
23
+ stroke={color}
24
+ strokeWidth="2"
25
+ strokeLinecap="round"
26
+ strokeLinejoin="round"
27
+ >
28
+ <polyline points="9 18 15 12 9 6" />
29
+ </svg>
30
+ );
31
+
32
+ export const ChevronLeft = ({ size = 16, color = 'currentColor' }) => (
33
+ <svg
34
+ width={size}
35
+ height={size}
36
+ viewBox="0 0 24 24"
37
+ fill="none"
38
+ stroke={color}
39
+ strokeWidth="2"
40
+ strokeLinecap="round"
41
+ strokeLinejoin="round"
42
+ >
43
+ <polyline points="15 18 9 12 15 6" />
44
+ </svg>
45
+ );
@@ -0,0 +1,108 @@
1
+ import { useState, useEffect } from 'react';
2
+
3
+ export function useTooltipPosition(elementRect, step, currentStep) {
4
+ const [tooltipPosition, setTooltipPosition] = useState({ x: 0, y: 0 });
5
+ const [isDragging, setIsDragging] = useState(false);
6
+ const [dragOffset, setDragOffset] = useState({ x: 0, y: 0 });
7
+
8
+ useEffect(() => {
9
+ setTooltipPosition({ x: 0, y: 0 });
10
+ }, [currentStep]);
11
+
12
+ const handleMouseDown = (e, tooltipRef) => {
13
+ e.preventDefault();
14
+ e.stopPropagation();
15
+ if (tooltipRef.current) {
16
+ const rect = tooltipRef.current.getBoundingClientRect();
17
+ setDragOffset({
18
+ x: e.clientX - rect.left,
19
+ y: e.clientY - rect.top,
20
+ });
21
+ setIsDragging(true);
22
+ }
23
+ };
24
+
25
+ useEffect(() => {
26
+ if (!isDragging) return;
27
+
28
+ const handleMouseMove = (e) => {
29
+ setTooltipPosition({
30
+ x: e.clientX - dragOffset.x,
31
+ y: e.clientY - dragOffset.y,
32
+ });
33
+ };
34
+
35
+ const handleMouseUp = () => {
36
+ setIsDragging(false);
37
+ };
38
+
39
+ window.addEventListener('mousemove', handleMouseMove);
40
+ window.addEventListener('mouseup', handleMouseUp);
41
+
42
+ return () => {
43
+ window.removeEventListener('mousemove', handleMouseMove);
44
+ window.removeEventListener('mouseup', handleMouseUp);
45
+ };
46
+ }, [isDragging, dragOffset]);
47
+
48
+ const calculatePosition = () => {
49
+ if (!elementRect) return { left: 0, top: 0, transform: 'none' };
50
+
51
+ const tooltipWidth = 350;
52
+ const tooltipHeight = 200;
53
+ const spacing = 20;
54
+
55
+ if (tooltipPosition.x !== 0 || tooltipPosition.y !== 0) {
56
+ const left = Math.max(10, Math.min(tooltipPosition.x, window.innerWidth - tooltipWidth - 10));
57
+ const top = Math.max(
58
+ 10,
59
+ Math.min(tooltipPosition.y, window.innerHeight - tooltipHeight - 10)
60
+ );
61
+ return { left, top, transform: 'none' };
62
+ }
63
+
64
+ const position = step.position || 'bottom';
65
+ let left, top, transform;
66
+
67
+ if (position === 'left') {
68
+ left = elementRect.left - tooltipWidth - spacing;
69
+ top = elementRect.top + elementRect.height / 2;
70
+ transform = 'translateY(-50%)';
71
+ if (left < 10) {
72
+ left = elementRect.right + spacing;
73
+ }
74
+ } else if (position === 'right') {
75
+ left = elementRect.right + spacing;
76
+ top = elementRect.top + elementRect.height / 2;
77
+ transform = 'translateY(-50%)';
78
+ if (left + tooltipWidth > window.innerWidth - 10) {
79
+ left = elementRect.left - tooltipWidth - spacing;
80
+ }
81
+ } else if (position === 'top') {
82
+ left = elementRect.left + elementRect.width / 2;
83
+ top = elementRect.top - tooltipHeight - spacing;
84
+ transform = 'translate(-50%, 0)';
85
+ if (top < 10) {
86
+ top = elementRect.bottom + spacing;
87
+ }
88
+ } else {
89
+ left = elementRect.left + elementRect.width / 2;
90
+ top = elementRect.bottom + spacing;
91
+ transform = 'translate(-50%, 0)';
92
+ if (top + tooltipHeight > window.innerHeight - 10) {
93
+ top = elementRect.top - tooltipHeight - spacing;
94
+ }
95
+ }
96
+
97
+ left = Math.max(10, Math.min(left, window.innerWidth - tooltipWidth - 10));
98
+ top = Math.max(10, Math.min(top, window.innerHeight - tooltipHeight - 10));
99
+
100
+ return { left, top, transform };
101
+ };
102
+
103
+ return {
104
+ position: calculatePosition(),
105
+ isDragging,
106
+ handleMouseDown,
107
+ };
108
+ }
@@ -0,0 +1,83 @@
1
+ import { useRef } from 'react';
2
+ import { colors, fonts } from '../theme';
3
+ import TourTooltipHeader from './TourTooltip/TourTooltipHeader';
4
+ import TourTooltipButtons from './TourTooltip/TourTooltipButtons';
5
+ import { useTooltipPosition } from './TourTooltip/useTooltipPosition';
6
+
7
+ function TourTooltip({ elementRect, step, currentStep, totalSteps, onNext, onPrevious, onSkip }) {
8
+ const tooltipRef = useRef(null);
9
+ const { position, isDragging, handleMouseDown } = useTooltipPosition(
10
+ elementRect,
11
+ step,
12
+ currentStep
13
+ );
14
+
15
+ if (!elementRect) {
16
+ return null;
17
+ }
18
+
19
+ return (
20
+ <div
21
+ ref={tooltipRef}
22
+ onMouseDown={(e) => handleMouseDown(e, tooltipRef)}
23
+ style={{
24
+ position: 'fixed',
25
+ left: `${position.left}px`,
26
+ top: `${position.top}px`,
27
+ transform: position.transform,
28
+ background: colors.bgCard,
29
+ border: `2px solid ${colors.accentBlue}`,
30
+ borderRadius: '12px',
31
+ padding: '20px',
32
+ maxWidth: '350px',
33
+ minWidth: '300px',
34
+ boxShadow: `0 4px 20px ${colors.shadowLg}`,
35
+ zIndex: 10001,
36
+ pointerEvents: 'auto',
37
+ cursor: isDragging ? 'grabbing' : 'grab',
38
+ userSelect: 'none',
39
+ }}
40
+ onClick={(e) => {
41
+ const target = e.target;
42
+ if (
43
+ target.tagName !== 'BUTTON' &&
44
+ target.tagName !== 'INPUT' &&
45
+ !target.closest('button')
46
+ ) {
47
+ e.stopPropagation();
48
+ }
49
+ }}
50
+ >
51
+ <TourTooltipHeader
52
+ step={step}
53
+ currentStep={currentStep}
54
+ totalSteps={totalSteps}
55
+ isDragging={isDragging}
56
+ onSkip={onSkip}
57
+ />
58
+
59
+ <div
60
+ style={{
61
+ color: colors.textPrimary,
62
+ fontSize: '14px',
63
+ lineHeight: '1.6',
64
+ marginBottom: '20px',
65
+ pointerEvents: 'none',
66
+ fontFamily: fonts.body,
67
+ }}
68
+ >
69
+ {step.content}
70
+ </div>
71
+
72
+ <TourTooltipButtons
73
+ currentStep={currentStep}
74
+ totalSteps={totalSteps}
75
+ onNext={onNext}
76
+ onPrevious={onPrevious}
77
+ onSkip={onSkip}
78
+ />
79
+ </div>
80
+ );
81
+ }
82
+
83
+ export default TourTooltip;
@@ -0,0 +1,91 @@
1
+ import { colors, fonts } from '../theme';
2
+ import { IconList, IconNetwork } from '@tabler/icons-react';
3
+
4
+ function ViewModeTabs({ viewMode, onViewModeChange }) {
5
+ return (
6
+ <div
7
+ data-tour="view-modes"
8
+ style={{
9
+ display: 'flex',
10
+ borderBottom: `1px solid ${colors.borderLight}`,
11
+ background: colors.bgSecondary,
12
+ padding: '0 12px',
13
+ boxShadow: `0 1px 3px ${colors.shadowSm}`,
14
+ flexShrink: 0,
15
+ }}
16
+ >
17
+ <button
18
+ onClick={() => onViewModeChange('general')}
19
+ style={{
20
+ padding: '10px 18px',
21
+ background: viewMode === 'general' ? colors.bgCard : 'transparent',
22
+ fontFamily: fonts.body,
23
+ border: 'none',
24
+ borderBottom:
25
+ viewMode === 'general' ? `2px solid ${colors.accentBlue}` : '2px solid transparent',
26
+ color: viewMode === 'general' ? colors.textPrimary : colors.textSecondary,
27
+ borderRadius: '8px 8px 0 0',
28
+ cursor: 'pointer',
29
+ fontSize: '12px',
30
+ fontWeight: viewMode === 'general' ? '500' : 'normal',
31
+ display: 'flex',
32
+ alignItems: 'center',
33
+ gap: '6px',
34
+ }}
35
+ onMouseEnter={(e) => {
36
+ if (viewMode !== 'general') {
37
+ e.currentTarget.style.background = colors.bgHover;
38
+ e.currentTarget.style.color = colors.textPrimary;
39
+ }
40
+ }}
41
+ onMouseLeave={(e) => {
42
+ if (viewMode !== 'general') {
43
+ e.currentTarget.style.background = 'transparent';
44
+ e.currentTarget.style.color = colors.textSecondary;
45
+ }
46
+ }}
47
+ >
48
+ <IconList size={16} stroke={1.5} />
49
+ General List
50
+ </button>
51
+ <button
52
+ onClick={() => onViewModeChange('groupedByMcp')}
53
+ style={{
54
+ padding: '10px 18px',
55
+ background: viewMode === 'groupedByMcp' ? colors.bgCard : 'transparent',
56
+ fontFamily: fonts.body,
57
+ border: 'none',
58
+ borderBottom:
59
+ viewMode === 'groupedByMcp'
60
+ ? `2px solid ${colors.accentBlue}`
61
+ : '2px solid transparent',
62
+ color: viewMode === 'groupedByMcp' ? colors.textPrimary : colors.textSecondary,
63
+ cursor: 'pointer',
64
+ fontSize: '12px',
65
+ fontWeight: viewMode === 'groupedByMcp' ? '500' : 'normal',
66
+ borderRadius: '8px 8px 0 0',
67
+ display: 'flex',
68
+ alignItems: 'center',
69
+ gap: '6px',
70
+ }}
71
+ onMouseEnter={(e) => {
72
+ if (viewMode !== 'groupedByMcp') {
73
+ e.currentTarget.style.background = colors.bgHover;
74
+ e.currentTarget.style.color = colors.textPrimary;
75
+ }
76
+ }}
77
+ onMouseLeave={(e) => {
78
+ if (viewMode !== 'groupedByMcp') {
79
+ e.currentTarget.style.background = 'transparent';
80
+ e.currentTarget.style.color = colors.textSecondary;
81
+ }
82
+ }}
83
+ >
84
+ <IconNetwork size={16} stroke={1.5} />
85
+ MCP Protocol View
86
+ </button>
87
+ </div>
88
+ );
89
+ }
90
+
91
+ export default ViewModeTabs;
@@ -0,0 +1,61 @@
1
+ import { colors, fonts } from '../theme';
2
+
3
+ export default function WhatThisDoesSection({ filePath, updatePath }) {
4
+ return (
5
+ <div
6
+ style={{
7
+ background: colors.bgCard,
8
+ border: `1px solid ${colors.borderLight}`,
9
+ borderRadius: '12px',
10
+ padding: '24px',
11
+ boxShadow: `0 2px 4px ${colors.shadowSm}`,
12
+ }}
13
+ >
14
+ <h3
15
+ style={{
16
+ fontSize: '15px',
17
+ fontWeight: '600',
18
+ marginBottom: '12px',
19
+ color: colors.textPrimary,
20
+ fontFamily: fonts.body,
21
+ }}
22
+ >
23
+ What This Does
24
+ </h3>
25
+ <ul
26
+ style={{
27
+ margin: 0,
28
+ paddingLeft: '20px',
29
+ fontSize: '13px',
30
+ color: colors.textSecondary,
31
+ lineHeight: '1.8',
32
+ fontFamily: fonts.body,
33
+ }}
34
+ >
35
+ <li>
36
+ Converts your MCP config (
37
+ <code style={{ color: colors.accentOrange, fontFamily: fonts.mono }}>mcpServers</code>) to
38
+ MCP Shark format (
39
+ <code style={{ color: colors.accentOrange, fontFamily: fonts.mono }}>servers</code>)
40
+ </li>
41
+ <li>
42
+ Starts the MCP Shark server on{' '}
43
+ <code style={{ color: colors.accentBlue, fontFamily: fonts.mono }}>
44
+ http://localhost:9851/mcp
45
+ </code>
46
+ </li>
47
+ <li>
48
+ {filePath || updatePath
49
+ ? 'Updates your original config file to point to the MCP Shark server (creates a backup first)'
50
+ : 'Note: Provide a file path to update your original config file automatically'}
51
+ </li>
52
+ {(filePath || updatePath) && (
53
+ <li style={{ color: colors.success, marginTop: '4px', fontWeight: '500' }}>
54
+ ✓ Original config will be automatically restored when you stop the server or close the
55
+ UI
56
+ </li>
57
+ )}
58
+ </ul>
59
+ </div>
60
+ );
61
+ }