@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,92 @@
1
+ import { colors, fonts } from '../../theme';
2
+ import { IconX, IconExternalLink } from '@tabler/icons-react';
3
+
4
+ export default function ScanDetailHeader({ scanId, serverName, onClose }) {
5
+ return (
6
+ <div
7
+ style={{
8
+ display: 'flex',
9
+ justifyContent: 'space-between',
10
+ alignItems: 'center',
11
+ marginBottom: '20px',
12
+ }}
13
+ >
14
+ <div>
15
+ <h2
16
+ style={{
17
+ fontSize: '16px',
18
+ fontWeight: '600',
19
+ color: colors.textPrimary,
20
+ fontFamily: fonts.body,
21
+ margin: 0,
22
+ marginBottom: '8px',
23
+ }}
24
+ >
25
+ {serverName}
26
+ </h2>
27
+ {scanId && (
28
+ <div
29
+ style={{
30
+ fontSize: '12px',
31
+ color: colors.textTertiary,
32
+ fontFamily: fonts.body,
33
+ }}
34
+ >
35
+ ID: {scanId}
36
+ </div>
37
+ )}
38
+ </div>
39
+ <div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
40
+ {scanId && (
41
+ <a
42
+ href={`https://smart.mcpshark.sh/scan-results?id=${scanId}`}
43
+ target="_blank"
44
+ rel="noopener noreferrer"
45
+ style={{
46
+ padding: '6px 12px',
47
+ background: colors.buttonPrimary,
48
+ border: 'none',
49
+ color: colors.textInverse,
50
+ borderRadius: '6px',
51
+ fontSize: '12px',
52
+ fontFamily: fonts.body,
53
+ fontWeight: '500',
54
+ textDecoration: 'none',
55
+ cursor: 'pointer',
56
+ display: 'flex',
57
+ alignItems: 'center',
58
+ gap: '6px',
59
+ }}
60
+ >
61
+ <IconExternalLink size={14} stroke={1.5} />
62
+ View on Smart Scan
63
+ </a>
64
+ )}
65
+ <button
66
+ onClick={onClose}
67
+ style={{
68
+ padding: '6px',
69
+ background: 'transparent',
70
+ border: 'none',
71
+ color: colors.textSecondary,
72
+ cursor: 'pointer',
73
+ borderRadius: '4px',
74
+ display: 'flex',
75
+ alignItems: 'center',
76
+ justifyContent: 'center',
77
+ }}
78
+ onMouseEnter={(e) => {
79
+ e.currentTarget.style.background = colors.bgTertiary;
80
+ e.currentTarget.style.color = colors.textPrimary;
81
+ }}
82
+ onMouseLeave={(e) => {
83
+ e.currentTarget.style.background = 'transparent';
84
+ e.currentTarget.style.color = colors.textSecondary;
85
+ }}
86
+ >
87
+ <IconX size={20} stroke={1.5} />
88
+ </button>
89
+ </div>
90
+ </div>
91
+ );
92
+ }
@@ -0,0 +1,141 @@
1
+ import { colors, fonts } from '../../theme';
2
+ import AnalysisResult from './AnalysisResult';
3
+ import { normalizeScanData } from './scanDataUtils';
4
+ import ScanDetailHeader from './ScanDetailHeader';
5
+ import DebugInfoSection from './DebugInfoSection';
6
+ import ScanOverviewSection from './ScanOverviewSection';
7
+ import ServerInfoSection from './ServerInfoSection';
8
+ import RawDataSection from './RawDataSection';
9
+
10
+ export default function ScanDetailView({ scan, loading, onClose }) {
11
+ if (loading) {
12
+ return (
13
+ <div
14
+ style={{
15
+ background: colors.bgCard,
16
+ border: `1px solid ${colors.borderLight}`,
17
+ borderRadius: '8px',
18
+ padding: '24px',
19
+ textAlign: 'center',
20
+ }}
21
+ >
22
+ <p style={{ color: colors.textSecondary, fontFamily: fonts.body }}>
23
+ Loading scan details...
24
+ </p>
25
+ </div>
26
+ );
27
+ }
28
+
29
+ if (!scan) {
30
+ return (
31
+ <div
32
+ style={{
33
+ background: colors.bgCard,
34
+ border: `1px solid ${colors.borderLight}`,
35
+ borderRadius: '8px',
36
+ padding: '24px',
37
+ textAlign: 'center',
38
+ }}
39
+ >
40
+ <p style={{ color: colors.textSecondary, fontFamily: fonts.body }}>
41
+ No scan data available
42
+ </p>
43
+ </div>
44
+ );
45
+ }
46
+
47
+ const {
48
+ scanId,
49
+ serverName,
50
+ status,
51
+ overallRiskLevel,
52
+ createdAt,
53
+ updatedAt,
54
+ analysisResult,
55
+ serverData,
56
+ } = normalizeScanData(scan);
57
+
58
+ return (
59
+ <div
60
+ style={{
61
+ background: colors.bgCard,
62
+ border: `1px solid ${colors.borderLight}`,
63
+ borderRadius: '8px',
64
+ padding: '24px',
65
+ boxShadow: `0 1px 3px ${colors.shadowSm}`,
66
+ position: 'relative',
67
+ }}
68
+ >
69
+ <ScanDetailHeader scanId={scanId} serverName={serverName} onClose={onClose} />
70
+
71
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>
72
+ <DebugInfoSection
73
+ scan={scan}
74
+ scanId={scanId}
75
+ serverName={serverName}
76
+ analysisResult={analysisResult}
77
+ />
78
+
79
+ <ScanOverviewSection
80
+ status={status}
81
+ overallRiskLevel={overallRiskLevel}
82
+ createdAt={createdAt}
83
+ updatedAt={updatedAt}
84
+ />
85
+
86
+ <ServerInfoSection serverData={serverData} />
87
+
88
+ {analysisResult ? (
89
+ <div style={{ marginBottom: '24px' }}>
90
+ <h3
91
+ style={{
92
+ fontSize: '13px',
93
+ fontWeight: '600',
94
+ color: colors.textPrimary,
95
+ fontFamily: fonts.body,
96
+ marginBottom: '12px',
97
+ paddingBottom: '8px',
98
+ borderBottom: `1px solid ${colors.borderLight}`,
99
+ }}
100
+ >
101
+ Analysis Result
102
+ </h3>
103
+ <AnalysisResult analysis={analysisResult} />
104
+ </div>
105
+ ) : (
106
+ <div style={{ marginBottom: '24px' }}>
107
+ <h3
108
+ style={{
109
+ fontSize: '13px',
110
+ fontWeight: '600',
111
+ color: colors.textPrimary,
112
+ fontFamily: fonts.body,
113
+ marginBottom: '12px',
114
+ paddingBottom: '8px',
115
+ borderBottom: `1px solid ${colors.borderLight}`,
116
+ }}
117
+ >
118
+ Analysis Result
119
+ </h3>
120
+ <div
121
+ style={{
122
+ padding: '12px',
123
+ background: colors.bgTertiary + '80',
124
+ borderRadius: '6px',
125
+ border: `1px solid ${colors.borderLight}`,
126
+ fontSize: '12px',
127
+ color: colors.textSecondary,
128
+ fontFamily: fonts.body,
129
+ }}
130
+ >
131
+ No analysis result available for this scan. Check the Raw Data section below to see
132
+ the scan structure.
133
+ </div>
134
+ </div>
135
+ )}
136
+
137
+ <RawDataSection scan={scan} />
138
+ </div>
139
+ </div>
140
+ );
141
+ }
@@ -0,0 +1,49 @@
1
+ import { colors, fonts } from '../../../theme';
2
+ import { IconRefresh } from '@tabler/icons-react';
3
+
4
+ export default function ScanListHeader({ scanCount, loading, onRefresh }) {
5
+ return (
6
+ <div
7
+ style={{
8
+ display: 'flex',
9
+ justifyContent: 'space-between',
10
+ alignItems: 'center',
11
+ marginBottom: '16px',
12
+ }}
13
+ >
14
+ <h2
15
+ style={{
16
+ fontSize: '14px',
17
+ fontWeight: '600',
18
+ color: colors.textPrimary,
19
+ fontFamily: fonts.body,
20
+ margin: 0,
21
+ }}
22
+ >
23
+ All Scans ({scanCount})
24
+ </h2>
25
+ <button
26
+ onClick={onRefresh}
27
+ disabled={loading}
28
+ style={{
29
+ padding: '6px 12px',
30
+ background: colors.buttonSecondary,
31
+ border: `1px solid ${colors.borderLight}`,
32
+ color: colors.textPrimary,
33
+ borderRadius: '6px',
34
+ fontSize: '12px',
35
+ fontFamily: fonts.body,
36
+ fontWeight: '500',
37
+ cursor: loading ? 'not-allowed' : 'pointer',
38
+ display: 'flex',
39
+ alignItems: 'center',
40
+ gap: '6px',
41
+ opacity: loading ? 0.5 : 1,
42
+ }}
43
+ >
44
+ <IconRefresh size={14} stroke={1.5} />
45
+ Refresh
46
+ </button>
47
+ </div>
48
+ );
49
+ }
@@ -0,0 +1,201 @@
1
+ import { useState } from 'react';
2
+ import { colors, fonts } from '../../../theme';
3
+ import { IconChevronRight, IconEye, IconExternalLink } from '@tabler/icons-react';
4
+ import { getRiskLevelColor } from '../utils';
5
+
6
+ export default function ScanListItem({ scan, onSelectScan }) {
7
+ const [isExpanded, setIsExpanded] = useState(false);
8
+
9
+ return (
10
+ <div
11
+ style={{
12
+ background: colors.bgTertiary,
13
+ border: `1px solid ${colors.borderLight}`,
14
+ borderRadius: '8px',
15
+ overflow: 'hidden',
16
+ }}
17
+ >
18
+ <div
19
+ style={{
20
+ padding: '12px 16px',
21
+ display: 'flex',
22
+ alignItems: 'center',
23
+ justifyContent: 'space-between',
24
+ gap: '12px',
25
+ cursor: 'pointer',
26
+ }}
27
+ onClick={() => setIsExpanded(!isExpanded)}
28
+ >
29
+ <div
30
+ style={{
31
+ display: 'flex',
32
+ alignItems: 'center',
33
+ gap: '12px',
34
+ flex: 1,
35
+ minWidth: 0,
36
+ }}
37
+ >
38
+ <IconChevronRight
39
+ size={16}
40
+ stroke={1.5}
41
+ color={colors.textSecondary}
42
+ style={{
43
+ transform: isExpanded ? 'rotate(90deg)' : 'rotate(0deg)',
44
+ transition: 'transform 0.2s',
45
+ }}
46
+ />
47
+ <div style={{ flex: 1, minWidth: 0 }}>
48
+ <div
49
+ style={{
50
+ fontSize: '13px',
51
+ fontWeight: '600',
52
+ color: colors.textPrimary,
53
+ fontFamily: fonts.body,
54
+ marginBottom: '4px',
55
+ }}
56
+ >
57
+ {scan.server?.name || 'Unknown Server'}
58
+ </div>
59
+ <div
60
+ style={{
61
+ display: 'flex',
62
+ alignItems: 'center',
63
+ gap: '8px',
64
+ flexWrap: 'wrap',
65
+ }}
66
+ >
67
+ {scan.overall_risk_level && (
68
+ <span
69
+ style={{
70
+ padding: '2px 8px',
71
+ borderRadius: '4px',
72
+ fontSize: '10px',
73
+ fontWeight: '700',
74
+ fontFamily: fonts.body,
75
+ background: getRiskLevelColor(scan.overall_risk_level),
76
+ color: colors.textInverse,
77
+ }}
78
+ >
79
+ {scan.overall_risk_level.toLowerCase()}
80
+ </span>
81
+ )}
82
+ {scan.created_at && (
83
+ <span
84
+ style={{
85
+ fontSize: '11px',
86
+ color: colors.textSecondary,
87
+ fontFamily: fonts.body,
88
+ }}
89
+ >
90
+ {new Date(scan.created_at).toLocaleString()}
91
+ </span>
92
+ )}
93
+ </div>
94
+ </div>
95
+ </div>
96
+ <div
97
+ style={{
98
+ display: 'flex',
99
+ alignItems: 'center',
100
+ gap: '8px',
101
+ flexShrink: 0,
102
+ }}
103
+ onClick={(e) => e.stopPropagation()}
104
+ >
105
+ <button
106
+ onClick={() => {
107
+ onSelectScan(scan.id);
108
+ }}
109
+ style={{
110
+ padding: '6px 12px',
111
+ background: colors.buttonPrimary,
112
+ border: 'none',
113
+ color: colors.textInverse,
114
+ borderRadius: '6px',
115
+ fontSize: '11px',
116
+ fontFamily: fonts.body,
117
+ fontWeight: '500',
118
+ cursor: 'pointer',
119
+ display: 'flex',
120
+ alignItems: 'center',
121
+ gap: '6px',
122
+ }}
123
+ >
124
+ <IconEye size={12} stroke={1.5} />
125
+ View
126
+ </button>
127
+ <a
128
+ href={`https://smart.mcpshark.sh/scan-results?id=${scan.id}`}
129
+ target="_blank"
130
+ rel="noopener noreferrer"
131
+ style={{
132
+ padding: '6px 12px',
133
+ background: colors.bgSecondary,
134
+ border: `1px solid ${colors.borderLight}`,
135
+ color: colors.accentBlue,
136
+ borderRadius: '6px',
137
+ fontSize: '11px',
138
+ fontFamily: fonts.body,
139
+ fontWeight: '500',
140
+ textDecoration: 'none',
141
+ cursor: 'pointer',
142
+ display: 'flex',
143
+ alignItems: 'center',
144
+ gap: '6px',
145
+ }}
146
+ >
147
+ <IconExternalLink size={12} stroke={1.5} />
148
+ Open
149
+ </a>
150
+ </div>
151
+ </div>
152
+
153
+ {isExpanded && (
154
+ <div
155
+ style={{
156
+ padding: '12px 16px',
157
+ borderTop: `1px solid ${colors.borderLight}`,
158
+ background: colors.bgSecondary,
159
+ }}
160
+ >
161
+ <div
162
+ style={{
163
+ display: 'grid',
164
+ gridTemplateColumns: 'repeat(auto-fit, minmax(200px, 1fr))',
165
+ gap: '12px',
166
+ fontSize: '12px',
167
+ fontFamily: fonts.body,
168
+ }}
169
+ >
170
+ <div>
171
+ <div style={{ color: colors.textTertiary, marginBottom: '4px' }}>Scan ID</div>
172
+ <div style={{ color: colors.textPrimary, fontWeight: '500' }}>{scan.id}</div>
173
+ </div>
174
+ {scan.server?.name && (
175
+ <div>
176
+ <div style={{ color: colors.textTertiary, marginBottom: '4px' }}>Server</div>
177
+ <div style={{ color: colors.textPrimary, fontWeight: '500' }}>
178
+ {scan.server.name}
179
+ </div>
180
+ </div>
181
+ )}
182
+ {scan.status && (
183
+ <div>
184
+ <div style={{ color: colors.textTertiary, marginBottom: '4px' }}>Status</div>
185
+ <div style={{ color: colors.textPrimary, fontWeight: '500' }}>{scan.status}</div>
186
+ </div>
187
+ )}
188
+ {scan.created_at && (
189
+ <div>
190
+ <div style={{ color: colors.textTertiary, marginBottom: '4px' }}>Created</div>
191
+ <div style={{ color: colors.textPrimary, fontWeight: '500' }}>
192
+ {new Date(scan.created_at).toLocaleString()}
193
+ </div>
194
+ </div>
195
+ )}
196
+ </div>
197
+ </div>
198
+ )}
199
+ </div>
200
+ );
201
+ }
@@ -0,0 +1,73 @@
1
+ import { colors, fonts } from '../../theme';
2
+ import ScanListHeader from './ScanListView/ScanListHeader';
3
+ import ScanListItem from './ScanListView/ScanListItem';
4
+
5
+ export default function ScanListView({ scans, loading, onRefresh, onSelectScan }) {
6
+ if (loading) {
7
+ return (
8
+ <div
9
+ style={{
10
+ background: colors.bgCard,
11
+ border: `1px solid ${colors.borderLight}`,
12
+ borderRadius: '8px',
13
+ padding: '24px',
14
+ textAlign: 'center',
15
+ }}
16
+ >
17
+ <p style={{ color: colors.textSecondary, fontFamily: fonts.body }}>Loading scans...</p>
18
+ </div>
19
+ );
20
+ }
21
+
22
+ if (!scans || scans.length === 0) {
23
+ return (
24
+ <div
25
+ style={{
26
+ background: colors.bgCard,
27
+ border: `1px solid ${colors.borderLight}`,
28
+ borderRadius: '8px',
29
+ padding: '24px',
30
+ textAlign: 'center',
31
+ }}
32
+ >
33
+ <p style={{ color: colors.textSecondary, fontFamily: fonts.body }}>
34
+ No scans found. Run a scan to see results here.
35
+ </p>
36
+ </div>
37
+ );
38
+ }
39
+
40
+ return (
41
+ <div
42
+ style={{
43
+ background: colors.bgCard,
44
+ border: `1px solid ${colors.borderLight}`,
45
+ borderRadius: '8px',
46
+ padding: '20px',
47
+ boxShadow: `0 1px 3px ${colors.shadowSm}`,
48
+ }}
49
+ >
50
+ <ScanListHeader scanCount={scans.length} loading={loading} onRefresh={onRefresh} />
51
+ <div
52
+ style={{
53
+ padding: '8px 12px',
54
+ background: colors.bgSecondary,
55
+ border: `1px solid ${colors.borderLight}`,
56
+ borderRadius: '6px',
57
+ marginBottom: '16px',
58
+ fontSize: '11px',
59
+ color: colors.textSecondary,
60
+ fontFamily: fonts.body,
61
+ fontStyle: 'italic',
62
+ }}
63
+ >
64
+ ℹ️ These results are from local cache. Run a new scan to see the latest results.
65
+ </div>
66
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
67
+ {scans.map((scan) => (
68
+ <ScanListItem key={scan.id} scan={scan} onSelectScan={onSelectScan} />
69
+ ))}
70
+ </div>
71
+ </div>
72
+ );
73
+ }
@@ -0,0 +1,123 @@
1
+ import { colors, fonts } from '../../theme';
2
+ import { getRiskLevelColor } from './utils';
3
+
4
+ export default function ScanOverviewSection({ status, overallRiskLevel, createdAt, updatedAt }) {
5
+ const formatDate = (dateString) => {
6
+ if (!dateString) return 'N/A';
7
+ return new Date(dateString).toLocaleString();
8
+ };
9
+
10
+ return (
11
+ <div
12
+ style={{
13
+ display: 'grid',
14
+ gridTemplateColumns: 'repeat(auto-fit, minmax(200px, 1fr))',
15
+ gap: '16px',
16
+ padding: '16px',
17
+ background: colors.bgTertiary,
18
+ borderRadius: '8px',
19
+ }}
20
+ >
21
+ {status && (
22
+ <div>
23
+ <div
24
+ style={{
25
+ fontSize: '11px',
26
+ color: colors.textTertiary,
27
+ fontFamily: fonts.body,
28
+ marginBottom: '4px',
29
+ }}
30
+ >
31
+ Status
32
+ </div>
33
+ <div
34
+ style={{
35
+ fontSize: '13px',
36
+ color: colors.textPrimary,
37
+ fontFamily: fonts.body,
38
+ fontWeight: '500',
39
+ }}
40
+ >
41
+ {status}
42
+ </div>
43
+ </div>
44
+ )}
45
+ {overallRiskLevel && (
46
+ <div>
47
+ <div
48
+ style={{
49
+ fontSize: '11px',
50
+ color: colors.textTertiary,
51
+ fontFamily: fonts.body,
52
+ marginBottom: '4px',
53
+ }}
54
+ >
55
+ Overall Risk Level
56
+ </div>
57
+ <span
58
+ style={{
59
+ padding: '4px 10px',
60
+ borderRadius: '6px',
61
+ fontSize: '11px',
62
+ fontWeight: '700',
63
+ fontFamily: fonts.body,
64
+ background: getRiskLevelColor(overallRiskLevel),
65
+ color: colors.textInverse,
66
+ display: 'inline-block',
67
+ }}
68
+ >
69
+ {overallRiskLevel.toLowerCase()}
70
+ </span>
71
+ </div>
72
+ )}
73
+ {createdAt && (
74
+ <div>
75
+ <div
76
+ style={{
77
+ fontSize: '11px',
78
+ color: colors.textTertiary,
79
+ fontFamily: fonts.body,
80
+ marginBottom: '4px',
81
+ }}
82
+ >
83
+ Created At
84
+ </div>
85
+ <div
86
+ style={{
87
+ fontSize: '13px',
88
+ color: colors.textPrimary,
89
+ fontFamily: fonts.body,
90
+ fontWeight: '500',
91
+ }}
92
+ >
93
+ {formatDate(createdAt)}
94
+ </div>
95
+ </div>
96
+ )}
97
+ {updatedAt && (
98
+ <div>
99
+ <div
100
+ style={{
101
+ fontSize: '11px',
102
+ color: colors.textTertiary,
103
+ fontFamily: fonts.body,
104
+ marginBottom: '4px',
105
+ }}
106
+ >
107
+ Updated At
108
+ </div>
109
+ <div
110
+ style={{
111
+ fontSize: '13px',
112
+ color: colors.textPrimary,
113
+ fontFamily: fonts.body,
114
+ fontWeight: '500',
115
+ }}
116
+ >
117
+ {formatDate(updatedAt)}
118
+ </div>
119
+ </div>
120
+ )}
121
+ </div>
122
+ );
123
+ }