superbased 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +31 -0
- package/README.md +84 -0
- package/SUPERBASED_SKILL.md +358 -0
- package/dist/electron/ai/ai-client.d.ts +45 -0
- package/dist/electron/ai/ai-client.d.ts.map +1 -0
- package/dist/electron/ai/ai-client.js +205 -0
- package/dist/electron/ai/ai-client.js.map +1 -0
- package/dist/electron/ai/context-builder.d.ts +8 -0
- package/dist/electron/ai/context-builder.d.ts.map +1 -0
- package/dist/electron/ai/context-builder.js +28 -0
- package/dist/electron/ai/context-builder.js.map +1 -0
- package/dist/electron/ai/instruction-parser.d.ts +11 -0
- package/dist/electron/ai/instruction-parser.d.ts.map +1 -0
- package/dist/electron/ai/instruction-parser.js +47 -0
- package/dist/electron/ai/instruction-parser.js.map +1 -0
- package/dist/electron/ai/orchestrator.d.ts +17 -0
- package/dist/electron/ai/orchestrator.d.ts.map +1 -0
- package/dist/electron/ai/orchestrator.js +53 -0
- package/dist/electron/ai/orchestrator.js.map +1 -0
- package/dist/electron/ai/providers/anthropic.d.ts +6 -0
- package/dist/electron/ai/providers/anthropic.d.ts.map +1 -0
- package/dist/electron/ai/providers/anthropic.js +67 -0
- package/dist/electron/ai/providers/anthropic.js.map +1 -0
- package/dist/electron/ai/providers/azure-openai.d.ts +12 -0
- package/dist/electron/ai/providers/azure-openai.d.ts.map +1 -0
- package/dist/electron/ai/providers/azure-openai.js +87 -0
- package/dist/electron/ai/providers/azure-openai.js.map +1 -0
- package/dist/electron/ai/providers/gemini.d.ts +6 -0
- package/dist/electron/ai/providers/gemini.d.ts.map +1 -0
- package/dist/electron/ai/providers/gemini.js +49 -0
- package/dist/electron/ai/providers/gemini.js.map +1 -0
- package/dist/electron/ai/providers/openai.d.ts +6 -0
- package/dist/electron/ai/providers/openai.d.ts.map +1 -0
- package/dist/electron/ai/providers/openai.js +68 -0
- package/dist/electron/ai/providers/openai.js.map +1 -0
- package/dist/electron/core/auth-store.d.ts +15 -0
- package/dist/electron/core/auth-store.d.ts.map +1 -0
- package/dist/electron/core/auth-store.js +86 -0
- package/dist/electron/core/auth-store.js.map +1 -0
- package/dist/electron/core/config.d.ts +6 -0
- package/dist/electron/core/config.d.ts.map +1 -0
- package/dist/electron/core/config.js +81 -0
- package/dist/electron/core/config.js.map +1 -0
- package/dist/electron/core/file-logger.d.ts +17 -0
- package/dist/electron/core/file-logger.d.ts.map +1 -0
- package/dist/electron/core/file-logger.js +74 -0
- package/dist/electron/core/file-logger.js.map +1 -0
- package/dist/electron/core/json-store.d.ts +4 -0
- package/dist/electron/core/json-store.d.ts.map +1 -0
- package/dist/electron/core/json-store.js +118 -0
- package/dist/electron/core/json-store.js.map +1 -0
- package/dist/electron/core/paths.d.ts +17 -0
- package/dist/electron/core/paths.d.ts.map +1 -0
- package/dist/electron/core/paths.js +117 -0
- package/dist/electron/core/paths.js.map +1 -0
- package/dist/electron/core/platform.d.ts +21 -0
- package/dist/electron/core/platform.d.ts.map +1 -0
- package/dist/electron/core/platform.js +18 -0
- package/dist/electron/core/platform.js.map +1 -0
- package/dist/electron/core/process-coord.d.ts +19 -0
- package/dist/electron/core/process-coord.d.ts.map +1 -0
- package/dist/electron/core/process-coord.js +124 -0
- package/dist/electron/core/process-coord.js.map +1 -0
- package/dist/electron/db/database.d.ts +154 -0
- package/dist/electron/db/database.d.ts.map +1 -0
- package/dist/electron/db/database.js +637 -0
- package/dist/electron/db/database.js.map +1 -0
- package/dist/electron/db/models.d.ts +26 -0
- package/dist/electron/db/models.d.ts.map +1 -0
- package/dist/electron/db/models.js +4 -0
- package/dist/electron/db/models.js.map +1 -0
- package/dist/electron/logger.d.ts +9 -0
- package/dist/electron/logger.d.ts.map +1 -0
- package/dist/electron/logger.js +18 -0
- package/dist/electron/logger.js.map +1 -0
- package/dist/electron/main.js +3286 -0
- package/dist/electron/modules/active-window.d.ts +6 -0
- package/dist/electron/modules/active-window.d.ts.map +1 -0
- package/dist/electron/modules/active-window.js +68 -0
- package/dist/electron/modules/active-window.js.map +1 -0
- package/dist/electron/modules/api-server.d.ts +8 -0
- package/dist/electron/modules/api-server.d.ts.map +1 -0
- package/dist/electron/modules/api-server.js +1324 -0
- package/dist/electron/modules/api-server.js.map +1 -0
- package/dist/electron/modules/auth.d.ts +28 -0
- package/dist/electron/modules/auth.d.ts.map +1 -0
- package/dist/electron/modules/auth.js +150 -0
- package/dist/electron/modules/auth.js.map +1 -0
- package/dist/electron/modules/azure-speech-realtime.d.ts +38 -0
- package/dist/electron/modules/azure-speech-realtime.d.ts.map +1 -0
- package/dist/electron/modules/azure-speech-realtime.js +354 -0
- package/dist/electron/modules/azure-speech-realtime.js.map +1 -0
- package/dist/electron/modules/capture-modes.d.ts +19 -0
- package/dist/electron/modules/capture-modes.d.ts.map +1 -0
- package/dist/electron/modules/capture-modes.js +100 -0
- package/dist/electron/modules/capture-modes.js.map +1 -0
- package/dist/electron/modules/capture.d.ts +16 -0
- package/dist/electron/modules/capture.d.ts.map +1 -0
- package/dist/electron/modules/capture.js +139 -0
- package/dist/electron/modules/capture.js.map +1 -0
- package/dist/electron/modules/clipboard.d.ts +6 -0
- package/dist/electron/modules/clipboard.d.ts.map +1 -0
- package/dist/electron/modules/clipboard.js +26 -0
- package/dist/electron/modules/clipboard.js.map +1 -0
- package/dist/electron/modules/color-picker.d.ts +4 -0
- package/dist/electron/modules/color-picker.d.ts.map +1 -0
- package/dist/electron/modules/color-picker.js +233 -0
- package/dist/electron/modules/color-picker.js.map +1 -0
- package/dist/electron/modules/dictation.d.ts +25 -0
- package/dist/electron/modules/dictation.d.ts.map +1 -0
- package/dist/electron/modules/dictation.js +1058 -0
- package/dist/electron/modules/dictation.js.map +1 -0
- package/dist/electron/modules/error-reporter.d.ts +7 -0
- package/dist/electron/modules/error-reporter.d.ts.map +1 -0
- package/dist/electron/modules/error-reporter.js +65 -0
- package/dist/electron/modules/error-reporter.js.map +1 -0
- package/dist/electron/modules/hotkeys.d.ts +4 -0
- package/dist/electron/modules/hotkeys.d.ts.map +1 -0
- package/dist/electron/modules/hotkeys.js +40 -0
- package/dist/electron/modules/hotkeys.js.map +1 -0
- package/dist/electron/modules/keystroke.d.ts +7 -0
- package/dist/electron/modules/keystroke.d.ts.map +1 -0
- package/dist/electron/modules/keystroke.js +53 -0
- package/dist/electron/modules/keystroke.js.map +1 -0
- package/dist/electron/modules/license.d.ts +25 -0
- package/dist/electron/modules/license.d.ts.map +1 -0
- package/dist/electron/modules/license.js +175 -0
- package/dist/electron/modules/license.js.map +1 -0
- package/dist/electron/modules/mcp-config.d.ts +16 -0
- package/dist/electron/modules/mcp-config.d.ts.map +1 -0
- package/dist/electron/modules/mcp-config.js +146 -0
- package/dist/electron/modules/mcp-config.js.map +1 -0
- package/dist/electron/modules/ocr.d.ts +3 -0
- package/dist/electron/modules/ocr.d.ts.map +1 -0
- package/dist/electron/modules/ocr.js +176 -0
- package/dist/electron/modules/ocr.js.map +1 -0
- package/dist/electron/modules/pin-window.d.ts +3 -0
- package/dist/electron/modules/pin-window.d.ts.map +1 -0
- package/dist/electron/modules/pin-window.js +63 -0
- package/dist/electron/modules/pin-window.js.map +1 -0
- package/dist/electron/modules/recording/ai-analysis.d.ts +8 -0
- package/dist/electron/modules/recording/ai-analysis.d.ts.map +1 -0
- package/dist/electron/modules/recording/ai-analysis.js +88 -0
- package/dist/electron/modules/recording/ai-analysis.js.map +1 -0
- package/dist/electron/modules/recording/capture-queue.d.ts +48 -0
- package/dist/electron/modules/recording/capture-queue.d.ts.map +1 -0
- package/dist/electron/modules/recording/capture-queue.js +376 -0
- package/dist/electron/modules/recording/capture-queue.js.map +1 -0
- package/dist/electron/modules/recording/cli.d.ts +13 -0
- package/dist/electron/modules/recording/cli.d.ts.map +1 -0
- package/dist/electron/modules/recording/cli.js +135 -0
- package/dist/electron/modules/recording/cli.js.map +1 -0
- package/dist/electron/modules/recording/http-api.d.ts +3 -0
- package/dist/electron/modules/recording/http-api.d.ts.map +1 -0
- package/dist/electron/modules/recording/http-api.js +236 -0
- package/dist/electron/modules/recording/http-api.js.map +1 -0
- package/dist/electron/modules/recording/index.d.ts +15 -0
- package/dist/electron/modules/recording/index.d.ts.map +1 -0
- package/dist/electron/modules/recording/index.js +148 -0
- package/dist/electron/modules/recording/index.js.map +1 -0
- package/dist/electron/modules/recording/input-hook-provider.d.ts +15 -0
- package/dist/electron/modules/recording/input-hook-provider.d.ts.map +1 -0
- package/dist/electron/modules/recording/input-hook-provider.js +5 -0
- package/dist/electron/modules/recording/input-hook-provider.js.map +1 -0
- package/dist/electron/modules/recording/mcp-tool.d.ts +13 -0
- package/dist/electron/modules/recording/mcp-tool.d.ts.map +1 -0
- package/dist/electron/modules/recording/mcp-tool.js +81 -0
- package/dist/electron/modules/recording/mcp-tool.js.map +1 -0
- package/dist/electron/modules/recording/providers/periodic-provider.d.ts +15 -0
- package/dist/electron/modules/recording/providers/periodic-provider.d.ts.map +1 -0
- package/dist/electron/modules/recording/providers/periodic-provider.js +55 -0
- package/dist/electron/modules/recording/providers/periodic-provider.js.map +1 -0
- package/dist/electron/modules/recording/providers/provider-factory.d.ts +9 -0
- package/dist/electron/modules/recording/providers/provider-factory.d.ts.map +1 -0
- package/dist/electron/modules/recording/providers/provider-factory.js +70 -0
- package/dist/electron/modules/recording/providers/provider-factory.js.map +1 -0
- package/dist/electron/modules/recording/providers/uiohook-provider.d.ts +19 -0
- package/dist/electron/modules/recording/providers/uiohook-provider.d.ts.map +1 -0
- package/dist/electron/modules/recording/providers/uiohook-provider.js +263 -0
- package/dist/electron/modules/recording/providers/uiohook-provider.js.map +1 -0
- package/dist/electron/modules/recording/recording-session.d.ts +25 -0
- package/dist/electron/modules/recording/recording-session.d.ts.map +1 -0
- package/dist/electron/modules/recording/recording-session.js +317 -0
- package/dist/electron/modules/recording/recording-session.js.map +1 -0
- package/dist/electron/modules/recording/session-alignment.d.ts +32 -0
- package/dist/electron/modules/recording/session-alignment.d.ts.map +1 -0
- package/dist/electron/modules/recording/session-alignment.js +103 -0
- package/dist/electron/modules/recording/session-alignment.js.map +1 -0
- package/dist/electron/modules/recording/session-export.d.ts +2 -0
- package/dist/electron/modules/recording/session-export.d.ts.map +1 -0
- package/dist/electron/modules/recording/session-export.js +287 -0
- package/dist/electron/modules/recording/session-export.js.map +1 -0
- package/dist/electron/modules/recording/trigger-engine.d.ts +62 -0
- package/dist/electron/modules/recording/trigger-engine.d.ts.map +1 -0
- package/dist/electron/modules/recording/trigger-engine.js +546 -0
- package/dist/electron/modules/recording/trigger-engine.js.map +1 -0
- package/dist/electron/modules/recording/visual-diff.d.ts +17 -0
- package/dist/electron/modules/recording/visual-diff.d.ts.map +1 -0
- package/dist/electron/modules/recording/visual-diff.js +109 -0
- package/dist/electron/modules/recording/visual-diff.js.map +1 -0
- package/dist/electron/modules/redact.d.ts +34 -0
- package/dist/electron/modules/redact.d.ts.map +1 -0
- package/dist/electron/modules/redact.js +583 -0
- package/dist/electron/modules/redact.js.map +1 -0
- package/dist/electron/modules/scroll-capture.d.ts +19 -0
- package/dist/electron/modules/scroll-capture.d.ts.map +1 -0
- package/dist/electron/modules/scroll-capture.js +185 -0
- package/dist/electron/modules/scroll-capture.js.map +1 -0
- package/dist/electron/modules/store.d.ts +59 -0
- package/dist/electron/modules/store.d.ts.map +1 -0
- package/dist/electron/modules/store.js +100 -0
- package/dist/electron/modules/store.js.map +1 -0
- package/dist/electron/modules/tce/content-analyzer.d.ts +20 -0
- package/dist/electron/modules/tce/content-analyzer.d.ts.map +1 -0
- package/dist/electron/modules/tce/content-analyzer.js +123 -0
- package/dist/electron/modules/tce/content-analyzer.js.map +1 -0
- package/dist/electron/modules/tce/index.d.ts +54 -0
- package/dist/electron/modules/tce/index.d.ts.map +1 -0
- package/dist/electron/modules/tce/index.js +174 -0
- package/dist/electron/modules/tce/index.js.map +1 -0
- package/dist/electron/modules/tce/layout-engine.d.ts +68 -0
- package/dist/electron/modules/tce/layout-engine.d.ts.map +1 -0
- package/dist/electron/modules/tce/layout-engine.js +313 -0
- package/dist/electron/modules/tce/layout-engine.js.map +1 -0
- package/dist/electron/modules/tce/renderer.d.ts +16 -0
- package/dist/electron/modules/tce/renderer.d.ts.map +1 -0
- package/dist/electron/modules/tce/renderer.js +196 -0
- package/dist/electron/modules/tce/renderer.js.map +1 -0
- package/dist/electron/modules/tce/themes.d.ts +14 -0
- package/dist/electron/modules/tce/themes.d.ts.map +1 -0
- package/dist/electron/modules/tce/themes.js +68 -0
- package/dist/electron/modules/tce/themes.js.map +1 -0
- package/dist/electron/modules/tce/token-estimator.d.ts +30 -0
- package/dist/electron/modules/tce/token-estimator.d.ts.map +1 -0
- package/dist/electron/modules/tce/token-estimator.js +59 -0
- package/dist/electron/modules/tce/token-estimator.js.map +1 -0
- package/dist/electron/modules/telemetry.d.ts +44 -0
- package/dist/electron/modules/telemetry.d.ts.map +1 -0
- package/dist/electron/modules/telemetry.js +316 -0
- package/dist/electron/modules/telemetry.js.map +1 -0
- package/dist/electron/modules/tray.d.ts +22 -0
- package/dist/electron/modules/tray.d.ts.map +1 -0
- package/dist/electron/modules/tray.js +221 -0
- package/dist/electron/modules/tray.js.map +1 -0
- package/dist/electron/modules/updater.d.ts +14 -0
- package/dist/electron/modules/updater.d.ts.map +1 -0
- package/dist/electron/modules/updater.js +102 -0
- package/dist/electron/modules/updater.js.map +1 -0
- package/dist/electron/modules/usage-link.d.ts +7 -0
- package/dist/electron/modules/usage-link.d.ts.map +1 -0
- package/dist/electron/modules/usage-link.js +63 -0
- package/dist/electron/modules/usage-link.js.map +1 -0
- package/dist/electron/modules/version-check.d.ts +3 -0
- package/dist/electron/modules/version-check.d.ts.map +1 -0
- package/dist/electron/modules/version-check.js +76 -0
- package/dist/electron/modules/version-check.js.map +1 -0
- package/dist/electron/modules/window-picker.d.ts +6 -0
- package/dist/electron/modules/window-picker.d.ts.map +1 -0
- package/dist/electron/modules/window-picker.js +192 -0
- package/dist/electron/modules/window-picker.js.map +1 -0
- package/dist/headless/electron/ai/ai-client.js +204 -0
- package/dist/headless/electron/ai/context-builder.js +27 -0
- package/dist/headless/electron/ai/instruction-parser.js +46 -0
- package/dist/headless/electron/core/auth-store.js +85 -0
- package/dist/headless/electron/core/config.js +80 -0
- package/dist/headless/electron/core/file-logger.js +73 -0
- package/dist/headless/electron/core/json-store.js +117 -0
- package/dist/headless/electron/core/paths.js +116 -0
- package/dist/headless/electron/core/platform.js +17 -0
- package/dist/headless/electron/core/process-coord.js +123 -0
- package/dist/headless/electron/db/database.js +636 -0
- package/dist/headless/electron/db/models.js +3 -0
- package/dist/headless/electron/logger.js +17 -0
- package/dist/headless/electron/modules/active-window.js +67 -0
- package/dist/headless/electron/modules/api-server.js +1323 -0
- package/dist/headless/electron/modules/auth.js +149 -0
- package/dist/headless/electron/modules/azure-speech-realtime.js +353 -0
- package/dist/headless/electron/modules/capture.js +138 -0
- package/dist/headless/electron/modules/clipboard.js +25 -0
- package/dist/headless/electron/modules/dictation.js +1057 -0
- package/dist/headless/electron/modules/keystroke.js +52 -0
- package/dist/headless/electron/modules/license.js +174 -0
- package/dist/headless/electron/modules/mcp-config.js +145 -0
- package/dist/headless/electron/modules/ocr.js +175 -0
- package/dist/headless/electron/modules/recording/ai-analysis.js +87 -0
- package/dist/headless/electron/modules/recording/capture-queue.js +375 -0
- package/dist/headless/electron/modules/recording/cli.js +134 -0
- package/dist/headless/electron/modules/recording/http-api.js +235 -0
- package/dist/headless/electron/modules/recording/index.js +147 -0
- package/dist/headless/electron/modules/recording/input-hook-provider.js +4 -0
- package/dist/headless/electron/modules/recording/mcp-tool.js +80 -0
- package/dist/headless/electron/modules/recording/providers/periodic-provider.js +54 -0
- package/dist/headless/electron/modules/recording/providers/provider-factory.js +69 -0
- package/dist/headless/electron/modules/recording/providers/uiohook-provider.js +262 -0
- package/dist/headless/electron/modules/recording/recording-session.js +316 -0
- package/dist/headless/electron/modules/recording/session-alignment.js +102 -0
- package/dist/headless/electron/modules/recording/session-export.js +286 -0
- package/dist/headless/electron/modules/recording/trigger-engine.js +545 -0
- package/dist/headless/electron/modules/recording/visual-diff.js +108 -0
- package/dist/headless/electron/modules/redact.js +582 -0
- package/dist/headless/electron/modules/store.js +99 -0
- package/dist/headless/electron/modules/tce/content-analyzer.js +122 -0
- package/dist/headless/electron/modules/tce/index.js +173 -0
- package/dist/headless/electron/modules/tce/layout-engine.js +312 -0
- package/dist/headless/electron/modules/tce/renderer.js +195 -0
- package/dist/headless/electron/modules/tce/themes.js +67 -0
- package/dist/headless/electron/modules/tce/token-estimator.js +58 -0
- package/dist/headless/electron/modules/telemetry.js +315 -0
- package/dist/headless/headless/capture-hotkey.js +155 -0
- package/dist/headless/headless/cli-auth.js +158 -0
- package/dist/headless/headless/cli.js +220 -0
- package/dist/headless/headless/dictation-hotkey.js +360 -0
- package/dist/headless/headless/mic-capture.js +312 -0
- package/dist/headless/headless/platform-headless.js +121 -0
- package/dist/headless/headless/server.js +159 -0
- package/dist/headless/mic-capture.d.ts +29 -0
- package/dist/headless/mic-capture.d.ts.map +1 -0
- package/dist/headless/mic-capture.js +313 -0
- package/dist/headless/mic-capture.js.map +1 -0
- package/dist/headless/shared/constants.js +63 -0
- package/dist/headless/shared/design-tokens.js +189 -0
- package/dist/headless/shared/recording-types.js +93 -0
- package/dist/headless/shared/types.js +3 -0
- package/dist/shared/constants.d.ts +98 -0
- package/dist/shared/constants.d.ts.map +1 -0
- package/dist/shared/constants.js +64 -0
- package/dist/shared/constants.js.map +1 -0
- package/dist/shared/design-tokens.d.ts +112 -0
- package/dist/shared/design-tokens.d.ts.map +1 -0
- package/dist/shared/design-tokens.js +190 -0
- package/dist/shared/design-tokens.js.map +1 -0
- package/dist/shared/recording-types.d.ts +174 -0
- package/dist/shared/recording-types.d.ts.map +1 -0
- package/dist/shared/recording-types.js +94 -0
- package/dist/shared/recording-types.js.map +1 -0
- package/dist/shared/types.d.ts +135 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/types.js +4 -0
- package/dist/shared/types.js.map +1 -0
- package/mcp-server/dist/api-client.js +261 -0
- package/mcp-server/dist/index.js +824 -0
- package/mcp-server/package.json +16 -0
- package/package.json +125 -0
|
@@ -0,0 +1,824 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
// SuperBased MCP Server — exposes desktop app capabilities to AI coding CLIs.
|
|
4
|
+
// Connects via stdio transport. Proxies tool calls to SuperBased HTTP API.
|
|
5
|
+
// Usage: node index.js [--port PORT] [--project-dir DIR]
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
+
var ownKeys = function(o) {
|
|
24
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
+
var ar = [];
|
|
26
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.startMcpServer = startMcpServer;
|
|
41
|
+
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
42
|
+
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
43
|
+
const zod_1 = require("zod");
|
|
44
|
+
const api_client_1 = require("./api-client");
|
|
45
|
+
const fs = __importStar(require("fs"));
|
|
46
|
+
const path = __importStar(require("path"));
|
|
47
|
+
const os = __importStar(require("os"));
|
|
48
|
+
// Parse CLI args
|
|
49
|
+
function parseArgs() {
|
|
50
|
+
const args = process.argv.slice(2);
|
|
51
|
+
let port = 47592;
|
|
52
|
+
let projectDir;
|
|
53
|
+
for (let i = 0; i < args.length; i++) {
|
|
54
|
+
if (args[i] === '--port' && args[i + 1]) {
|
|
55
|
+
port = parseInt(args[i + 1], 10);
|
|
56
|
+
i++;
|
|
57
|
+
}
|
|
58
|
+
else if (args[i] === '--project-dir' && args[i + 1]) {
|
|
59
|
+
projectDir = args[i + 1];
|
|
60
|
+
i++;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// Try to read config file for port discovery
|
|
64
|
+
if (port === 47592) {
|
|
65
|
+
const configPath = path.join(os.homedir(), '.superbased', 'mcp.json');
|
|
66
|
+
try {
|
|
67
|
+
if (fs.existsSync(configPath)) {
|
|
68
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
69
|
+
if (config.apiUrl) {
|
|
70
|
+
const url = new URL(config.apiUrl);
|
|
71
|
+
port = parseInt(url.port, 10) || 47592;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
// Config not found or invalid — use default
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
// Default projectDir to CWD (which is typically the project dir when invoked from Claude Code)
|
|
80
|
+
if (!projectDir) {
|
|
81
|
+
projectDir = process.cwd();
|
|
82
|
+
}
|
|
83
|
+
return { port, projectDir };
|
|
84
|
+
}
|
|
85
|
+
function formatResponse(data) {
|
|
86
|
+
return JSON.stringify(data, null, 2);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Start the MCP server with explicit port and projectDir.
|
|
90
|
+
* Called from `superbased mcp` (unified mode) or standalone.
|
|
91
|
+
*/
|
|
92
|
+
async function startMcpServer(port = 47592, projectDir) {
|
|
93
|
+
const client = new api_client_1.SuperBasedAPIClient(`http://127.0.0.1:${port}`);
|
|
94
|
+
const server = new mcp_js_1.McpServer({
|
|
95
|
+
name: 'superbased',
|
|
96
|
+
version: '1.0.0',
|
|
97
|
+
});
|
|
98
|
+
// ── Tool: superbased_capture ──
|
|
99
|
+
server.tool('superbased_capture', {
|
|
100
|
+
mode: zod_1.z.enum(['fullscreen', 'region', 'active_window']).describe('Capture mode'),
|
|
101
|
+
x: zod_1.z.number().optional().describe('Left coordinate for region capture'),
|
|
102
|
+
y: zod_1.z.number().optional().describe('Top coordinate for region capture'),
|
|
103
|
+
width: zod_1.z.number().optional().describe('Width for region capture'),
|
|
104
|
+
height: zod_1.z.number().optional().describe('Height for region capture'),
|
|
105
|
+
projectDir: zod_1.z.string().optional().describe('Project directory — captures save to {projectDir}/.superbased/captures/'),
|
|
106
|
+
}, async ({ mode, x, y, width, height, projectDir: pd }) => {
|
|
107
|
+
try {
|
|
108
|
+
const dir = pd || projectDir;
|
|
109
|
+
switch (mode) {
|
|
110
|
+
case 'region': {
|
|
111
|
+
if (x === undefined || y === undefined || width === undefined || height === undefined) {
|
|
112
|
+
return { content: [{ type: 'text', text: 'Error: x, y, width, height are required for region capture' }], isError: true };
|
|
113
|
+
}
|
|
114
|
+
const res = await client.captureRegion(x, y, width, height, dir);
|
|
115
|
+
const { imageBase64: _img, ...summary } = res.data;
|
|
116
|
+
return { content: [{ type: 'text', text: formatResponse({ ...summary, imageSizeBytes: res.data.imageBase64?.length || 0 }) }] };
|
|
117
|
+
}
|
|
118
|
+
case 'active_window': {
|
|
119
|
+
const res = await client.captureActiveWindow();
|
|
120
|
+
return { content: [{ type: 'text', text: formatResponse({ windowInfo: res.data.windowInfo, imageSizeBytes: res.data.imageBase64?.length || 0 }) }] };
|
|
121
|
+
}
|
|
122
|
+
case 'fullscreen':
|
|
123
|
+
default: {
|
|
124
|
+
const res = await client.captureFullscreen(dir);
|
|
125
|
+
const { imageBase64: _img, ...summary } = res.data;
|
|
126
|
+
return { content: [{ type: 'text', text: formatResponse({ ...summary, imageSizeBytes: res.data.imageBase64?.length || 0 }) }] };
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
catch (err) {
|
|
131
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
132
|
+
return { content: [{ type: 'text', text: msg }], isError: true };
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
// ── Tool: superbased_ai ──
|
|
136
|
+
server.tool('superbased_ai', {
|
|
137
|
+
instruction: zod_1.z.string().describe('What to do with the image. Slash commands: /extract, /summarize, /code, /explain, /translate, /table, /edit, /reformat. Or free text.'),
|
|
138
|
+
captureId: zod_1.z.number().optional().describe('ID of an existing capture from the gallery'),
|
|
139
|
+
screenshotPath: zod_1.z.string().optional().describe('Path to a screenshot file on disk'),
|
|
140
|
+
projectDir: zod_1.z.string().optional().describe('Project directory for auto-captures. Defaults to CWD.'),
|
|
141
|
+
}, async ({ instruction, captureId, screenshotPath, projectDir: pd }) => {
|
|
142
|
+
try {
|
|
143
|
+
const res = await client.processAI({
|
|
144
|
+
instruction,
|
|
145
|
+
captureId,
|
|
146
|
+
screenshotPath,
|
|
147
|
+
projectDir: pd || projectDir,
|
|
148
|
+
});
|
|
149
|
+
if (res.status >= 400) {
|
|
150
|
+
return { content: [{ type: 'text', text: formatResponse(res.data) }], isError: true };
|
|
151
|
+
}
|
|
152
|
+
return { content: [{ type: 'text', text: res.data.response }] };
|
|
153
|
+
}
|
|
154
|
+
catch (err) {
|
|
155
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
156
|
+
return { content: [{ type: 'text', text: msg }], isError: true };
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
// ── Tool: superbased_ocr ──
|
|
160
|
+
server.tool('superbased_ocr', {
|
|
161
|
+
screenshotPath: zod_1.z.string().optional().describe('Path to a screenshot file on disk'),
|
|
162
|
+
captureId: zod_1.z.number().optional().describe('ID of an existing capture — loads the image from gallery'),
|
|
163
|
+
}, async ({ screenshotPath, captureId }) => {
|
|
164
|
+
try {
|
|
165
|
+
let params = {};
|
|
166
|
+
if (screenshotPath) {
|
|
167
|
+
params = { screenshotPath };
|
|
168
|
+
}
|
|
169
|
+
else if (captureId) {
|
|
170
|
+
const captureRes = await client.getCapture(captureId);
|
|
171
|
+
const capture = captureRes.data.capture;
|
|
172
|
+
if (capture?.screenshot_path) {
|
|
173
|
+
params = { screenshotPath: capture.screenshot_path };
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
return { content: [{ type: 'text', text: `Capture ${captureId} not found or has no image` }], isError: true };
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
return { content: [{ type: 'text', text: 'screenshotPath or captureId is required' }], isError: true };
|
|
181
|
+
}
|
|
182
|
+
const res = await client.ocr(params);
|
|
183
|
+
return { content: [{ type: 'text', text: res.data.text }] };
|
|
184
|
+
}
|
|
185
|
+
catch (err) {
|
|
186
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
187
|
+
return { content: [{ type: 'text', text: msg }], isError: true };
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
// ── Tool: superbased_gallery ──
|
|
191
|
+
server.tool('superbased_gallery', {
|
|
192
|
+
action: zod_1.z.enum(['list', 'get', 'search', 'stats']).describe('list=recent captures, get=specific capture, search=full-text, stats=statistics'),
|
|
193
|
+
captureId: zod_1.z.number().optional().describe('Capture ID (for get action)'),
|
|
194
|
+
query: zod_1.z.string().optional().describe('Search query (for search action)'),
|
|
195
|
+
limit: zod_1.z.number().optional().describe('Max results to return (default 20)'),
|
|
196
|
+
}, async ({ action, captureId, query, limit }) => {
|
|
197
|
+
try {
|
|
198
|
+
switch (action) {
|
|
199
|
+
case 'get': {
|
|
200
|
+
if (!captureId) {
|
|
201
|
+
return { content: [{ type: 'text', text: 'captureId is required for get action' }], isError: true };
|
|
202
|
+
}
|
|
203
|
+
const res = await client.getCapture(captureId);
|
|
204
|
+
return { content: [{ type: 'text', text: formatResponse(res.data) }] };
|
|
205
|
+
}
|
|
206
|
+
case 'search': {
|
|
207
|
+
if (!query) {
|
|
208
|
+
return { content: [{ type: 'text', text: 'query is required for search action' }], isError: true };
|
|
209
|
+
}
|
|
210
|
+
const res = await client.searchCaptures(query, limit || 20);
|
|
211
|
+
return { content: [{ type: 'text', text: formatResponse(res.data) }] };
|
|
212
|
+
}
|
|
213
|
+
case 'stats': {
|
|
214
|
+
const res = await client.getStats();
|
|
215
|
+
return { content: [{ type: 'text', text: formatResponse(res.data) }] };
|
|
216
|
+
}
|
|
217
|
+
case 'list':
|
|
218
|
+
default: {
|
|
219
|
+
const res = await client.getCaptures(limit || 20);
|
|
220
|
+
return { content: [{ type: 'text', text: formatResponse(res.data) }] };
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
catch (err) {
|
|
225
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
226
|
+
return { content: [{ type: 'text', text: msg }], isError: true };
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
// ── Tool: superbased_gallery_update ──
|
|
230
|
+
server.tool('superbased_gallery_update', {
|
|
231
|
+
captureId: zod_1.z.number().describe('Capture ID to update'),
|
|
232
|
+
tags: zod_1.z.string().optional().describe('Comma-separated tags (replaces existing tags)'),
|
|
233
|
+
notes: zod_1.z.string().optional().describe('Notes text (replaces existing notes)'),
|
|
234
|
+
}, async ({ captureId, tags, notes }) => {
|
|
235
|
+
try {
|
|
236
|
+
const results = [];
|
|
237
|
+
if (tags !== undefined) {
|
|
238
|
+
await client.updateTags(captureId, tags);
|
|
239
|
+
results.push(`Tags updated to: ${tags}`);
|
|
240
|
+
}
|
|
241
|
+
if (notes !== undefined) {
|
|
242
|
+
await client.updateNotes(captureId, notes);
|
|
243
|
+
results.push(`Notes updated`);
|
|
244
|
+
}
|
|
245
|
+
if (results.length === 0) {
|
|
246
|
+
return { content: [{ type: 'text', text: 'Provide tags or notes to update' }], isError: true };
|
|
247
|
+
}
|
|
248
|
+
return { content: [{ type: 'text', text: results.join('\n') }] };
|
|
249
|
+
}
|
|
250
|
+
catch (err) {
|
|
251
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
252
|
+
return { content: [{ type: 'text', text: msg }], isError: true };
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
// ── Tool: superbased_settings ──
|
|
256
|
+
server.tool('superbased_settings', {
|
|
257
|
+
action: zod_1.z.enum(['get', 'set', 'get_provider']).describe('get=all settings, set=update a setting, get_provider=current AI provider'),
|
|
258
|
+
key: zod_1.z.string().optional().describe('Setting key (for set action). Common: theme, activeProvider, activeModel, screenshotFolder'),
|
|
259
|
+
value: zod_1.z.string().optional().describe('New value (for set action). Use JSON for complex values.'),
|
|
260
|
+
}, async ({ action, key, value }) => {
|
|
261
|
+
try {
|
|
262
|
+
switch (action) {
|
|
263
|
+
case 'set': {
|
|
264
|
+
if (!key) {
|
|
265
|
+
return { content: [{ type: 'text', text: 'key is required for set action' }], isError: true };
|
|
266
|
+
}
|
|
267
|
+
let parsedValue = value;
|
|
268
|
+
if (typeof value === 'string') {
|
|
269
|
+
try {
|
|
270
|
+
parsedValue = JSON.parse(value);
|
|
271
|
+
}
|
|
272
|
+
catch {
|
|
273
|
+
parsedValue = value;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
const res = await client.setSetting(key, parsedValue);
|
|
277
|
+
if (res.status >= 400) {
|
|
278
|
+
return { content: [{ type: 'text', text: formatResponse(res.data) }], isError: true };
|
|
279
|
+
}
|
|
280
|
+
return { content: [{ type: 'text', text: `Setting '${key}' updated successfully` }] };
|
|
281
|
+
}
|
|
282
|
+
case 'get_provider': {
|
|
283
|
+
const res = await client.getProvider();
|
|
284
|
+
return { content: [{ type: 'text', text: formatResponse(res.data) }] };
|
|
285
|
+
}
|
|
286
|
+
case 'get':
|
|
287
|
+
default: {
|
|
288
|
+
const res = await client.getSettings();
|
|
289
|
+
return { content: [{ type: 'text', text: formatResponse(res.data) }] };
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
catch (err) {
|
|
294
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
295
|
+
return { content: [{ type: 'text', text: msg }], isError: true };
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
// ── Tool: superbased_presets ──
|
|
299
|
+
server.tool('superbased_presets', {
|
|
300
|
+
action: zod_1.z.enum(['list', 'create', 'update', 'delete']).describe('list, create, update, or delete a preset'),
|
|
301
|
+
id: zod_1.z.number().optional().describe('Preset ID (for update/delete)'),
|
|
302
|
+
name: zod_1.z.string().optional().describe('Preset name (for create/update)'),
|
|
303
|
+
instruction: zod_1.z.string().optional().describe('AI instruction template (for create/update)'),
|
|
304
|
+
shortcut: zod_1.z.string().optional().describe('Keyboard shortcut (optional)'),
|
|
305
|
+
}, async ({ action, id, name, instruction, shortcut }) => {
|
|
306
|
+
try {
|
|
307
|
+
switch (action) {
|
|
308
|
+
case 'create': {
|
|
309
|
+
if (!name || !instruction) {
|
|
310
|
+
return { content: [{ type: 'text', text: 'name and instruction are required' }], isError: true };
|
|
311
|
+
}
|
|
312
|
+
const res = await client.createPreset(name, instruction, shortcut);
|
|
313
|
+
return { content: [{ type: 'text', text: formatResponse(res.data) }] };
|
|
314
|
+
}
|
|
315
|
+
case 'update': {
|
|
316
|
+
if (!id || !name || !instruction) {
|
|
317
|
+
return { content: [{ type: 'text', text: 'id, name, and instruction are required' }], isError: true };
|
|
318
|
+
}
|
|
319
|
+
await client.updatePreset(id, name, instruction, shortcut);
|
|
320
|
+
return { content: [{ type: 'text', text: `Preset ${id} updated` }] };
|
|
321
|
+
}
|
|
322
|
+
case 'delete': {
|
|
323
|
+
if (!id) {
|
|
324
|
+
return { content: [{ type: 'text', text: 'id is required' }], isError: true };
|
|
325
|
+
}
|
|
326
|
+
await client.deletePreset(id);
|
|
327
|
+
return { content: [{ type: 'text', text: `Preset ${id} deleted` }] };
|
|
328
|
+
}
|
|
329
|
+
case 'list':
|
|
330
|
+
default: {
|
|
331
|
+
const res = await client.getPresets();
|
|
332
|
+
return { content: [{ type: 'text', text: formatResponse(res.data) }] };
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
catch (err) {
|
|
337
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
338
|
+
return { content: [{ type: 'text', text: msg }], isError: true };
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
// ── Tool: superbased_recording ──
|
|
342
|
+
server.tool('superbased_recording', {
|
|
343
|
+
action: zod_1.z.enum(['start', 'stop', 'pause', 'resume', 'status', 'capture']).describe('Recording action'),
|
|
344
|
+
name: zod_1.z.string().optional().describe('Session name (for start)'),
|
|
345
|
+
profile: zod_1.z.enum(['automated_test', 'bug_report', 'user_journey', 'compliance']).optional().describe('Recording profile (for start)'),
|
|
346
|
+
targetApp: zod_1.z.string().optional().describe('Process name to scope recording to (for start)'),
|
|
347
|
+
}, async ({ action, name, profile, targetApp }) => {
|
|
348
|
+
try {
|
|
349
|
+
switch (action) {
|
|
350
|
+
case 'start': {
|
|
351
|
+
const res = await client.recordingStart({
|
|
352
|
+
name: name || undefined,
|
|
353
|
+
profile: profile || undefined,
|
|
354
|
+
scope: targetApp ? 'specific_app' : undefined,
|
|
355
|
+
targetProcessName: targetApp || undefined,
|
|
356
|
+
});
|
|
357
|
+
return { content: [{ type: 'text', text: formatResponse(res.data) }] };
|
|
358
|
+
}
|
|
359
|
+
case 'stop': {
|
|
360
|
+
const res = await client.recordingStop();
|
|
361
|
+
return { content: [{ type: 'text', text: formatResponse(res.data) }] };
|
|
362
|
+
}
|
|
363
|
+
case 'pause': {
|
|
364
|
+
const res = await client.recordingPause();
|
|
365
|
+
return { content: [{ type: 'text', text: formatResponse(res.data) }] };
|
|
366
|
+
}
|
|
367
|
+
case 'resume': {
|
|
368
|
+
const res = await client.recordingResume();
|
|
369
|
+
return { content: [{ type: 'text', text: formatResponse(res.data) }] };
|
|
370
|
+
}
|
|
371
|
+
case 'capture': {
|
|
372
|
+
const res = await client.recordingCapture();
|
|
373
|
+
return { content: [{ type: 'text', text: formatResponse(res.data) }] };
|
|
374
|
+
}
|
|
375
|
+
case 'status':
|
|
376
|
+
default: {
|
|
377
|
+
const res = await client.recordingStatus();
|
|
378
|
+
return { content: [{ type: 'text', text: formatResponse(res.data) }] };
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
catch (err) {
|
|
383
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
384
|
+
return { content: [{ type: 'text', text: msg }], isError: true };
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
// ── Tool: superbased_sessions ──
|
|
388
|
+
server.tool('superbased_sessions', {
|
|
389
|
+
action: zod_1.z.enum(['list', 'frames']).describe('list=all sessions, frames=frames for a session'),
|
|
390
|
+
sessionId: zod_1.z.string().optional().describe('Session ID (required for frames action)'),
|
|
391
|
+
}, async ({ action, sessionId }) => {
|
|
392
|
+
try {
|
|
393
|
+
if (action === 'frames') {
|
|
394
|
+
if (!sessionId) {
|
|
395
|
+
return { content: [{ type: 'text', text: 'sessionId is required for frames action' }], isError: true };
|
|
396
|
+
}
|
|
397
|
+
const framesRes = await client.getSessionFrames(sessionId);
|
|
398
|
+
return { content: [{ type: 'text', text: formatResponse(framesRes.data) }] };
|
|
399
|
+
}
|
|
400
|
+
const res = await client.getSessions();
|
|
401
|
+
return { content: [{ type: 'text', text: formatResponse(res.data) }] };
|
|
402
|
+
}
|
|
403
|
+
catch (err) {
|
|
404
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
405
|
+
return { content: [{ type: 'text', text: msg }], isError: true };
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
// ── Tool: superbased_export ──
|
|
409
|
+
server.tool('superbased_export', {
|
|
410
|
+
sessionId: zod_1.z.string().describe('Session ID to export'),
|
|
411
|
+
format: zod_1.z.enum(['zip', 'markdown', 'pdf', 'html', 'gif']).describe('Export format'),
|
|
412
|
+
output: zod_1.z.string().optional().describe('Output file path (optional, defaults to exports folder)'),
|
|
413
|
+
}, async ({ sessionId, format, output }) => {
|
|
414
|
+
try {
|
|
415
|
+
const res = await client.exportSession(sessionId, format, output);
|
|
416
|
+
return { content: [{ type: 'text', text: formatResponse(res.data) }] };
|
|
417
|
+
}
|
|
418
|
+
catch (err) {
|
|
419
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
420
|
+
return { content: [{ type: 'text', text: msg }], isError: true };
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
// ── Tool: superbased_compress_text ──
|
|
424
|
+
server.tool('superbased_compress_text', {
|
|
425
|
+
text: zod_1.z.string().describe('Text content to compress into optimized screenshot images'),
|
|
426
|
+
preset: zod_1.z.enum(['compact', 'standard', 'tall', 'wide', 'full', 'auto']).optional().describe('Resolution preset (default: standard)'),
|
|
427
|
+
columns: zod_1.z.union([zod_1.z.literal('auto'), zod_1.z.literal(1), zod_1.z.literal(2), zod_1.z.literal(3)]).optional().describe('Column layout (default: auto)'),
|
|
428
|
+
theme: zod_1.z.enum(['dark', 'light', 'terminal', 'high-contrast', 'paper']).optional().describe('Visual theme (default: dark)'),
|
|
429
|
+
render_style: zod_1.z.enum(['auto', 'code', 'document', 'terminal']).optional().describe('Rendering style (default: auto-detect)'),
|
|
430
|
+
overlap_lines: zod_1.z.number().optional().describe('Lines repeated across page boundaries (default: 3)'),
|
|
431
|
+
}, async ({ text, preset, columns, theme, render_style, overlap_lines }) => {
|
|
432
|
+
try {
|
|
433
|
+
const res = await client.compressText(text, { preset, columns, theme, render_style, overlap_lines });
|
|
434
|
+
const meta = res.data.metadata;
|
|
435
|
+
const summary = `Compressed ${meta.estimated_text_tokens} text tokens → ${meta.total_image_tokens} image tokens (${meta.compression_ratio}x, ${meta.savings_percent}% savings)\n` +
|
|
436
|
+
`${res.data.pages.length} page(s) at ${meta.resolution}, ${meta.columns_used}-column, ${meta.content_type}${meta.language ? ` (${meta.language})` : ''}\n` +
|
|
437
|
+
`Preset: ${meta.preset_used}`;
|
|
438
|
+
const content = [
|
|
439
|
+
{ type: 'text', text: summary },
|
|
440
|
+
];
|
|
441
|
+
for (const page of res.data.pages) {
|
|
442
|
+
content.push({
|
|
443
|
+
type: 'image',
|
|
444
|
+
data: page.data,
|
|
445
|
+
mimeType: 'image/png',
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
return { content };
|
|
449
|
+
}
|
|
450
|
+
catch (err) {
|
|
451
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
452
|
+
return { content: [{ type: 'text', text: msg }], isError: true };
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
// ── Tool: superbased_capture_image ──
|
|
456
|
+
server.tool('superbased_capture_image', {
|
|
457
|
+
mode: zod_1.z.enum(['fullscreen', 'region', 'active_window']).default('fullscreen').describe('Capture mode'),
|
|
458
|
+
resolution: zod_1.z.enum(['full', 'high', 'half', 'quarter', 'thumbnail']).default('half').describe('Image resolution (half saves ~4x tokens vs full)'),
|
|
459
|
+
window: zod_1.z.string().optional().describe('Capture a specific window by name substring'),
|
|
460
|
+
x: zod_1.z.number().optional(), y: zod_1.z.number().optional(),
|
|
461
|
+
width: zod_1.z.number().optional(), height: zod_1.z.number().optional(),
|
|
462
|
+
}, async ({ mode, resolution, window: windowName, x, y, width, height }) => {
|
|
463
|
+
try {
|
|
464
|
+
let res;
|
|
465
|
+
if (mode === 'region' && x !== undefined && y !== undefined && width && height) {
|
|
466
|
+
res = await client.captureRegion(x, y, width, height, projectDir);
|
|
467
|
+
}
|
|
468
|
+
else {
|
|
469
|
+
res = await client.captureFullscreenImage({ resolution, window: windowName, projectDir });
|
|
470
|
+
}
|
|
471
|
+
const d = res.data;
|
|
472
|
+
const content = [
|
|
473
|
+
{ type: 'text', text: `Capture #${d.captureId} (${d.width}x${d.height})` },
|
|
474
|
+
];
|
|
475
|
+
if (d.imageBase64) {
|
|
476
|
+
content.push({ type: 'image', data: d.imageBase64, mimeType: ('mimeType' in d ? d.mimeType : null) || 'image/png' });
|
|
477
|
+
}
|
|
478
|
+
return { content };
|
|
479
|
+
}
|
|
480
|
+
catch (err) {
|
|
481
|
+
return { content: [{ type: 'text', text: err instanceof Error ? err.message : String(err) }], isError: true };
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
// ── Tool: superbased_gallery_image ──
|
|
485
|
+
server.tool('superbased_gallery_image', {
|
|
486
|
+
captureId: zod_1.z.number().describe('Gallery capture ID'),
|
|
487
|
+
resolution: zod_1.z.enum(['full', 'high', 'half', 'quarter', 'thumbnail']).default('half').describe('Image resolution'),
|
|
488
|
+
}, async ({ captureId, resolution }) => {
|
|
489
|
+
try {
|
|
490
|
+
const res = await client.getCaptureImage(captureId, resolution);
|
|
491
|
+
const content = [
|
|
492
|
+
{ type: 'text', text: `Gallery capture #${captureId}` },
|
|
493
|
+
];
|
|
494
|
+
if (res.data.imageBase64) {
|
|
495
|
+
content.push({ type: 'image', data: res.data.imageBase64, mimeType: res.data.mimeType || 'image/png' });
|
|
496
|
+
}
|
|
497
|
+
return { content };
|
|
498
|
+
}
|
|
499
|
+
catch (err) {
|
|
500
|
+
return { content: [{ type: 'text', text: err instanceof Error ? err.message : String(err) }], isError: true };
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
// ── Tool: superbased_diff ──
|
|
504
|
+
server.tool('superbased_diff', {
|
|
505
|
+
baselineSessionId: zod_1.z.string().describe('Baseline recording session ID'),
|
|
506
|
+
currentSessionId: zod_1.z.string().describe('Current recording session ID'),
|
|
507
|
+
}, async ({ baselineSessionId, currentSessionId }) => {
|
|
508
|
+
try {
|
|
509
|
+
const res = await client.diffSessions(baselineSessionId, currentSessionId);
|
|
510
|
+
return { content: [{ type: 'text', text: formatResponse(res.data) }] };
|
|
511
|
+
}
|
|
512
|
+
catch (err) {
|
|
513
|
+
return { content: [{ type: 'text', text: err instanceof Error ? err.message : String(err) }], isError: true };
|
|
514
|
+
}
|
|
515
|
+
});
|
|
516
|
+
// ── Tool: superbased_health ──
|
|
517
|
+
server.tool('superbased_health', {}, async () => {
|
|
518
|
+
try {
|
|
519
|
+
const res = await client.health();
|
|
520
|
+
return { content: [{ type: 'text', text: formatResponse(res.data) }] };
|
|
521
|
+
}
|
|
522
|
+
catch (err) {
|
|
523
|
+
return { content: [{ type: 'text', text: err instanceof Error ? err.message : String(err) }], isError: true };
|
|
524
|
+
}
|
|
525
|
+
});
|
|
526
|
+
// ── Tool: superbased_redact ──
|
|
527
|
+
server.tool('superbased_redact', {
|
|
528
|
+
captureId: zod_1.z.number().optional().describe('Capture to redact'),
|
|
529
|
+
screenshotPath: zod_1.z.string().optional().describe('Path to image file'),
|
|
530
|
+
secrets: zod_1.z.boolean().default(true).describe('Redact API keys, tokens, passwords'),
|
|
531
|
+
pii: zod_1.z.boolean().default(false).describe('Redact emails, phone numbers, names'),
|
|
532
|
+
}, async ({ captureId, screenshotPath, secrets, pii }) => {
|
|
533
|
+
try {
|
|
534
|
+
const res = await client.redact({ captureId, screenshotPath, secrets, pii });
|
|
535
|
+
const content = [
|
|
536
|
+
{ type: 'text', text: `Redacted ${res.data.regionsFound} sensitive region(s)` },
|
|
537
|
+
];
|
|
538
|
+
if (res.data.imageBase64) {
|
|
539
|
+
content.push({ type: 'image', data: res.data.imageBase64, mimeType: 'image/png' });
|
|
540
|
+
}
|
|
541
|
+
return { content };
|
|
542
|
+
}
|
|
543
|
+
catch (err) {
|
|
544
|
+
return { content: [{ type: 'text', text: err instanceof Error ? err.message : String(err) }], isError: true };
|
|
545
|
+
}
|
|
546
|
+
});
|
|
547
|
+
// ── Tool: superbased_auth ──
|
|
548
|
+
server.tool('superbased_auth', {
|
|
549
|
+
action: zod_1.z.enum(['status']).default('status').describe('Auth action (status)'),
|
|
550
|
+
}, async () => {
|
|
551
|
+
try {
|
|
552
|
+
const res = await client.authStatus();
|
|
553
|
+
return { content: [{ type: 'text', text: formatResponse(res.data) }] };
|
|
554
|
+
}
|
|
555
|
+
catch (err) {
|
|
556
|
+
return { content: [{ type: 'text', text: err instanceof Error ? err.message : String(err) }], isError: true };
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
// ── Tool: superbased_license ──
|
|
560
|
+
server.tool('superbased_license', {}, async () => {
|
|
561
|
+
try {
|
|
562
|
+
const res = await client.licenseInfo();
|
|
563
|
+
return { content: [{ type: 'text', text: formatResponse(res.data) }] };
|
|
564
|
+
}
|
|
565
|
+
catch (err) {
|
|
566
|
+
return { content: [{ type: 'text', text: err instanceof Error ? err.message : String(err) }], isError: true };
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
// ── Tool: superbased_transcribe ──
|
|
570
|
+
server.tool('superbased_transcribe', {
|
|
571
|
+
audioPath: zod_1.z.string().optional().describe('Path to audio file (wav, mp3, webm, etc.)'),
|
|
572
|
+
audioBase64: zod_1.z.string().optional().describe('Base64-encoded audio data'),
|
|
573
|
+
language: zod_1.z.string().optional().describe('BCP 47 language code (e.g. en-US)'),
|
|
574
|
+
}, async ({ audioPath, audioBase64, language }) => {
|
|
575
|
+
try {
|
|
576
|
+
const res = await client.transcribe({ audioPath, audioBase64, language });
|
|
577
|
+
return { content: [{ type: 'text', text: res.data.text }] };
|
|
578
|
+
}
|
|
579
|
+
catch (err) {
|
|
580
|
+
return { content: [{ type: 'text', text: err instanceof Error ? err.message : String(err) }], isError: true };
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
// ── Tool: superbased_ai_usage ──
|
|
584
|
+
server.tool('superbased_ai_usage', {}, async () => {
|
|
585
|
+
try {
|
|
586
|
+
const res = await client.aiUsage();
|
|
587
|
+
return { content: [{ type: 'text', text: formatResponse(res.data) }] };
|
|
588
|
+
}
|
|
589
|
+
catch (err) {
|
|
590
|
+
return { content: [{ type: 'text', text: err instanceof Error ? err.message : String(err) }], isError: true };
|
|
591
|
+
}
|
|
592
|
+
});
|
|
593
|
+
// ── Tool: superbased_window_list ──
|
|
594
|
+
server.tool('superbased_window_list', {}, async () => {
|
|
595
|
+
try {
|
|
596
|
+
const res = await client.listWindows();
|
|
597
|
+
return { content: [{ type: 'text', text: formatResponse(res.data) }] };
|
|
598
|
+
}
|
|
599
|
+
catch (err) {
|
|
600
|
+
return { content: [{ type: 'text', text: err instanceof Error ? err.message : String(err) }], isError: true };
|
|
601
|
+
}
|
|
602
|
+
});
|
|
603
|
+
// ── Tool: superbased_dictation_history ──
|
|
604
|
+
server.tool('superbased_dictation_history', {
|
|
605
|
+
limit: zod_1.z.number().default(20).describe('Max entries to return'),
|
|
606
|
+
}, async ({ limit }) => {
|
|
607
|
+
try {
|
|
608
|
+
const res = await client.dictationHistory(limit);
|
|
609
|
+
return { content: [{ type: 'text', text: formatResponse(res.data) }] };
|
|
610
|
+
}
|
|
611
|
+
catch (err) {
|
|
612
|
+
return { content: [{ type: 'text', text: err instanceof Error ? err.message : String(err) }], isError: true };
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
// ── Tool: superbased_describe_frames ──
|
|
616
|
+
server.tool('superbased_describe_frames', {
|
|
617
|
+
sessionId: zod_1.z.string().describe('Recording session ID'),
|
|
618
|
+
limit: zod_1.z.number().default(20).describe('Max frames to describe'),
|
|
619
|
+
}, async ({ sessionId, limit }) => {
|
|
620
|
+
try {
|
|
621
|
+
const res = await client.describeFrames(sessionId, limit);
|
|
622
|
+
return { content: [{ type: 'text', text: formatResponse(res.data) }] };
|
|
623
|
+
}
|
|
624
|
+
catch (err) {
|
|
625
|
+
return { content: [{ type: 'text', text: err instanceof Error ? err.message : String(err) }], isError: true };
|
|
626
|
+
}
|
|
627
|
+
});
|
|
628
|
+
// ── Tool: superbased_narrate ──
|
|
629
|
+
server.tool('superbased_narrate', {
|
|
630
|
+
sessionId: zod_1.z.string().describe('Recording session ID'),
|
|
631
|
+
descriptions: zod_1.z.array(zod_1.z.object({
|
|
632
|
+
frameNumber: zod_1.z.number(),
|
|
633
|
+
description: zod_1.z.string(),
|
|
634
|
+
})).describe('Frame descriptions (from superbased_describe_frames)'),
|
|
635
|
+
}, async ({ sessionId, descriptions }) => {
|
|
636
|
+
try {
|
|
637
|
+
const res = await client.narrate(sessionId, descriptions);
|
|
638
|
+
return { content: [{ type: 'text', text: res.data.narration }] };
|
|
639
|
+
}
|
|
640
|
+
catch (err) {
|
|
641
|
+
return { content: [{ type: 'text', text: err instanceof Error ? err.message : String(err) }], isError: true };
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
// ── Tool: superbased_baseline ──
|
|
645
|
+
server.tool('superbased_baseline', {
|
|
646
|
+
action: zod_1.z.enum(['set', 'get', 'history']).describe('Baseline action'),
|
|
647
|
+
workflowName: zod_1.z.string().describe('Workflow name (e.g. "checkout-flow")'),
|
|
648
|
+
sessionId: zod_1.z.string().optional().describe('Session ID (required for set)'),
|
|
649
|
+
}, async ({ action, workflowName, sessionId }) => {
|
|
650
|
+
try {
|
|
651
|
+
const res = await client.baseline(action, workflowName, sessionId);
|
|
652
|
+
return { content: [{ type: 'text', text: formatResponse(res.data) }] };
|
|
653
|
+
}
|
|
654
|
+
catch (err) {
|
|
655
|
+
return { content: [{ type: 'text', text: err instanceof Error ? err.message : String(err) }], isError: true };
|
|
656
|
+
}
|
|
657
|
+
});
|
|
658
|
+
// ── Tool: superbased_dictate ──
|
|
659
|
+
server.tool('superbased_dictate', {
|
|
660
|
+
audioPath: zod_1.z.string().optional().describe('Path to audio file to transcribe with text cleanup'),
|
|
661
|
+
audioBase64: zod_1.z.string().optional().describe('Base64-encoded audio data'),
|
|
662
|
+
mic: zod_1.z.boolean().optional().describe('Record from microphone (requires SoX installed)'),
|
|
663
|
+
duration: zod_1.z.number().optional().describe('Mic recording duration in seconds (default 10)'),
|
|
664
|
+
language: zod_1.z.string().optional().describe('BCP 47 language code'),
|
|
665
|
+
cleanup: zod_1.z.boolean().default(true).describe('Apply filler word removal and deduplication'),
|
|
666
|
+
}, async ({ audioPath, audioBase64, mic, duration, language, cleanup }) => {
|
|
667
|
+
try {
|
|
668
|
+
if (mic) {
|
|
669
|
+
// Live mic recording
|
|
670
|
+
const res = await client.dictateMic(duration || 10, language, cleanup);
|
|
671
|
+
return { content: [{ type: 'text', text: res.data.text }] };
|
|
672
|
+
}
|
|
673
|
+
const res = await client.dictate({ audioPath, audioBase64, language, cleanup });
|
|
674
|
+
return { content: [{ type: 'text', text: res.data.text }] };
|
|
675
|
+
}
|
|
676
|
+
catch (err) {
|
|
677
|
+
return { content: [{ type: 'text', text: err instanceof Error ? err.message : String(err) }], isError: true };
|
|
678
|
+
}
|
|
679
|
+
});
|
|
680
|
+
// ── Tool: superbased_annotate ──
|
|
681
|
+
server.tool('superbased_annotate', {
|
|
682
|
+
captureId: zod_1.z.number().describe('Capture to annotate'),
|
|
683
|
+
annotations: zod_1.z.array(zod_1.z.object({
|
|
684
|
+
type: zod_1.z.enum(['rectangle', 'highlight', 'blur', 'text', 'arrow']),
|
|
685
|
+
x: zod_1.z.number(), y: zod_1.z.number(),
|
|
686
|
+
width: zod_1.z.number().optional(), height: zod_1.z.number().optional(),
|
|
687
|
+
text: zod_1.z.string().optional(), color: zod_1.z.string().optional(),
|
|
688
|
+
fontSize: zod_1.z.number().optional(),
|
|
689
|
+
toX: zod_1.z.number().optional(), toY: zod_1.z.number().optional(),
|
|
690
|
+
})).describe('Annotations to add (rectangles, highlights, blur, text labels, arrows)'),
|
|
691
|
+
save: zod_1.z.boolean().default(false).describe('Save annotated image over the original'),
|
|
692
|
+
}, async ({ captureId, annotations, save }) => {
|
|
693
|
+
try {
|
|
694
|
+
const res = await client.annotate(captureId, annotations, save);
|
|
695
|
+
const content = [
|
|
696
|
+
{ type: 'text', text: `Applied ${res.data.annotationsApplied} annotation(s)${res.data.saved ? ' (saved)' : ''}` },
|
|
697
|
+
];
|
|
698
|
+
if (res.data.imageBase64) {
|
|
699
|
+
content.push({ type: 'image', data: res.data.imageBase64, mimeType: 'image/png' });
|
|
700
|
+
}
|
|
701
|
+
return { content };
|
|
702
|
+
}
|
|
703
|
+
catch (err) {
|
|
704
|
+
return { content: [{ type: 'text', text: err instanceof Error ? err.message : String(err) }], isError: true };
|
|
705
|
+
}
|
|
706
|
+
});
|
|
707
|
+
// ── Tool: superbased_clipboard ──
|
|
708
|
+
server.tool('superbased_clipboard', {
|
|
709
|
+
action: zod_1.z.enum(['read', 'write', 'readImage']).describe('Clipboard action'),
|
|
710
|
+
text: zod_1.z.string().optional().describe('Text to write (for write action)'),
|
|
711
|
+
}, async ({ action, text }) => {
|
|
712
|
+
try {
|
|
713
|
+
const res = await client.clipboard(action, text);
|
|
714
|
+
const d = res.data;
|
|
715
|
+
if (action === 'readImage' && d.imageBase64) {
|
|
716
|
+
return { content: [
|
|
717
|
+
{ type: 'text', text: 'Clipboard image:' },
|
|
718
|
+
{ type: 'image', data: d.imageBase64, mimeType: 'image/png' },
|
|
719
|
+
] };
|
|
720
|
+
}
|
|
721
|
+
return { content: [{ type: 'text', text: formatResponse(res.data) }] };
|
|
722
|
+
}
|
|
723
|
+
catch (err) {
|
|
724
|
+
return { content: [{ type: 'text', text: err instanceof Error ? err.message : String(err) }], isError: true };
|
|
725
|
+
}
|
|
726
|
+
});
|
|
727
|
+
// ── Resources ──
|
|
728
|
+
server.resource('superbased-status', 'superbased://status', async () => {
|
|
729
|
+
try {
|
|
730
|
+
const res = await client.health();
|
|
731
|
+
return { contents: [{ uri: 'superbased://status', mimeType: 'application/json', text: formatResponse(res.data) }] };
|
|
732
|
+
}
|
|
733
|
+
catch {
|
|
734
|
+
return { contents: [{ uri: 'superbased://status', mimeType: 'text/plain', text: 'SuperBased is not running' }] };
|
|
735
|
+
}
|
|
736
|
+
});
|
|
737
|
+
server.resource('superbased-settings', 'superbased://settings', async () => {
|
|
738
|
+
try {
|
|
739
|
+
const res = await client.getSettings();
|
|
740
|
+
return { contents: [{ uri: 'superbased://settings', mimeType: 'application/json', text: formatResponse(res.data) }] };
|
|
741
|
+
}
|
|
742
|
+
catch {
|
|
743
|
+
return { contents: [{ uri: 'superbased://settings', mimeType: 'text/plain', text: 'Cannot read settings — SuperBased may not be running' }] };
|
|
744
|
+
}
|
|
745
|
+
});
|
|
746
|
+
server.resource('superbased-presets', 'superbased://presets', async () => {
|
|
747
|
+
try {
|
|
748
|
+
const res = await client.getPresets();
|
|
749
|
+
return { contents: [{ uri: 'superbased://presets', mimeType: 'application/json', text: formatResponse(res.data) }] };
|
|
750
|
+
}
|
|
751
|
+
catch {
|
|
752
|
+
return { contents: [{ uri: 'superbased://presets', mimeType: 'text/plain', text: 'Cannot read presets — SuperBased may not be running' }] };
|
|
753
|
+
}
|
|
754
|
+
});
|
|
755
|
+
server.resource('superbased-recent-captures', 'superbased://captures/recent', async () => {
|
|
756
|
+
try {
|
|
757
|
+
const res = await client.getCaptures(10);
|
|
758
|
+
return { contents: [{ uri: 'superbased://captures/recent', mimeType: 'application/json', text: formatResponse(res.data) }] };
|
|
759
|
+
}
|
|
760
|
+
catch {
|
|
761
|
+
return { contents: [{ uri: 'superbased://captures/recent', mimeType: 'text/plain', text: 'Cannot read captures — SuperBased may not be running' }] };
|
|
762
|
+
}
|
|
763
|
+
});
|
|
764
|
+
// ── Expanded Resources ──
|
|
765
|
+
server.resource('superbased-auth', 'superbased://auth', async () => {
|
|
766
|
+
try {
|
|
767
|
+
const res = await client.authStatus();
|
|
768
|
+
return { contents: [{ uri: 'superbased://auth', mimeType: 'application/json', text: formatResponse(res.data) }] };
|
|
769
|
+
}
|
|
770
|
+
catch {
|
|
771
|
+
return { contents: [{ uri: 'superbased://auth', mimeType: 'text/plain', text: 'Cannot read auth state' }] };
|
|
772
|
+
}
|
|
773
|
+
});
|
|
774
|
+
server.resource('superbased-license', 'superbased://license', async () => {
|
|
775
|
+
try {
|
|
776
|
+
const res = await client.licenseInfo();
|
|
777
|
+
return { contents: [{ uri: 'superbased://license', mimeType: 'application/json', text: formatResponse(res.data) }] };
|
|
778
|
+
}
|
|
779
|
+
catch {
|
|
780
|
+
return { contents: [{ uri: 'superbased://license', mimeType: 'text/plain', text: 'Cannot read license state' }] };
|
|
781
|
+
}
|
|
782
|
+
});
|
|
783
|
+
server.resource('superbased-recording', 'superbased://recording', async () => {
|
|
784
|
+
try {
|
|
785
|
+
const res = await client.recordingStatus();
|
|
786
|
+
return { contents: [{ uri: 'superbased://recording', mimeType: 'application/json', text: formatResponse(res.data) }] };
|
|
787
|
+
}
|
|
788
|
+
catch {
|
|
789
|
+
return { contents: [{ uri: 'superbased://recording', mimeType: 'text/plain', text: 'Cannot read recording state' }] };
|
|
790
|
+
}
|
|
791
|
+
});
|
|
792
|
+
server.resource('superbased-analytics', 'superbased://analytics/summary', async () => {
|
|
793
|
+
try {
|
|
794
|
+
const res = await client.analyticsSummary();
|
|
795
|
+
return { contents: [{ uri: 'superbased://analytics/summary', mimeType: 'application/json', text: formatResponse(res.data) }] };
|
|
796
|
+
}
|
|
797
|
+
catch {
|
|
798
|
+
return { contents: [{ uri: 'superbased://analytics/summary', mimeType: 'text/plain', text: 'Cannot read analytics' }] };
|
|
799
|
+
}
|
|
800
|
+
});
|
|
801
|
+
server.resource('superbased-ai-usage', 'superbased://ai/usage', async () => {
|
|
802
|
+
try {
|
|
803
|
+
const res = await client.aiUsage();
|
|
804
|
+
return { contents: [{ uri: 'superbased://ai/usage', mimeType: 'application/json', text: formatResponse(res.data) }] };
|
|
805
|
+
}
|
|
806
|
+
catch {
|
|
807
|
+
return { contents: [{ uri: 'superbased://ai/usage', mimeType: 'text/plain', text: 'Cannot read AI usage' }] };
|
|
808
|
+
}
|
|
809
|
+
});
|
|
810
|
+
// ── Connect ──
|
|
811
|
+
const transport = new stdio_js_1.StdioServerTransport();
|
|
812
|
+
await server.connect(transport);
|
|
813
|
+
}
|
|
814
|
+
// Auto-run when executed directly (node index.js)
|
|
815
|
+
async function main() {
|
|
816
|
+
const { port, projectDir } = parseArgs();
|
|
817
|
+
await startMcpServer(port, projectDir);
|
|
818
|
+
}
|
|
819
|
+
if (require.main === module) {
|
|
820
|
+
main().catch((err) => {
|
|
821
|
+
process.stderr.write(`MCP server error: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
822
|
+
process.exit(1);
|
|
823
|
+
});
|
|
824
|
+
}
|