@mcp-shark/mcp-shark 1.4.2 → 1.5.2
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 +22 -38
- 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 +4 -12
- 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 +3 -13
- package/mcp-server/lib/server/internal/handlers/prompts-list.js +2 -6
- package/mcp-server/lib/server/internal/handlers/resources-list.js +2 -6
- package/mcp-server/lib/server/internal/handlers/resources-read.js +3 -12
- package/mcp-server/lib/server/internal/handlers/tools-call.js +3 -9
- package/mcp-server/lib/server/internal/handlers/tools-list.js +2 -2
- package/mcp-server/lib/server/internal/run.js +4 -16
- package/mcp-server/lib/server/internal/server.js +6 -7
- package/mcp-server/lib/server/internal/session.js +2 -15
- package/mcp-server/mcp-shark.js +16 -66
- package/package.json +23 -38
- package/shared/logger.js +90 -0
- 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 +45 -47
- 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 +7 -6
- 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 +86 -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 -4
- 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 +6 -2
- package/ui/src/components/McpPlayground/PromptsSection/PromptsList.jsx +4 -4
- 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 +6 -2
- package/ui/src/components/McpPlayground/ResourcesSection/ResourcesList.jsx +4 -4
- 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 +6 -2
- package/ui/src/components/McpPlayground/ToolsSection/ToolsList.jsx +4 -4
- package/ui/src/components/McpPlayground/ToolsSection.jsx +2 -1
- package/ui/src/components/McpPlayground/hooks/useMcpDataLoader.js +9 -9
- package/ui/src/components/McpPlayground/hooks/useMcpRequest.js +10 -5
- package/ui/src/components/McpPlayground/hooks/useMcpServerStatus.js +43 -23
- package/ui/src/components/McpPlayground/useMcpPlayground.js +72 -44
- package/ui/src/components/McpPlayground.jsx +5 -2
- 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 +32 -101
- 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 -260
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import express from 'express';
|
|
2
1
|
import cors from 'cors';
|
|
2
|
+
import express from 'express';
|
|
3
3
|
|
|
4
4
|
import { withSession } from './session.js';
|
|
5
5
|
|
|
6
|
-
export function getInternalServer(
|
|
7
|
-
serverFactory,
|
|
8
|
-
auditLogger,
|
|
9
|
-
withAuditRequestResponseHandler
|
|
10
|
-
) {
|
|
6
|
+
export function getInternalServer(serverFactory, auditLogger, withAuditRequestResponseHandler) {
|
|
11
7
|
const app = express();
|
|
12
8
|
|
|
13
9
|
// Parse JSON body for POST requests
|
|
@@ -23,13 +19,7 @@ export function getInternalServer(
|
|
|
23
19
|
);
|
|
24
20
|
|
|
25
21
|
app.all('/mcp/*', async (req, res) => {
|
|
26
|
-
await withSession(
|
|
27
|
-
serverFactory,
|
|
28
|
-
withAuditRequestResponseHandler,
|
|
29
|
-
req,
|
|
30
|
-
res,
|
|
31
|
-
auditLogger
|
|
32
|
-
);
|
|
22
|
+
await withSession(serverFactory, withAuditRequestResponseHandler, req, res, auditLogger);
|
|
33
23
|
});
|
|
34
24
|
|
|
35
25
|
// Catch-all for other routes (404)
|
|
@@ -42,8 +32,6 @@ export function getInternalServer(
|
|
|
42
32
|
|
|
43
33
|
export function runInternalServer(logger, port, app) {
|
|
44
34
|
app.listen(port, '0.0.0.0', () => {
|
|
45
|
-
logger.info(
|
|
46
|
-
`MCP proxy HTTP server listening on http://localhost:${port}/mcp`
|
|
47
|
-
);
|
|
35
|
+
logger.info(`MCP proxy HTTP server listening on http://localhost:${port}/mcp`);
|
|
48
36
|
});
|
|
49
37
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
-
ListToolsRequestSchema,
|
|
5
4
|
CallToolRequestSchema,
|
|
6
|
-
ListPromptsRequestSchema,
|
|
7
5
|
GetPromptRequestSchema,
|
|
6
|
+
ListPromptsRequestSchema,
|
|
8
7
|
ListResourcesRequestSchema,
|
|
8
|
+
ListToolsRequestSchema,
|
|
9
9
|
ReadResourceRequestSchema,
|
|
10
10
|
} from '@modelcontextprotocol/sdk/types.js';
|
|
11
11
|
|
|
12
|
-
import { createToolsListHandler } from './handlers/tools-list.js';
|
|
13
|
-
import { createToolsCallHandler } from './handlers/tools-call.js';
|
|
14
|
-
import { createPromptsListHandler } from './handlers/prompts-list.js';
|
|
15
12
|
import { createPromptsGetHandler } from './handlers/prompts-get.js';
|
|
13
|
+
import { createPromptsListHandler } from './handlers/prompts-list.js';
|
|
16
14
|
import { createResourcesListHandler } from './handlers/resources-list.js';
|
|
17
15
|
import { createResourcesReadHandler } from './handlers/resources-read.js';
|
|
16
|
+
import { createToolsCallHandler } from './handlers/tools-call.js';
|
|
17
|
+
import { createToolsListHandler } from './handlers/tools-list.js';
|
|
18
18
|
|
|
19
19
|
export function createInternalServer(logger, mcpServers, requestedMcpServer) {
|
|
20
20
|
// create MCP server
|
|
@@ -58,6 +58,5 @@ export function createInternalServer(logger, mcpServers, requestedMcpServer) {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
export function createInternalServerFactory(logger, mcpServers) {
|
|
61
|
-
return requestedMcpServer =>
|
|
62
|
-
createInternalServer(logger, mcpServers, requestedMcpServer);
|
|
61
|
+
return (requestedMcpServer) => createInternalServer(logger, mcpServers, requestedMcpServer);
|
|
63
62
|
}
|
|
@@ -13,13 +13,7 @@ function getTransportFromSession(sessionId) {
|
|
|
13
13
|
return sessions.get(sessionId);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export async function withSession(
|
|
17
|
-
serverFactory,
|
|
18
|
-
requestHandler,
|
|
19
|
-
req,
|
|
20
|
-
res,
|
|
21
|
-
auditLogger
|
|
22
|
-
) {
|
|
16
|
+
export async function withSession(serverFactory, requestHandler, req, res, auditLogger) {
|
|
23
17
|
const requestedMcpServer = req.params[0];
|
|
24
18
|
const sessionId = getSessionFromRequest(req);
|
|
25
19
|
if (!sessionId) {
|
|
@@ -32,14 +26,7 @@ export async function withSession(
|
|
|
32
26
|
await server.connect(transport);
|
|
33
27
|
storeTransportInSession(initialSessionId, transport);
|
|
34
28
|
// Session creation will be logged as part of the request packet in audit.js
|
|
35
|
-
return requestHandler(
|
|
36
|
-
transport,
|
|
37
|
-
req,
|
|
38
|
-
res,
|
|
39
|
-
auditLogger,
|
|
40
|
-
requestedMcpServer,
|
|
41
|
-
initialSessionId
|
|
42
|
-
);
|
|
29
|
+
return requestHandler(transport, req, res, auditLogger, requestedMcpServer, initialSessionId);
|
|
43
30
|
}
|
|
44
31
|
|
|
45
32
|
const transport = getTransportFromSession(sessionId);
|
package/mcp-server/mcp-shark.js
CHANGED
|
@@ -1,72 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import { isError } from './lib/common/error.js';
|
|
5
|
-
|
|
6
|
-
import { createInternalServerFactory } from './lib/server/internal/server.js';
|
|
7
|
-
import {
|
|
8
|
-
getInternalServer,
|
|
9
|
-
runInternalServer,
|
|
10
|
-
} from './lib/server/internal/run.js';
|
|
11
|
-
import { initDb } from 'mcp-shark-common/db/init.js';
|
|
12
|
-
import { getLogger } from 'mcp-shark-common/db/logger.js';
|
|
13
|
-
import {
|
|
14
|
-
getDatabaseFile,
|
|
15
|
-
getMcpConfigPath,
|
|
16
|
-
prepareAppDataSpaces,
|
|
17
|
-
} from 'mcp-shark-common/configs/index.js';
|
|
18
|
-
import { withAuditRequestResponseHandler } from './lib/auditor/audit.js';
|
|
19
|
-
|
|
20
|
-
function initAuditLogger(logger) {
|
|
21
|
-
logger.info('Initializing audit logger at', getDatabaseFile());
|
|
22
|
-
return getLogger(initDb(getDatabaseFile()));
|
|
23
|
-
}
|
|
1
|
+
import logger from '../shared/logger.js';
|
|
2
|
+
// CLI entry point - uses the library
|
|
3
|
+
import { startMcpSharkServer } from './index.js';
|
|
24
4
|
|
|
25
5
|
async function main() {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const result = await runAllExternalServers(consola, configPath);
|
|
39
|
-
if (isError(result)) {
|
|
40
|
-
console.error(JSON.stringify(result));
|
|
6
|
+
try {
|
|
7
|
+
await startMcpSharkServer({
|
|
8
|
+
onReady: () => {
|
|
9
|
+
logger.info('[MCP-Shark] MCP server started successfully');
|
|
10
|
+
},
|
|
11
|
+
onError: (error) => {
|
|
12
|
+
logger.error({ error: error.message, stack: error.stack }, 'Error starting MCP server');
|
|
13
|
+
process.exit(1);
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
} catch (error) {
|
|
17
|
+
logger.error({ error: error.message, stack: error.stack }, 'Error starting MCP server');
|
|
41
18
|
process.exit(1);
|
|
42
19
|
}
|
|
43
|
-
|
|
44
|
-
const internalServerFactory = createInternalServerFactory(consola, result);
|
|
45
|
-
const app = getInternalServer(
|
|
46
|
-
internalServerFactory,
|
|
47
|
-
auditLogger,
|
|
48
|
-
withAuditRequestResponseHandler
|
|
49
|
-
);
|
|
50
|
-
await runInternalServer(consola, 9851, app);
|
|
51
20
|
}
|
|
52
21
|
|
|
53
|
-
main()
|
|
54
|
-
.then(() => {
|
|
55
|
-
const successMsg = 'MCP server started successfully';
|
|
56
|
-
console.log(`[MCP-Shark] ${successMsg}`);
|
|
57
|
-
consola.info(successMsg);
|
|
58
|
-
})
|
|
59
|
-
.catch(error => {
|
|
60
|
-
const errorMsg = 'Error starting MCP server';
|
|
61
|
-
console.error(`[MCP-Shark] ${errorMsg}:`, error);
|
|
62
|
-
console.error(`[MCP-Shark] Error message: ${error.message}`);
|
|
63
|
-
if (error.stack) {
|
|
64
|
-
console.error(`[MCP-Shark] Error stack:`, error.stack);
|
|
65
|
-
}
|
|
66
|
-
consola.error(errorMsg, error);
|
|
67
|
-
consola.error(`Error message: ${error.message}`);
|
|
68
|
-
if (error.stack) {
|
|
69
|
-
consola.error(`Error stack: ${error.stack}`);
|
|
70
|
-
}
|
|
71
|
-
process.exit(1);
|
|
72
|
-
});
|
|
22
|
+
main();
|
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-shark/mcp-shark",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "Aggregate multiple Model Context Protocol (MCP) servers into a single unified interface with a powerful monitoring UI. Prov deep visibility into every request and response.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./bin/mcp-shark.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./bin/mcp-shark.js",
|
|
9
|
+
"./mcp-server": "./mcp-server/index.js"
|
|
10
|
+
},
|
|
7
11
|
"bin": {
|
|
8
12
|
"mcp-shark": "./bin/mcp-shark.js",
|
|
9
13
|
"@mcp-shark/mcp-shark": "./bin/mcp-shark.js"
|
|
@@ -16,40 +20,25 @@
|
|
|
16
20
|
"bugs": {
|
|
17
21
|
"url": "https://github.com/mcp-shark/mcp-shark/issues"
|
|
18
22
|
},
|
|
19
|
-
"files": [
|
|
20
|
-
"bin",
|
|
21
|
-
"ui",
|
|
22
|
-
"mcp-server",
|
|
23
|
-
"README.md",
|
|
24
|
-
"LICENSE"
|
|
25
|
-
],
|
|
23
|
+
"files": ["bin", "ui", "mcp-server", "shared", "README.md", "LICENSE", "package.json"],
|
|
26
24
|
"scripts": {
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"build:ui": "cd ui &&
|
|
32
|
-
"lint
|
|
33
|
-
"lint:fix
|
|
34
|
-
"format
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"format:ui": "prettier --write \"ui/**/*.{js,jsx,ts,tsx,json,css,md}\"",
|
|
38
|
-
"lint:fix:all": "(npm run lint:fix:server || true) && (npm run lint:fix:ui || true)",
|
|
39
|
-
"format:all": "(npm run format:server || true) && (npm run format:ui || true)",
|
|
40
|
-
"fix:all": "(npm run lint:fix:all || true) && (npm run format:all || true)",
|
|
25
|
+
"start": "node scripts/start-ui.js",
|
|
26
|
+
"predev": "npm run build:ui",
|
|
27
|
+
"dev": "node scripts/start-ui.js'",
|
|
28
|
+
"build": "bash -c 'cd ui && vite build'",
|
|
29
|
+
"build:ui": "bash -c 'cd ui && vite build'",
|
|
30
|
+
"lint": "biome lint .",
|
|
31
|
+
"lint:fix": "biome lint --write .",
|
|
32
|
+
"format": "biome format --write .",
|
|
33
|
+
"check": "biome check .",
|
|
34
|
+
"check:fix": "biome check --write .",
|
|
41
35
|
"prepare": "husky install || true",
|
|
42
|
-
"prepublishOnly": "npm run
|
|
36
|
+
"prepublishOnly": "npm run check:fix && npm run build:ui",
|
|
43
37
|
"publish:public": "npm publish --access public",
|
|
44
38
|
"publish:dry-run": "npm publish --dry-run"
|
|
45
39
|
},
|
|
46
40
|
"lint-staged": {
|
|
47
|
-
"
|
|
48
|
-
"prettier --write"
|
|
49
|
-
],
|
|
50
|
-
"*.{json,css,md,yml,yaml}": [
|
|
51
|
-
"prettier --write"
|
|
52
|
-
]
|
|
41
|
+
"*": ["biome check --write"]
|
|
53
42
|
},
|
|
54
43
|
"keywords": [
|
|
55
44
|
"mcp",
|
|
@@ -78,28 +67,24 @@
|
|
|
78
67
|
"@modelcontextprotocol/sdk": "^1.20.2",
|
|
79
68
|
"@tabler/icons-react": "^3.0.0",
|
|
80
69
|
"animejs": "^3.2.2",
|
|
70
|
+
"commander": "^14.0.2",
|
|
81
71
|
"consola": "^3.4.2",
|
|
82
72
|
"cors": "^2.8.5",
|
|
83
73
|
"express": "^4.18.2",
|
|
84
74
|
"jsonrpc-lite": "^2.2.0",
|
|
85
75
|
"mcp-shark-common": "github:mcp-shark/mcp-shark-common",
|
|
76
|
+
"open": "^11.0.0",
|
|
86
77
|
"react": "^18.2.0",
|
|
87
78
|
"react-dom": "^18.2.0",
|
|
88
|
-
"ws": "^8.16.0"
|
|
89
|
-
"open": "^11.0.0",
|
|
90
|
-
"commander": "^14.0.2"
|
|
79
|
+
"ws": "^8.16.0"
|
|
91
80
|
},
|
|
92
81
|
"devDependencies": {
|
|
82
|
+
"@biomejs/biome": "^1.9.4",
|
|
93
83
|
"@commitlint/cli": "^19.5.0",
|
|
94
84
|
"@commitlint/config-conventional": "^19.5.0",
|
|
95
|
-
"@eslint/js": "^9.15.0",
|
|
96
85
|
"@vitejs/plugin-react": "^4.2.1",
|
|
97
|
-
"eslint": "^9.15.0",
|
|
98
|
-
"eslint-config-prettier": "^9.1.0",
|
|
99
|
-
"eslint-plugin-prettier": "^5.2.1",
|
|
100
86
|
"husky": "^9.1.6",
|
|
101
87
|
"lint-staged": "^15.2.10",
|
|
102
|
-
"
|
|
103
|
-
"vite": "^5.1.0"
|
|
88
|
+
"vite": "^7.3.0"
|
|
104
89
|
}
|
|
105
90
|
}
|
package/shared/logger.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { consola } from 'consola';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Unified logger for the entire codebase
|
|
5
|
+
* Uses consola (already installed) with a consistent API
|
|
6
|
+
* Supports both Pino-style API (object, message) and consola-style (multiple args)
|
|
7
|
+
*/
|
|
8
|
+
const logger = {
|
|
9
|
+
info: (...args) => {
|
|
10
|
+
if (args.length === 0) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
// If first arg is an object and second is a string, use Pino-style
|
|
14
|
+
if (
|
|
15
|
+
args.length === 2 &&
|
|
16
|
+
typeof args[0] === 'object' &&
|
|
17
|
+
args[0] !== null &&
|
|
18
|
+
typeof args[1] === 'string'
|
|
19
|
+
) {
|
|
20
|
+
consola.info(args[1] || '', args[0]);
|
|
21
|
+
} else {
|
|
22
|
+
// Otherwise, pass all args to consola (supports multiple strings/values)
|
|
23
|
+
consola.info(...args);
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
error: (...args) => {
|
|
27
|
+
if (args.length === 0) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (
|
|
31
|
+
args.length === 2 &&
|
|
32
|
+
typeof args[0] === 'object' &&
|
|
33
|
+
args[0] !== null &&
|
|
34
|
+
typeof args[1] === 'string'
|
|
35
|
+
) {
|
|
36
|
+
consola.error(args[1] || '', args[0]);
|
|
37
|
+
} else {
|
|
38
|
+
consola.error(...args);
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
warn: (...args) => {
|
|
42
|
+
if (args.length === 0) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (
|
|
46
|
+
args.length === 2 &&
|
|
47
|
+
typeof args[0] === 'object' &&
|
|
48
|
+
args[0] !== null &&
|
|
49
|
+
typeof args[1] === 'string'
|
|
50
|
+
) {
|
|
51
|
+
consola.warn(args[1] || '', args[0]);
|
|
52
|
+
} else {
|
|
53
|
+
consola.warn(...args);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
debug: (...args) => {
|
|
57
|
+
if (args.length === 0) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (
|
|
61
|
+
args.length === 2 &&
|
|
62
|
+
typeof args[0] === 'object' &&
|
|
63
|
+
args[0] !== null &&
|
|
64
|
+
typeof args[1] === 'string'
|
|
65
|
+
) {
|
|
66
|
+
consola.debug(args[1] || '', args[0]);
|
|
67
|
+
} else {
|
|
68
|
+
consola.debug(...args);
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
log: (...args) => {
|
|
72
|
+
if (args.length === 0) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (
|
|
76
|
+
args.length === 2 &&
|
|
77
|
+
typeof args[0] === 'object' &&
|
|
78
|
+
args[0] !== null &&
|
|
79
|
+
typeof args[1] === 'string'
|
|
80
|
+
) {
|
|
81
|
+
consola.log(args[1] || '', args[0]);
|
|
82
|
+
} else {
|
|
83
|
+
consola.log(...args);
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
// Expose consola directly for advanced usage
|
|
87
|
+
consola,
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export default logger;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import"https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&family=Roboto+Mono:wght@400;500&display=swap";*{margin:0;padding:0;box-sizing:border-box}body{font-family:Roboto,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;background:#fff;color:#202124;overflow:hidden;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}code,pre,.monospace{font-family:Roboto Mono,JetBrains Mono,Fira Code,Consolas,monospace}#root{height:100vh;display:flex;flex-direction:column}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}
|