@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,103 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { colors, fonts } from '../theme';
|
|
3
|
+
import RequestRow from './RequestRow';
|
|
4
|
+
import GroupHeader from './GroupHeader';
|
|
5
|
+
import { getCategoryIconComponent, getMethodDescription } from '../utils/mcpGroupingUtils';
|
|
6
|
+
import { getJsonRpcMethod } from '../utils/requestUtils';
|
|
7
|
+
|
|
8
|
+
function GroupedByMcpView({
|
|
9
|
+
groupedData,
|
|
10
|
+
selected,
|
|
11
|
+
firstRequestTime,
|
|
12
|
+
onSelect,
|
|
13
|
+
expandedSessions,
|
|
14
|
+
expandedCategories,
|
|
15
|
+
onToggleSession,
|
|
16
|
+
onToggleCategory,
|
|
17
|
+
}) {
|
|
18
|
+
const getJsonRpcMethodFromPair = (pair) => {
|
|
19
|
+
const request = pair.request || pair.response;
|
|
20
|
+
if (!request) return null;
|
|
21
|
+
return getJsonRpcMethod(request);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<tbody>
|
|
26
|
+
{groupedData.map((sessionGroup) => {
|
|
27
|
+
const sessionKey = sessionGroup.sessionId || '__NO_SESSION__';
|
|
28
|
+
const isSessionExpanded = expandedSessions.has(sessionKey);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<React.Fragment key={sessionKey}>
|
|
32
|
+
<GroupHeader
|
|
33
|
+
onClick={() => onToggleSession(sessionKey)}
|
|
34
|
+
isExpanded={isSessionExpanded}
|
|
35
|
+
indent={0}
|
|
36
|
+
>
|
|
37
|
+
<span style={{ color: colors.accentBlue, marginRight: '8px' }}>
|
|
38
|
+
Session: {sessionGroup.sessionId || 'No Session'}
|
|
39
|
+
</span>
|
|
40
|
+
<span style={{ color: colors.textTertiary, fontSize: '11px', fontWeight: '400' }}>
|
|
41
|
+
({sessionGroup.categories.reduce((sum, cat) => sum + cat.pairs.length, 0)}{' '}
|
|
42
|
+
operations)
|
|
43
|
+
</span>
|
|
44
|
+
</GroupHeader>
|
|
45
|
+
|
|
46
|
+
{isSessionExpanded &&
|
|
47
|
+
sessionGroup.categories.map((categoryGroup) => {
|
|
48
|
+
const categoryKey = `${sessionKey}::${categoryGroup.category}`;
|
|
49
|
+
const isCategoryExpanded = expandedCategories.has(categoryKey);
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<React.Fragment key={categoryKey}>
|
|
53
|
+
<GroupHeader
|
|
54
|
+
onClick={() => onToggleCategory(categoryKey)}
|
|
55
|
+
isExpanded={isCategoryExpanded}
|
|
56
|
+
indent={1}
|
|
57
|
+
>
|
|
58
|
+
<span
|
|
59
|
+
style={{ marginRight: '8px', display: 'inline-flex', alignItems: 'center' }}
|
|
60
|
+
>
|
|
61
|
+
{React.createElement(getCategoryIconComponent(categoryGroup.category), {
|
|
62
|
+
size: 16,
|
|
63
|
+
stroke: 1.5,
|
|
64
|
+
color: colors.accentBlue,
|
|
65
|
+
})}
|
|
66
|
+
</span>
|
|
67
|
+
<span style={{ color: colors.textPrimary }}>{categoryGroup.label}</span>
|
|
68
|
+
<span
|
|
69
|
+
style={{
|
|
70
|
+
color: colors.textTertiary,
|
|
71
|
+
fontSize: '11px',
|
|
72
|
+
fontWeight: '400',
|
|
73
|
+
marginLeft: '8px',
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
76
|
+
({categoryGroup.pairs.length}{' '}
|
|
77
|
+
{categoryGroup.pairs.length === 1 ? 'operation' : 'operations'})
|
|
78
|
+
</span>
|
|
79
|
+
</GroupHeader>
|
|
80
|
+
|
|
81
|
+
{isCategoryExpanded &&
|
|
82
|
+
categoryGroup.pairs.map((pair) => (
|
|
83
|
+
<RequestRow
|
|
84
|
+
key={pair.frame_number}
|
|
85
|
+
pair={pair}
|
|
86
|
+
selected={selected}
|
|
87
|
+
firstRequestTime={firstRequestTime}
|
|
88
|
+
onSelect={onSelect}
|
|
89
|
+
isExpanded={false}
|
|
90
|
+
onToggleExpand={() => {}}
|
|
91
|
+
/>
|
|
92
|
+
))}
|
|
93
|
+
</React.Fragment>
|
|
94
|
+
);
|
|
95
|
+
})}
|
|
96
|
+
</React.Fragment>
|
|
97
|
+
);
|
|
98
|
+
})}
|
|
99
|
+
</tbody>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export default GroupedByMcpView;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { colors, fonts } from '../theme';
|
|
3
|
+
import RequestRow from './RequestRow';
|
|
4
|
+
import GroupHeader from './GroupHeader';
|
|
5
|
+
|
|
6
|
+
export default function GroupedByServerView({
|
|
7
|
+
groupedData,
|
|
8
|
+
expandedServersFirst,
|
|
9
|
+
expandedSessionsInServer,
|
|
10
|
+
onToggleServerFirst,
|
|
11
|
+
onToggleSessionInServer,
|
|
12
|
+
selected,
|
|
13
|
+
firstRequestTime,
|
|
14
|
+
onSelect,
|
|
15
|
+
}) {
|
|
16
|
+
return (
|
|
17
|
+
<tbody>
|
|
18
|
+
{groupedData.map((serverGroup) => {
|
|
19
|
+
const serverKey = serverGroup.serverName || '__UNKNOWN_SERVER__';
|
|
20
|
+
const isServerExpanded = expandedServersFirst.has(serverKey);
|
|
21
|
+
const totalRequests = serverGroup.sessions.reduce(
|
|
22
|
+
(sum, session) => sum + session.requests.length,
|
|
23
|
+
0
|
|
24
|
+
);
|
|
25
|
+
const requestCountText = totalRequests === 1 ? '1 request' : `${totalRequests} requests`;
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<React.Fragment key={serverKey}>
|
|
29
|
+
<GroupHeader
|
|
30
|
+
onClick={() => onToggleServerFirst(serverGroup.serverName)}
|
|
31
|
+
isExpanded={isServerExpanded}
|
|
32
|
+
>
|
|
33
|
+
<span style={{ color: colors.textSecondary, fontFamily: fonts.body }}>Server:</span>{' '}
|
|
34
|
+
{serverGroup.serverName ? (
|
|
35
|
+
<span
|
|
36
|
+
style={{ color: colors.accentBlue, fontFamily: fonts.mono, fontWeight: '500' }}
|
|
37
|
+
>
|
|
38
|
+
{serverGroup.serverName}
|
|
39
|
+
</span>
|
|
40
|
+
) : (
|
|
41
|
+
<span
|
|
42
|
+
style={{
|
|
43
|
+
color: colors.textSecondary,
|
|
44
|
+
fontStyle: 'italic',
|
|
45
|
+
fontFamily: fonts.body,
|
|
46
|
+
}}
|
|
47
|
+
>
|
|
48
|
+
(Unknown Server)
|
|
49
|
+
</span>
|
|
50
|
+
)}
|
|
51
|
+
<span
|
|
52
|
+
style={{
|
|
53
|
+
marginLeft: '12px',
|
|
54
|
+
color: colors.textSecondary,
|
|
55
|
+
fontWeight: '400',
|
|
56
|
+
fontFamily: fonts.body,
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
({requestCountText})
|
|
60
|
+
</span>
|
|
61
|
+
</GroupHeader>
|
|
62
|
+
{isServerExpanded &&
|
|
63
|
+
serverGroup.sessions.map((session) => {
|
|
64
|
+
const sessionKey = session.sessionId || '__NO_SESSION__';
|
|
65
|
+
const sessionSet = expandedSessionsInServer.get(serverKey) || new Set();
|
|
66
|
+
const isSessionExpanded = sessionSet.has(sessionKey);
|
|
67
|
+
const sessionRequestCount = session.requests.length;
|
|
68
|
+
const sessionRequestCountText =
|
|
69
|
+
sessionRequestCount === 1 ? '1 request' : `${sessionRequestCount} requests`;
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<React.Fragment key={`${serverKey}-${sessionKey}`}>
|
|
73
|
+
<GroupHeader
|
|
74
|
+
onClick={(e) => {
|
|
75
|
+
e.stopPropagation();
|
|
76
|
+
onToggleSessionInServer(serverGroup.serverName, session.sessionId);
|
|
77
|
+
}}
|
|
78
|
+
isExpanded={isSessionExpanded}
|
|
79
|
+
indent={1}
|
|
80
|
+
>
|
|
81
|
+
<span style={{ color: colors.textSecondary, fontFamily: fonts.body }}>
|
|
82
|
+
Session:
|
|
83
|
+
</span>{' '}
|
|
84
|
+
{session.sessionId ? (
|
|
85
|
+
<span
|
|
86
|
+
style={{
|
|
87
|
+
color: colors.accentGreen,
|
|
88
|
+
fontFamily: fonts.mono,
|
|
89
|
+
fontWeight: '500',
|
|
90
|
+
}}
|
|
91
|
+
>
|
|
92
|
+
{session.sessionId}
|
|
93
|
+
</span>
|
|
94
|
+
) : (
|
|
95
|
+
<span
|
|
96
|
+
style={{
|
|
97
|
+
color: colors.textSecondary,
|
|
98
|
+
fontStyle: 'italic',
|
|
99
|
+
fontFamily: fonts.body,
|
|
100
|
+
}}
|
|
101
|
+
>
|
|
102
|
+
(No Session ID)
|
|
103
|
+
</span>
|
|
104
|
+
)}
|
|
105
|
+
<span
|
|
106
|
+
style={{
|
|
107
|
+
marginLeft: '12px',
|
|
108
|
+
color: colors.textSecondary,
|
|
109
|
+
fontWeight: '400',
|
|
110
|
+
fontFamily: fonts.body,
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
({sessionRequestCountText})
|
|
114
|
+
</span>
|
|
115
|
+
</GroupHeader>
|
|
116
|
+
{isSessionExpanded &&
|
|
117
|
+
session.requests.map((request) => (
|
|
118
|
+
<RequestRow
|
|
119
|
+
key={request.frame_number}
|
|
120
|
+
request={request}
|
|
121
|
+
selected={selected}
|
|
122
|
+
firstRequestTime={firstRequestTime}
|
|
123
|
+
onSelect={onSelect}
|
|
124
|
+
/>
|
|
125
|
+
))}
|
|
126
|
+
</React.Fragment>
|
|
127
|
+
);
|
|
128
|
+
})}
|
|
129
|
+
</React.Fragment>
|
|
130
|
+
);
|
|
131
|
+
})}
|
|
132
|
+
</tbody>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { colors, fonts } from '../theme';
|
|
3
|
+
import RequestRow from './RequestRow';
|
|
4
|
+
import GroupHeader from './GroupHeader';
|
|
5
|
+
|
|
6
|
+
export default function GroupedBySessionView({
|
|
7
|
+
groupedData,
|
|
8
|
+
expandedSessions,
|
|
9
|
+
expandedServers,
|
|
10
|
+
onToggleSession,
|
|
11
|
+
onToggleServer,
|
|
12
|
+
selected,
|
|
13
|
+
firstRequestTime,
|
|
14
|
+
onSelect,
|
|
15
|
+
}) {
|
|
16
|
+
return (
|
|
17
|
+
<tbody>
|
|
18
|
+
{groupedData.map((sessionGroup) => {
|
|
19
|
+
const sessionKey = sessionGroup.sessionId || '__NO_SESSION__';
|
|
20
|
+
const isSessionExpanded = expandedSessions.has(sessionKey);
|
|
21
|
+
const totalRequests = sessionGroup.servers.reduce(
|
|
22
|
+
(sum, server) => sum + server.requests.length,
|
|
23
|
+
0
|
|
24
|
+
);
|
|
25
|
+
const requestCountText = totalRequests === 1 ? '1 request' : `${totalRequests} requests`;
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<React.Fragment key={sessionKey}>
|
|
29
|
+
<GroupHeader
|
|
30
|
+
onClick={() => onToggleSession(sessionGroup.sessionId)}
|
|
31
|
+
isExpanded={isSessionExpanded}
|
|
32
|
+
>
|
|
33
|
+
<span style={{ color: colors.textSecondary, fontFamily: fonts.body }}>Session:</span>{' '}
|
|
34
|
+
{sessionGroup.sessionId ? (
|
|
35
|
+
<span
|
|
36
|
+
style={{ color: colors.accentBlue, fontFamily: fonts.mono, fontWeight: '500' }}
|
|
37
|
+
>
|
|
38
|
+
{sessionGroup.sessionId}
|
|
39
|
+
</span>
|
|
40
|
+
) : (
|
|
41
|
+
<span
|
|
42
|
+
style={{
|
|
43
|
+
color: colors.textSecondary,
|
|
44
|
+
fontStyle: 'italic',
|
|
45
|
+
fontFamily: fonts.body,
|
|
46
|
+
}}
|
|
47
|
+
>
|
|
48
|
+
(No Session ID)
|
|
49
|
+
</span>
|
|
50
|
+
)}
|
|
51
|
+
<span
|
|
52
|
+
style={{
|
|
53
|
+
marginLeft: '12px',
|
|
54
|
+
color: colors.textSecondary,
|
|
55
|
+
fontWeight: '400',
|
|
56
|
+
fontFamily: fonts.body,
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
({requestCountText})
|
|
60
|
+
</span>
|
|
61
|
+
</GroupHeader>
|
|
62
|
+
{isSessionExpanded &&
|
|
63
|
+
sessionGroup.servers.map((server) => {
|
|
64
|
+
const serverKey = server.serverName || '__UNKNOWN_SERVER__';
|
|
65
|
+
const serverSet = expandedServers.get(sessionKey) || new Set();
|
|
66
|
+
const isServerExpanded = serverSet.has(serverKey);
|
|
67
|
+
const serverRequestCount = server.requests.length;
|
|
68
|
+
const serverRequestCountText =
|
|
69
|
+
serverRequestCount === 1 ? '1 request' : `${serverRequestCount} requests`;
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<React.Fragment key={`${sessionKey}-${serverKey}`}>
|
|
73
|
+
<GroupHeader
|
|
74
|
+
onClick={(e) => {
|
|
75
|
+
e.stopPropagation();
|
|
76
|
+
onToggleServer(sessionGroup.sessionId, server.serverName);
|
|
77
|
+
}}
|
|
78
|
+
isExpanded={isServerExpanded}
|
|
79
|
+
indent={1}
|
|
80
|
+
>
|
|
81
|
+
<span style={{ color: colors.textSecondary, fontFamily: fonts.body }}>
|
|
82
|
+
Server:
|
|
83
|
+
</span>{' '}
|
|
84
|
+
{server.serverName ? (
|
|
85
|
+
<span
|
|
86
|
+
style={{
|
|
87
|
+
color: colors.accentGreen,
|
|
88
|
+
fontFamily: fonts.mono,
|
|
89
|
+
fontWeight: '500',
|
|
90
|
+
}}
|
|
91
|
+
>
|
|
92
|
+
{server.serverName}
|
|
93
|
+
</span>
|
|
94
|
+
) : (
|
|
95
|
+
<span
|
|
96
|
+
style={{
|
|
97
|
+
color: colors.textSecondary,
|
|
98
|
+
fontStyle: 'italic',
|
|
99
|
+
fontFamily: fonts.body,
|
|
100
|
+
}}
|
|
101
|
+
>
|
|
102
|
+
(Unknown Server)
|
|
103
|
+
</span>
|
|
104
|
+
)}
|
|
105
|
+
<span style={{ marginLeft: '12px', color: '#858585', fontWeight: 'normal' }}>
|
|
106
|
+
({serverRequestCountText})
|
|
107
|
+
</span>
|
|
108
|
+
</GroupHeader>
|
|
109
|
+
{isServerExpanded &&
|
|
110
|
+
server.requests.map((request) => (
|
|
111
|
+
<RequestRow
|
|
112
|
+
key={request.frame_number}
|
|
113
|
+
request={request}
|
|
114
|
+
selected={selected}
|
|
115
|
+
firstRequestTime={firstRequestTime}
|
|
116
|
+
onSelect={onSelect}
|
|
117
|
+
/>
|
|
118
|
+
))}
|
|
119
|
+
</React.Fragment>
|
|
120
|
+
);
|
|
121
|
+
})}
|
|
122
|
+
</React.Fragment>
|
|
123
|
+
);
|
|
124
|
+
})}
|
|
125
|
+
</tbody>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { colors, fonts } from '../theme';
|
|
3
|
+
|
|
4
|
+
const ChevronDown = ({ size = 14, color = 'currentColor', rotated = false }) => (
|
|
5
|
+
<svg
|
|
6
|
+
width={size}
|
|
7
|
+
height={size}
|
|
8
|
+
viewBox="0 0 24 24"
|
|
9
|
+
fill="none"
|
|
10
|
+
stroke={color}
|
|
11
|
+
strokeWidth="2.5"
|
|
12
|
+
strokeLinecap="round"
|
|
13
|
+
strokeLinejoin="round"
|
|
14
|
+
style={{
|
|
15
|
+
display: 'inline-block',
|
|
16
|
+
verticalAlign: 'middle',
|
|
17
|
+
transform: rotated ? 'rotate(-90deg)' : 'rotate(0deg)',
|
|
18
|
+
transition: 'transform 0.2s ease',
|
|
19
|
+
}}
|
|
20
|
+
>
|
|
21
|
+
<polyline points="6 9 12 15 18 9" />
|
|
22
|
+
</svg>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
function CollapsibleRequestResponse({ title, titleColor, children, defaultExpanded = true }) {
|
|
26
|
+
const [isExpanded, setIsExpanded] = useState(defaultExpanded);
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div
|
|
30
|
+
style={{
|
|
31
|
+
background: colors.bgCard,
|
|
32
|
+
borderRadius: '8px',
|
|
33
|
+
border: `1px solid ${colors.borderLight}`,
|
|
34
|
+
overflow: 'hidden',
|
|
35
|
+
marginBottom: '20px',
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
<div
|
|
39
|
+
onClick={() => setIsExpanded(!isExpanded)}
|
|
40
|
+
style={{
|
|
41
|
+
padding: '16px 20px',
|
|
42
|
+
background: isExpanded ? colors.bgCard : colors.bgSecondary,
|
|
43
|
+
borderBottom: isExpanded ? `1px solid ${colors.borderLight}` : 'none',
|
|
44
|
+
cursor: 'pointer',
|
|
45
|
+
userSelect: 'none',
|
|
46
|
+
display: 'flex',
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
justifyContent: 'space-between',
|
|
49
|
+
transition: 'background-color 0.15s ease',
|
|
50
|
+
}}
|
|
51
|
+
onMouseEnter={(e) => {
|
|
52
|
+
e.currentTarget.style.background = colors.bgHover;
|
|
53
|
+
}}
|
|
54
|
+
onMouseLeave={(e) => {
|
|
55
|
+
e.currentTarget.style.background = isExpanded ? colors.bgCard : colors.bgSecondary;
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
58
|
+
<div
|
|
59
|
+
style={{
|
|
60
|
+
fontSize: '13px',
|
|
61
|
+
fontWeight: '600',
|
|
62
|
+
color: titleColor,
|
|
63
|
+
textTransform: 'uppercase',
|
|
64
|
+
letterSpacing: '0.05em',
|
|
65
|
+
fontFamily: fonts.body,
|
|
66
|
+
display: 'flex',
|
|
67
|
+
alignItems: 'center',
|
|
68
|
+
gap: '8px',
|
|
69
|
+
}}
|
|
70
|
+
>
|
|
71
|
+
<ChevronDown size={14} color={titleColor} rotated={!isExpanded} />
|
|
72
|
+
{title}
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
{isExpanded && <div style={{ padding: '20px' }}>{children}</div>}
|
|
76
|
+
</div>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function HexTab({ requestHexLines, responseHexLines, hasRequest, hasResponse }) {
|
|
81
|
+
return (
|
|
82
|
+
<div style={{ padding: '20px', overflow: 'auto', flex: 1, background: colors.bgPrimary }}>
|
|
83
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '0' }}>
|
|
84
|
+
{hasRequest && (
|
|
85
|
+
<CollapsibleRequestResponse
|
|
86
|
+
title="Request Hex Dump"
|
|
87
|
+
titleColor={colors.accentBlue}
|
|
88
|
+
defaultExpanded={true}
|
|
89
|
+
>
|
|
90
|
+
<div
|
|
91
|
+
style={{
|
|
92
|
+
background: colors.bgSecondary,
|
|
93
|
+
padding: '16px',
|
|
94
|
+
borderRadius: '8px',
|
|
95
|
+
border: `1px solid ${colors.borderLight}`,
|
|
96
|
+
maxHeight: 'calc(100vh - 300px)',
|
|
97
|
+
overflow: 'auto',
|
|
98
|
+
}}
|
|
99
|
+
>
|
|
100
|
+
{requestHexLines.length > 0 ? (
|
|
101
|
+
requestHexLines.map((line, i) => (
|
|
102
|
+
<div
|
|
103
|
+
key={i}
|
|
104
|
+
style={{
|
|
105
|
+
display: 'flex',
|
|
106
|
+
gap: '16px',
|
|
107
|
+
padding: '4px 0',
|
|
108
|
+
color: colors.textPrimary,
|
|
109
|
+
fontFamily: fonts.mono,
|
|
110
|
+
fontSize: '12px',
|
|
111
|
+
lineHeight: '1.5',
|
|
112
|
+
}}
|
|
113
|
+
>
|
|
114
|
+
<span style={{ color: colors.textTertiary, minWidth: '80px' }}>
|
|
115
|
+
{line.offset}
|
|
116
|
+
</span>
|
|
117
|
+
<span style={{ minWidth: '400px', color: colors.textPrimary }}>
|
|
118
|
+
{line.hex.padEnd(48)}
|
|
119
|
+
</span>
|
|
120
|
+
<span style={{ color: colors.textSecondary }}>{line.ascii}</span>
|
|
121
|
+
</div>
|
|
122
|
+
))
|
|
123
|
+
) : (
|
|
124
|
+
<div
|
|
125
|
+
style={{ color: colors.textTertiary, fontFamily: fonts.body, fontSize: '12px' }}
|
|
126
|
+
>
|
|
127
|
+
(empty)
|
|
128
|
+
</div>
|
|
129
|
+
)}
|
|
130
|
+
</div>
|
|
131
|
+
</CollapsibleRequestResponse>
|
|
132
|
+
)}
|
|
133
|
+
|
|
134
|
+
{hasResponse && (
|
|
135
|
+
<CollapsibleRequestResponse
|
|
136
|
+
title="Response Hex Dump"
|
|
137
|
+
titleColor={colors.accentGreen}
|
|
138
|
+
defaultExpanded={true}
|
|
139
|
+
>
|
|
140
|
+
<div
|
|
141
|
+
style={{
|
|
142
|
+
background: colors.bgSecondary,
|
|
143
|
+
padding: '16px',
|
|
144
|
+
borderRadius: '8px',
|
|
145
|
+
border: `1px solid ${colors.borderLight}`,
|
|
146
|
+
maxHeight: 'calc(100vh - 300px)',
|
|
147
|
+
overflow: 'auto',
|
|
148
|
+
}}
|
|
149
|
+
>
|
|
150
|
+
{responseHexLines.length > 0 ? (
|
|
151
|
+
responseHexLines.map((line, i) => (
|
|
152
|
+
<div
|
|
153
|
+
key={i}
|
|
154
|
+
style={{
|
|
155
|
+
display: 'flex',
|
|
156
|
+
gap: '16px',
|
|
157
|
+
padding: '4px 0',
|
|
158
|
+
color: colors.textPrimary,
|
|
159
|
+
fontFamily: fonts.mono,
|
|
160
|
+
fontSize: '12px',
|
|
161
|
+
lineHeight: '1.5',
|
|
162
|
+
}}
|
|
163
|
+
>
|
|
164
|
+
<span style={{ color: colors.textTertiary, minWidth: '80px' }}>
|
|
165
|
+
{line.offset}
|
|
166
|
+
</span>
|
|
167
|
+
<span style={{ minWidth: '400px', color: colors.textPrimary }}>
|
|
168
|
+
{line.hex.padEnd(48)}
|
|
169
|
+
</span>
|
|
170
|
+
<span style={{ color: colors.textSecondary }}>{line.ascii}</span>
|
|
171
|
+
</div>
|
|
172
|
+
))
|
|
173
|
+
) : (
|
|
174
|
+
<div
|
|
175
|
+
style={{ color: colors.textTertiary, fontFamily: fonts.body, fontSize: '12px' }}
|
|
176
|
+
>
|
|
177
|
+
(empty)
|
|
178
|
+
</div>
|
|
179
|
+
)}
|
|
180
|
+
</div>
|
|
181
|
+
</CollapsibleRequestResponse>
|
|
182
|
+
)}
|
|
183
|
+
</div>
|
|
184
|
+
</div>
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export default HexTab;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { colors, fonts } from '../theme';
|
|
2
|
+
|
|
3
|
+
export default function LogsDisplay({ logs, filteredLogs, logEndRef, getLogColor }) {
|
|
4
|
+
return (
|
|
5
|
+
<div
|
|
6
|
+
style={{
|
|
7
|
+
flex: 1,
|
|
8
|
+
overflow: 'auto',
|
|
9
|
+
padding: '16px',
|
|
10
|
+
fontFamily: fonts.mono,
|
|
11
|
+
fontSize: '12px',
|
|
12
|
+
background: colors.bgCard,
|
|
13
|
+
}}
|
|
14
|
+
>
|
|
15
|
+
{filteredLogs.length === 0 ? (
|
|
16
|
+
<div
|
|
17
|
+
style={{
|
|
18
|
+
color: colors.textSecondary,
|
|
19
|
+
padding: '40px',
|
|
20
|
+
textAlign: 'center',
|
|
21
|
+
fontFamily: fonts.body,
|
|
22
|
+
}}
|
|
23
|
+
>
|
|
24
|
+
{logs.length === 0
|
|
25
|
+
? 'No logs available. Start the MCP Shark server to see logs here.'
|
|
26
|
+
: 'No logs match the current filter.'}
|
|
27
|
+
</div>
|
|
28
|
+
) : (
|
|
29
|
+
<>
|
|
30
|
+
<div ref={logEndRef} />
|
|
31
|
+
{filteredLogs.map((log, index) => (
|
|
32
|
+
<div
|
|
33
|
+
key={`${log.timestamp}-${index}`}
|
|
34
|
+
style={{
|
|
35
|
+
display: 'flex',
|
|
36
|
+
gap: '12px',
|
|
37
|
+
padding: '12px 16px',
|
|
38
|
+
borderBottom: `1px solid ${colors.borderLight}`,
|
|
39
|
+
background: colors.bgCard,
|
|
40
|
+
transition: 'background-color 0.15s ease',
|
|
41
|
+
}}
|
|
42
|
+
onMouseEnter={(e) => {
|
|
43
|
+
e.currentTarget.style.background = colors.bgHover;
|
|
44
|
+
}}
|
|
45
|
+
onMouseLeave={(e) => {
|
|
46
|
+
e.currentTarget.style.background = colors.bgCard;
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
<span
|
|
50
|
+
style={{
|
|
51
|
+
color: colors.textTertiary,
|
|
52
|
+
minWidth: '140px',
|
|
53
|
+
flexShrink: 0,
|
|
54
|
+
fontFamily: fonts.mono,
|
|
55
|
+
fontSize: '11px',
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
58
|
+
{new Date(log.timestamp).toLocaleTimeString()}
|
|
59
|
+
</span>
|
|
60
|
+
<span
|
|
61
|
+
style={{
|
|
62
|
+
color: colors.textTertiary,
|
|
63
|
+
minWidth: '70px',
|
|
64
|
+
flexShrink: 0,
|
|
65
|
+
textTransform: 'uppercase',
|
|
66
|
+
fontFamily: fonts.body,
|
|
67
|
+
fontSize: '10px',
|
|
68
|
+
fontWeight: '600',
|
|
69
|
+
letterSpacing: '0.05em',
|
|
70
|
+
}}
|
|
71
|
+
>
|
|
72
|
+
{log.type}
|
|
73
|
+
</span>
|
|
74
|
+
<span
|
|
75
|
+
style={{
|
|
76
|
+
color: getLogColor(log.type),
|
|
77
|
+
whiteSpace: 'pre-wrap',
|
|
78
|
+
wordBreak: 'break-word',
|
|
79
|
+
flex: 1,
|
|
80
|
+
fontFamily: fonts.mono,
|
|
81
|
+
fontSize: '12px',
|
|
82
|
+
lineHeight: '1.5',
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
{log.line}
|
|
86
|
+
</span>
|
|
87
|
+
</div>
|
|
88
|
+
))}
|
|
89
|
+
</>
|
|
90
|
+
)}
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
}
|