@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.
- package/README.md +84 -645
- package/bin/mcp-shark.js +30 -36
- package/mcp-server/index.js +115 -0
- package/mcp-server/lib/auditor/audit.js +34 -42
- package/mcp-server/lib/common/error.js +1 -1
- package/mcp-server/lib/server/external/all.js +5 -6
- package/mcp-server/lib/server/external/config.js +1 -3
- package/mcp-server/lib/server/external/kv.js +21 -40
- package/mcp-server/lib/server/external/single/request.js +3 -6
- package/mcp-server/lib/server/external/single/run.js +8 -19
- package/mcp-server/lib/server/internal/handlers/prompts-get.js +5 -7
- package/mcp-server/lib/server/internal/handlers/prompts-list.js +5 -4
- package/mcp-server/lib/server/internal/handlers/resources-list.js +5 -4
- package/mcp-server/lib/server/internal/handlers/resources-read.js +5 -4
- package/mcp-server/lib/server/internal/handlers/tools-call.js +8 -10
- package/mcp-server/lib/server/internal/handlers/tools-list.js +6 -5
- package/mcp-server/lib/server/internal/run.js +5 -17
- package/mcp-server/lib/server/internal/server.js +14 -15
- package/mcp-server/lib/server/internal/session.js +8 -13
- package/mcp-server/mcp-shark.js +16 -66
- package/package.json +23 -38
- package/ui/dist/assets/index-Cc-IUa83.css +1 -0
- package/ui/dist/assets/index-srLDlk97.js +35 -0
- package/ui/dist/index.html +17 -0
- package/ui/dist/og-image.png +0 -0
- package/ui/server/routes/backups/deleteBackup.js +54 -0
- package/ui/server/routes/backups/index.js +15 -0
- package/ui/server/routes/backups/listBackups.js +75 -0
- package/ui/server/routes/backups/restoreBackup.js +83 -0
- package/ui/server/routes/backups/viewBackup.js +47 -0
- package/ui/server/routes/composite/index.js +46 -0
- package/ui/server/routes/composite/servers.js +18 -0
- package/ui/server/routes/composite/setup.js +129 -0
- package/ui/server/routes/composite/status.js +7 -0
- package/ui/server/routes/composite/stop.js +39 -0
- package/ui/server/routes/composite/utils.js +45 -0
- package/ui/server/routes/config.js +34 -30
- package/ui/server/routes/conversations.js +3 -3
- package/ui/server/routes/help.js +2 -2
- package/ui/server/routes/logs.js +5 -5
- package/ui/server/routes/playground.js +91 -62
- package/ui/server/routes/requests.js +112 -108
- package/ui/server/routes/sessions.js +4 -4
- package/ui/server/routes/settings.js +199 -0
- package/ui/server/routes/smartscan/discover.js +7 -6
- package/ui/server/routes/smartscan/scans/clearCache.js +3 -2
- package/ui/server/routes/smartscan/scans/createBatchScans.js +4 -3
- package/ui/server/routes/smartscan/scans/createScan.js +2 -1
- package/ui/server/routes/smartscan/scans/getCachedResults.js +2 -1
- package/ui/server/routes/smartscan/scans/getScan.js +2 -1
- package/ui/server/routes/smartscan/scans/listScans.js +5 -4
- package/ui/server/routes/smartscan/scans.js +3 -3
- package/ui/server/routes/smartscan/token.js +4 -3
- package/ui/server/routes/smartscan/transport.js +1 -1
- package/ui/server/routes/smartscan.js +1 -1
- package/ui/server/routes/statistics.js +13 -10
- package/ui/server/utils/config-update.js +140 -112
- package/ui/server/utils/config.js +4 -4
- package/ui/server/utils/logger.js +2 -0
- package/ui/server/utils/paths.js +210 -2
- package/ui/server/utils/port.js +2 -2
- package/ui/server/utils/process.js +0 -67
- package/ui/server/utils/scan-cache/all-results.js +76 -59
- package/ui/server/utils/scan-cache/directory.js +1 -1
- package/ui/server/utils/scan-cache/file-operations.js +19 -16
- package/ui/server/utils/scan-cache/server-operations.js +14 -9
- package/ui/server/utils/serialization.js +9 -3
- package/ui/server/utils/smartscan-token.js +4 -3
- package/ui/server.js +87 -41
- package/ui/src/App.jsx +5 -5
- package/ui/src/CompositeLogs.jsx +20 -20
- package/ui/src/CompositeSetup.jsx +9 -9
- package/ui/src/HelpGuide/HelpGuideFooter.jsx +1 -0
- package/ui/src/HelpGuide/HelpGuideHeader.jsx +2 -1
- package/ui/src/HelpGuide.jsx +17 -4
- package/ui/src/IntroTour.jsx +19 -5
- package/ui/src/LogDetail.jsx +1 -0
- package/ui/src/LogTable.jsx +24 -6
- package/ui/src/PacketDetail.jsx +21 -16
- package/ui/src/PacketFilters.jsx +29 -14
- package/ui/src/PacketList.jsx +4 -5
- package/ui/src/SmartScan.jsx +5 -5
- package/ui/src/TabNavigation.jsx +5 -5
- package/ui/src/components/App/HelpButton.jsx +4 -0
- package/ui/src/components/App/TrafficTab.jsx +4 -4
- package/ui/src/components/App/useAppState.js +118 -24
- package/ui/src/components/BackupList.jsx +6 -2
- package/ui/src/components/CollapsibleSection.jsx +16 -2
- package/ui/src/components/ConfigViewerModal.jsx +17 -3
- package/ui/src/components/ConfirmationModal.jsx +20 -3
- package/ui/src/components/DetailsTab/BodySection.jsx +3 -1
- package/ui/src/components/DetailsTab/CollapsibleRequestResponse.jsx +14 -3
- package/ui/src/components/DetailsTab/InfoSection.jsx +4 -2
- package/ui/src/components/DetailsTab/RequestDetailsSection.jsx +7 -5
- package/ui/src/components/DetailsTab/ResponseDetailsSection.jsx +7 -5
- package/ui/src/components/DetectedPathsList.jsx +5 -2
- package/ui/src/components/FileInput.jsx +3 -1
- package/ui/src/components/GroupHeader.jsx +14 -0
- package/ui/src/components/GroupedByMcpView.jsx +3 -10
- package/ui/src/components/GroupedByServerView.jsx +1 -1
- package/ui/src/components/GroupedBySessionView.jsx +1 -1
- package/ui/src/components/HexTab.jsx +17 -4
- package/ui/src/components/LogsToolbar.jsx +3 -1
- package/ui/src/components/McpPlayground/LoadingModal.jsx +7 -3
- package/ui/src/components/McpPlayground/PromptsSection/PromptCallPanel.jsx +5 -0
- package/ui/src/components/McpPlayground/PromptsSection/PromptItem.jsx +52 -23
- package/ui/src/components/McpPlayground/PromptsSection/PromptsList.jsx +13 -11
- package/ui/src/components/McpPlayground/PromptsSection.jsx +2 -1
- package/ui/src/components/McpPlayground/ResourcesSection/ResourceCallPanel.jsx +3 -0
- package/ui/src/components/McpPlayground/ResourcesSection/ResourceItem.jsx +66 -34
- package/ui/src/components/McpPlayground/ResourcesSection/ResourcesList.jsx +13 -11
- package/ui/src/components/McpPlayground/ResourcesSection.jsx +2 -1
- package/ui/src/components/McpPlayground/ToolsSection/ToolCallPanel.jsx +5 -0
- package/ui/src/components/McpPlayground/ToolsSection/ToolItem.jsx +52 -23
- package/ui/src/components/McpPlayground/ToolsSection/ToolsList.jsx +13 -11
- package/ui/src/components/McpPlayground/ToolsSection.jsx +2 -1
- package/ui/src/components/McpPlayground/hooks/useMcpDataLoader.js +107 -0
- package/ui/src/components/McpPlayground/hooks/useMcpRequest.js +70 -0
- package/ui/src/components/McpPlayground/hooks/useMcpServerStatus.js +90 -0
- package/ui/src/components/McpPlayground/useMcpPlayground.js +118 -159
- package/ui/src/components/McpPlayground.jsx +105 -23
- package/ui/src/components/PacketDetailHeader.jsx +8 -3
- package/ui/src/components/PacketFilters/ExportControls.jsx +2 -1
- package/ui/src/components/PacketFilters/FilterInput.jsx +1 -1
- package/ui/src/components/RawTab.jsx +15 -2
- package/ui/src/components/RequestRow/OrphanedResponseRow.jsx +10 -2
- package/ui/src/components/RequestRow/RequestRowMain.jsx +12 -3
- package/ui/src/components/RequestRow/ResponseRow.jsx +11 -3
- package/ui/src/components/RequestRow.jsx +17 -9
- package/ui/src/components/ServerControl.jsx +3 -1
- package/ui/src/components/ServiceSelector.jsx +2 -0
- package/ui/src/components/SmartScan/AnalysisResult.jsx +2 -2
- package/ui/src/components/SmartScan/BatchResultsDisplay/BatchResultItem.jsx +2 -1
- package/ui/src/components/SmartScan/BatchResultsDisplay/BatchResultsHeader.jsx +1 -1
- package/ui/src/components/SmartScan/BatchResultsDisplay.jsx +9 -3
- package/ui/src/components/SmartScan/EmptyState.jsx +3 -0
- package/ui/src/components/SmartScan/ErrorDisplay.jsx +4 -2
- package/ui/src/components/SmartScan/ExpandableSection.jsx +4 -0
- package/ui/src/components/SmartScan/FindingsTable.jsx +46 -42
- package/ui/src/components/SmartScan/ListViewContent.jsx +2 -2
- package/ui/src/components/SmartScan/NotablePatternsSection.jsx +13 -8
- package/ui/src/components/SmartScan/OverallSummarySection.jsx +36 -29
- package/ui/src/components/SmartScan/RecommendationsSection.jsx +10 -8
- package/ui/src/components/SmartScan/ScanDetailHeader.jsx +2 -1
- package/ui/src/components/SmartScan/ScanDetailView.jsx +4 -4
- package/ui/src/components/SmartScan/ScanListView/ScanListHeader.jsx +2 -1
- package/ui/src/components/SmartScan/ScanListView/ScanListItem.jsx +15 -1
- package/ui/src/components/SmartScan/ScanOverviewSection.jsx +3 -1
- package/ui/src/components/SmartScan/ScanResultsDisplay.jsx +1 -1
- package/ui/src/components/SmartScan/ScanViewContent.jsx +2 -2
- package/ui/src/components/SmartScan/ScanningProgress.jsx +4 -2
- package/ui/src/components/SmartScan/ServerInfoSection.jsx +3 -1
- package/ui/src/components/SmartScan/ServerSelectionRow.jsx +4 -2
- package/ui/src/components/SmartScan/SingleResultDisplay.jsx +5 -3
- package/ui/src/components/SmartScan/SmartScanControls.jsx +11 -7
- package/ui/src/components/SmartScan/SmartScanHeader.jsx +1 -1
- package/ui/src/components/SmartScan/ViewModeTabs.jsx +2 -0
- package/ui/src/components/SmartScan/hooks/useCacheManagement.js +1 -2
- package/ui/src/components/SmartScan/hooks/useMcpDiscovery.js +22 -26
- package/ui/src/components/SmartScan/hooks/useScanList.js +10 -9
- package/ui/src/components/SmartScan/hooks/useScanOperations.js +23 -14
- package/ui/src/components/SmartScan/hooks/useServerStatus.js +2 -2
- package/ui/src/components/SmartScan/hooks/useTokenManagement.js +2 -2
- package/ui/src/components/SmartScan/scanDataUtils.js +22 -17
- package/ui/src/components/SmartScan/useSmartScan.js +4 -4
- package/ui/src/components/SmartScan/utils.js +3 -1
- package/ui/src/components/SmartScanIcons.jsx +6 -3
- package/ui/src/components/TabNavigation/DesktopTabs.jsx +8 -3
- package/ui/src/components/TabNavigation/MobileDropdown.jsx +3 -1
- package/ui/src/components/TabNavigation.jsx +8 -3
- package/ui/src/components/TabNavigationIcons.jsx +4 -4
- package/ui/src/components/TourOverlay.jsx +1 -1
- package/ui/src/components/TourTooltip/TourTooltipButtons.jsx +3 -0
- package/ui/src/components/TourTooltip/TourTooltipHeader.jsx +1 -0
- package/ui/src/components/TourTooltip/TourTooltipIcons.jsx +9 -0
- package/ui/src/components/TourTooltip/useTooltipPosition.js +63 -36
- package/ui/src/components/TourTooltip.jsx +11 -3
- package/ui/src/components/ViewModeTabs.jsx +3 -1
- package/ui/src/config/tourSteps.jsx +0 -2
- package/ui/src/hooks/useAnimation.js +15 -12
- package/ui/src/hooks/useConfigManagement.js +8 -8
- package/ui/src/hooks/useServiceExtraction.js +1 -1
- package/ui/src/index.css +3 -8
- package/ui/src/theme.js +3 -3
- package/ui/src/utils/hexUtils.js +11 -5
- package/ui/src/utils/mcpGroupingUtils.js +18 -10
- package/ui/src/utils/requestPairing.js +89 -0
- package/ui/src/utils/requestUtils.js +37 -105
- package/ui/vite.config.js +1 -1
- package/mcp-server/.editorconfig +0 -15
- package/mcp-server/.prettierignore +0 -11
- package/mcp-server/.prettierrc +0 -12
- package/mcp-server/README.md +0 -280
- package/mcp-server/commitlint.config.cjs +0 -42
- package/mcp-server/eslint.config.js +0 -131
- package/mcp-server/package-lock.json +0 -4784
- package/mcp-server/package.json +0 -30
- package/ui/README.md +0 -212
- package/ui/package-lock.json +0 -3574
- package/ui/package.json +0 -12
- package/ui/paths.js +0 -282
- package/ui/server/routes/backups.js +0 -251
- package/ui/server/routes/composite.js +0 -244
package/mcp-server/.editorconfig
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
root = true
|
|
2
|
-
|
|
3
|
-
[*]
|
|
4
|
-
charset = utf-8
|
|
5
|
-
end_of_line = lf
|
|
6
|
-
insert_final_newline = true
|
|
7
|
-
trim_trailing_whitespace = true
|
|
8
|
-
|
|
9
|
-
[*.{js,jsx,ts,tsx,json,css,md}]
|
|
10
|
-
indent_style = space
|
|
11
|
-
indent_size = 2
|
|
12
|
-
|
|
13
|
-
[*.md]
|
|
14
|
-
trim_trailing_whitespace = false
|
|
15
|
-
|
package/mcp-server/.prettierrc
DELETED
package/mcp-server/README.md
DELETED
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
# MCP Shark Server
|
|
2
|
-
|
|
3
|
-
> **Aggregate multiple Model Context Protocol (MCP) servers into a single unified interface**
|
|
4
|
-
|
|
5
|
-
MCP Shark Server is a powerful aggregation layer that combines multiple MCP servers (both HTTP and stdio-based) into one cohesive endpoint. It provides a unified API for tools, prompts, and resources from all connected servers, with comprehensive audit logging and session management.
|
|
6
|
-
|
|
7
|
-
## ✨ Features
|
|
8
|
-
|
|
9
|
-
- **🔗 Multi-Server Aggregation**: Connect to multiple MCP servers simultaneously (HTTP and stdio)
|
|
10
|
-
- **📊 Comprehensive Audit Logging**: SQLite-based logging with request/response tracking, performance metrics, and error handling
|
|
11
|
-
- **🌐 HTTP Interface**: RESTful API endpoint for easy integration with any MCP client
|
|
12
|
-
- **🔄 Session Management**: Automatic session handling for stateful MCP interactions
|
|
13
|
-
- **🛠️ Unified Tool Access**: Access tools from all connected servers through a single interface
|
|
14
|
-
- **📝 Prompt & Resource Aggregation**: Unified access to prompts and resources across all servers
|
|
15
|
-
- **⚡ Streaming Support**: Full support for async iterable responses (streaming)
|
|
16
|
-
- **🔍 Request Correlation**: Track request/response pairs with correlation IDs
|
|
17
|
-
|
|
18
|
-
## 🚀 Quick Start
|
|
19
|
-
|
|
20
|
-
### Installation
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
npm install
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### Configuration
|
|
27
|
-
|
|
28
|
-
**Recommended: Use the UI**
|
|
29
|
-
|
|
30
|
-
The recommended way to configure the MCP server is through the UI interface, which automatically detects and converts IDE configuration files.
|
|
31
|
-
|
|
32
|
-
**Alternative: Manual Configuration**
|
|
33
|
-
|
|
34
|
-
If running the server directly, create a configuration file at `~/.mcp-shark/mcps.json`:
|
|
35
|
-
|
|
36
|
-
```json
|
|
37
|
-
{
|
|
38
|
-
"servers": {
|
|
39
|
-
"github": {
|
|
40
|
-
"type": "http",
|
|
41
|
-
"url": "https://api.githubcopilot.com/mcp/",
|
|
42
|
-
"headers": {
|
|
43
|
-
"Authorization": "Bearer YOUR_TOKEN"
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
"@21st-dev/magic": {
|
|
47
|
-
"type": "stdio",
|
|
48
|
-
"command": "npx",
|
|
49
|
-
"args": ["-y", "@21st-dev/magic@latest", "API_KEY=\"your-api-key\""]
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
### Running
|
|
56
|
-
|
|
57
|
-
**Recommended: Managed through UI**
|
|
58
|
-
|
|
59
|
-
The recommended way to run the MCP server is through the UI interface:
|
|
60
|
-
|
|
61
|
-
1. Start the UI server (see main README)
|
|
62
|
-
2. Use the UI's "MCP Server Setup" tab to configure and start the server
|
|
63
|
-
|
|
64
|
-
**Alternative: Run Directly**
|
|
65
|
-
|
|
66
|
-
If you need to run the server independently:
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
npm start
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
The server will start on `http://localhost:9851/mcp`
|
|
73
|
-
|
|
74
|
-
**Note:** When running directly, ensure you have a valid configuration file at `~/.mcp-shark/mcps.json` before starting. The UI handles configuration automatically when using the recommended workflow.
|
|
75
|
-
|
|
76
|
-
## 📖 Usage
|
|
77
|
-
|
|
78
|
-
### Endpoint
|
|
79
|
-
|
|
80
|
-
All MCP requests should be sent to:
|
|
81
|
-
|
|
82
|
-
```
|
|
83
|
-
POST http://localhost:9851/mcp
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
### Example: List All Tools
|
|
87
|
-
|
|
88
|
-
```bash
|
|
89
|
-
curl -X POST http://localhost:9851/mcp \
|
|
90
|
-
-H "Content-Type: application/json" \
|
|
91
|
-
-d '{
|
|
92
|
-
"jsonrpc": "2.0",
|
|
93
|
-
"id": 1,
|
|
94
|
-
"method": "tools/list"
|
|
95
|
-
}'
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### Example: Call a Tool
|
|
99
|
-
|
|
100
|
-
Tools from different servers are prefixed with the server name:
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
curl -X POST http://localhost:9851/mcp \
|
|
104
|
-
-H "Content-Type: application/json" \
|
|
105
|
-
-d '{
|
|
106
|
-
"jsonrpc": "2.0",
|
|
107
|
-
"id": 2,
|
|
108
|
-
"method": "tools/call",
|
|
109
|
-
"params": {
|
|
110
|
-
"name": "github:search_repositories",
|
|
111
|
-
"arguments": {
|
|
112
|
-
"query": "language:javascript stars:>1000"
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}'
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
## 🏗️ Architecture
|
|
119
|
-
|
|
120
|
-
```
|
|
121
|
-
┌─────────────────┐
|
|
122
|
-
│ MCP Client │
|
|
123
|
-
└────────┬────────┘
|
|
124
|
-
│ HTTP
|
|
125
|
-
▼
|
|
126
|
-
┌─────────────────────────────────┐
|
|
127
|
-
│ MCP Shark Server │
|
|
128
|
-
│ (Express on port 9851) │
|
|
129
|
-
│ │
|
|
130
|
-
│ ┌────────────────────────────┐ │
|
|
131
|
-
│ │ Internal MCP Server │ │
|
|
132
|
-
│ │ - tools/list │ │
|
|
133
|
-
│ │ - tools/call │ │
|
|
134
|
-
│ │ - prompts/list │ │
|
|
135
|
-
│ │ - prompts/get │ │
|
|
136
|
-
│ │ - resources/list │ │
|
|
137
|
-
│ │ - resources/read │ │
|
|
138
|
-
│ └──────────┬──────────────────┘ │
|
|
139
|
-
│ │ │
|
|
140
|
-
│ ┌──────────▼──────────────────┐ │
|
|
141
|
-
│ │ Audit Logger (SQLite) │ │
|
|
142
|
-
│ └──────────────────────────────┘ │
|
|
143
|
-
└──────────┬────────────────────────┘
|
|
144
|
-
│
|
|
145
|
-
├──► HTTP MCP Server
|
|
146
|
-
├──► stdio MCP Server
|
|
147
|
-
└──► stdio MCP Server
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
## 📁 Project Structure
|
|
151
|
-
|
|
152
|
-
```
|
|
153
|
-
mcp-server/
|
|
154
|
-
├── mcp-shark.js # Main entry point
|
|
155
|
-
├── lib/
|
|
156
|
-
│ ├── server/
|
|
157
|
-
│ │ ├── internal/ # Internal MCP server (aggregator)
|
|
158
|
-
│ │ │ ├── server.js # Server creation
|
|
159
|
-
│ │ │ ├── run.js # Express server setup
|
|
160
|
-
│ │ │ ├── session.js # Session management
|
|
161
|
-
│ │ │ └── handlers/ # Request handlers
|
|
162
|
-
│ │ └── external/ # External MCP server clients
|
|
163
|
-
│ │ ├── all.js # Multi-server orchestration
|
|
164
|
-
│ │ ├── config.js # Configuration parsing
|
|
165
|
-
│ │ ├── kv.js # Key-value store for servers
|
|
166
|
-
│ │ └── single/ # Single server client
|
|
167
|
-
│ ├── db/
|
|
168
|
-
│ │ ├── init.js # Database initialization
|
|
169
|
-
│ │ ├── logger.js # Audit logging
|
|
170
|
-
│ │ └── query.js # Database queries
|
|
171
|
-
│ └── common/
|
|
172
|
-
│ └── error.js # Error handling utilities
|
|
173
|
-
└── lib/
|
|
174
|
-
└── ...
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
**Note:** Configuration and database files are stored in `~/.mcp-shark/` by default:
|
|
178
|
-
|
|
179
|
-
- `~/.mcp-shark/mcps.json` - Server configuration
|
|
180
|
-
- `~/.mcp-shark/db/mcp-shark.sqlite` - SQLite database
|
|
181
|
-
|
|
182
|
-
## 🔧 Configuration Format
|
|
183
|
-
|
|
184
|
-
### HTTP Server
|
|
185
|
-
|
|
186
|
-
```json
|
|
187
|
-
{
|
|
188
|
-
"servers": {
|
|
189
|
-
"server-name": {
|
|
190
|
-
"type": "http",
|
|
191
|
-
"url": "https://api.example.com/mcp/",
|
|
192
|
-
"headers": {
|
|
193
|
-
"Authorization": "Bearer TOKEN"
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
### stdio Server
|
|
201
|
-
|
|
202
|
-
```json
|
|
203
|
-
{
|
|
204
|
-
"servers": {
|
|
205
|
-
"server-name": {
|
|
206
|
-
"type": "stdio",
|
|
207
|
-
"command": "node",
|
|
208
|
-
"args": ["path/to/server.js"]
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
## 📊 Audit Logging
|
|
215
|
-
|
|
216
|
-
All MCP communications are logged to SQLite (default location: `~/.mcp-shark/db/mcp-shark.sqlite`) with:
|
|
217
|
-
|
|
218
|
-
- **Request/Response Tracking**: Full payload logging with correlation IDs
|
|
219
|
-
- **Performance Metrics**: Duration, latency, and timing information
|
|
220
|
-
- **Error Tracking**: Comprehensive error logging with stack traces
|
|
221
|
-
- **Session Management**: Session ID tracking for stateful interactions
|
|
222
|
-
- **Server Identification**: Track which external server handled each request
|
|
223
|
-
|
|
224
|
-
### Database Schema
|
|
225
|
-
|
|
226
|
-
- `mcp_communications`: All request/response communications
|
|
227
|
-
- `mcp_request_response_pairs`: Correlated request/response pairs
|
|
228
|
-
|
|
229
|
-
## 🛠️ Development
|
|
230
|
-
|
|
231
|
-
### Scripts
|
|
232
|
-
|
|
233
|
-
```bash
|
|
234
|
-
# Start the server
|
|
235
|
-
npm start
|
|
236
|
-
|
|
237
|
-
# Lint code
|
|
238
|
-
npm run lint
|
|
239
|
-
|
|
240
|
-
# Fix linting issues
|
|
241
|
-
npm run lint:fix
|
|
242
|
-
|
|
243
|
-
# Format code
|
|
244
|
-
npm run format
|
|
245
|
-
|
|
246
|
-
# Check formatting
|
|
247
|
-
npm run format:check
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
### Dependencies
|
|
251
|
-
|
|
252
|
-
This package uses `mcp-shark-common` for shared database utilities and configuration management. The database initialization and logging functionality is provided by the common package.
|
|
253
|
-
|
|
254
|
-
### Code Quality
|
|
255
|
-
|
|
256
|
-
- **ESLint**: Code linting with Prettier integration
|
|
257
|
-
- **Prettier**: Code formatting
|
|
258
|
-
- **Husky**: Git hooks for pre-commit checks
|
|
259
|
-
- **Commitlint**: Conventional commit message validation
|
|
260
|
-
|
|
261
|
-
## 🔌 Supported MCP Methods
|
|
262
|
-
|
|
263
|
-
- `tools/list` - List all tools from all servers
|
|
264
|
-
- `tools/call` - Call a tool from any server
|
|
265
|
-
- `prompts/list` - List all prompts from all servers
|
|
266
|
-
- `prompts/get` - Get a specific prompt
|
|
267
|
-
- `resources/list` - List all resources from all servers
|
|
268
|
-
- `resources/read` - Read a specific resource
|
|
269
|
-
|
|
270
|
-
## 📝 License
|
|
271
|
-
|
|
272
|
-
ISC
|
|
273
|
-
|
|
274
|
-
## 🤝 Contributing
|
|
275
|
-
|
|
276
|
-
Contributions are welcome! Please ensure your code passes linting and formatting checks before submitting.
|
|
277
|
-
|
|
278
|
-
---
|
|
279
|
-
|
|
280
|
-
**Built with ❤️ using the Model Context Protocol SDK**
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
extends: ['@commitlint/config-conventional'],
|
|
3
|
-
rules: {
|
|
4
|
-
// Type must be one of the following
|
|
5
|
-
'type-enum': [
|
|
6
|
-
2,
|
|
7
|
-
'always',
|
|
8
|
-
[
|
|
9
|
-
'feat', // A new feature
|
|
10
|
-
'fix', // A bug fix
|
|
11
|
-
'docs', // Documentation only changes
|
|
12
|
-
'style', // Changes that do not affect the meaning of the code
|
|
13
|
-
'refactor', // A code change that neither fixes a bug nor adds a feature
|
|
14
|
-
'perf', // A code change that improves performance
|
|
15
|
-
'test', // Adding missing tests or correcting existing tests
|
|
16
|
-
'build', // Changes that affect the build system or external dependencies
|
|
17
|
-
'ci', // Changes to CI configuration files and scripts
|
|
18
|
-
'chore', // Other changes that don't modify src or test files
|
|
19
|
-
'revert', // Reverts a previous commit
|
|
20
|
-
],
|
|
21
|
-
],
|
|
22
|
-
// Type case: must be lowercase
|
|
23
|
-
'type-case': [2, 'always', 'lower-case'],
|
|
24
|
-
// Type cannot be empty
|
|
25
|
-
'type-empty': [2, 'never'],
|
|
26
|
-
// Scope case: must be lowercase
|
|
27
|
-
'scope-case': [2, 'always', 'lower-case'],
|
|
28
|
-
// Subject case: sentence-case (first letter lowercase, rest as written)
|
|
29
|
-
'subject-case': [2, 'never', ['upper-case', 'pascal-case', 'start-case']],
|
|
30
|
-
// Subject cannot be empty
|
|
31
|
-
'subject-empty': [2, 'never'],
|
|
32
|
-
// Subject must end with a period
|
|
33
|
-
'subject-full-stop': [0, 'never'],
|
|
34
|
-
// Header must not exceed 72 characters (disabled, using max line length instead)
|
|
35
|
-
'header-max-length': [2, 'always', 100],
|
|
36
|
-
// Body must start with blank line
|
|
37
|
-
'body-leading-blank': [2, 'always'],
|
|
38
|
-
// Footer must start with blank line
|
|
39
|
-
'footer-leading-blank': [2, 'always'],
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import js from '@eslint/js';
|
|
2
|
-
import prettier from 'eslint-plugin-prettier';
|
|
3
|
-
import prettierConfig from 'eslint-config-prettier';
|
|
4
|
-
|
|
5
|
-
export default [
|
|
6
|
-
js.configs.recommended,
|
|
7
|
-
{
|
|
8
|
-
files: ['**/*.js'],
|
|
9
|
-
languageOptions: {
|
|
10
|
-
ecmaVersion: 'latest',
|
|
11
|
-
sourceType: 'module',
|
|
12
|
-
globals: {
|
|
13
|
-
console: 'readonly',
|
|
14
|
-
process: 'readonly',
|
|
15
|
-
Buffer: 'readonly',
|
|
16
|
-
URL: 'readonly',
|
|
17
|
-
URLSearchParams: 'readonly',
|
|
18
|
-
__dirname: 'readonly',
|
|
19
|
-
__filename: 'readonly',
|
|
20
|
-
module: 'readonly',
|
|
21
|
-
require: 'readonly',
|
|
22
|
-
exports: 'readonly',
|
|
23
|
-
global: 'readonly',
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
plugins: {
|
|
27
|
-
prettier,
|
|
28
|
-
},
|
|
29
|
-
rules: {
|
|
30
|
-
// Prettier integration
|
|
31
|
-
'prettier/prettier': 'error',
|
|
32
|
-
|
|
33
|
-
// Strict JavaScript rules
|
|
34
|
-
'no-console': 'off', // Console is expected in CLI tools
|
|
35
|
-
'no-debugger': 'error',
|
|
36
|
-
'no-alert': 'error',
|
|
37
|
-
'no-var': 'error',
|
|
38
|
-
'prefer-const': 'error',
|
|
39
|
-
'prefer-arrow-callback': 'error',
|
|
40
|
-
'prefer-template': 'error',
|
|
41
|
-
'prefer-spread': 'error',
|
|
42
|
-
'prefer-rest-params': 'error',
|
|
43
|
-
'object-shorthand': 'error',
|
|
44
|
-
'no-duplicate-imports': 'error',
|
|
45
|
-
'no-useless-constructor': 'error',
|
|
46
|
-
'no-useless-rename': 'error',
|
|
47
|
-
'no-param-reassign': 'error',
|
|
48
|
-
'no-unused-vars': [
|
|
49
|
-
'error',
|
|
50
|
-
{
|
|
51
|
-
argsIgnorePattern: '^_',
|
|
52
|
-
varsIgnorePattern: '^_',
|
|
53
|
-
caughtErrorsIgnorePattern: '^_',
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
'no-undef': 'error',
|
|
57
|
-
'no-use-before-define': 'error',
|
|
58
|
-
'no-shadow': 'error',
|
|
59
|
-
'no-implicit-globals': 'error',
|
|
60
|
-
'no-new-wrappers': 'error',
|
|
61
|
-
'no-array-constructor': 'error',
|
|
62
|
-
'no-new-object': 'error',
|
|
63
|
-
'no-new-func': 'error',
|
|
64
|
-
'no-iterator': 'error',
|
|
65
|
-
'no-restricted-syntax': [
|
|
66
|
-
'error',
|
|
67
|
-
{
|
|
68
|
-
selector: 'CallExpression[callee.name="eval"]',
|
|
69
|
-
message: 'eval() is not allowed.',
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
selector: 'CallExpression[callee.name="Function"]',
|
|
73
|
-
message: 'Function constructor is not allowed.',
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
'no-implied-eval': 'error',
|
|
77
|
-
'no-script-url': 'error',
|
|
78
|
-
'no-throw-literal': 'error',
|
|
79
|
-
'no-return-await': 'error',
|
|
80
|
-
'require-await': 'error',
|
|
81
|
-
'no-async-promise-executor': 'error',
|
|
82
|
-
'no-promise-executor-return': 'error',
|
|
83
|
-
'no-await-in-loop': 'warn',
|
|
84
|
-
'no-return-assign': 'error',
|
|
85
|
-
'no-sequences': 'error',
|
|
86
|
-
'no-nested-ternary': 'warn',
|
|
87
|
-
'no-unneeded-ternary': 'error',
|
|
88
|
-
'no-useless-return': 'error',
|
|
89
|
-
'no-useless-concat': 'error',
|
|
90
|
-
'no-useless-escape': 'error',
|
|
91
|
-
'no-void': 'error',
|
|
92
|
-
'no-with': 'error',
|
|
93
|
-
radix: 'error',
|
|
94
|
-
'vars-on-top': 'error',
|
|
95
|
-
'wrap-iife': ['error', 'inside'],
|
|
96
|
-
yoda: 'error',
|
|
97
|
-
strict: ['error', 'never'], // Use ES modules instead
|
|
98
|
-
'no-constant-condition': 'error',
|
|
99
|
-
'no-empty': 'error',
|
|
100
|
-
'no-empty-character-class': 'error',
|
|
101
|
-
'no-ex-assign': 'error',
|
|
102
|
-
'no-extra-boolean-cast': 'error',
|
|
103
|
-
'no-extra-parens': ['error', 'functions'],
|
|
104
|
-
'no-extra-semi': 'error',
|
|
105
|
-
'no-func-assign': 'error',
|
|
106
|
-
'no-inner-declarations': 'error',
|
|
107
|
-
'no-invalid-regexp': 'error',
|
|
108
|
-
'no-irregular-whitespace': 'error',
|
|
109
|
-
'no-obj-calls': 'error',
|
|
110
|
-
'no-regex-spaces': 'error',
|
|
111
|
-
'no-sparse-arrays': 'error',
|
|
112
|
-
'no-unreachable': 'error',
|
|
113
|
-
'no-unsafe-finally': 'error',
|
|
114
|
-
'no-unsafe-negation': 'error',
|
|
115
|
-
'use-isnan': 'error',
|
|
116
|
-
'valid-typeof': 'error',
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
prettierConfig,
|
|
120
|
-
{
|
|
121
|
-
ignores: [
|
|
122
|
-
'node_modules/**',
|
|
123
|
-
'dist/**',
|
|
124
|
-
'build/**',
|
|
125
|
-
'coverage/**',
|
|
126
|
-
'*.min.js',
|
|
127
|
-
'.git/**',
|
|
128
|
-
'.husky/**',
|
|
129
|
-
],
|
|
130
|
-
},
|
|
131
|
-
];
|