@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,82 @@
1
+ import { useState } from 'react';
2
+ import { colors, fonts } from '../theme';
3
+
4
+ const ChevronDown = ({ size = 12, color = 'currentColor' }) => (
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={{ display: 'inline-block', verticalAlign: 'middle', marginRight: '4px' }}
15
+ >
16
+ <polyline points="6 9 12 15 18 9" />
17
+ </svg>
18
+ );
19
+
20
+ function CollapsibleSection({
21
+ title,
22
+ children,
23
+ titleColor = colors.accentBlue,
24
+ defaultExpanded = true,
25
+ }) {
26
+ const [isExpanded, setIsExpanded] = useState(defaultExpanded);
27
+
28
+ return (
29
+ <div style={{ marginBottom: '16px' }}>
30
+ <div
31
+ style={{
32
+ color: titleColor,
33
+ fontWeight: '600',
34
+ fontFamily: fonts.body,
35
+ fontSize: '12px',
36
+ marginBottom: '8px',
37
+ cursor: 'pointer',
38
+ userSelect: 'none',
39
+ display: 'flex',
40
+ alignItems: 'center',
41
+ gap: '6px',
42
+ padding: '4px 0',
43
+ transition: 'color 0.15s ease',
44
+ }}
45
+ onClick={() => setIsExpanded(!isExpanded)}
46
+ onMouseEnter={(e) => {
47
+ e.currentTarget.style.color =
48
+ titleColor === colors.accentBlue ? colors.accentBlueHover : titleColor;
49
+ }}
50
+ onMouseLeave={(e) => {
51
+ e.currentTarget.style.color = titleColor;
52
+ }}
53
+ >
54
+ <span
55
+ style={{
56
+ transform: isExpanded ? 'rotate(0deg)' : 'rotate(-90deg)',
57
+ transition: 'transform 0.2s ease',
58
+ display: 'inline-block',
59
+ }}
60
+ >
61
+ <ChevronDown size={12} color={titleColor} />
62
+ </span>
63
+ {title}
64
+ </div>
65
+ {isExpanded && (
66
+ <div
67
+ style={{
68
+ paddingLeft: '20px',
69
+ color: colors.textPrimary,
70
+ fontFamily: fonts.body,
71
+ fontSize: '12px',
72
+ lineHeight: '1.6',
73
+ }}
74
+ >
75
+ {children}
76
+ </div>
77
+ )}
78
+ </div>
79
+ );
80
+ }
81
+
82
+ export default CollapsibleSection;
@@ -0,0 +1,84 @@
1
+ import { colors, fonts } from '../theme';
2
+ import DetectedPathsList from './DetectedPathsList';
3
+ import FileInput from './FileInput';
4
+ import ServiceSelector from './ServiceSelector';
5
+
6
+ export default function ConfigFileSection({
7
+ detectedPaths,
8
+ detecting,
9
+ onDetect,
10
+ onPathSelect,
11
+ onViewConfig,
12
+ filePath,
13
+ fileContent,
14
+ updatePath,
15
+ onFileSelect,
16
+ onPathChange,
17
+ onUpdatePathChange,
18
+ services,
19
+ selectedServices,
20
+ onSelectionChange,
21
+ }) {
22
+ return (
23
+ <div
24
+ style={{
25
+ background: colors.bgCard,
26
+ border: `1px solid ${colors.borderLight}`,
27
+ borderRadius: '12px',
28
+ padding: '24px',
29
+ marginBottom: '20px',
30
+ boxShadow: `0 2px 4px ${colors.shadowSm}`,
31
+ }}
32
+ >
33
+ <div style={{ marginBottom: '16px' }}>
34
+ <h3
35
+ style={{
36
+ fontSize: '15px',
37
+ fontWeight: '600',
38
+ marginBottom: '8px',
39
+ color: colors.textPrimary,
40
+ fontFamily: fonts.body,
41
+ }}
42
+ >
43
+ Configuration File
44
+ </h3>
45
+ <p
46
+ style={{
47
+ fontSize: '13px',
48
+ color: colors.textSecondary,
49
+ lineHeight: '1.5',
50
+ fontFamily: fonts.body,
51
+ }}
52
+ >
53
+ Select your MCP configuration file or provide a file path. The file will be converted to
54
+ MCP Shark format and used to start the server.
55
+ </p>
56
+ </div>
57
+
58
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
59
+ <DetectedPathsList
60
+ detectedPaths={detectedPaths}
61
+ detecting={detecting}
62
+ onDetect={onDetect}
63
+ onSelect={onPathSelect}
64
+ onView={onViewConfig}
65
+ />
66
+
67
+ <FileInput
68
+ filePath={filePath}
69
+ fileContent={fileContent}
70
+ updatePath={updatePath}
71
+ onFileSelect={onFileSelect}
72
+ onPathChange={onPathChange}
73
+ onUpdatePathChange={onUpdatePathChange}
74
+ />
75
+
76
+ <ServiceSelector
77
+ services={services}
78
+ selectedServices={selectedServices}
79
+ onSelectionChange={onSelectionChange}
80
+ />
81
+ </div>
82
+ </div>
83
+ );
84
+ }
@@ -0,0 +1,141 @@
1
+ import { colors, fonts } from '../theme';
2
+
3
+ function ConfigViewerModal({
4
+ viewingConfig,
5
+ configContent,
6
+ loadingConfig,
7
+ onClose,
8
+ viewingBackup,
9
+ backupContent,
10
+ loadingBackup,
11
+ }) {
12
+ const isViewingBackup = viewingBackup !== null;
13
+ const isViewingConfig = viewingConfig !== null;
14
+
15
+ if (!isViewingConfig && !isViewingBackup) {
16
+ return null;
17
+ }
18
+
19
+ const content = isViewingBackup ? backupContent : configContent;
20
+ const loading = isViewingBackup ? loadingBackup : loadingConfig;
21
+ const title = isViewingBackup ? 'Backup File' : 'MCP Configuration File';
22
+
23
+ return (
24
+ <div
25
+ style={{
26
+ position: 'fixed',
27
+ top: 0,
28
+ left: 0,
29
+ right: 0,
30
+ bottom: 0,
31
+ background: 'rgba(0, 0, 0, 0.8)',
32
+ display: 'flex',
33
+ alignItems: 'center',
34
+ justifyContent: 'center',
35
+ zIndex: 1000,
36
+ padding: '20px',
37
+ }}
38
+ onClick={onClose}
39
+ >
40
+ <div
41
+ style={{
42
+ background: colors.bgPrimary,
43
+ border: `1px solid ${colors.borderLight}`,
44
+ borderRadius: '8px',
45
+ width: '100%',
46
+ maxWidth: '800px',
47
+ maxHeight: '90vh',
48
+ display: 'flex',
49
+ flexDirection: 'column',
50
+ overflow: 'hidden',
51
+ }}
52
+ onClick={(e) => e.stopPropagation()}
53
+ >
54
+ <div
55
+ style={{
56
+ padding: '16px',
57
+ borderBottom: '1px solid #333',
58
+ display: 'flex',
59
+ justifyContent: 'space-between',
60
+ alignItems: 'center',
61
+ }}
62
+ >
63
+ <div>
64
+ <h3
65
+ style={{
66
+ fontSize: '16px',
67
+ fontWeight: '500',
68
+ marginBottom: '4px',
69
+ color: colors.textPrimary,
70
+ }}
71
+ >
72
+ {title}
73
+ </h3>
74
+ {content && (
75
+ <div style={{ fontSize: '12px', color: '#858585' }}>
76
+ {content.displayPath}
77
+ {isViewingBackup && content.createdAt && (
78
+ <span style={{ marginLeft: '12px', color: '#666' }}>
79
+ Created: {new Date(content.createdAt).toLocaleString()}
80
+ </span>
81
+ )}
82
+ </div>
83
+ )}
84
+ </div>
85
+ <button
86
+ onClick={onClose}
87
+ style={{
88
+ background: 'transparent',
89
+ border: 'none',
90
+ color: colors.textPrimary,
91
+ cursor: 'pointer',
92
+ fontSize: '24px',
93
+ padding: '0',
94
+ width: '32px',
95
+ height: '32px',
96
+ display: 'flex',
97
+ alignItems: 'center',
98
+ justifyContent: 'center',
99
+ }}
100
+ >
101
+ ×
102
+ </button>
103
+ </div>
104
+ <div
105
+ style={{
106
+ flex: 1,
107
+ overflow: 'auto',
108
+ padding: '20px',
109
+ }}
110
+ >
111
+ {loading ? (
112
+ <div style={{ color: '#858585', textAlign: 'center', padding: '40px' }}>Loading...</div>
113
+ ) : content ? (
114
+ <pre
115
+ style={{
116
+ background: colors.bgPrimary,
117
+ padding: '16px',
118
+ borderRadius: '4px',
119
+ fontSize: '13px',
120
+ fontFamily: 'monospace',
121
+ color: colors.textPrimary,
122
+ overflow: 'auto',
123
+ border: `1px solid ${colors.borderLight}`,
124
+ lineHeight: '1.6',
125
+ margin: 0,
126
+ }}
127
+ >
128
+ {content.content}
129
+ </pre>
130
+ ) : (
131
+ <div style={{ color: '#f48771', textAlign: 'center', padding: '40px' }}>
132
+ Failed to load file content
133
+ </div>
134
+ )}
135
+ </div>
136
+ </div>
137
+ </div>
138
+ );
139
+ }
140
+
141
+ export default ConfigViewerModal;
@@ -0,0 +1,129 @@
1
+ import { colors, fonts } from '../theme';
2
+
3
+ function ConfirmationModal({
4
+ isOpen,
5
+ onClose,
6
+ onConfirm,
7
+ title,
8
+ message,
9
+ confirmText = 'Confirm',
10
+ cancelText = 'Cancel',
11
+ danger = false,
12
+ }) {
13
+ if (!isOpen) return null;
14
+
15
+ return (
16
+ <div
17
+ style={{
18
+ position: 'fixed',
19
+ top: 0,
20
+ left: 0,
21
+ right: 0,
22
+ bottom: 0,
23
+ backgroundColor: 'rgba(0, 0, 0, 0.5)',
24
+ display: 'flex',
25
+ alignItems: 'center',
26
+ justifyContent: 'center',
27
+ zIndex: 1000,
28
+ }}
29
+ onClick={onClose}
30
+ >
31
+ <div
32
+ style={{
33
+ background: colors.bgCard,
34
+ borderRadius: '12px',
35
+ padding: '24px',
36
+ maxWidth: '500px',
37
+ width: '90%',
38
+ boxShadow: `0 4px 20px ${colors.shadowLg}`,
39
+ fontFamily: fonts.body,
40
+ }}
41
+ onClick={(e) => e.stopPropagation()}
42
+ >
43
+ <h3
44
+ style={{
45
+ margin: '0 0 12px 0',
46
+ fontSize: '18px',
47
+ fontWeight: '600',
48
+ color: colors.textPrimary,
49
+ }}
50
+ >
51
+ {title}
52
+ </h3>
53
+ <p
54
+ style={{
55
+ margin: '0 0 24px 0',
56
+ fontSize: '14px',
57
+ color: colors.textSecondary,
58
+ lineHeight: '1.5',
59
+ }}
60
+ >
61
+ {message}
62
+ </p>
63
+ <div
64
+ style={{
65
+ display: 'flex',
66
+ gap: '12px',
67
+ justifyContent: 'flex-end',
68
+ }}
69
+ >
70
+ <button
71
+ onClick={onClose}
72
+ style={{
73
+ padding: '10px 20px',
74
+ background: colors.buttonSecondary,
75
+ border: `1px solid ${colors.borderLight}`,
76
+ borderRadius: '8px',
77
+ color: colors.textPrimary,
78
+ fontSize: '14px',
79
+ fontWeight: '500',
80
+ fontFamily: fonts.body,
81
+ cursor: 'pointer',
82
+ transition: 'all 0.2s',
83
+ }}
84
+ onMouseEnter={(e) => {
85
+ e.currentTarget.style.background = colors.buttonSecondaryHover;
86
+ }}
87
+ onMouseLeave={(e) => {
88
+ e.currentTarget.style.background = colors.buttonSecondary;
89
+ }}
90
+ >
91
+ {cancelText}
92
+ </button>
93
+ <button
94
+ onClick={() => {
95
+ onConfirm();
96
+ onClose();
97
+ }}
98
+ style={{
99
+ padding: '10px 20px',
100
+ background: danger ? colors.buttonDanger : colors.buttonPrimary,
101
+ border: 'none',
102
+ borderRadius: '8px',
103
+ color: colors.textInverse,
104
+ fontSize: '14px',
105
+ fontWeight: '500',
106
+ fontFamily: fonts.body,
107
+ cursor: 'pointer',
108
+ transition: 'all 0.2s',
109
+ }}
110
+ onMouseEnter={(e) => {
111
+ e.currentTarget.style.background = danger
112
+ ? colors.buttonDangerHover
113
+ : colors.buttonPrimaryHover;
114
+ }}
115
+ onMouseLeave={(e) => {
116
+ e.currentTarget.style.background = danger
117
+ ? colors.buttonDanger
118
+ : colors.buttonPrimary;
119
+ }}
120
+ >
121
+ {confirmText}
122
+ </button>
123
+ </div>
124
+ </div>
125
+ </div>
126
+ );
127
+ }
128
+
129
+ export default ConfirmationModal;
@@ -0,0 +1,27 @@
1
+ import { colors, fonts } from '../../theme';
2
+ import CollapsibleSection from '../CollapsibleSection';
3
+
4
+ export default function BodySection({ body, title, titleColor }) {
5
+ if (!body) return null;
6
+
7
+ return (
8
+ <CollapsibleSection title={title || 'Body'} titleColor={titleColor}>
9
+ <pre
10
+ style={{
11
+ background: colors.bgSecondary,
12
+ padding: '16px',
13
+ borderRadius: '8px',
14
+ overflow: 'auto',
15
+ fontSize: '12px',
16
+ fontFamily: fonts.mono,
17
+ maxHeight: '400px',
18
+ border: `1px solid ${colors.borderLight}`,
19
+ color: colors.textPrimary,
20
+ lineHeight: '1.5',
21
+ }}
22
+ >
23
+ {typeof body === 'object' ? JSON.stringify(body, null, 2) : body}
24
+ </pre>
25
+ </CollapsibleSection>
26
+ );
27
+ }
@@ -0,0 +1,70 @@
1
+ import { useState } from 'react';
2
+ import { colors, fonts } from '../../theme';
3
+ import { IconChevronDown } from '@tabler/icons-react';
4
+
5
+ export default function CollapsibleRequestResponse({
6
+ title,
7
+ titleColor,
8
+ children,
9
+ defaultExpanded = true,
10
+ }) {
11
+ const [isExpanded, setIsExpanded] = useState(defaultExpanded);
12
+
13
+ return (
14
+ <div
15
+ style={{
16
+ background: colors.bgCard,
17
+ borderRadius: '8px',
18
+ border: `1px solid ${colors.borderLight}`,
19
+ overflow: 'hidden',
20
+ marginBottom: '20px',
21
+ }}
22
+ >
23
+ <div
24
+ onClick={() => setIsExpanded(!isExpanded)}
25
+ style={{
26
+ padding: '16px 20px',
27
+ background: isExpanded ? colors.bgCard : colors.bgSecondary,
28
+ borderBottom: isExpanded ? `1px solid ${colors.borderLight}` : 'none',
29
+ cursor: 'pointer',
30
+ userSelect: 'none',
31
+ display: 'flex',
32
+ alignItems: 'center',
33
+ justifyContent: 'space-between',
34
+ transition: 'background-color 0.15s ease',
35
+ }}
36
+ onMouseEnter={(e) => {
37
+ e.currentTarget.style.background = colors.bgHover;
38
+ }}
39
+ onMouseLeave={(e) => {
40
+ e.currentTarget.style.background = isExpanded ? colors.bgCard : colors.bgSecondary;
41
+ }}
42
+ >
43
+ <div
44
+ style={{
45
+ fontSize: '13px',
46
+ fontWeight: '600',
47
+ color: titleColor,
48
+ textTransform: 'uppercase',
49
+ letterSpacing: '0.05em',
50
+ fontFamily: fonts.body,
51
+ display: 'flex',
52
+ alignItems: 'center',
53
+ gap: '8px',
54
+ }}
55
+ >
56
+ <IconChevronDown
57
+ size={14}
58
+ stroke={1.5}
59
+ style={{
60
+ transform: isExpanded ? 'rotate(0deg)' : 'rotate(-90deg)',
61
+ transition: 'transform 0.2s ease',
62
+ }}
63
+ />
64
+ {title}
65
+ </div>
66
+ </div>
67
+ {isExpanded && <div style={{ padding: '20px' }}>{children}</div>}
68
+ </div>
69
+ );
70
+ }
@@ -0,0 +1,25 @@
1
+ import { colors, fonts } from '../../theme';
2
+ import CollapsibleSection from '../CollapsibleSection';
3
+
4
+ export default function HeadersSection({ headers, titleColor }) {
5
+ if (!headers || Object.keys(headers).length === 0) return null;
6
+
7
+ return (
8
+ <CollapsibleSection title="Headers">
9
+ {Object.entries(headers).map(([key, value]) => (
10
+ <div key={key} style={{ marginBottom: '6px', fontSize: '12px', fontFamily: fonts.body }}>
11
+ <span
12
+ style={{
13
+ color: titleColor,
14
+ fontWeight: '500',
15
+ fontFamily: fonts.mono,
16
+ }}
17
+ >
18
+ {key}:
19
+ </span>{' '}
20
+ <span style={{ color: colors.textPrimary }}>{String(value)}</span>
21
+ </div>
22
+ ))}
23
+ </CollapsibleSection>
24
+ );
25
+ }
@@ -0,0 +1,28 @@
1
+ import { colors, fonts } from '../../theme';
2
+ import CollapsibleSection from '../CollapsibleSection';
3
+ import { getInfo } from '../../utils/requestUtils';
4
+
5
+ export default function InfoSection({ data, titleColor }) {
6
+ if (!data) return null;
7
+
8
+ const info = getInfo(data);
9
+
10
+ return (
11
+ <CollapsibleSection title="Info" titleColor={titleColor} defaultExpanded={false}>
12
+ <div
13
+ style={{
14
+ background: colors.bgSecondary,
15
+ padding: '12px 16px',
16
+ borderRadius: '6px',
17
+ border: `1px solid ${colors.borderLight}`,
18
+ fontFamily: fonts.mono,
19
+ fontSize: '12px',
20
+ color: titleColor,
21
+ wordBreak: 'break-word',
22
+ }}
23
+ >
24
+ {info}
25
+ </div>
26
+ </CollapsibleSection>
27
+ );
28
+ }
@@ -0,0 +1,63 @@
1
+ import { colors, fonts } from '../../theme';
2
+ import CollapsibleSection from '../CollapsibleSection';
3
+
4
+ export default function NetworkInfoSection({ data, showUserAgent = false }) {
5
+ return (
6
+ <CollapsibleSection title="Network Information">
7
+ <div
8
+ style={{
9
+ fontSize: '12px',
10
+ color: colors.textPrimary,
11
+ fontFamily: fonts.body,
12
+ marginBottom: '4px',
13
+ }}
14
+ >
15
+ Remote Address:{' '}
16
+ <span style={{ color: colors.textSecondary, fontFamily: fonts.mono }}>
17
+ {data.remote_address || 'N/A'}
18
+ </span>
19
+ </div>
20
+ <div
21
+ style={{
22
+ fontSize: '12px',
23
+ color: colors.textPrimary,
24
+ fontFamily: fonts.body,
25
+ marginBottom: '4px',
26
+ }}
27
+ >
28
+ Host:{' '}
29
+ <span style={{ color: colors.textSecondary, fontFamily: fonts.mono }}>
30
+ {data.host || 'N/A'}
31
+ </span>
32
+ </div>
33
+ {showUserAgent && data.user_agent && (
34
+ <div
35
+ style={{
36
+ fontSize: '12px',
37
+ color: colors.textPrimary,
38
+ fontFamily: fonts.body,
39
+ marginBottom: '4px',
40
+ }}
41
+ >
42
+ User Agent:{' '}
43
+ <span style={{ color: colors.textSecondary, fontSize: '11px' }}>{data.user_agent}</span>
44
+ </div>
45
+ )}
46
+ {data.session_id && (
47
+ <div
48
+ style={{
49
+ fontSize: '12px',
50
+ color: colors.textPrimary,
51
+ fontFamily: fonts.body,
52
+ marginBottom: '4px',
53
+ }}
54
+ >
55
+ Session ID:{' '}
56
+ <span style={{ color: colors.textSecondary, fontFamily: fonts.mono }}>
57
+ {data.session_id}
58
+ </span>
59
+ </div>
60
+ )}
61
+ </CollapsibleSection>
62
+ );
63
+ }