@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,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
+ }