@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.
- package/LICENSE +85 -0
- package/README.md +724 -0
- package/bin/mcp-shark.js +93 -0
- package/mcp-server/.editorconfig +15 -0
- package/mcp-server/.prettierignore +11 -0
- package/mcp-server/.prettierrc +12 -0
- package/mcp-server/README.md +280 -0
- package/mcp-server/commitlint.config.cjs +42 -0
- package/mcp-server/eslint.config.js +131 -0
- package/mcp-server/lib/auditor/audit.js +228 -0
- package/mcp-server/lib/common/error.js +15 -0
- package/mcp-server/lib/server/external/all.js +32 -0
- package/mcp-server/lib/server/external/config.js +59 -0
- package/mcp-server/lib/server/external/kv.js +102 -0
- package/mcp-server/lib/server/external/single/client.js +35 -0
- package/mcp-server/lib/server/external/single/request.js +49 -0
- package/mcp-server/lib/server/external/single/run.js +75 -0
- package/mcp-server/lib/server/external/single/transport.js +57 -0
- package/mcp-server/lib/server/internal/handlers/common.js +20 -0
- package/mcp-server/lib/server/internal/handlers/error.js +7 -0
- package/mcp-server/lib/server/internal/handlers/prompts-get.js +22 -0
- package/mcp-server/lib/server/internal/handlers/prompts-list.js +12 -0
- package/mcp-server/lib/server/internal/handlers/resources-list.js +12 -0
- package/mcp-server/lib/server/internal/handlers/resources-read.js +19 -0
- package/mcp-server/lib/server/internal/handlers/tools-call.js +37 -0
- package/mcp-server/lib/server/internal/handlers/tools-list.js +14 -0
- package/mcp-server/lib/server/internal/run.js +49 -0
- package/mcp-server/lib/server/internal/server.js +63 -0
- package/mcp-server/lib/server/internal/session.js +39 -0
- package/mcp-server/mcp-shark.js +72 -0
- package/mcp-server/package-lock.json +4784 -0
- package/mcp-server/package.json +30 -0
- package/package.json +103 -0
- package/ui/README.md +212 -0
- package/ui/index.html +16 -0
- package/ui/package-lock.json +3574 -0
- package/ui/package.json +12 -0
- package/ui/paths.js +282 -0
- package/ui/public/og-image.png +0 -0
- package/ui/server/routes/backups.js +251 -0
- package/ui/server/routes/composite.js +244 -0
- package/ui/server/routes/config.js +175 -0
- package/ui/server/routes/conversations.js +25 -0
- package/ui/server/routes/help.js +43 -0
- package/ui/server/routes/logs.js +32 -0
- package/ui/server/routes/playground.js +152 -0
- package/ui/server/routes/requests.js +235 -0
- package/ui/server/routes/sessions.js +27 -0
- package/ui/server/routes/smartscan/discover.js +117 -0
- package/ui/server/routes/smartscan/scans/clearCache.js +22 -0
- package/ui/server/routes/smartscan/scans/createBatchScans.js +123 -0
- package/ui/server/routes/smartscan/scans/createScan.js +42 -0
- package/ui/server/routes/smartscan/scans/getCachedResults.js +51 -0
- package/ui/server/routes/smartscan/scans/getScan.js +41 -0
- package/ui/server/routes/smartscan/scans/listScans.js +24 -0
- package/ui/server/routes/smartscan/scans.js +13 -0
- package/ui/server/routes/smartscan/token.js +56 -0
- package/ui/server/routes/smartscan/transport.js +53 -0
- package/ui/server/routes/smartscan.js +24 -0
- package/ui/server/routes/statistics.js +83 -0
- package/ui/server/utils/config-update.js +212 -0
- package/ui/server/utils/config.js +98 -0
- package/ui/server/utils/paths.js +23 -0
- package/ui/server/utils/port.js +28 -0
- package/ui/server/utils/process.js +80 -0
- package/ui/server/utils/scan-cache/all-results.js +180 -0
- package/ui/server/utils/scan-cache/directory.js +35 -0
- package/ui/server/utils/scan-cache/file-operations.js +104 -0
- package/ui/server/utils/scan-cache/hash.js +47 -0
- package/ui/server/utils/scan-cache/server-operations.js +80 -0
- package/ui/server/utils/scan-cache.js +12 -0
- package/ui/server/utils/serialization.js +13 -0
- package/ui/server/utils/smartscan-token.js +42 -0
- package/ui/server.js +199 -0
- package/ui/src/App.jsx +153 -0
- package/ui/src/CompositeLogs.jsx +164 -0
- package/ui/src/CompositeSetup.jsx +285 -0
- package/ui/src/HelpGuide/HelpGuideContent.jsx +118 -0
- package/ui/src/HelpGuide/HelpGuideFooter.jsx +58 -0
- package/ui/src/HelpGuide/HelpGuideHeader.jsx +56 -0
- package/ui/src/HelpGuide.jsx +65 -0
- package/ui/src/IntroTour.jsx +140 -0
- package/ui/src/LogDetail.jsx +122 -0
- package/ui/src/LogTable.jsx +242 -0
- package/ui/src/PacketDetail.jsx +190 -0
- package/ui/src/PacketFilters.jsx +222 -0
- package/ui/src/PacketList.jsx +183 -0
- package/ui/src/SmartScan.jsx +178 -0
- package/ui/src/TabNavigation.jsx +143 -0
- package/ui/src/components/App/HelpButton.jsx +64 -0
- package/ui/src/components/App/TrafficTab.jsx +69 -0
- package/ui/src/components/App/useAppState.js +163 -0
- package/ui/src/components/BackupList.jsx +192 -0
- package/ui/src/components/CollapsibleSection.jsx +82 -0
- package/ui/src/components/ConfigFileSection.jsx +84 -0
- package/ui/src/components/ConfigViewerModal.jsx +141 -0
- package/ui/src/components/ConfirmationModal.jsx +129 -0
- package/ui/src/components/DetailsTab/BodySection.jsx +27 -0
- package/ui/src/components/DetailsTab/CollapsibleRequestResponse.jsx +70 -0
- package/ui/src/components/DetailsTab/HeadersSection.jsx +25 -0
- package/ui/src/components/DetailsTab/InfoSection.jsx +28 -0
- package/ui/src/components/DetailsTab/NetworkInfoSection.jsx +63 -0
- package/ui/src/components/DetailsTab/ProtocolInfoSection.jsx +75 -0
- package/ui/src/components/DetailsTab/RequestDetailsSection.jsx +46 -0
- package/ui/src/components/DetailsTab/ResponseDetailsSection.jsx +66 -0
- package/ui/src/components/DetailsTab.jsx +31 -0
- package/ui/src/components/DetectedPathsList.jsx +171 -0
- package/ui/src/components/FileInput.jsx +144 -0
- package/ui/src/components/GroupHeader.jsx +76 -0
- package/ui/src/components/GroupedByMcpView.jsx +103 -0
- package/ui/src/components/GroupedByServerView.jsx +134 -0
- package/ui/src/components/GroupedBySessionView.jsx +127 -0
- package/ui/src/components/GroupedViews.jsx +2 -0
- package/ui/src/components/HexTab.jsx +188 -0
- package/ui/src/components/LogsDisplay.jsx +93 -0
- package/ui/src/components/LogsToolbar.jsx +193 -0
- package/ui/src/components/McpPlayground/LoadingModal.jsx +113 -0
- package/ui/src/components/McpPlayground/PromptsSection/PromptCallPanel.jsx +125 -0
- package/ui/src/components/McpPlayground/PromptsSection/PromptItem.jsx +48 -0
- package/ui/src/components/McpPlayground/PromptsSection/PromptsList.jsx +45 -0
- package/ui/src/components/McpPlayground/PromptsSection.jsx +106 -0
- package/ui/src/components/McpPlayground/ResourcesSection/ResourceCallPanel.jsx +89 -0
- package/ui/src/components/McpPlayground/ResourcesSection/ResourceItem.jsx +59 -0
- package/ui/src/components/McpPlayground/ResourcesSection/ResourcesList.jsx +45 -0
- package/ui/src/components/McpPlayground/ResourcesSection.jsx +91 -0
- package/ui/src/components/McpPlayground/ToolsSection/ToolCallPanel.jsx +125 -0
- package/ui/src/components/McpPlayground/ToolsSection/ToolItem.jsx +48 -0
- package/ui/src/components/McpPlayground/ToolsSection/ToolsList.jsx +45 -0
- package/ui/src/components/McpPlayground/ToolsSection.jsx +107 -0
- package/ui/src/components/McpPlayground/common/EmptyState.jsx +17 -0
- package/ui/src/components/McpPlayground/common/ErrorState.jsx +17 -0
- package/ui/src/components/McpPlayground/common/LoadingState.jsx +17 -0
- package/ui/src/components/McpPlayground/useMcpPlayground.js +280 -0
- package/ui/src/components/McpPlayground.jsx +171 -0
- package/ui/src/components/MessageDisplay.jsx +28 -0
- package/ui/src/components/PacketDetailHeader.jsx +88 -0
- package/ui/src/components/PacketFilters/ExportControls.jsx +126 -0
- package/ui/src/components/PacketFilters/FilterInput.jsx +59 -0
- package/ui/src/components/RawTab.jsx +142 -0
- package/ui/src/components/RequestRow/OrphanedResponseRow.jsx +155 -0
- package/ui/src/components/RequestRow/RequestRowMain.jsx +240 -0
- package/ui/src/components/RequestRow/ResponseRow.jsx +158 -0
- package/ui/src/components/RequestRow.jsx +70 -0
- package/ui/src/components/ServerControl.jsx +133 -0
- package/ui/src/components/ServiceSelector.jsx +209 -0
- package/ui/src/components/SetupHeader.jsx +30 -0
- package/ui/src/components/SharkLogo.jsx +21 -0
- package/ui/src/components/SmartScan/AnalysisResult.jsx +64 -0
- package/ui/src/components/SmartScan/BatchResultsDisplay/BatchResultItem.jsx +215 -0
- package/ui/src/components/SmartScan/BatchResultsDisplay/BatchResultsHeader.jsx +94 -0
- package/ui/src/components/SmartScan/BatchResultsDisplay.jsx +26 -0
- package/ui/src/components/SmartScan/DebugInfoSection.jsx +53 -0
- package/ui/src/components/SmartScan/EmptyState.jsx +57 -0
- package/ui/src/components/SmartScan/ErrorDisplay.jsx +48 -0
- package/ui/src/components/SmartScan/ExpandableSection.jsx +93 -0
- package/ui/src/components/SmartScan/FindingsTable.jsx +257 -0
- package/ui/src/components/SmartScan/ListViewContent.jsx +75 -0
- package/ui/src/components/SmartScan/NotablePatternsSection.jsx +75 -0
- package/ui/src/components/SmartScan/OverallSummarySection.jsx +72 -0
- package/ui/src/components/SmartScan/RawDataSection.jsx +52 -0
- package/ui/src/components/SmartScan/RecommendationsSection.jsx +78 -0
- package/ui/src/components/SmartScan/ScanDetailHeader.jsx +92 -0
- package/ui/src/components/SmartScan/ScanDetailView.jsx +141 -0
- package/ui/src/components/SmartScan/ScanListView/ScanListHeader.jsx +49 -0
- package/ui/src/components/SmartScan/ScanListView/ScanListItem.jsx +201 -0
- package/ui/src/components/SmartScan/ScanListView.jsx +73 -0
- package/ui/src/components/SmartScan/ScanOverviewSection.jsx +123 -0
- package/ui/src/components/SmartScan/ScanResultsDisplay.jsx +35 -0
- package/ui/src/components/SmartScan/ScanViewContent.jsx +68 -0
- package/ui/src/components/SmartScan/ScanningProgress.jsx +47 -0
- package/ui/src/components/SmartScan/ServerInfoSection.jsx +43 -0
- package/ui/src/components/SmartScan/ServerSelectionRow.jsx +207 -0
- package/ui/src/components/SmartScan/SingleResultDisplay.jsx +269 -0
- package/ui/src/components/SmartScan/SmartScanControls.jsx +290 -0
- package/ui/src/components/SmartScan/SmartScanHeader.jsx +77 -0
- package/ui/src/components/SmartScan/ViewModeTabs.jsx +57 -0
- package/ui/src/components/SmartScan/hooks/useCacheManagement.js +34 -0
- package/ui/src/components/SmartScan/hooks/useMcpDiscovery.js +121 -0
- package/ui/src/components/SmartScan/hooks/useScanList.js +193 -0
- package/ui/src/components/SmartScan/hooks/useScanOperations.js +87 -0
- package/ui/src/components/SmartScan/hooks/useServerStatus.js +26 -0
- package/ui/src/components/SmartScan/hooks/useTokenManagement.js +53 -0
- package/ui/src/components/SmartScan/scanDataUtils.js +98 -0
- package/ui/src/components/SmartScan/useSmartScan.js +72 -0
- package/ui/src/components/SmartScan/utils.js +19 -0
- package/ui/src/components/SmartScanIcons.jsx +58 -0
- package/ui/src/components/TabNavigation/DesktopTabs.jsx +111 -0
- package/ui/src/components/TabNavigation/MobileDropdown.jsx +140 -0
- package/ui/src/components/TabNavigation.jsx +97 -0
- package/ui/src/components/TabNavigationIcons.jsx +40 -0
- package/ui/src/components/TableHeader.jsx +164 -0
- package/ui/src/components/TourOverlay.jsx +117 -0
- package/ui/src/components/TourTooltip/TourTooltipButtons.jsx +117 -0
- package/ui/src/components/TourTooltip/TourTooltipHeader.jsx +70 -0
- package/ui/src/components/TourTooltip/TourTooltipIcons.jsx +45 -0
- package/ui/src/components/TourTooltip/useTooltipPosition.js +108 -0
- package/ui/src/components/TourTooltip.jsx +83 -0
- package/ui/src/components/ViewModeTabs.jsx +91 -0
- package/ui/src/components/WhatThisDoesSection.jsx +61 -0
- package/ui/src/config/tourSteps.jsx +141 -0
- package/ui/src/hooks/useAnimation.js +92 -0
- package/ui/src/hooks/useConfigManagement.js +124 -0
- package/ui/src/hooks/useServiceExtraction.js +51 -0
- package/ui/src/index.css +42 -0
- package/ui/src/main.jsx +10 -0
- package/ui/src/theme.js +65 -0
- package/ui/src/utils/animations.js +170 -0
- package/ui/src/utils/groupingUtils.js +93 -0
- package/ui/src/utils/hexUtils.js +24 -0
- package/ui/src/utils/mcpGroupingUtils.js +262 -0
- package/ui/src/utils/requestUtils.js +297 -0
- package/ui/vite.config.js +18 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { colors } from '../../theme';
|
|
2
|
+
import EmptyState from './EmptyState';
|
|
3
|
+
import ErrorDisplay from './ErrorDisplay';
|
|
4
|
+
import ScanningProgress from './ScanningProgress';
|
|
5
|
+
import BatchResultsDisplay from './BatchResultsDisplay';
|
|
6
|
+
import SingleResultDisplay from './SingleResultDisplay';
|
|
7
|
+
|
|
8
|
+
export default function ScanResultsDisplay({
|
|
9
|
+
error,
|
|
10
|
+
scanning,
|
|
11
|
+
selectedServers,
|
|
12
|
+
scanResults,
|
|
13
|
+
scanResult,
|
|
14
|
+
onViewScan,
|
|
15
|
+
}) {
|
|
16
|
+
return (
|
|
17
|
+
<div
|
|
18
|
+
style={{
|
|
19
|
+
flex: 1,
|
|
20
|
+
overflowY: 'auto',
|
|
21
|
+
overflowX: 'hidden',
|
|
22
|
+
padding: '24px',
|
|
23
|
+
background: colors.bgPrimary,
|
|
24
|
+
}}
|
|
25
|
+
>
|
|
26
|
+
{!error && scanResults.length === 0 && !scanResult && !scanning && <EmptyState />}
|
|
27
|
+
<ErrorDisplay error={error} />
|
|
28
|
+
<ScanningProgress scanning={scanning} selectedServers={selectedServers} />
|
|
29
|
+
{scanResults.length > 0 && (
|
|
30
|
+
<BatchResultsDisplay scanResults={scanResults} onViewScan={onViewScan} />
|
|
31
|
+
)}
|
|
32
|
+
{scanResult && scanResults.length === 0 && <SingleResultDisplay scanResult={scanResult} />}
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { colors } from '../../theme';
|
|
2
|
+
import ServerSelectionRow from './ServerSelectionRow';
|
|
3
|
+
import ScanResultsDisplay from './ScanResultsDisplay';
|
|
4
|
+
import ScanDetailView from './ScanDetailView';
|
|
5
|
+
|
|
6
|
+
export default function ScanViewContent({
|
|
7
|
+
discoveredServers,
|
|
8
|
+
selectedServers,
|
|
9
|
+
setSelectedServers,
|
|
10
|
+
runScan,
|
|
11
|
+
scanning,
|
|
12
|
+
apiToken,
|
|
13
|
+
error,
|
|
14
|
+
scanResults,
|
|
15
|
+
scanResult,
|
|
16
|
+
selectedScan,
|
|
17
|
+
loadingScanDetail,
|
|
18
|
+
setSelectedScan,
|
|
19
|
+
loadScanDetail,
|
|
20
|
+
onViewScan,
|
|
21
|
+
}) {
|
|
22
|
+
if (selectedScan) {
|
|
23
|
+
return (
|
|
24
|
+
<div
|
|
25
|
+
style={{
|
|
26
|
+
flex: 1,
|
|
27
|
+
overflowY: 'auto',
|
|
28
|
+
overflowX: 'hidden',
|
|
29
|
+
padding: '24px',
|
|
30
|
+
background: colors.bgPrimary,
|
|
31
|
+
}}
|
|
32
|
+
>
|
|
33
|
+
<ScanDetailView
|
|
34
|
+
scan={selectedScan}
|
|
35
|
+
loading={loadingScanDetail}
|
|
36
|
+
onClose={() => {
|
|
37
|
+
setSelectedScan(null);
|
|
38
|
+
loadScanDetail(null);
|
|
39
|
+
}}
|
|
40
|
+
/>
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<>
|
|
47
|
+
{discoveredServers.length > 0 && (
|
|
48
|
+
<ServerSelectionRow
|
|
49
|
+
discoveredServers={discoveredServers}
|
|
50
|
+
selectedServers={selectedServers}
|
|
51
|
+
setSelectedServers={setSelectedServers}
|
|
52
|
+
runScan={runScan}
|
|
53
|
+
scanning={scanning}
|
|
54
|
+
apiToken={apiToken}
|
|
55
|
+
/>
|
|
56
|
+
)}
|
|
57
|
+
|
|
58
|
+
<ScanResultsDisplay
|
|
59
|
+
error={error}
|
|
60
|
+
scanning={scanning}
|
|
61
|
+
selectedServers={selectedServers}
|
|
62
|
+
scanResults={scanResults}
|
|
63
|
+
scanResult={scanResult}
|
|
64
|
+
onViewScan={onViewScan}
|
|
65
|
+
/>
|
|
66
|
+
</>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { LoadingSpinner } from '../SmartScanIcons';
|
|
2
|
+
import { colors, fonts } from '../../theme';
|
|
3
|
+
|
|
4
|
+
export default function ScanningProgress({ scanning, selectedServers }) {
|
|
5
|
+
if (!scanning) return null;
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<div
|
|
9
|
+
style={{
|
|
10
|
+
background: colors.bgCard,
|
|
11
|
+
border: `1px solid ${colors.borderLight}`,
|
|
12
|
+
borderRadius: '12px',
|
|
13
|
+
padding: '24px',
|
|
14
|
+
marginBottom: '24px',
|
|
15
|
+
boxShadow: `0 2px 8px ${colors.shadowSm}`,
|
|
16
|
+
}}
|
|
17
|
+
>
|
|
18
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
|
|
19
|
+
<LoadingSpinner size={20} />
|
|
20
|
+
<div style={{ flex: 1 }}>
|
|
21
|
+
<p
|
|
22
|
+
style={{
|
|
23
|
+
fontSize: '14px',
|
|
24
|
+
fontWeight: '600',
|
|
25
|
+
color: colors.textPrimary,
|
|
26
|
+
fontFamily: fonts.body,
|
|
27
|
+
margin: 0,
|
|
28
|
+
marginBottom: '4px',
|
|
29
|
+
}}
|
|
30
|
+
>
|
|
31
|
+
Scanning {selectedServers.size} server{selectedServers.size !== 1 ? 's' : ''}...
|
|
32
|
+
</p>
|
|
33
|
+
<p
|
|
34
|
+
style={{
|
|
35
|
+
fontSize: '12px',
|
|
36
|
+
color: colors.textSecondary,
|
|
37
|
+
fontFamily: fonts.body,
|
|
38
|
+
margin: 0,
|
|
39
|
+
}}
|
|
40
|
+
>
|
|
41
|
+
Analyzing security vulnerabilities and risks
|
|
42
|
+
</p>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { colors, fonts } from '../../theme';
|
|
2
|
+
|
|
3
|
+
export default function ServerInfoSection({ serverData }) {
|
|
4
|
+
if (!serverData) return null;
|
|
5
|
+
|
|
6
|
+
return (
|
|
7
|
+
<div style={{ marginBottom: '24px' }}>
|
|
8
|
+
<h3
|
|
9
|
+
style={{
|
|
10
|
+
fontSize: '13px',
|
|
11
|
+
fontWeight: '600',
|
|
12
|
+
color: colors.textPrimary,
|
|
13
|
+
fontFamily: fonts.body,
|
|
14
|
+
marginBottom: '12px',
|
|
15
|
+
paddingBottom: '8px',
|
|
16
|
+
borderBottom: `1px solid ${colors.borderLight}`,
|
|
17
|
+
}}
|
|
18
|
+
>
|
|
19
|
+
Server Information
|
|
20
|
+
</h3>
|
|
21
|
+
<div
|
|
22
|
+
style={{
|
|
23
|
+
padding: '12px',
|
|
24
|
+
background: colors.bgTertiary,
|
|
25
|
+
borderRadius: '6px',
|
|
26
|
+
fontSize: '12px',
|
|
27
|
+
fontFamily: fonts.body,
|
|
28
|
+
}}
|
|
29
|
+
>
|
|
30
|
+
<div style={{ marginBottom: '8px' }}>
|
|
31
|
+
<strong style={{ color: colors.textTertiary }}>Name: </strong>
|
|
32
|
+
<span style={{ color: colors.textPrimary }}>{serverData.name || 'N/A'}</span>
|
|
33
|
+
</div>
|
|
34
|
+
{serverData.description && (
|
|
35
|
+
<div>
|
|
36
|
+
<strong style={{ color: colors.textTertiary }}>Description: </strong>
|
|
37
|
+
<span style={{ color: colors.textPrimary }}>{serverData.description}</span>
|
|
38
|
+
</div>
|
|
39
|
+
)}
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { CheckIcon, ShieldIcon, LoadingSpinner } from '../SmartScanIcons';
|
|
2
|
+
import { colors, fonts } from '../../theme';
|
|
3
|
+
|
|
4
|
+
export default function ServerSelectionRow({
|
|
5
|
+
discoveredServers,
|
|
6
|
+
selectedServers,
|
|
7
|
+
setSelectedServers,
|
|
8
|
+
runScan,
|
|
9
|
+
scanning,
|
|
10
|
+
apiToken,
|
|
11
|
+
}) {
|
|
12
|
+
const toggleSelectAll = () => {
|
|
13
|
+
if (selectedServers.size === discoveredServers.length) {
|
|
14
|
+
setSelectedServers(new Set());
|
|
15
|
+
} else {
|
|
16
|
+
setSelectedServers(new Set(discoveredServers.map((s) => s.name)));
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div
|
|
22
|
+
style={{
|
|
23
|
+
background: colors.bgSecondary,
|
|
24
|
+
borderBottom: `1px solid ${colors.borderLight}`,
|
|
25
|
+
padding: '12px 24px',
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
28
|
+
<div
|
|
29
|
+
style={{
|
|
30
|
+
display: 'flex',
|
|
31
|
+
alignItems: 'center',
|
|
32
|
+
gap: '16px',
|
|
33
|
+
flexWrap: 'wrap',
|
|
34
|
+
}}
|
|
35
|
+
>
|
|
36
|
+
<div
|
|
37
|
+
style={{
|
|
38
|
+
fontSize: '12px',
|
|
39
|
+
fontWeight: '600',
|
|
40
|
+
color: colors.textSecondary,
|
|
41
|
+
fontFamily: fonts.body,
|
|
42
|
+
whiteSpace: 'nowrap',
|
|
43
|
+
}}
|
|
44
|
+
>
|
|
45
|
+
Select servers to scan:
|
|
46
|
+
</div>
|
|
47
|
+
<div
|
|
48
|
+
style={{
|
|
49
|
+
display: 'flex',
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
gap: '12px',
|
|
52
|
+
flexWrap: 'wrap',
|
|
53
|
+
flex: 1,
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
{discoveredServers.map((server, idx) => {
|
|
57
|
+
const isSelected = selectedServers.has(server.name);
|
|
58
|
+
return (
|
|
59
|
+
<label
|
|
60
|
+
key={idx}
|
|
61
|
+
style={{
|
|
62
|
+
display: 'flex',
|
|
63
|
+
alignItems: 'center',
|
|
64
|
+
gap: '8px',
|
|
65
|
+
padding: '8px 12px',
|
|
66
|
+
background: isSelected ? colors.bgCard : colors.bgTertiary,
|
|
67
|
+
border: `1px solid ${isSelected ? colors.accentBlue : colors.borderLight}`,
|
|
68
|
+
borderRadius: '8px',
|
|
69
|
+
cursor: 'pointer',
|
|
70
|
+
transition: 'all 0.2s ease',
|
|
71
|
+
fontSize: '12px',
|
|
72
|
+
fontFamily: fonts.body,
|
|
73
|
+
fontWeight: isSelected ? '600' : '500',
|
|
74
|
+
color: isSelected ? colors.textPrimary : colors.textSecondary,
|
|
75
|
+
}}
|
|
76
|
+
onMouseEnter={(e) => {
|
|
77
|
+
e.currentTarget.style.borderColor = colors.accentBlue;
|
|
78
|
+
e.currentTarget.style.boxShadow = `0 2px 4px ${colors.shadowSm}`;
|
|
79
|
+
}}
|
|
80
|
+
onMouseLeave={(e) => {
|
|
81
|
+
if (!isSelected) {
|
|
82
|
+
e.currentTarget.style.borderColor = colors.borderLight;
|
|
83
|
+
e.currentTarget.style.boxShadow = 'none';
|
|
84
|
+
}
|
|
85
|
+
}}
|
|
86
|
+
>
|
|
87
|
+
<input
|
|
88
|
+
type="checkbox"
|
|
89
|
+
checked={isSelected}
|
|
90
|
+
onChange={(e) => {
|
|
91
|
+
const newSelected = new Set(selectedServers);
|
|
92
|
+
if (e.target.checked) {
|
|
93
|
+
newSelected.add(server.name);
|
|
94
|
+
} else {
|
|
95
|
+
newSelected.delete(server.name);
|
|
96
|
+
}
|
|
97
|
+
setSelectedServers(newSelected);
|
|
98
|
+
}}
|
|
99
|
+
style={{
|
|
100
|
+
width: '16px',
|
|
101
|
+
height: '16px',
|
|
102
|
+
cursor: 'pointer',
|
|
103
|
+
accentColor: colors.accentBlue,
|
|
104
|
+
}}
|
|
105
|
+
/>
|
|
106
|
+
<span>{server.name}</span>
|
|
107
|
+
<span
|
|
108
|
+
style={{
|
|
109
|
+
fontSize: '10px',
|
|
110
|
+
color: colors.textTertiary,
|
|
111
|
+
fontWeight: '400',
|
|
112
|
+
}}
|
|
113
|
+
>
|
|
114
|
+
({server.tools?.length || 0} tools, {server.resources?.length || 0} resources,{' '}
|
|
115
|
+
{server.prompts?.length || 0} prompts)
|
|
116
|
+
</span>
|
|
117
|
+
</label>
|
|
118
|
+
);
|
|
119
|
+
})}
|
|
120
|
+
</div>
|
|
121
|
+
<button
|
|
122
|
+
onClick={toggleSelectAll}
|
|
123
|
+
style={{
|
|
124
|
+
padding: '6px 12px',
|
|
125
|
+
background: colors.buttonSecondary,
|
|
126
|
+
color: colors.textPrimary,
|
|
127
|
+
border: `1px solid ${colors.borderMedium}`,
|
|
128
|
+
borderRadius: '6px',
|
|
129
|
+
fontSize: '11px',
|
|
130
|
+
fontWeight: '600',
|
|
131
|
+
fontFamily: fonts.body,
|
|
132
|
+
cursor: 'pointer',
|
|
133
|
+
transition: 'all 0.2s ease',
|
|
134
|
+
whiteSpace: 'nowrap',
|
|
135
|
+
}}
|
|
136
|
+
onMouseEnter={(e) => {
|
|
137
|
+
e.currentTarget.style.background = colors.buttonSecondaryHover;
|
|
138
|
+
}}
|
|
139
|
+
onMouseLeave={(e) => {
|
|
140
|
+
e.currentTarget.style.background = colors.buttonSecondary;
|
|
141
|
+
}}
|
|
142
|
+
>
|
|
143
|
+
{selectedServers.size === discoveredServers.length ? 'Deselect All' : 'Select All'}
|
|
144
|
+
</button>
|
|
145
|
+
<button
|
|
146
|
+
onClick={runScan}
|
|
147
|
+
disabled={!apiToken || selectedServers.size === 0 || scanning}
|
|
148
|
+
style={{
|
|
149
|
+
padding: '8px 16px',
|
|
150
|
+
background:
|
|
151
|
+
apiToken && selectedServers.size > 0 && !scanning
|
|
152
|
+
? colors.buttonPrimary
|
|
153
|
+
: colors.buttonSecondary,
|
|
154
|
+
color:
|
|
155
|
+
apiToken && selectedServers.size > 0 && !scanning
|
|
156
|
+
? colors.textInverse
|
|
157
|
+
: colors.textTertiary,
|
|
158
|
+
border: 'none',
|
|
159
|
+
borderRadius: '6px',
|
|
160
|
+
fontSize: '13px',
|
|
161
|
+
fontWeight: '600',
|
|
162
|
+
fontFamily: fonts.body,
|
|
163
|
+
cursor: apiToken && selectedServers.size > 0 && !scanning ? 'pointer' : 'not-allowed',
|
|
164
|
+
transition: 'all 0.2s ease',
|
|
165
|
+
display: 'flex',
|
|
166
|
+
alignItems: 'center',
|
|
167
|
+
gap: '8px',
|
|
168
|
+
whiteSpace: 'nowrap',
|
|
169
|
+
}}
|
|
170
|
+
onMouseEnter={(e) => {
|
|
171
|
+
if (apiToken && selectedServers.size > 0 && !scanning) {
|
|
172
|
+
e.currentTarget.style.background = colors.buttonPrimaryHover;
|
|
173
|
+
e.currentTarget.style.transform = 'translateY(-1px)';
|
|
174
|
+
e.currentTarget.style.boxShadow = `0 4px 12px ${colors.shadowMd}`;
|
|
175
|
+
}
|
|
176
|
+
}}
|
|
177
|
+
onMouseLeave={(e) => {
|
|
178
|
+
if (apiToken && selectedServers.size > 0 && !scanning) {
|
|
179
|
+
e.currentTarget.style.background = colors.buttonPrimary;
|
|
180
|
+
e.currentTarget.style.transform = 'translateY(0)';
|
|
181
|
+
e.currentTarget.style.boxShadow = 'none';
|
|
182
|
+
}
|
|
183
|
+
}}
|
|
184
|
+
>
|
|
185
|
+
{scanning ? (
|
|
186
|
+
<>
|
|
187
|
+
<LoadingSpinner size={14} color={colors.textInverse} />
|
|
188
|
+
<span>
|
|
189
|
+
Scanning {selectedServers.size} server{selectedServers.size !== 1 ? 's' : ''}...
|
|
190
|
+
</span>
|
|
191
|
+
</>
|
|
192
|
+
) : (
|
|
193
|
+
<>
|
|
194
|
+
<ShieldIcon
|
|
195
|
+
size={14}
|
|
196
|
+
color={
|
|
197
|
+
apiToken && selectedServers.size > 0 ? colors.textInverse : colors.textTertiary
|
|
198
|
+
}
|
|
199
|
+
/>
|
|
200
|
+
<span>Run Scan ({selectedServers.size})</span>
|
|
201
|
+
</>
|
|
202
|
+
)}
|
|
203
|
+
</button>
|
|
204
|
+
</div>
|
|
205
|
+
</div>
|
|
206
|
+
);
|
|
207
|
+
}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { ExternalLinkIcon } from '../SmartScanIcons';
|
|
2
|
+
import { colors, fonts } from '../../theme';
|
|
3
|
+
import { getRiskLevelColor } from './utils';
|
|
4
|
+
|
|
5
|
+
export default function SingleResultDisplay({ scanResult }) {
|
|
6
|
+
if (!scanResult) return null;
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<div
|
|
10
|
+
style={{
|
|
11
|
+
background: colors.bgCard,
|
|
12
|
+
border: `1px solid ${colors.borderLight}`,
|
|
13
|
+
borderRadius: '8px',
|
|
14
|
+
padding: '20px',
|
|
15
|
+
boxShadow: `0 1px 3px ${colors.shadowSm}`,
|
|
16
|
+
}}
|
|
17
|
+
>
|
|
18
|
+
<h2
|
|
19
|
+
style={{
|
|
20
|
+
fontSize: '16px',
|
|
21
|
+
fontWeight: '600',
|
|
22
|
+
color: colors.textPrimary,
|
|
23
|
+
fontFamily: fonts.body,
|
|
24
|
+
marginBottom: '16px',
|
|
25
|
+
}}
|
|
26
|
+
>
|
|
27
|
+
Scan Results
|
|
28
|
+
</h2>
|
|
29
|
+
|
|
30
|
+
{/* Overall Risk */}
|
|
31
|
+
{scanResult.data?.overall_risk_level && (
|
|
32
|
+
<div
|
|
33
|
+
style={{
|
|
34
|
+
background: colors.bgTertiary,
|
|
35
|
+
border: `1px solid ${colors.borderLight}`,
|
|
36
|
+
borderRadius: '8px',
|
|
37
|
+
padding: '16px',
|
|
38
|
+
marginBottom: '20px',
|
|
39
|
+
}}
|
|
40
|
+
>
|
|
41
|
+
<div
|
|
42
|
+
style={{
|
|
43
|
+
display: 'flex',
|
|
44
|
+
alignItems: 'center',
|
|
45
|
+
gap: '12px',
|
|
46
|
+
marginBottom: '8px',
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
<span
|
|
50
|
+
style={{
|
|
51
|
+
padding: '4px 12px',
|
|
52
|
+
borderRadius: '6px',
|
|
53
|
+
fontSize: '12px',
|
|
54
|
+
fontWeight: '700',
|
|
55
|
+
fontFamily: fonts.body,
|
|
56
|
+
background: getRiskLevelColor(scanResult.data.overall_risk_level),
|
|
57
|
+
color: colors.textInverse,
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
60
|
+
{scanResult.data.overall_risk_level.toUpperCase()}
|
|
61
|
+
</span>
|
|
62
|
+
<span
|
|
63
|
+
style={{
|
|
64
|
+
fontSize: '14px',
|
|
65
|
+
color: colors.textSecondary,
|
|
66
|
+
fontFamily: fonts.body,
|
|
67
|
+
}}
|
|
68
|
+
>
|
|
69
|
+
Overall Risk Level
|
|
70
|
+
</span>
|
|
71
|
+
</div>
|
|
72
|
+
{scanResult.data.overall_reason && (
|
|
73
|
+
<p
|
|
74
|
+
style={{
|
|
75
|
+
fontSize: '13px',
|
|
76
|
+
color: colors.textSecondary,
|
|
77
|
+
fontFamily: fonts.body,
|
|
78
|
+
margin: 0,
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
{scanResult.data.overall_reason}
|
|
82
|
+
</p>
|
|
83
|
+
)}
|
|
84
|
+
</div>
|
|
85
|
+
)}
|
|
86
|
+
|
|
87
|
+
{/* Findings Summary */}
|
|
88
|
+
<div
|
|
89
|
+
style={{
|
|
90
|
+
display: 'grid',
|
|
91
|
+
gridTemplateColumns: 'repeat(auto-fit, minmax(200px, 1fr))',
|
|
92
|
+
gap: '12px',
|
|
93
|
+
marginBottom: '20px',
|
|
94
|
+
}}
|
|
95
|
+
>
|
|
96
|
+
{scanResult.data?.tool_findings?.length > 0 && (
|
|
97
|
+
<div
|
|
98
|
+
style={{
|
|
99
|
+
background: colors.bgTertiary,
|
|
100
|
+
border: `1px solid ${colors.borderLight}`,
|
|
101
|
+
borderRadius: '8px',
|
|
102
|
+
padding: '12px',
|
|
103
|
+
}}
|
|
104
|
+
>
|
|
105
|
+
<div
|
|
106
|
+
style={{
|
|
107
|
+
fontSize: '24px',
|
|
108
|
+
fontWeight: '700',
|
|
109
|
+
color: colors.textPrimary,
|
|
110
|
+
fontFamily: fonts.body,
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
{scanResult.data.tool_findings.length}
|
|
114
|
+
</div>
|
|
115
|
+
<div
|
|
116
|
+
style={{
|
|
117
|
+
fontSize: '12px',
|
|
118
|
+
color: colors.textSecondary,
|
|
119
|
+
fontFamily: fonts.body,
|
|
120
|
+
}}
|
|
121
|
+
>
|
|
122
|
+
Tool Findings
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
)}
|
|
126
|
+
{scanResult.data?.resource_findings?.length > 0 && (
|
|
127
|
+
<div
|
|
128
|
+
style={{
|
|
129
|
+
background: colors.bgTertiary,
|
|
130
|
+
border: `1px solid ${colors.borderLight}`,
|
|
131
|
+
borderRadius: '8px',
|
|
132
|
+
padding: '12px',
|
|
133
|
+
}}
|
|
134
|
+
>
|
|
135
|
+
<div
|
|
136
|
+
style={{
|
|
137
|
+
fontSize: '24px',
|
|
138
|
+
fontWeight: '700',
|
|
139
|
+
color: colors.textPrimary,
|
|
140
|
+
fontFamily: fonts.body,
|
|
141
|
+
}}
|
|
142
|
+
>
|
|
143
|
+
{scanResult.data.resource_findings.length}
|
|
144
|
+
</div>
|
|
145
|
+
<div
|
|
146
|
+
style={{
|
|
147
|
+
fontSize: '12px',
|
|
148
|
+
color: colors.textSecondary,
|
|
149
|
+
fontFamily: fonts.body,
|
|
150
|
+
}}
|
|
151
|
+
>
|
|
152
|
+
Resource Findings
|
|
153
|
+
</div>
|
|
154
|
+
</div>
|
|
155
|
+
)}
|
|
156
|
+
{scanResult.data?.prompt_findings?.length > 0 && (
|
|
157
|
+
<div
|
|
158
|
+
style={{
|
|
159
|
+
background: colors.bgTertiary,
|
|
160
|
+
border: `1px solid ${colors.borderLight}`,
|
|
161
|
+
borderRadius: '8px',
|
|
162
|
+
padding: '12px',
|
|
163
|
+
}}
|
|
164
|
+
>
|
|
165
|
+
<div
|
|
166
|
+
style={{
|
|
167
|
+
fontSize: '24px',
|
|
168
|
+
fontWeight: '700',
|
|
169
|
+
color: colors.textPrimary,
|
|
170
|
+
fontFamily: fonts.body,
|
|
171
|
+
}}
|
|
172
|
+
>
|
|
173
|
+
{scanResult.data.prompt_findings.length}
|
|
174
|
+
</div>
|
|
175
|
+
<div
|
|
176
|
+
style={{
|
|
177
|
+
fontSize: '12px',
|
|
178
|
+
color: colors.textSecondary,
|
|
179
|
+
fontFamily: fonts.body,
|
|
180
|
+
}}
|
|
181
|
+
>
|
|
182
|
+
Prompt Findings
|
|
183
|
+
</div>
|
|
184
|
+
</div>
|
|
185
|
+
)}
|
|
186
|
+
</div>
|
|
187
|
+
|
|
188
|
+
{/* Recommendations */}
|
|
189
|
+
{scanResult.data?.recommendations?.length > 0 && (
|
|
190
|
+
<div
|
|
191
|
+
style={{
|
|
192
|
+
background: colors.bgTertiary,
|
|
193
|
+
border: `1px solid ${colors.borderLight}`,
|
|
194
|
+
borderRadius: '8px',
|
|
195
|
+
padding: '16px',
|
|
196
|
+
marginBottom: '20px',
|
|
197
|
+
}}
|
|
198
|
+
>
|
|
199
|
+
<h3
|
|
200
|
+
style={{
|
|
201
|
+
fontSize: '14px',
|
|
202
|
+
fontWeight: '600',
|
|
203
|
+
color: colors.textPrimary,
|
|
204
|
+
fontFamily: fonts.body,
|
|
205
|
+
marginBottom: '12px',
|
|
206
|
+
}}
|
|
207
|
+
>
|
|
208
|
+
Recommendations
|
|
209
|
+
</h3>
|
|
210
|
+
<ul
|
|
211
|
+
style={{
|
|
212
|
+
margin: 0,
|
|
213
|
+
paddingLeft: '20px',
|
|
214
|
+
fontSize: '13px',
|
|
215
|
+
color: colors.textSecondary,
|
|
216
|
+
fontFamily: fonts.body,
|
|
217
|
+
lineHeight: '1.8',
|
|
218
|
+
}}
|
|
219
|
+
>
|
|
220
|
+
{scanResult.data.recommendations.map((rec, idx) => (
|
|
221
|
+
<li key={idx}>{rec}</li>
|
|
222
|
+
))}
|
|
223
|
+
</ul>
|
|
224
|
+
</div>
|
|
225
|
+
)}
|
|
226
|
+
|
|
227
|
+
{/* View Full Results Link */}
|
|
228
|
+
{scanResult.scan_id && (
|
|
229
|
+
<div
|
|
230
|
+
style={{
|
|
231
|
+
marginTop: '20px',
|
|
232
|
+
paddingTop: '20px',
|
|
233
|
+
borderTop: `1px solid ${colors.borderLight}`,
|
|
234
|
+
}}
|
|
235
|
+
>
|
|
236
|
+
<a
|
|
237
|
+
href={`https://smart.mcpshark.sh/scan-results?id=${scanResult.scan_id}`}
|
|
238
|
+
target="_blank"
|
|
239
|
+
rel="noopener noreferrer"
|
|
240
|
+
style={{
|
|
241
|
+
display: 'inline-flex',
|
|
242
|
+
alignItems: 'center',
|
|
243
|
+
gap: '8px',
|
|
244
|
+
padding: '10px 20px',
|
|
245
|
+
background: colors.buttonSecondary,
|
|
246
|
+
color: colors.textPrimary,
|
|
247
|
+
border: `1px solid ${colors.borderMedium}`,
|
|
248
|
+
borderRadius: '8px',
|
|
249
|
+
textDecoration: 'none',
|
|
250
|
+
fontSize: '13px',
|
|
251
|
+
fontWeight: '600',
|
|
252
|
+
fontFamily: fonts.body,
|
|
253
|
+
transition: 'all 0.2s ease',
|
|
254
|
+
}}
|
|
255
|
+
onMouseEnter={(e) => {
|
|
256
|
+
e.currentTarget.style.background = colors.buttonSecondaryHover;
|
|
257
|
+
}}
|
|
258
|
+
onMouseLeave={(e) => {
|
|
259
|
+
e.currentTarget.style.background = colors.buttonSecondary;
|
|
260
|
+
}}
|
|
261
|
+
>
|
|
262
|
+
<span>View Full Results</span>
|
|
263
|
+
<ExternalLinkIcon size={14} color={colors.textPrimary} />
|
|
264
|
+
</a>
|
|
265
|
+
</div>
|
|
266
|
+
)}
|
|
267
|
+
</div>
|
|
268
|
+
);
|
|
269
|
+
}
|