@mcp-shark/mcp-shark 1.4.1 โ†’ 1.5.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 (203) hide show
  1. package/README.md +84 -645
  2. package/bin/mcp-shark.js +30 -36
  3. package/mcp-server/index.js +115 -0
  4. package/mcp-server/lib/auditor/audit.js +34 -42
  5. package/mcp-server/lib/common/error.js +1 -1
  6. package/mcp-server/lib/server/external/all.js +5 -6
  7. package/mcp-server/lib/server/external/config.js +1 -3
  8. package/mcp-server/lib/server/external/kv.js +21 -40
  9. package/mcp-server/lib/server/external/single/request.js +3 -6
  10. package/mcp-server/lib/server/external/single/run.js +8 -19
  11. package/mcp-server/lib/server/internal/handlers/prompts-get.js +5 -7
  12. package/mcp-server/lib/server/internal/handlers/prompts-list.js +5 -4
  13. package/mcp-server/lib/server/internal/handlers/resources-list.js +5 -4
  14. package/mcp-server/lib/server/internal/handlers/resources-read.js +5 -4
  15. package/mcp-server/lib/server/internal/handlers/tools-call.js +8 -10
  16. package/mcp-server/lib/server/internal/handlers/tools-list.js +6 -5
  17. package/mcp-server/lib/server/internal/run.js +5 -17
  18. package/mcp-server/lib/server/internal/server.js +14 -15
  19. package/mcp-server/lib/server/internal/session.js +8 -13
  20. package/mcp-server/mcp-shark.js +16 -66
  21. package/package.json +23 -38
  22. package/ui/dist/assets/index-Cc-IUa83.css +1 -0
  23. package/ui/dist/assets/index-srLDlk97.js +35 -0
  24. package/ui/dist/index.html +17 -0
  25. package/ui/dist/og-image.png +0 -0
  26. package/ui/server/routes/backups/deleteBackup.js +54 -0
  27. package/ui/server/routes/backups/index.js +15 -0
  28. package/ui/server/routes/backups/listBackups.js +75 -0
  29. package/ui/server/routes/backups/restoreBackup.js +83 -0
  30. package/ui/server/routes/backups/viewBackup.js +47 -0
  31. package/ui/server/routes/composite/index.js +46 -0
  32. package/ui/server/routes/composite/servers.js +18 -0
  33. package/ui/server/routes/composite/setup.js +129 -0
  34. package/ui/server/routes/composite/status.js +7 -0
  35. package/ui/server/routes/composite/stop.js +39 -0
  36. package/ui/server/routes/composite/utils.js +45 -0
  37. package/ui/server/routes/config.js +34 -30
  38. package/ui/server/routes/conversations.js +3 -3
  39. package/ui/server/routes/help.js +2 -2
  40. package/ui/server/routes/logs.js +5 -5
  41. package/ui/server/routes/playground.js +91 -62
  42. package/ui/server/routes/requests.js +112 -108
  43. package/ui/server/routes/sessions.js +4 -4
  44. package/ui/server/routes/settings.js +199 -0
  45. package/ui/server/routes/smartscan/discover.js +7 -6
  46. package/ui/server/routes/smartscan/scans/clearCache.js +3 -2
  47. package/ui/server/routes/smartscan/scans/createBatchScans.js +4 -3
  48. package/ui/server/routes/smartscan/scans/createScan.js +2 -1
  49. package/ui/server/routes/smartscan/scans/getCachedResults.js +2 -1
  50. package/ui/server/routes/smartscan/scans/getScan.js +2 -1
  51. package/ui/server/routes/smartscan/scans/listScans.js +5 -4
  52. package/ui/server/routes/smartscan/scans.js +3 -3
  53. package/ui/server/routes/smartscan/token.js +4 -3
  54. package/ui/server/routes/smartscan/transport.js +1 -1
  55. package/ui/server/routes/smartscan.js +1 -1
  56. package/ui/server/routes/statistics.js +13 -10
  57. package/ui/server/utils/config-update.js +140 -112
  58. package/ui/server/utils/config.js +4 -4
  59. package/ui/server/utils/logger.js +2 -0
  60. package/ui/server/utils/paths.js +210 -2
  61. package/ui/server/utils/port.js +2 -2
  62. package/ui/server/utils/process.js +0 -67
  63. package/ui/server/utils/scan-cache/all-results.js +76 -59
  64. package/ui/server/utils/scan-cache/directory.js +1 -1
  65. package/ui/server/utils/scan-cache/file-operations.js +19 -16
  66. package/ui/server/utils/scan-cache/server-operations.js +14 -9
  67. package/ui/server/utils/serialization.js +9 -3
  68. package/ui/server/utils/smartscan-token.js +4 -3
  69. package/ui/server.js +87 -41
  70. package/ui/src/App.jsx +5 -5
  71. package/ui/src/CompositeLogs.jsx +20 -20
  72. package/ui/src/CompositeSetup.jsx +9 -9
  73. package/ui/src/HelpGuide/HelpGuideFooter.jsx +1 -0
  74. package/ui/src/HelpGuide/HelpGuideHeader.jsx +2 -1
  75. package/ui/src/HelpGuide.jsx +17 -4
  76. package/ui/src/IntroTour.jsx +19 -5
  77. package/ui/src/LogDetail.jsx +1 -0
  78. package/ui/src/LogTable.jsx +24 -6
  79. package/ui/src/PacketDetail.jsx +21 -16
  80. package/ui/src/PacketFilters.jsx +29 -14
  81. package/ui/src/PacketList.jsx +4 -5
  82. package/ui/src/SmartScan.jsx +5 -5
  83. package/ui/src/TabNavigation.jsx +5 -5
  84. package/ui/src/components/App/HelpButton.jsx +4 -0
  85. package/ui/src/components/App/TrafficTab.jsx +4 -4
  86. package/ui/src/components/App/useAppState.js +118 -24
  87. package/ui/src/components/BackupList.jsx +6 -2
  88. package/ui/src/components/CollapsibleSection.jsx +16 -2
  89. package/ui/src/components/ConfigViewerModal.jsx +17 -3
  90. package/ui/src/components/ConfirmationModal.jsx +20 -3
  91. package/ui/src/components/DetailsTab/BodySection.jsx +3 -1
  92. package/ui/src/components/DetailsTab/CollapsibleRequestResponse.jsx +14 -3
  93. package/ui/src/components/DetailsTab/InfoSection.jsx +4 -2
  94. package/ui/src/components/DetailsTab/RequestDetailsSection.jsx +7 -5
  95. package/ui/src/components/DetailsTab/ResponseDetailsSection.jsx +7 -5
  96. package/ui/src/components/DetectedPathsList.jsx +5 -2
  97. package/ui/src/components/FileInput.jsx +3 -1
  98. package/ui/src/components/GroupHeader.jsx +14 -0
  99. package/ui/src/components/GroupedByMcpView.jsx +3 -10
  100. package/ui/src/components/GroupedByServerView.jsx +1 -1
  101. package/ui/src/components/GroupedBySessionView.jsx +1 -1
  102. package/ui/src/components/HexTab.jsx +17 -4
  103. package/ui/src/components/LogsToolbar.jsx +3 -1
  104. package/ui/src/components/McpPlayground/LoadingModal.jsx +7 -3
  105. package/ui/src/components/McpPlayground/PromptsSection/PromptCallPanel.jsx +5 -0
  106. package/ui/src/components/McpPlayground/PromptsSection/PromptItem.jsx +52 -23
  107. package/ui/src/components/McpPlayground/PromptsSection/PromptsList.jsx +13 -11
  108. package/ui/src/components/McpPlayground/PromptsSection.jsx +2 -1
  109. package/ui/src/components/McpPlayground/ResourcesSection/ResourceCallPanel.jsx +3 -0
  110. package/ui/src/components/McpPlayground/ResourcesSection/ResourceItem.jsx +66 -34
  111. package/ui/src/components/McpPlayground/ResourcesSection/ResourcesList.jsx +13 -11
  112. package/ui/src/components/McpPlayground/ResourcesSection.jsx +2 -1
  113. package/ui/src/components/McpPlayground/ToolsSection/ToolCallPanel.jsx +5 -0
  114. package/ui/src/components/McpPlayground/ToolsSection/ToolItem.jsx +52 -23
  115. package/ui/src/components/McpPlayground/ToolsSection/ToolsList.jsx +13 -11
  116. package/ui/src/components/McpPlayground/ToolsSection.jsx +2 -1
  117. package/ui/src/components/McpPlayground/hooks/useMcpDataLoader.js +107 -0
  118. package/ui/src/components/McpPlayground/hooks/useMcpRequest.js +70 -0
  119. package/ui/src/components/McpPlayground/hooks/useMcpServerStatus.js +90 -0
  120. package/ui/src/components/McpPlayground/useMcpPlayground.js +118 -159
  121. package/ui/src/components/McpPlayground.jsx +105 -23
  122. package/ui/src/components/PacketDetailHeader.jsx +8 -3
  123. package/ui/src/components/PacketFilters/ExportControls.jsx +2 -1
  124. package/ui/src/components/PacketFilters/FilterInput.jsx +1 -1
  125. package/ui/src/components/RawTab.jsx +15 -2
  126. package/ui/src/components/RequestRow/OrphanedResponseRow.jsx +10 -2
  127. package/ui/src/components/RequestRow/RequestRowMain.jsx +12 -3
  128. package/ui/src/components/RequestRow/ResponseRow.jsx +11 -3
  129. package/ui/src/components/RequestRow.jsx +17 -9
  130. package/ui/src/components/ServerControl.jsx +3 -1
  131. package/ui/src/components/ServiceSelector.jsx +2 -0
  132. package/ui/src/components/SmartScan/AnalysisResult.jsx +2 -2
  133. package/ui/src/components/SmartScan/BatchResultsDisplay/BatchResultItem.jsx +2 -1
  134. package/ui/src/components/SmartScan/BatchResultsDisplay/BatchResultsHeader.jsx +1 -1
  135. package/ui/src/components/SmartScan/BatchResultsDisplay.jsx +9 -3
  136. package/ui/src/components/SmartScan/EmptyState.jsx +3 -0
  137. package/ui/src/components/SmartScan/ErrorDisplay.jsx +4 -2
  138. package/ui/src/components/SmartScan/ExpandableSection.jsx +4 -0
  139. package/ui/src/components/SmartScan/FindingsTable.jsx +46 -42
  140. package/ui/src/components/SmartScan/ListViewContent.jsx +2 -2
  141. package/ui/src/components/SmartScan/NotablePatternsSection.jsx +13 -8
  142. package/ui/src/components/SmartScan/OverallSummarySection.jsx +36 -29
  143. package/ui/src/components/SmartScan/RecommendationsSection.jsx +10 -8
  144. package/ui/src/components/SmartScan/ScanDetailHeader.jsx +2 -1
  145. package/ui/src/components/SmartScan/ScanDetailView.jsx +4 -4
  146. package/ui/src/components/SmartScan/ScanListView/ScanListHeader.jsx +2 -1
  147. package/ui/src/components/SmartScan/ScanListView/ScanListItem.jsx +15 -1
  148. package/ui/src/components/SmartScan/ScanOverviewSection.jsx +3 -1
  149. package/ui/src/components/SmartScan/ScanResultsDisplay.jsx +1 -1
  150. package/ui/src/components/SmartScan/ScanViewContent.jsx +2 -2
  151. package/ui/src/components/SmartScan/ScanningProgress.jsx +4 -2
  152. package/ui/src/components/SmartScan/ServerInfoSection.jsx +3 -1
  153. package/ui/src/components/SmartScan/ServerSelectionRow.jsx +4 -2
  154. package/ui/src/components/SmartScan/SingleResultDisplay.jsx +5 -3
  155. package/ui/src/components/SmartScan/SmartScanControls.jsx +11 -7
  156. package/ui/src/components/SmartScan/SmartScanHeader.jsx +1 -1
  157. package/ui/src/components/SmartScan/ViewModeTabs.jsx +2 -0
  158. package/ui/src/components/SmartScan/hooks/useCacheManagement.js +1 -2
  159. package/ui/src/components/SmartScan/hooks/useMcpDiscovery.js +22 -26
  160. package/ui/src/components/SmartScan/hooks/useScanList.js +10 -9
  161. package/ui/src/components/SmartScan/hooks/useScanOperations.js +23 -14
  162. package/ui/src/components/SmartScan/hooks/useServerStatus.js +2 -2
  163. package/ui/src/components/SmartScan/hooks/useTokenManagement.js +2 -2
  164. package/ui/src/components/SmartScan/scanDataUtils.js +22 -17
  165. package/ui/src/components/SmartScan/useSmartScan.js +4 -4
  166. package/ui/src/components/SmartScan/utils.js +3 -1
  167. package/ui/src/components/SmartScanIcons.jsx +6 -3
  168. package/ui/src/components/TabNavigation/DesktopTabs.jsx +8 -3
  169. package/ui/src/components/TabNavigation/MobileDropdown.jsx +3 -1
  170. package/ui/src/components/TabNavigation.jsx +8 -3
  171. package/ui/src/components/TabNavigationIcons.jsx +4 -4
  172. package/ui/src/components/TourOverlay.jsx +1 -1
  173. package/ui/src/components/TourTooltip/TourTooltipButtons.jsx +3 -0
  174. package/ui/src/components/TourTooltip/TourTooltipHeader.jsx +1 -0
  175. package/ui/src/components/TourTooltip/TourTooltipIcons.jsx +9 -0
  176. package/ui/src/components/TourTooltip/useTooltipPosition.js +63 -36
  177. package/ui/src/components/TourTooltip.jsx +11 -3
  178. package/ui/src/components/ViewModeTabs.jsx +3 -1
  179. package/ui/src/config/tourSteps.jsx +0 -2
  180. package/ui/src/hooks/useAnimation.js +15 -12
  181. package/ui/src/hooks/useConfigManagement.js +8 -8
  182. package/ui/src/hooks/useServiceExtraction.js +1 -1
  183. package/ui/src/index.css +3 -8
  184. package/ui/src/theme.js +3 -3
  185. package/ui/src/utils/hexUtils.js +11 -5
  186. package/ui/src/utils/mcpGroupingUtils.js +18 -10
  187. package/ui/src/utils/requestPairing.js +89 -0
  188. package/ui/src/utils/requestUtils.js +37 -105
  189. package/ui/vite.config.js +1 -1
  190. package/mcp-server/.editorconfig +0 -15
  191. package/mcp-server/.prettierignore +0 -11
  192. package/mcp-server/.prettierrc +0 -12
  193. package/mcp-server/README.md +0 -280
  194. package/mcp-server/commitlint.config.cjs +0 -42
  195. package/mcp-server/eslint.config.js +0 -131
  196. package/mcp-server/package-lock.json +0 -4784
  197. package/mcp-server/package.json +0 -30
  198. package/ui/README.md +0 -212
  199. package/ui/package-lock.json +0 -3574
  200. package/ui/package.json +0 -12
  201. package/ui/paths.js +0 -282
  202. package/ui/server/routes/backups.js +0 -251
  203. package/ui/server/routes/composite.js +0 -244
@@ -1,30 +0,0 @@
1
- {
2
- "name": "mcp-shark-server",
3
- "version": "1.0.0",
4
- "description": "MCP Shark server - aggregate multiple MCP servers",
5
- "main": "index.js",
6
- "type": "module",
7
- "bin": {
8
- "mcp-shark": "./mcp-shark.js"
9
- },
10
- "scripts": {
11
- "lint": "eslint . --ext .js",
12
- "lint:fix": "eslint . --ext .js --fix",
13
- "format": "prettier --write \"**/*.{js,json,css,md}\"",
14
- "format:check": "prettier --check \"**/*.{js,json,css,md}\"",
15
- "prepare": "husky install",
16
- "start": "node mcp-shark.js"
17
- },
18
- "lint-staged": {
19
- "*.js": [
20
- "eslint --fix",
21
- "prettier --write"
22
- ],
23
- "*.{json,css,md}": [
24
- "prettier --write"
25
- ]
26
- },
27
- "keywords": [],
28
- "author": "",
29
- "license": "ISC"
30
- }
package/ui/README.md DELETED
@@ -1,212 +0,0 @@
1
- # MCP Shark UI
2
-
3
- A real-time web interface for monitoring and inspecting MCP (Model Context Protocol) communications. Built with React and Express, this tool provides a sleek, dark-themed dashboard for viewing server logs, filtering communications, and analyzing request/response patterns.
4
-
5
- ## โœจ Features
6
-
7
- - **Real-time Updates**: WebSocket-powered live log streaming
8
- - **Advanced Filtering**: Filter by server, direction (request/response), HTTP method, and status
9
- - **Detailed Log View**: Inspect individual log entries with full payload details
10
- - **Performance Metrics**: View duration, payload size, and status for each communication
11
- - **Dark Theme UI**: Modern, developer-friendly interface
12
- - **SQLite Backend**: Efficient storage and querying of communication logs
13
- - **MCP Server Management**: Configure and manage MCP Shark server from the UI
14
-
15
- ## ๐Ÿ› ๏ธ Tech Stack
16
-
17
- - **Frontend**: React 18, Vite
18
- - **Backend**: Express.js, WebSocket (ws)
19
- - **Database**: SQLite (better-sqlite3)
20
- - **Build Tool**: Vite
21
-
22
- ## ๐Ÿ“ฆ Installation
23
-
24
- From the root directory:
25
-
26
- ```bash
27
- # Install all dependencies (recommended)
28
- npm run install:all
29
-
30
- # Or install UI dependencies only
31
- cd ui
32
- npm install
33
- ```
34
-
35
- ## ๐Ÿš€ Usage
36
-
37
- ### Starting the UI
38
-
39
- **Production Mode:**
40
-
41
- 1. Build the frontend:
42
-
43
- ```bash
44
- npm run build
45
- ```
46
-
47
- 2. Start the server:
48
-
49
- ```bash
50
- npm start
51
- ```
52
-
53
- Or specify a custom database path:
54
-
55
- ```bash
56
- DB_PATH=/path/to/mcp-shark.sqlite npm start
57
- ```
58
-
59
- The server will start on port `9853` by default (configurable via `UI_PORT` environment variable).
60
-
61
- **Development Mode:**
62
-
63
- Start the development server with hot reload:
64
-
65
- ```bash
66
- npm run dev
67
- ```
68
-
69
- The UI will be available at `http://localhost:5173` (or the port Vite assigns).
70
-
71
- ### Managing the MCP Server
72
-
73
- The MCP server is **managed through the UI**, not started separately:
74
-
75
- 1. Start the UI server (see above)
76
- 2. Open `http://localhost:9853` in your browser
77
- 3. Navigate to the **"MCP Server Setup"** tab
78
- 4. Select or provide your MCP configuration file (e.g., `~/.cursor/mcp.json`)
79
- 5. Click **"Start MCP Shark"** to start the server
80
-
81
- The UI will:
82
-
83
- - Convert your MCP config format automatically
84
- - Start the MCP server on port 9851
85
- - Display server logs in real-time
86
- - Allow you to stop/restart the server
87
-
88
- **Note:** The MCP server is started as a child process by the UI server. When you stop the UI, the MCP server will also be stopped automatically.
89
-
90
- ### Environment Variables
91
-
92
- - `UI_PORT`: Port for the server (default: `9853`)
93
- - `DB_PATH`: Path to the SQLite database file (default: `~/.mcp-shark/db/mcp-shark.sqlite`)
94
-
95
- ## ๐Ÿ“ก API Endpoints
96
-
97
- ### Traffic & Monitoring
98
-
99
- - `GET /api/requests` - Retrieve communication requests/responses with optional filtering
100
- - `GET /api/conversations` - Get request/response conversation pairs
101
- - `GET /api/sessions` - List all sessions
102
- - `GET /api/statistics` - Get traffic statistics
103
-
104
- ### MCP Server Management
105
-
106
- - `GET /api/composite/status` - Get the status of the MCP Shark server
107
- - `GET /api/composite/logs` - Get MCP Shark server logs
108
- - `POST /api/composite/setup` - Configure and start the MCP Shark server
109
- - `POST /api/composite/stop` - Stop the MCP Shark server
110
- - `POST /api/composite/logs/clear` - Clear server logs
111
-
112
- ### Configuration
113
-
114
- - `GET /api/config/detect` - Detect default MCP config file paths
115
- - `GET /api/config/read` - Read MCP configuration file
116
-
117
- ## ๐Ÿ”Œ WebSocket
118
-
119
- The server broadcasts real-time updates via WebSocket on the same port as the HTTP server.
120
-
121
- **Connection:**
122
-
123
- - Development: `ws://localhost:9853`
124
- - Production: `wss://your-domain.com` (if using HTTPS)
125
-
126
- **Message Format:**
127
-
128
- ```json
129
- {
130
- "type": "update",
131
- "data": [
132
- /* array of log entries */
133
- ]
134
- }
135
- ```
136
-
137
- ## ๐ŸŽจ UI Features
138
-
139
- ### Filtering
140
-
141
- - **Server**: Filter by server name
142
- - **Direction**: Filter by request or response
143
- - **Method**: Filter by HTTP method (GET, POST, etc.)
144
- - **Status**: Filter by status (success, error, pending)
145
-
146
- ### Log Table
147
-
148
- Displays:
149
-
150
- - Timestamp
151
- - Server name
152
- - Direction (request/response)
153
- - HTTP method
154
- - Status (color-coded)
155
- - Duration (ms)
156
- - Payload size (KB)
157
-
158
- ### Log Detail Panel
159
-
160
- Click any log entry to view:
161
-
162
- - Full log metadata
163
- - Request ID
164
- - Error messages (if any)
165
- - Formatted JSON payload
166
-
167
- ## ๐Ÿ“ Project Structure
168
-
169
- ```
170
- ui/
171
- โ”œโ”€โ”€ src/
172
- โ”‚ โ”œโ”€โ”€ App.jsx # Main application component
173
- โ”‚ โ”œโ”€โ”€ LogTable.jsx # Log table component
174
- โ”‚ โ”œโ”€โ”€ LogDetail.jsx # Log detail panel component
175
- โ”‚ โ”œโ”€โ”€ PacketList.jsx # Packet list component
176
- โ”‚ โ”œโ”€โ”€ PacketDetail.jsx # Packet detail component
177
- โ”‚ โ”œโ”€โ”€ CompositeLogs.jsx # MCP Shark server logs
178
- โ”‚ โ”œโ”€โ”€ CompositeSetup.jsx # MCP Shark server setup
179
- โ”‚ โ”œโ”€โ”€ TabNavigation.jsx # Tab navigation
180
- โ”‚ โ”œโ”€โ”€ main.jsx # Application entry point
181
- โ”‚ โ””โ”€โ”€ index.css # Global styles
182
- โ”œโ”€โ”€ server.js # Express server with WebSocket
183
- โ”œโ”€โ”€ vite.config.js # Vite configuration
184
- โ””โ”€โ”€ package.json # Dependencies and scripts
185
- ```
186
-
187
- ## ๐Ÿงช Development
188
-
189
- ### Available Scripts
190
-
191
- - `npm run dev`: Start Vite dev server with hot reload
192
- - `npm run build`: Build for production
193
- - `npm run preview`: Preview production build
194
- - `npm start`: Start the production server
195
-
196
- ### Database Schema
197
-
198
- The application expects a SQLite database with tables for packets, conversations, and sessions. The database is created and managed by the MCP Shark server using the `mcp-shark-common` package.
199
-
200
- The database schema includes:
201
-
202
- - `packets`: Individual HTTP request/response packets with full metadata
203
- - `conversations`: Correlated request/response pairs
204
- - `sessions`: Session tracking for stateful MCP interactions
205
-
206
- ## ๐Ÿค Contributing
207
-
208
- Contributions are welcome! Please feel free to submit a Pull Request.
209
-
210
- ## ๐Ÿ“ License
211
-
212
- ISC