@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,193 @@
|
|
|
1
|
+
import { colors, fonts } from '../theme';
|
|
2
|
+
import { IconTrash, IconDownload, IconSearch } from '@tabler/icons-react';
|
|
3
|
+
|
|
4
|
+
export default function LogsToolbar({
|
|
5
|
+
filter,
|
|
6
|
+
setFilter,
|
|
7
|
+
logType,
|
|
8
|
+
setLogType,
|
|
9
|
+
autoScroll,
|
|
10
|
+
setAutoScroll,
|
|
11
|
+
onClearLogs,
|
|
12
|
+
onExportLogs,
|
|
13
|
+
filteredCount,
|
|
14
|
+
totalCount,
|
|
15
|
+
}) {
|
|
16
|
+
return (
|
|
17
|
+
<div
|
|
18
|
+
style={{
|
|
19
|
+
padding: '12px 16px',
|
|
20
|
+
borderBottom: `1px solid ${colors.borderLight}`,
|
|
21
|
+
background: colors.bgCard,
|
|
22
|
+
display: 'flex',
|
|
23
|
+
gap: '10px',
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
flexWrap: 'wrap',
|
|
26
|
+
boxShadow: `0 1px 3px ${colors.shadowSm}`,
|
|
27
|
+
}}
|
|
28
|
+
>
|
|
29
|
+
<div style={{ position: 'relative', width: '300px' }}>
|
|
30
|
+
<IconSearch
|
|
31
|
+
size={16}
|
|
32
|
+
stroke={1.5}
|
|
33
|
+
style={{
|
|
34
|
+
position: 'absolute',
|
|
35
|
+
left: '12px',
|
|
36
|
+
top: '50%',
|
|
37
|
+
transform: 'translateY(-50%)',
|
|
38
|
+
color: colors.textTertiary,
|
|
39
|
+
pointerEvents: 'none',
|
|
40
|
+
}}
|
|
41
|
+
/>
|
|
42
|
+
<input
|
|
43
|
+
type="text"
|
|
44
|
+
placeholder="Filter logs..."
|
|
45
|
+
value={filter}
|
|
46
|
+
onChange={(e) => setFilter(e.target.value)}
|
|
47
|
+
style={{
|
|
48
|
+
padding: '8px 12px 8px 36px',
|
|
49
|
+
background: colors.bgCard,
|
|
50
|
+
border: `1px solid ${colors.borderLight}`,
|
|
51
|
+
color: colors.textPrimary,
|
|
52
|
+
fontSize: '13px',
|
|
53
|
+
fontFamily: fonts.body,
|
|
54
|
+
width: '100%',
|
|
55
|
+
borderRadius: '8px',
|
|
56
|
+
transition: 'all 0.2s',
|
|
57
|
+
}}
|
|
58
|
+
onFocus={(e) => {
|
|
59
|
+
e.currentTarget.style.borderColor = colors.accentBlue;
|
|
60
|
+
e.currentTarget.style.boxShadow = `0 0 0 3px ${colors.accentBlue}20`;
|
|
61
|
+
}}
|
|
62
|
+
onBlur={(e) => {
|
|
63
|
+
e.currentTarget.style.borderColor = colors.borderLight;
|
|
64
|
+
e.currentTarget.style.boxShadow = 'none';
|
|
65
|
+
}}
|
|
66
|
+
/>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
<select
|
|
70
|
+
value={logType}
|
|
71
|
+
onChange={(e) => setLogType(e.target.value)}
|
|
72
|
+
style={{
|
|
73
|
+
padding: '8px 12px',
|
|
74
|
+
background: colors.bgCard,
|
|
75
|
+
border: `1px solid ${colors.borderLight}`,
|
|
76
|
+
color: colors.textPrimary,
|
|
77
|
+
fontSize: '13px',
|
|
78
|
+
fontFamily: fonts.body,
|
|
79
|
+
borderRadius: '8px',
|
|
80
|
+
cursor: 'pointer',
|
|
81
|
+
transition: 'all 0.2s',
|
|
82
|
+
}}
|
|
83
|
+
onFocus={(e) => {
|
|
84
|
+
e.currentTarget.style.borderColor = colors.accentBlue;
|
|
85
|
+
e.currentTarget.style.boxShadow = `0 0 0 3px ${colors.accentBlue}20`;
|
|
86
|
+
}}
|
|
87
|
+
onBlur={(e) => {
|
|
88
|
+
e.currentTarget.style.borderColor = colors.borderLight;
|
|
89
|
+
e.currentTarget.style.boxShadow = 'none';
|
|
90
|
+
}}
|
|
91
|
+
>
|
|
92
|
+
<option value="all">All Types</option>
|
|
93
|
+
<option value="stdout">Stdout</option>
|
|
94
|
+
<option value="stderr">Stderr</option>
|
|
95
|
+
<option value="error">Errors</option>
|
|
96
|
+
<option value="exit">Exit</option>
|
|
97
|
+
</select>
|
|
98
|
+
|
|
99
|
+
<label
|
|
100
|
+
style={{
|
|
101
|
+
display: 'flex',
|
|
102
|
+
alignItems: 'center',
|
|
103
|
+
gap: '8px',
|
|
104
|
+
color: colors.textPrimary,
|
|
105
|
+
fontSize: '13px',
|
|
106
|
+
fontFamily: fonts.body,
|
|
107
|
+
cursor: 'pointer',
|
|
108
|
+
}}
|
|
109
|
+
>
|
|
110
|
+
<input
|
|
111
|
+
type="checkbox"
|
|
112
|
+
checked={autoScroll}
|
|
113
|
+
onChange={(e) => setAutoScroll(e.target.checked)}
|
|
114
|
+
style={{ cursor: 'pointer' }}
|
|
115
|
+
/>
|
|
116
|
+
Auto-scroll
|
|
117
|
+
</label>
|
|
118
|
+
|
|
119
|
+
<button
|
|
120
|
+
onClick={onClearLogs}
|
|
121
|
+
style={{
|
|
122
|
+
padding: '8px 14px',
|
|
123
|
+
background: colors.buttonDanger,
|
|
124
|
+
border: 'none',
|
|
125
|
+
color: colors.textInverse,
|
|
126
|
+
fontSize: '12px',
|
|
127
|
+
fontFamily: fonts.body,
|
|
128
|
+
fontWeight: '500',
|
|
129
|
+
cursor: 'pointer',
|
|
130
|
+
borderRadius: '8px',
|
|
131
|
+
transition: 'all 0.2s',
|
|
132
|
+
boxShadow: `0 2px 4px ${colors.shadowSm}`,
|
|
133
|
+
display: 'flex',
|
|
134
|
+
alignItems: 'center',
|
|
135
|
+
gap: '6px',
|
|
136
|
+
}}
|
|
137
|
+
onMouseEnter={(e) => {
|
|
138
|
+
e.currentTarget.style.background = colors.buttonDangerHover;
|
|
139
|
+
e.currentTarget.style.transform = 'translateY(-1px)';
|
|
140
|
+
}}
|
|
141
|
+
onMouseLeave={(e) => {
|
|
142
|
+
e.currentTarget.style.background = colors.buttonDanger;
|
|
143
|
+
e.currentTarget.style.transform = 'translateY(0)';
|
|
144
|
+
}}
|
|
145
|
+
>
|
|
146
|
+
<IconTrash size={14} stroke={1.5} />
|
|
147
|
+
Clear Logs
|
|
148
|
+
</button>
|
|
149
|
+
|
|
150
|
+
<button
|
|
151
|
+
onClick={onExportLogs}
|
|
152
|
+
style={{
|
|
153
|
+
padding: '8px 14px',
|
|
154
|
+
background: colors.buttonPrimary,
|
|
155
|
+
border: 'none',
|
|
156
|
+
color: colors.textInverse,
|
|
157
|
+
fontSize: '12px',
|
|
158
|
+
fontFamily: fonts.body,
|
|
159
|
+
fontWeight: '500',
|
|
160
|
+
cursor: 'pointer',
|
|
161
|
+
borderRadius: '8px',
|
|
162
|
+
transition: 'all 0.2s',
|
|
163
|
+
boxShadow: `0 2px 4px ${colors.shadowSm}`,
|
|
164
|
+
display: 'flex',
|
|
165
|
+
alignItems: 'center',
|
|
166
|
+
gap: '6px',
|
|
167
|
+
}}
|
|
168
|
+
onMouseEnter={(e) => {
|
|
169
|
+
e.currentTarget.style.background = colors.buttonPrimaryHover;
|
|
170
|
+
e.currentTarget.style.transform = 'translateY(-1px)';
|
|
171
|
+
}}
|
|
172
|
+
onMouseLeave={(e) => {
|
|
173
|
+
e.currentTarget.style.background = colors.buttonPrimary;
|
|
174
|
+
e.currentTarget.style.transform = 'translateY(0)';
|
|
175
|
+
}}
|
|
176
|
+
>
|
|
177
|
+
<IconDownload size={14} stroke={1.5} />
|
|
178
|
+
Export Logs
|
|
179
|
+
</button>
|
|
180
|
+
|
|
181
|
+
<div
|
|
182
|
+
style={{
|
|
183
|
+
marginLeft: 'auto',
|
|
184
|
+
color: colors.textSecondary,
|
|
185
|
+
fontSize: '12px',
|
|
186
|
+
fontFamily: fonts.body,
|
|
187
|
+
}}
|
|
188
|
+
>
|
|
189
|
+
{filteredCount} / {totalCount} lines
|
|
190
|
+
</div>
|
|
191
|
+
</div>
|
|
192
|
+
);
|
|
193
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { colors, fonts } from '../../theme';
|
|
3
|
+
import anime from 'animejs';
|
|
4
|
+
|
|
5
|
+
export default function LoadingModal({ show }) {
|
|
6
|
+
const loadingModalRef = useRef(null);
|
|
7
|
+
const dotsRef = useRef([]);
|
|
8
|
+
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (show && loadingModalRef.current) {
|
|
11
|
+
anime({
|
|
12
|
+
targets: loadingModalRef.current,
|
|
13
|
+
opacity: [0, 1],
|
|
14
|
+
scale: [0.9, 1],
|
|
15
|
+
duration: 400,
|
|
16
|
+
easing: 'easeOutExpo',
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
if (dotsRef.current.length > 0) {
|
|
20
|
+
anime({
|
|
21
|
+
targets: dotsRef.current,
|
|
22
|
+
translateY: [0, -10, 0],
|
|
23
|
+
duration: 1200,
|
|
24
|
+
delay: anime.stagger(200),
|
|
25
|
+
loop: true,
|
|
26
|
+
easing: 'easeInOutQuad',
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
} else if (!show && loadingModalRef.current) {
|
|
30
|
+
anime({
|
|
31
|
+
targets: loadingModalRef.current,
|
|
32
|
+
opacity: [1, 0],
|
|
33
|
+
scale: [1, 0.9],
|
|
34
|
+
duration: 300,
|
|
35
|
+
easing: 'easeInExpo',
|
|
36
|
+
complete: () => {
|
|
37
|
+
if (loadingModalRef.current) {
|
|
38
|
+
loadingModalRef.current.style.display = 'none';
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}, [show]);
|
|
44
|
+
|
|
45
|
+
if (!show) return null;
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<div
|
|
49
|
+
ref={loadingModalRef}
|
|
50
|
+
style={{
|
|
51
|
+
position: 'absolute',
|
|
52
|
+
top: 0,
|
|
53
|
+
left: 0,
|
|
54
|
+
right: 0,
|
|
55
|
+
bottom: 0,
|
|
56
|
+
background: 'rgba(245, 243, 240, 0.9)',
|
|
57
|
+
display: 'flex',
|
|
58
|
+
alignItems: 'center',
|
|
59
|
+
justifyContent: 'center',
|
|
60
|
+
zIndex: 1000,
|
|
61
|
+
borderRadius: '8px',
|
|
62
|
+
backdropFilter: 'blur(2px)',
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
65
|
+
<div
|
|
66
|
+
style={{
|
|
67
|
+
background: colors.bgCard,
|
|
68
|
+
borderRadius: '16px',
|
|
69
|
+
padding: '32px',
|
|
70
|
+
boxShadow: `0 8px 32px ${colors.shadowMd}`,
|
|
71
|
+
maxWidth: '320px',
|
|
72
|
+
width: '90%',
|
|
73
|
+
textAlign: 'center',
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
76
|
+
<h3
|
|
77
|
+
style={{
|
|
78
|
+
fontSize: '16px',
|
|
79
|
+
fontWeight: '600',
|
|
80
|
+
color: colors.textPrimary,
|
|
81
|
+
fontFamily: fonts.body,
|
|
82
|
+
marginBottom: '20px',
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
Waiting for MCP server to start
|
|
86
|
+
</h3>
|
|
87
|
+
|
|
88
|
+
<div
|
|
89
|
+
style={{
|
|
90
|
+
display: 'flex',
|
|
91
|
+
justifyContent: 'center',
|
|
92
|
+
gap: '8px',
|
|
93
|
+
}}
|
|
94
|
+
>
|
|
95
|
+
{[0, 1, 2].map((i) => (
|
|
96
|
+
<div
|
|
97
|
+
key={i}
|
|
98
|
+
ref={(el) => {
|
|
99
|
+
if (el) dotsRef.current[i] = el;
|
|
100
|
+
}}
|
|
101
|
+
style={{
|
|
102
|
+
width: '12px',
|
|
103
|
+
height: '12px',
|
|
104
|
+
borderRadius: '50%',
|
|
105
|
+
background: colors.accentBlue,
|
|
106
|
+
}}
|
|
107
|
+
/>
|
|
108
|
+
))}
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { colors, fonts } from '../../../theme';
|
|
2
|
+
|
|
3
|
+
export default function PromptCallPanel({
|
|
4
|
+
prompt,
|
|
5
|
+
promptArgs,
|
|
6
|
+
onPromptArgsChange,
|
|
7
|
+
promptResult,
|
|
8
|
+
onGetPrompt,
|
|
9
|
+
loading,
|
|
10
|
+
}) {
|
|
11
|
+
return (
|
|
12
|
+
<div
|
|
13
|
+
style={{
|
|
14
|
+
flex: 1,
|
|
15
|
+
border: `1px solid ${colors.borderLight}`,
|
|
16
|
+
borderRadius: '8px',
|
|
17
|
+
overflow: 'hidden',
|
|
18
|
+
display: 'flex',
|
|
19
|
+
flexDirection: 'column',
|
|
20
|
+
}}
|
|
21
|
+
>
|
|
22
|
+
<div
|
|
23
|
+
style={{
|
|
24
|
+
padding: '12px',
|
|
25
|
+
background: colors.bgSecondary,
|
|
26
|
+
borderBottom: `1px solid ${colors.borderLight}`,
|
|
27
|
+
fontWeight: '500',
|
|
28
|
+
fontSize: '14px',
|
|
29
|
+
color: colors.textPrimary,
|
|
30
|
+
}}
|
|
31
|
+
>
|
|
32
|
+
Get Prompt: {prompt.name}
|
|
33
|
+
</div>
|
|
34
|
+
<div
|
|
35
|
+
style={{
|
|
36
|
+
flex: 1,
|
|
37
|
+
overflow: 'auto',
|
|
38
|
+
padding: '16px',
|
|
39
|
+
display: 'flex',
|
|
40
|
+
flexDirection: 'column',
|
|
41
|
+
gap: '12px',
|
|
42
|
+
}}
|
|
43
|
+
>
|
|
44
|
+
<div>
|
|
45
|
+
<label
|
|
46
|
+
style={{
|
|
47
|
+
display: 'block',
|
|
48
|
+
fontSize: '12px',
|
|
49
|
+
fontWeight: '500',
|
|
50
|
+
color: colors.textSecondary,
|
|
51
|
+
marginBottom: '6px',
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
54
|
+
Arguments (JSON)
|
|
55
|
+
</label>
|
|
56
|
+
<textarea
|
|
57
|
+
value={promptArgs}
|
|
58
|
+
onChange={(e) => onPromptArgsChange(e.target.value)}
|
|
59
|
+
style={{
|
|
60
|
+
width: '100%',
|
|
61
|
+
minHeight: '150px',
|
|
62
|
+
padding: '10px',
|
|
63
|
+
border: `1px solid ${colors.borderLight}`,
|
|
64
|
+
borderRadius: '6px',
|
|
65
|
+
fontFamily: fonts.mono,
|
|
66
|
+
fontSize: '12px',
|
|
67
|
+
background: colors.bgCard,
|
|
68
|
+
color: colors.textPrimary,
|
|
69
|
+
resize: 'vertical',
|
|
70
|
+
}}
|
|
71
|
+
/>
|
|
72
|
+
</div>
|
|
73
|
+
<button
|
|
74
|
+
onClick={onGetPrompt}
|
|
75
|
+
disabled={loading}
|
|
76
|
+
style={{
|
|
77
|
+
padding: '10px 20px',
|
|
78
|
+
background: colors.buttonPrimary,
|
|
79
|
+
color: colors.textInverse,
|
|
80
|
+
border: 'none',
|
|
81
|
+
borderRadius: '6px',
|
|
82
|
+
cursor: loading ? 'not-allowed' : 'pointer',
|
|
83
|
+
fontFamily: fonts.body,
|
|
84
|
+
fontSize: '13px',
|
|
85
|
+
fontWeight: '500',
|
|
86
|
+
opacity: loading ? 0.6 : 1,
|
|
87
|
+
}}
|
|
88
|
+
>
|
|
89
|
+
{loading ? 'Getting...' : 'Get Prompt'}
|
|
90
|
+
</button>
|
|
91
|
+
{promptResult && (
|
|
92
|
+
<div>
|
|
93
|
+
<label
|
|
94
|
+
style={{
|
|
95
|
+
display: 'block',
|
|
96
|
+
fontSize: '12px',
|
|
97
|
+
fontWeight: '500',
|
|
98
|
+
color: colors.textSecondary,
|
|
99
|
+
marginBottom: '6px',
|
|
100
|
+
}}
|
|
101
|
+
>
|
|
102
|
+
Result
|
|
103
|
+
</label>
|
|
104
|
+
<pre
|
|
105
|
+
style={{
|
|
106
|
+
padding: '12px',
|
|
107
|
+
background: colors.bgSecondary,
|
|
108
|
+
border: `1px solid ${colors.borderLight}`,
|
|
109
|
+
borderRadius: '6px',
|
|
110
|
+
fontSize: '12px',
|
|
111
|
+
fontFamily: fonts.mono,
|
|
112
|
+
color: promptResult.error ? colors.error : colors.textPrimary,
|
|
113
|
+
overflow: 'auto',
|
|
114
|
+
maxHeight: '300px',
|
|
115
|
+
margin: 0,
|
|
116
|
+
}}
|
|
117
|
+
>
|
|
118
|
+
{JSON.stringify(promptResult, null, 2)}
|
|
119
|
+
</pre>
|
|
120
|
+
</div>
|
|
121
|
+
)}
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { colors } from '../../../theme';
|
|
2
|
+
|
|
3
|
+
export default function PromptItem({ prompt, isSelected, onClick }) {
|
|
4
|
+
return (
|
|
5
|
+
<div
|
|
6
|
+
onClick={onClick}
|
|
7
|
+
style={{
|
|
8
|
+
padding: '12px',
|
|
9
|
+
borderBottom: `1px solid ${colors.borderLight}`,
|
|
10
|
+
cursor: 'pointer',
|
|
11
|
+
background: isSelected ? colors.bgSecondary : colors.bgCard,
|
|
12
|
+
transition: 'background 0.2s',
|
|
13
|
+
}}
|
|
14
|
+
onMouseEnter={(e) => {
|
|
15
|
+
if (!isSelected) {
|
|
16
|
+
e.currentTarget.style.background = colors.bgHover;
|
|
17
|
+
}
|
|
18
|
+
}}
|
|
19
|
+
onMouseLeave={(e) => {
|
|
20
|
+
if (!isSelected) {
|
|
21
|
+
e.currentTarget.style.background = colors.bgCard;
|
|
22
|
+
}
|
|
23
|
+
}}
|
|
24
|
+
>
|
|
25
|
+
<div
|
|
26
|
+
style={{
|
|
27
|
+
fontWeight: '500',
|
|
28
|
+
fontSize: '13px',
|
|
29
|
+
color: colors.textPrimary,
|
|
30
|
+
marginBottom: '4px',
|
|
31
|
+
}}
|
|
32
|
+
>
|
|
33
|
+
{prompt.name}
|
|
34
|
+
</div>
|
|
35
|
+
{prompt.description && (
|
|
36
|
+
<div
|
|
37
|
+
style={{
|
|
38
|
+
fontSize: '12px',
|
|
39
|
+
color: colors.textSecondary,
|
|
40
|
+
marginTop: '4px',
|
|
41
|
+
}}
|
|
42
|
+
>
|
|
43
|
+
{prompt.description}
|
|
44
|
+
</div>
|
|
45
|
+
)}
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { colors } from '../../../theme';
|
|
2
|
+
import LoadingState from '../common/LoadingState';
|
|
3
|
+
import ErrorState from '../common/ErrorState';
|
|
4
|
+
import EmptyState from '../common/EmptyState';
|
|
5
|
+
import PromptItem from './PromptItem';
|
|
6
|
+
|
|
7
|
+
export default function PromptsList({
|
|
8
|
+
serverStatus,
|
|
9
|
+
promptsLoading,
|
|
10
|
+
promptsLoaded,
|
|
11
|
+
error,
|
|
12
|
+
prompts,
|
|
13
|
+
selectedPrompt,
|
|
14
|
+
onSelectPrompt,
|
|
15
|
+
}) {
|
|
16
|
+
return (
|
|
17
|
+
<div
|
|
18
|
+
style={{
|
|
19
|
+
flex: 1,
|
|
20
|
+
overflow: 'auto',
|
|
21
|
+
background: colors.bgCard,
|
|
22
|
+
position: 'relative',
|
|
23
|
+
}}
|
|
24
|
+
>
|
|
25
|
+
{!serverStatus?.running ? (
|
|
26
|
+
<LoadingState message="Waiting for MCP server to start..." />
|
|
27
|
+
) : promptsLoading || !promptsLoaded ? (
|
|
28
|
+
<LoadingState message="Loading prompts..." />
|
|
29
|
+
) : error && error.includes('prompts:') ? (
|
|
30
|
+
<ErrorState message={`Error loading prompts: ${error.replace('prompts: ', '')}`} />
|
|
31
|
+
) : prompts.length === 0 ? (
|
|
32
|
+
<EmptyState message="No prompts available." />
|
|
33
|
+
) : (
|
|
34
|
+
prompts.map((prompt, idx) => (
|
|
35
|
+
<PromptItem
|
|
36
|
+
key={idx}
|
|
37
|
+
prompt={prompt}
|
|
38
|
+
isSelected={selectedPrompt?.name === prompt.name}
|
|
39
|
+
onClick={() => onSelectPrompt(prompt)}
|
|
40
|
+
/>
|
|
41
|
+
))
|
|
42
|
+
)}
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { colors, fonts } from '../../theme';
|
|
2
|
+
import PromptsList from './PromptsSection/PromptsList';
|
|
3
|
+
import PromptCallPanel from './PromptsSection/PromptCallPanel';
|
|
4
|
+
|
|
5
|
+
export default function PromptsSection({
|
|
6
|
+
prompts,
|
|
7
|
+
selectedPrompt,
|
|
8
|
+
onSelectPrompt,
|
|
9
|
+
promptArgs,
|
|
10
|
+
onPromptArgsChange,
|
|
11
|
+
promptResult,
|
|
12
|
+
onGetPrompt,
|
|
13
|
+
loading,
|
|
14
|
+
promptsLoading,
|
|
15
|
+
promptsLoaded,
|
|
16
|
+
serverStatus,
|
|
17
|
+
error,
|
|
18
|
+
onRefresh,
|
|
19
|
+
}) {
|
|
20
|
+
const handleSelectPrompt = (prompt) => {
|
|
21
|
+
onSelectPrompt(prompt);
|
|
22
|
+
const exampleArgs = prompt.arguments
|
|
23
|
+
? prompt.arguments.reduce((acc, arg) => {
|
|
24
|
+
acc[arg.name] = arg.default !== undefined ? arg.default : '';
|
|
25
|
+
return acc;
|
|
26
|
+
}, {})
|
|
27
|
+
: {};
|
|
28
|
+
onPromptArgsChange(JSON.stringify(exampleArgs, null, 2));
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '16px', height: '100%' }}>
|
|
33
|
+
<div style={{ display: 'flex', gap: '8px', alignItems: 'center' }}>
|
|
34
|
+
<button
|
|
35
|
+
onClick={onRefresh}
|
|
36
|
+
disabled={loading || promptsLoading}
|
|
37
|
+
style={{
|
|
38
|
+
padding: '8px 16px',
|
|
39
|
+
background: colors.buttonPrimary,
|
|
40
|
+
color: colors.textInverse,
|
|
41
|
+
border: 'none',
|
|
42
|
+
borderRadius: '6px',
|
|
43
|
+
cursor: loading || promptsLoading ? 'not-allowed' : 'pointer',
|
|
44
|
+
fontFamily: fonts.body,
|
|
45
|
+
fontSize: '13px',
|
|
46
|
+
fontWeight: '500',
|
|
47
|
+
opacity: loading || promptsLoading ? 0.6 : 1,
|
|
48
|
+
}}
|
|
49
|
+
>
|
|
50
|
+
{promptsLoading ? 'Loading...' : 'Refresh Prompts'}
|
|
51
|
+
</button>
|
|
52
|
+
<span style={{ color: colors.textSecondary, fontSize: '13px' }}>
|
|
53
|
+
{promptsLoading
|
|
54
|
+
? 'Loading prompts...'
|
|
55
|
+
: `${prompts.length} prompt${prompts.length !== 1 ? 's' : ''} available`}
|
|
56
|
+
</span>
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
<div style={{ display: 'flex', gap: '16px', flex: 1, minHeight: 0 }}>
|
|
60
|
+
<div
|
|
61
|
+
style={{
|
|
62
|
+
flex: 1,
|
|
63
|
+
border: `1px solid ${colors.borderLight}`,
|
|
64
|
+
borderRadius: '8px',
|
|
65
|
+
overflow: 'hidden',
|
|
66
|
+
display: 'flex',
|
|
67
|
+
flexDirection: 'column',
|
|
68
|
+
}}
|
|
69
|
+
>
|
|
70
|
+
<div
|
|
71
|
+
style={{
|
|
72
|
+
padding: '12px',
|
|
73
|
+
background: colors.bgSecondary,
|
|
74
|
+
borderBottom: `1px solid ${colors.borderLight}`,
|
|
75
|
+
fontWeight: '500',
|
|
76
|
+
fontSize: '14px',
|
|
77
|
+
color: colors.textPrimary,
|
|
78
|
+
}}
|
|
79
|
+
>
|
|
80
|
+
Available Prompts
|
|
81
|
+
</div>
|
|
82
|
+
<PromptsList
|
|
83
|
+
serverStatus={serverStatus}
|
|
84
|
+
promptsLoading={promptsLoading}
|
|
85
|
+
promptsLoaded={promptsLoaded}
|
|
86
|
+
error={error}
|
|
87
|
+
prompts={prompts}
|
|
88
|
+
selectedPrompt={selectedPrompt}
|
|
89
|
+
onSelectPrompt={handleSelectPrompt}
|
|
90
|
+
/>
|
|
91
|
+
</div>
|
|
92
|
+
|
|
93
|
+
{selectedPrompt && (
|
|
94
|
+
<PromptCallPanel
|
|
95
|
+
prompt={selectedPrompt}
|
|
96
|
+
promptArgs={promptArgs}
|
|
97
|
+
onPromptArgsChange={onPromptArgsChange}
|
|
98
|
+
promptResult={promptResult}
|
|
99
|
+
onGetPrompt={onGetPrompt}
|
|
100
|
+
loading={loading}
|
|
101
|
+
/>
|
|
102
|
+
)}
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
);
|
|
106
|
+
}
|