@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,89 @@
|
|
|
1
|
+
import { colors, fonts } from '../../../theme';
|
|
2
|
+
|
|
3
|
+
export default function ResourceCallPanel({ resource, resourceResult, onReadResource, loading }) {
|
|
4
|
+
return (
|
|
5
|
+
<div
|
|
6
|
+
style={{
|
|
7
|
+
flex: 1,
|
|
8
|
+
border: `1px solid ${colors.borderLight}`,
|
|
9
|
+
borderRadius: '8px',
|
|
10
|
+
overflow: 'hidden',
|
|
11
|
+
display: 'flex',
|
|
12
|
+
flexDirection: 'column',
|
|
13
|
+
}}
|
|
14
|
+
>
|
|
15
|
+
<div
|
|
16
|
+
style={{
|
|
17
|
+
padding: '12px',
|
|
18
|
+
background: colors.bgSecondary,
|
|
19
|
+
borderBottom: `1px solid ${colors.borderLight}`,
|
|
20
|
+
fontWeight: '500',
|
|
21
|
+
fontSize: '14px',
|
|
22
|
+
color: colors.textPrimary,
|
|
23
|
+
}}
|
|
24
|
+
>
|
|
25
|
+
Read Resource: {resource.uri}
|
|
26
|
+
</div>
|
|
27
|
+
<div
|
|
28
|
+
style={{
|
|
29
|
+
flex: 1,
|
|
30
|
+
overflow: 'auto',
|
|
31
|
+
padding: '16px',
|
|
32
|
+
display: 'flex',
|
|
33
|
+
flexDirection: 'column',
|
|
34
|
+
gap: '12px',
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
37
|
+
<button
|
|
38
|
+
onClick={onReadResource}
|
|
39
|
+
disabled={loading}
|
|
40
|
+
style={{
|
|
41
|
+
padding: '10px 20px',
|
|
42
|
+
background: colors.buttonPrimary,
|
|
43
|
+
color: colors.textInverse,
|
|
44
|
+
border: 'none',
|
|
45
|
+
borderRadius: '6px',
|
|
46
|
+
cursor: loading ? 'not-allowed' : 'pointer',
|
|
47
|
+
fontFamily: fonts.body,
|
|
48
|
+
fontSize: '13px',
|
|
49
|
+
fontWeight: '500',
|
|
50
|
+
opacity: loading ? 0.6 : 1,
|
|
51
|
+
}}
|
|
52
|
+
>
|
|
53
|
+
{loading ? 'Reading...' : 'Read Resource'}
|
|
54
|
+
</button>
|
|
55
|
+
{resourceResult && (
|
|
56
|
+
<div>
|
|
57
|
+
<label
|
|
58
|
+
style={{
|
|
59
|
+
display: 'block',
|
|
60
|
+
fontSize: '12px',
|
|
61
|
+
fontWeight: '500',
|
|
62
|
+
color: colors.textSecondary,
|
|
63
|
+
marginBottom: '6px',
|
|
64
|
+
}}
|
|
65
|
+
>
|
|
66
|
+
Result
|
|
67
|
+
</label>
|
|
68
|
+
<pre
|
|
69
|
+
style={{
|
|
70
|
+
padding: '12px',
|
|
71
|
+
background: colors.bgSecondary,
|
|
72
|
+
border: `1px solid ${colors.borderLight}`,
|
|
73
|
+
borderRadius: '6px',
|
|
74
|
+
fontSize: '12px',
|
|
75
|
+
fontFamily: fonts.mono,
|
|
76
|
+
color: resourceResult.error ? colors.error : colors.textPrimary,
|
|
77
|
+
overflow: 'auto',
|
|
78
|
+
maxHeight: '400px',
|
|
79
|
+
margin: 0,
|
|
80
|
+
}}
|
|
81
|
+
>
|
|
82
|
+
{JSON.stringify(resourceResult, null, 2)}
|
|
83
|
+
</pre>
|
|
84
|
+
</div>
|
|
85
|
+
)}
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { colors } from '../../../theme';
|
|
2
|
+
|
|
3
|
+
export default function ResourceItem({ resource, 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
|
+
{resource.uri}
|
|
34
|
+
</div>
|
|
35
|
+
{resource.name && (
|
|
36
|
+
<div
|
|
37
|
+
style={{
|
|
38
|
+
fontSize: '12px',
|
|
39
|
+
color: colors.textSecondary,
|
|
40
|
+
marginTop: '4px',
|
|
41
|
+
}}
|
|
42
|
+
>
|
|
43
|
+
{resource.name}
|
|
44
|
+
</div>
|
|
45
|
+
)}
|
|
46
|
+
{resource.description && (
|
|
47
|
+
<div
|
|
48
|
+
style={{
|
|
49
|
+
fontSize: '12px',
|
|
50
|
+
color: colors.textSecondary,
|
|
51
|
+
marginTop: '4px',
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
54
|
+
{resource.description}
|
|
55
|
+
</div>
|
|
56
|
+
)}
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
@@ -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 ResourceItem from './ResourceItem';
|
|
6
|
+
|
|
7
|
+
export default function ResourcesList({
|
|
8
|
+
serverStatus,
|
|
9
|
+
resourcesLoading,
|
|
10
|
+
resourcesLoaded,
|
|
11
|
+
error,
|
|
12
|
+
resources,
|
|
13
|
+
selectedResource,
|
|
14
|
+
onSelectResource,
|
|
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
|
+
) : resourcesLoading || !resourcesLoaded ? (
|
|
28
|
+
<LoadingState message="Loading resources..." />
|
|
29
|
+
) : error && error.includes('resources:') ? (
|
|
30
|
+
<ErrorState message={`Error loading resources: ${error.replace('resources: ', '')}`} />
|
|
31
|
+
) : resources.length === 0 ? (
|
|
32
|
+
<EmptyState message="No resources available." />
|
|
33
|
+
) : (
|
|
34
|
+
resources.map((resource, idx) => (
|
|
35
|
+
<ResourceItem
|
|
36
|
+
key={idx}
|
|
37
|
+
resource={resource}
|
|
38
|
+
isSelected={selectedResource?.uri === resource.uri}
|
|
39
|
+
onClick={() => onSelectResource(resource)}
|
|
40
|
+
/>
|
|
41
|
+
))
|
|
42
|
+
)}
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { colors, fonts } from '../../theme';
|
|
2
|
+
import ResourcesList from './ResourcesSection/ResourcesList';
|
|
3
|
+
import ResourceCallPanel from './ResourcesSection/ResourceCallPanel';
|
|
4
|
+
|
|
5
|
+
export default function ResourcesSection({
|
|
6
|
+
resources,
|
|
7
|
+
selectedResource,
|
|
8
|
+
onSelectResource,
|
|
9
|
+
resourceResult,
|
|
10
|
+
onReadResource,
|
|
11
|
+
loading,
|
|
12
|
+
resourcesLoading,
|
|
13
|
+
resourcesLoaded,
|
|
14
|
+
serverStatus,
|
|
15
|
+
error,
|
|
16
|
+
onRefresh,
|
|
17
|
+
}) {
|
|
18
|
+
return (
|
|
19
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '16px', height: '100%' }}>
|
|
20
|
+
<div style={{ display: 'flex', gap: '8px', alignItems: 'center' }}>
|
|
21
|
+
<button
|
|
22
|
+
onClick={onRefresh}
|
|
23
|
+
disabled={loading || resourcesLoading}
|
|
24
|
+
style={{
|
|
25
|
+
padding: '8px 16px',
|
|
26
|
+
background: colors.buttonPrimary,
|
|
27
|
+
color: colors.textInverse,
|
|
28
|
+
border: 'none',
|
|
29
|
+
borderRadius: '6px',
|
|
30
|
+
cursor: loading || resourcesLoading ? 'not-allowed' : 'pointer',
|
|
31
|
+
fontFamily: fonts.body,
|
|
32
|
+
fontSize: '13px',
|
|
33
|
+
fontWeight: '500',
|
|
34
|
+
opacity: loading || resourcesLoading ? 0.6 : 1,
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
37
|
+
{resourcesLoading ? 'Loading...' : 'Refresh Resources'}
|
|
38
|
+
</button>
|
|
39
|
+
<span style={{ color: colors.textSecondary, fontSize: '13px' }}>
|
|
40
|
+
{resourcesLoading
|
|
41
|
+
? 'Loading resources...'
|
|
42
|
+
: `${resources.length} resource${resources.length !== 1 ? 's' : ''} available`}
|
|
43
|
+
</span>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div style={{ display: 'flex', gap: '16px', flex: 1, minHeight: 0 }}>
|
|
47
|
+
<div
|
|
48
|
+
style={{
|
|
49
|
+
flex: 1,
|
|
50
|
+
border: `1px solid ${colors.borderLight}`,
|
|
51
|
+
borderRadius: '8px',
|
|
52
|
+
overflow: 'hidden',
|
|
53
|
+
display: 'flex',
|
|
54
|
+
flexDirection: 'column',
|
|
55
|
+
}}
|
|
56
|
+
>
|
|
57
|
+
<div
|
|
58
|
+
style={{
|
|
59
|
+
padding: '12px',
|
|
60
|
+
background: colors.bgSecondary,
|
|
61
|
+
borderBottom: `1px solid ${colors.borderLight}`,
|
|
62
|
+
fontWeight: '500',
|
|
63
|
+
fontSize: '14px',
|
|
64
|
+
color: colors.textPrimary,
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
Available Resources
|
|
68
|
+
</div>
|
|
69
|
+
<ResourcesList
|
|
70
|
+
serverStatus={serverStatus}
|
|
71
|
+
resourcesLoading={resourcesLoading}
|
|
72
|
+
resourcesLoaded={resourcesLoaded}
|
|
73
|
+
error={error}
|
|
74
|
+
resources={resources}
|
|
75
|
+
selectedResource={selectedResource}
|
|
76
|
+
onSelectResource={onSelectResource}
|
|
77
|
+
/>
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
{selectedResource && (
|
|
81
|
+
<ResourceCallPanel
|
|
82
|
+
resource={selectedResource}
|
|
83
|
+
resourceResult={resourceResult}
|
|
84
|
+
onReadResource={onReadResource}
|
|
85
|
+
loading={loading}
|
|
86
|
+
/>
|
|
87
|
+
)}
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { colors, fonts } from '../../../theme';
|
|
2
|
+
|
|
3
|
+
export default function ToolCallPanel({
|
|
4
|
+
tool,
|
|
5
|
+
toolArgs,
|
|
6
|
+
onToolArgsChange,
|
|
7
|
+
toolResult,
|
|
8
|
+
onCallTool,
|
|
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
|
+
Call Tool: {tool.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={toolArgs}
|
|
58
|
+
onChange={(e) => onToolArgsChange(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={onCallTool}
|
|
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 ? 'Calling...' : 'Call Tool'}
|
|
90
|
+
</button>
|
|
91
|
+
{toolResult && (
|
|
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: toolResult.error ? colors.error : colors.textPrimary,
|
|
113
|
+
overflow: 'auto',
|
|
114
|
+
maxHeight: '300px',
|
|
115
|
+
margin: 0,
|
|
116
|
+
}}
|
|
117
|
+
>
|
|
118
|
+
{JSON.stringify(toolResult, 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 ToolItem({ tool, 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
|
+
{tool.name}
|
|
34
|
+
</div>
|
|
35
|
+
{tool.description && (
|
|
36
|
+
<div
|
|
37
|
+
style={{
|
|
38
|
+
fontSize: '12px',
|
|
39
|
+
color: colors.textSecondary,
|
|
40
|
+
marginTop: '4px',
|
|
41
|
+
}}
|
|
42
|
+
>
|
|
43
|
+
{tool.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 ToolItem from './ToolItem';
|
|
6
|
+
|
|
7
|
+
export default function ToolsList({
|
|
8
|
+
serverStatus,
|
|
9
|
+
toolsLoading,
|
|
10
|
+
toolsLoaded,
|
|
11
|
+
error,
|
|
12
|
+
tools,
|
|
13
|
+
selectedTool,
|
|
14
|
+
onSelectTool,
|
|
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
|
+
) : toolsLoading || !toolsLoaded ? (
|
|
28
|
+
<LoadingState message="Loading tools..." />
|
|
29
|
+
) : error && error.includes('tools:') ? (
|
|
30
|
+
<ErrorState message={`Error loading tools: ${error.replace('tools: ', '')}`} />
|
|
31
|
+
) : tools.length === 0 ? (
|
|
32
|
+
<EmptyState message="No tools available." />
|
|
33
|
+
) : (
|
|
34
|
+
tools.map((tool, idx) => (
|
|
35
|
+
<ToolItem
|
|
36
|
+
key={idx}
|
|
37
|
+
tool={tool}
|
|
38
|
+
isSelected={selectedTool?.name === tool.name}
|
|
39
|
+
onClick={() => onSelectTool(tool)}
|
|
40
|
+
/>
|
|
41
|
+
))
|
|
42
|
+
)}
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { colors, fonts } from '../../theme';
|
|
2
|
+
import ToolsList from './ToolsSection/ToolsList';
|
|
3
|
+
import ToolCallPanel from './ToolsSection/ToolCallPanel';
|
|
4
|
+
|
|
5
|
+
export default function ToolsSection({
|
|
6
|
+
tools,
|
|
7
|
+
selectedTool,
|
|
8
|
+
onSelectTool,
|
|
9
|
+
toolArgs,
|
|
10
|
+
onToolArgsChange,
|
|
11
|
+
toolResult,
|
|
12
|
+
onCallTool,
|
|
13
|
+
loading,
|
|
14
|
+
toolsLoading,
|
|
15
|
+
toolsLoaded,
|
|
16
|
+
serverStatus,
|
|
17
|
+
error,
|
|
18
|
+
onRefresh,
|
|
19
|
+
}) {
|
|
20
|
+
const handleSelectTool = (tool) => {
|
|
21
|
+
onSelectTool(tool);
|
|
22
|
+
const exampleArgs = tool.inputSchema?.properties
|
|
23
|
+
? Object.keys(tool.inputSchema.properties).reduce((acc, key) => {
|
|
24
|
+
const prop = tool.inputSchema.properties[key];
|
|
25
|
+
acc[key] = prop.default !== undefined ? prop.default : '';
|
|
26
|
+
return acc;
|
|
27
|
+
}, {})
|
|
28
|
+
: {};
|
|
29
|
+
onToolArgsChange(JSON.stringify(exampleArgs, null, 2));
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '16px', height: '100%' }}>
|
|
34
|
+
<div style={{ display: 'flex', gap: '8px', alignItems: 'center' }}>
|
|
35
|
+
<button
|
|
36
|
+
onClick={onRefresh}
|
|
37
|
+
disabled={loading || toolsLoading}
|
|
38
|
+
style={{
|
|
39
|
+
padding: '8px 16px',
|
|
40
|
+
background: colors.buttonPrimary,
|
|
41
|
+
color: colors.textInverse,
|
|
42
|
+
border: 'none',
|
|
43
|
+
borderRadius: '6px',
|
|
44
|
+
cursor: loading || toolsLoading ? 'not-allowed' : 'pointer',
|
|
45
|
+
fontFamily: fonts.body,
|
|
46
|
+
fontSize: '13px',
|
|
47
|
+
fontWeight: '500',
|
|
48
|
+
opacity: loading || toolsLoading ? 0.6 : 1,
|
|
49
|
+
}}
|
|
50
|
+
>
|
|
51
|
+
{toolsLoading ? 'Loading...' : 'Refresh Tools'}
|
|
52
|
+
</button>
|
|
53
|
+
<span style={{ color: colors.textSecondary, fontSize: '13px' }}>
|
|
54
|
+
{toolsLoading
|
|
55
|
+
? 'Loading tools...'
|
|
56
|
+
: `${tools.length} tool${tools.length !== 1 ? 's' : ''} available`}
|
|
57
|
+
</span>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<div style={{ display: 'flex', gap: '16px', flex: 1, minHeight: 0 }}>
|
|
61
|
+
<div
|
|
62
|
+
style={{
|
|
63
|
+
flex: 1,
|
|
64
|
+
border: `1px solid ${colors.borderLight}`,
|
|
65
|
+
borderRadius: '8px',
|
|
66
|
+
overflow: 'hidden',
|
|
67
|
+
display: 'flex',
|
|
68
|
+
flexDirection: 'column',
|
|
69
|
+
}}
|
|
70
|
+
>
|
|
71
|
+
<div
|
|
72
|
+
style={{
|
|
73
|
+
padding: '12px',
|
|
74
|
+
background: colors.bgSecondary,
|
|
75
|
+
borderBottom: `1px solid ${colors.borderLight}`,
|
|
76
|
+
fontWeight: '500',
|
|
77
|
+
fontSize: '14px',
|
|
78
|
+
color: colors.textPrimary,
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
Available Tools
|
|
82
|
+
</div>
|
|
83
|
+
<ToolsList
|
|
84
|
+
serverStatus={serverStatus}
|
|
85
|
+
toolsLoading={toolsLoading}
|
|
86
|
+
toolsLoaded={toolsLoaded}
|
|
87
|
+
error={error}
|
|
88
|
+
tools={tools}
|
|
89
|
+
selectedTool={selectedTool}
|
|
90
|
+
onSelectTool={handleSelectTool}
|
|
91
|
+
/>
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
{selectedTool && (
|
|
95
|
+
<ToolCallPanel
|
|
96
|
+
tool={selectedTool}
|
|
97
|
+
toolArgs={toolArgs}
|
|
98
|
+
onToolArgsChange={onToolArgsChange}
|
|
99
|
+
toolResult={toolResult}
|
|
100
|
+
onCallTool={onCallTool}
|
|
101
|
+
loading={loading}
|
|
102
|
+
/>
|
|
103
|
+
)}
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { colors, fonts } from '../../../theme';
|
|
2
|
+
|
|
3
|
+
export default function EmptyState({ message }) {
|
|
4
|
+
return (
|
|
5
|
+
<div
|
|
6
|
+
style={{
|
|
7
|
+
padding: '40px',
|
|
8
|
+
textAlign: 'center',
|
|
9
|
+
color: colors.textSecondary,
|
|
10
|
+
fontFamily: fonts.body,
|
|
11
|
+
fontSize: '13px',
|
|
12
|
+
}}
|
|
13
|
+
>
|
|
14
|
+
{message}
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { colors, fonts } from '../../../theme';
|
|
2
|
+
|
|
3
|
+
export default function ErrorState({ message }) {
|
|
4
|
+
return (
|
|
5
|
+
<div
|
|
6
|
+
style={{
|
|
7
|
+
padding: '40px',
|
|
8
|
+
textAlign: 'center',
|
|
9
|
+
color: colors.error,
|
|
10
|
+
fontFamily: fonts.body,
|
|
11
|
+
fontSize: '13px',
|
|
12
|
+
}}
|
|
13
|
+
>
|
|
14
|
+
{message}
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { colors, fonts } from '../../../theme';
|
|
2
|
+
|
|
3
|
+
export default function LoadingState({ message }) {
|
|
4
|
+
return (
|
|
5
|
+
<div
|
|
6
|
+
style={{
|
|
7
|
+
padding: '40px',
|
|
8
|
+
textAlign: 'center',
|
|
9
|
+
color: colors.textSecondary,
|
|
10
|
+
fontFamily: fonts.body,
|
|
11
|
+
fontSize: '13px',
|
|
12
|
+
}}
|
|
13
|
+
>
|
|
14
|
+
{message}
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
17
|
+
}
|