@metamask/client-mcp-core 0.1.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/CHANGELOG.md +17 -0
- package/LICENSE +6 -0
- package/LICENSE.APACHE2 +201 -0
- package/LICENSE.MIT +21 -0
- package/README.md +1459 -0
- package/dist/capabilities/context.cjs +34 -0
- package/dist/capabilities/context.cjs.map +1 -0
- package/dist/capabilities/context.d.cts +101 -0
- package/dist/capabilities/context.d.cts.map +1 -0
- package/dist/capabilities/context.d.mts +101 -0
- package/dist/capabilities/context.d.mts.map +1 -0
- package/dist/capabilities/context.mjs +29 -0
- package/dist/capabilities/context.mjs.map +1 -0
- package/dist/capabilities/index.cjs +18 -0
- package/dist/capabilities/index.cjs.map +1 -0
- package/dist/capabilities/index.d.cts +3 -0
- package/dist/capabilities/index.d.cts.map +1 -0
- package/dist/capabilities/index.d.mts +3 -0
- package/dist/capabilities/index.d.mts.map +1 -0
- package/dist/capabilities/index.mjs +2 -0
- package/dist/capabilities/index.mjs.map +1 -0
- package/dist/capabilities/types.cjs +3 -0
- package/dist/capabilities/types.cjs.map +1 -0
- package/dist/capabilities/types.d.cts +152 -0
- package/dist/capabilities/types.d.cts.map +1 -0
- package/dist/capabilities/types.d.mts +152 -0
- package/dist/capabilities/types.d.mts.map +1 -0
- package/dist/capabilities/types.mjs +2 -0
- package/dist/capabilities/types.mjs.map +1 -0
- package/dist/index.cjs +59 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +33 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +33 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +43 -0
- package/dist/index.mjs.map +1 -0
- package/dist/launcher/console-error-buffer.cjs +72 -0
- package/dist/launcher/console-error-buffer.cjs.map +1 -0
- package/dist/launcher/console-error-buffer.d.cts +43 -0
- package/dist/launcher/console-error-buffer.d.cts.map +1 -0
- package/dist/launcher/console-error-buffer.d.mts +43 -0
- package/dist/launcher/console-error-buffer.d.mts.map +1 -0
- package/dist/launcher/console-error-buffer.mjs +68 -0
- package/dist/launcher/console-error-buffer.mjs.map +1 -0
- package/dist/launcher/extension-id-resolver.cjs +177 -0
- package/dist/launcher/extension-id-resolver.cjs.map +1 -0
- package/dist/launcher/extension-id-resolver.d.cts +32 -0
- package/dist/launcher/extension-id-resolver.d.cts.map +1 -0
- package/dist/launcher/extension-id-resolver.d.mts +32 -0
- package/dist/launcher/extension-id-resolver.d.mts.map +1 -0
- package/dist/launcher/extension-id-resolver.mjs +173 -0
- package/dist/launcher/extension-id-resolver.mjs.map +1 -0
- package/dist/launcher/extension-readiness.cjs +50 -0
- package/dist/launcher/extension-readiness.cjs.map +1 -0
- package/dist/launcher/extension-readiness.d.cts +37 -0
- package/dist/launcher/extension-readiness.d.cts.map +1 -0
- package/dist/launcher/extension-readiness.d.mts +37 -0
- package/dist/launcher/extension-readiness.d.mts.map +1 -0
- package/dist/launcher/extension-readiness.mjs +43 -0
- package/dist/launcher/extension-readiness.mjs.map +1 -0
- package/dist/launcher/index.cjs +21 -0
- package/dist/launcher/index.cjs.map +1 -0
- package/dist/launcher/index.d.cts +5 -0
- package/dist/launcher/index.d.cts.map +1 -0
- package/dist/launcher/index.d.mts +5 -0
- package/dist/launcher/index.d.mts.map +1 -0
- package/dist/launcher/index.mjs +5 -0
- package/dist/launcher/index.mjs.map +1 -0
- package/dist/launcher/retry.cjs +35 -0
- package/dist/launcher/retry.cjs.map +1 -0
- package/dist/launcher/retry.d.cts +20 -0
- package/dist/launcher/retry.d.cts.map +1 -0
- package/dist/launcher/retry.d.mts +20 -0
- package/dist/launcher/retry.d.mts.map +1 -0
- package/dist/launcher/retry.mjs +31 -0
- package/dist/launcher/retry.mjs.map +1 -0
- package/dist/mcp-server/constants.cjs +22 -0
- package/dist/mcp-server/constants.cjs.map +1 -0
- package/dist/mcp-server/constants.d.cts +13 -0
- package/dist/mcp-server/constants.d.cts.map +1 -0
- package/dist/mcp-server/constants.d.mts +13 -0
- package/dist/mcp-server/constants.d.mts.map +1 -0
- package/dist/mcp-server/constants.mjs +19 -0
- package/dist/mcp-server/constants.mjs.map +1 -0
- package/dist/mcp-server/discovery.cjs +299 -0
- package/dist/mcp-server/discovery.cjs.map +1 -0
- package/dist/mcp-server/discovery.d.cts +56 -0
- package/dist/mcp-server/discovery.d.cts.map +1 -0
- package/dist/mcp-server/discovery.d.mts +56 -0
- package/dist/mcp-server/discovery.d.mts.map +1 -0
- package/dist/mcp-server/discovery.mjs +292 -0
- package/dist/mcp-server/discovery.mjs.map +1 -0
- package/dist/mcp-server/knowledge-store.cjs +1196 -0
- package/dist/mcp-server/knowledge-store.cjs.map +1 -0
- package/dist/mcp-server/knowledge-store.d.cts +249 -0
- package/dist/mcp-server/knowledge-store.d.cts.map +1 -0
- package/dist/mcp-server/knowledge-store.d.mts +249 -0
- package/dist/mcp-server/knowledge-store.d.mts.map +1 -0
- package/dist/mcp-server/knowledge-store.mjs +1154 -0
- package/dist/mcp-server/knowledge-store.mjs.map +1 -0
- package/dist/mcp-server/schemas.cjs +433 -0
- package/dist/mcp-server/schemas.cjs.map +1 -0
- package/dist/mcp-server/schemas.d.cts +557 -0
- package/dist/mcp-server/schemas.d.cts.map +1 -0
- package/dist/mcp-server/schemas.d.mts +557 -0
- package/dist/mcp-server/schemas.d.mts.map +1 -0
- package/dist/mcp-server/schemas.mjs +430 -0
- package/dist/mcp-server/schemas.mjs.map +1 -0
- package/dist/mcp-server/server.cjs +161 -0
- package/dist/mcp-server/server.cjs.map +1 -0
- package/dist/mcp-server/server.d.cts +24 -0
- package/dist/mcp-server/server.d.cts.map +1 -0
- package/dist/mcp-server/server.d.mts +24 -0
- package/dist/mcp-server/server.d.mts.map +1 -0
- package/dist/mcp-server/server.mjs +158 -0
- package/dist/mcp-server/server.mjs.map +1 -0
- package/dist/mcp-server/session-manager.cjs +53 -0
- package/dist/mcp-server/session-manager.cjs.map +1 -0
- package/dist/mcp-server/session-manager.d.cts +240 -0
- package/dist/mcp-server/session-manager.d.cts.map +1 -0
- package/dist/mcp-server/session-manager.d.mts +240 -0
- package/dist/mcp-server/session-manager.d.mts.map +1 -0
- package/dist/mcp-server/session-manager.mjs +48 -0
- package/dist/mcp-server/session-manager.mjs.map +1 -0
- package/dist/mcp-server/test-utils/flush-promises.cjs +10 -0
- package/dist/mcp-server/test-utils/flush-promises.cjs.map +1 -0
- package/dist/mcp-server/test-utils/flush-promises.d.cts +2 -0
- package/dist/mcp-server/test-utils/flush-promises.d.cts.map +1 -0
- package/dist/mcp-server/test-utils/flush-promises.d.mts +2 -0
- package/dist/mcp-server/test-utils/flush-promises.d.mts.map +1 -0
- package/dist/mcp-server/test-utils/flush-promises.mjs +7 -0
- package/dist/mcp-server/test-utils/flush-promises.mjs.map +1 -0
- package/dist/mcp-server/test-utils/index.cjs +13 -0
- package/dist/mcp-server/test-utils/index.cjs.map +1 -0
- package/dist/mcp-server/test-utils/index.d.cts +4 -0
- package/dist/mcp-server/test-utils/index.d.cts.map +1 -0
- package/dist/mcp-server/test-utils/index.d.mts +4 -0
- package/dist/mcp-server/test-utils/index.d.mts.map +1 -0
- package/dist/mcp-server/test-utils/index.mjs +4 -0
- package/dist/mcp-server/test-utils/index.mjs.map +1 -0
- package/dist/mcp-server/test-utils/mock-factories.cjs +129 -0
- package/dist/mcp-server/test-utils/mock-factories.cjs.map +1 -0
- package/dist/mcp-server/test-utils/mock-factories.d.cts +89 -0
- package/dist/mcp-server/test-utils/mock-factories.d.cts.map +1 -0
- package/dist/mcp-server/test-utils/mock-factories.d.mts +89 -0
- package/dist/mcp-server/test-utils/mock-factories.d.mts.map +1 -0
- package/dist/mcp-server/test-utils/mock-factories.mjs +125 -0
- package/dist/mcp-server/test-utils/mock-factories.mjs.map +1 -0
- package/dist/mcp-server/test-utils/mock-playwright.cjs +205 -0
- package/dist/mcp-server/test-utils/mock-playwright.cjs.map +1 -0
- package/dist/mcp-server/test-utils/mock-playwright.d.cts +69 -0
- package/dist/mcp-server/test-utils/mock-playwright.d.cts.map +1 -0
- package/dist/mcp-server/test-utils/mock-playwright.d.mts +69 -0
- package/dist/mcp-server/test-utils/mock-playwright.d.mts.map +1 -0
- package/dist/mcp-server/test-utils/mock-playwright.mjs +200 -0
- package/dist/mcp-server/test-utils/mock-playwright.mjs.map +1 -0
- package/dist/mcp-server/tokenization.cjs +117 -0
- package/dist/mcp-server/tokenization.cjs.map +1 -0
- package/dist/mcp-server/tokenization.d.cts +22 -0
- package/dist/mcp-server/tokenization.d.cts.map +1 -0
- package/dist/mcp-server/tokenization.d.mts +22 -0
- package/dist/mcp-server/tokenization.d.mts.map +1 -0
- package/dist/mcp-server/tokenization.mjs +112 -0
- package/dist/mcp-server/tokenization.mjs.map +1 -0
- package/dist/mcp-server/tools/batch.cjs +199 -0
- package/dist/mcp-server/tools/batch.cjs.map +1 -0
- package/dist/mcp-server/tools/batch.d.cts +81 -0
- package/dist/mcp-server/tools/batch.d.cts.map +1 -0
- package/dist/mcp-server/tools/batch.d.mts +81 -0
- package/dist/mcp-server/tools/batch.d.mts.map +1 -0
- package/dist/mcp-server/tools/batch.mjs +191 -0
- package/dist/mcp-server/tools/batch.mjs.map +1 -0
- package/dist/mcp-server/tools/build.cjs +47 -0
- package/dist/mcp-server/tools/build.cjs.map +1 -0
- package/dist/mcp-server/tools/build.d.cts +22 -0
- package/dist/mcp-server/tools/build.d.cts.map +1 -0
- package/dist/mcp-server/tools/build.d.mts +22 -0
- package/dist/mcp-server/tools/build.d.mts.map +1 -0
- package/dist/mcp-server/tools/build.mjs +44 -0
- package/dist/mcp-server/tools/build.mjs.map +1 -0
- package/dist/mcp-server/tools/cleanup.cjs +20 -0
- package/dist/mcp-server/tools/cleanup.cjs.map +1 -0
- package/dist/mcp-server/tools/cleanup.d.cts +10 -0
- package/dist/mcp-server/tools/cleanup.d.cts.map +1 -0
- package/dist/mcp-server/tools/cleanup.d.mts +10 -0
- package/dist/mcp-server/tools/cleanup.d.mts.map +1 -0
- package/dist/mcp-server/tools/cleanup.mjs +17 -0
- package/dist/mcp-server/tools/cleanup.mjs.map +1 -0
- package/dist/mcp-server/tools/clipboard.cjs +100 -0
- package/dist/mcp-server/tools/clipboard.cjs.map +1 -0
- package/dist/mcp-server/tools/clipboard.d.cts +16 -0
- package/dist/mcp-server/tools/clipboard.d.cts.map +1 -0
- package/dist/mcp-server/tools/clipboard.d.mts +16 -0
- package/dist/mcp-server/tools/clipboard.d.mts.map +1 -0
- package/dist/mcp-server/tools/clipboard.mjs +97 -0
- package/dist/mcp-server/tools/clipboard.mjs.map +1 -0
- package/dist/mcp-server/tools/context.cjs +66 -0
- package/dist/mcp-server/tools/context.cjs.map +1 -0
- package/dist/mcp-server/tools/context.d.cts +35 -0
- package/dist/mcp-server/tools/context.d.cts.map +1 -0
- package/dist/mcp-server/tools/context.d.mts +35 -0
- package/dist/mcp-server/tools/context.d.mts.map +1 -0
- package/dist/mcp-server/tools/context.mjs +62 -0
- package/dist/mcp-server/tools/context.mjs.map +1 -0
- package/dist/mcp-server/tools/definitions.cjs +463 -0
- package/dist/mcp-server/tools/definitions.cjs.map +1 -0
- package/dist/mcp-server/tools/definitions.d.cts +97 -0
- package/dist/mcp-server/tools/definitions.d.cts.map +1 -0
- package/dist/mcp-server/tools/definitions.d.mts +97 -0
- package/dist/mcp-server/tools/definitions.d.mts.map +1 -0
- package/dist/mcp-server/tools/definitions.mjs +451 -0
- package/dist/mcp-server/tools/definitions.mjs.map +1 -0
- package/dist/mcp-server/tools/discovery-tools.cjs +162 -0
- package/dist/mcp-server/tools/discovery-tools.cjs.map +1 -0
- package/dist/mcp-server/tools/discovery-tools.d.cts +26 -0
- package/dist/mcp-server/tools/discovery-tools.d.cts.map +1 -0
- package/dist/mcp-server/tools/discovery-tools.d.mts +26 -0
- package/dist/mcp-server/tools/discovery-tools.d.mts.map +1 -0
- package/dist/mcp-server/tools/discovery-tools.mjs +157 -0
- package/dist/mcp-server/tools/discovery-tools.mjs.map +1 -0
- package/dist/mcp-server/tools/error-classification.cjs +296 -0
- package/dist/mcp-server/tools/error-classification.cjs.map +1 -0
- package/dist/mcp-server/tools/error-classification.d.cts +135 -0
- package/dist/mcp-server/tools/error-classification.d.cts.map +1 -0
- package/dist/mcp-server/tools/error-classification.d.mts +135 -0
- package/dist/mcp-server/tools/error-classification.d.mts.map +1 -0
- package/dist/mcp-server/tools/error-classification.mjs +281 -0
- package/dist/mcp-server/tools/error-classification.mjs.map +1 -0
- package/dist/mcp-server/tools/helpers.cjs +149 -0
- package/dist/mcp-server/tools/helpers.cjs.map +1 -0
- package/dist/mcp-server/tools/helpers.d.cts +149 -0
- package/dist/mcp-server/tools/helpers.d.cts.map +1 -0
- package/dist/mcp-server/tools/helpers.d.mts +149 -0
- package/dist/mcp-server/tools/helpers.d.mts.map +1 -0
- package/dist/mcp-server/tools/helpers.mjs +141 -0
- package/dist/mcp-server/tools/helpers.mjs.map +1 -0
- package/dist/mcp-server/tools/index.cjs +27 -0
- package/dist/mcp-server/tools/index.cjs.map +1 -0
- package/dist/mcp-server/tools/index.d.cts +11 -0
- package/dist/mcp-server/tools/index.d.cts.map +1 -0
- package/dist/mcp-server/tools/index.d.mts +11 -0
- package/dist/mcp-server/tools/index.d.mts.map +1 -0
- package/dist/mcp-server/tools/index.mjs +11 -0
- package/dist/mcp-server/tools/index.mjs.map +1 -0
- package/dist/mcp-server/tools/interaction.cjs +190 -0
- package/dist/mcp-server/tools/interaction.cjs.map +1 -0
- package/dist/mcp-server/tools/interaction.d.cts +26 -0
- package/dist/mcp-server/tools/interaction.d.cts.map +1 -0
- package/dist/mcp-server/tools/interaction.d.mts +26 -0
- package/dist/mcp-server/tools/interaction.d.mts.map +1 -0
- package/dist/mcp-server/tools/interaction.mjs +185 -0
- package/dist/mcp-server/tools/interaction.mjs.map +1 -0
- package/dist/mcp-server/tools/knowledge.cjs +120 -0
- package/dist/mcp-server/tools/knowledge.cjs.map +1 -0
- package/dist/mcp-server/tools/knowledge.d.cts +34 -0
- package/dist/mcp-server/tools/knowledge.d.cts.map +1 -0
- package/dist/mcp-server/tools/knowledge.d.mts +34 -0
- package/dist/mcp-server/tools/knowledge.d.mts.map +1 -0
- package/dist/mcp-server/tools/knowledge.mjs +114 -0
- package/dist/mcp-server/tools/knowledge.mjs.map +1 -0
- package/dist/mcp-server/tools/launch.cjs +51 -0
- package/dist/mcp-server/tools/launch.cjs.map +1 -0
- package/dist/mcp-server/tools/launch.d.cts +10 -0
- package/dist/mcp-server/tools/launch.d.cts.map +1 -0
- package/dist/mcp-server/tools/launch.d.mts +10 -0
- package/dist/mcp-server/tools/launch.d.mts.map +1 -0
- package/dist/mcp-server/tools/launch.mjs +48 -0
- package/dist/mcp-server/tools/launch.mjs.map +1 -0
- package/dist/mcp-server/tools/navigation.cjs +242 -0
- package/dist/mcp-server/tools/navigation.cjs.map +1 -0
- package/dist/mcp-server/tools/navigation.d.cts +34 -0
- package/dist/mcp-server/tools/navigation.d.cts.map +1 -0
- package/dist/mcp-server/tools/navigation.d.mts +34 -0
- package/dist/mcp-server/tools/navigation.d.mts.map +1 -0
- package/dist/mcp-server/tools/navigation.mjs +236 -0
- package/dist/mcp-server/tools/navigation.mjs.map +1 -0
- package/dist/mcp-server/tools/registry.cjs +10 -0
- package/dist/mcp-server/tools/registry.cjs.map +1 -0
- package/dist/mcp-server/tools/registry.d.cts +4 -0
- package/dist/mcp-server/tools/registry.d.cts.map +1 -0
- package/dist/mcp-server/tools/registry.d.mts +4 -0
- package/dist/mcp-server/tools/registry.d.mts.map +1 -0
- package/dist/mcp-server/tools/registry.mjs +4 -0
- package/dist/mcp-server/tools/registry.mjs.map +1 -0
- package/dist/mcp-server/tools/run-tool.cjs +140 -0
- package/dist/mcp-server/tools/run-tool.cjs.map +1 -0
- package/dist/mcp-server/tools/run-tool.d.cts +39 -0
- package/dist/mcp-server/tools/run-tool.d.cts.map +1 -0
- package/dist/mcp-server/tools/run-tool.d.mts +39 -0
- package/dist/mcp-server/tools/run-tool.d.mts.map +1 -0
- package/dist/mcp-server/tools/run-tool.mjs +137 -0
- package/dist/mcp-server/tools/run-tool.mjs.map +1 -0
- package/dist/mcp-server/tools/screenshot.cjs +55 -0
- package/dist/mcp-server/tools/screenshot.cjs.map +1 -0
- package/dist/mcp-server/tools/screenshot.d.cts +10 -0
- package/dist/mcp-server/tools/screenshot.d.cts.map +1 -0
- package/dist/mcp-server/tools/screenshot.d.mts +10 -0
- package/dist/mcp-server/tools/screenshot.d.mts.map +1 -0
- package/dist/mcp-server/tools/screenshot.mjs +52 -0
- package/dist/mcp-server/tools/screenshot.mjs.map +1 -0
- package/dist/mcp-server/tools/seeding.cjs +214 -0
- package/dist/mcp-server/tools/seeding.cjs.map +1 -0
- package/dist/mcp-server/tools/seeding.d.cts +38 -0
- package/dist/mcp-server/tools/seeding.d.cts.map +1 -0
- package/dist/mcp-server/tools/seeding.d.mts +38 -0
- package/dist/mcp-server/tools/seeding.d.mts.map +1 -0
- package/dist/mcp-server/tools/seeding.mjs +208 -0
- package/dist/mcp-server/tools/seeding.mjs.map +1 -0
- package/dist/mcp-server/tools/state.cjs +69 -0
- package/dist/mcp-server/tools/state.cjs.map +1 -0
- package/dist/mcp-server/tools/state.d.cts +19 -0
- package/dist/mcp-server/tools/state.d.cts.map +1 -0
- package/dist/mcp-server/tools/state.d.mts +19 -0
- package/dist/mcp-server/tools/state.d.mts.map +1 -0
- package/dist/mcp-server/tools/state.mjs +66 -0
- package/dist/mcp-server/tools/state.mjs.map +1 -0
- package/dist/mcp-server/types/discovery.cjs +24 -0
- package/dist/mcp-server/types/discovery.cjs.map +1 -0
- package/dist/mcp-server/types/discovery.d.cts +30 -0
- package/dist/mcp-server/types/discovery.d.cts.map +1 -0
- package/dist/mcp-server/types/discovery.d.mts +30 -0
- package/dist/mcp-server/types/discovery.d.mts.map +1 -0
- package/dist/mcp-server/types/discovery.mjs +21 -0
- package/dist/mcp-server/types/discovery.mjs.map +1 -0
- package/dist/mcp-server/types/errors.cjs +33 -0
- package/dist/mcp-server/types/errors.cjs.map +1 -0
- package/dist/mcp-server/types/errors.d.cts +31 -0
- package/dist/mcp-server/types/errors.d.cts.map +1 -0
- package/dist/mcp-server/types/errors.d.mts +31 -0
- package/dist/mcp-server/types/errors.d.mts.map +1 -0
- package/dist/mcp-server/types/errors.mjs +30 -0
- package/dist/mcp-server/types/errors.mjs.map +1 -0
- package/dist/mcp-server/types/index.cjs +21 -0
- package/dist/mcp-server/types/index.cjs.map +1 -0
- package/dist/mcp-server/types/index.d.cts +10 -0
- package/dist/mcp-server/types/index.d.cts.map +1 -0
- package/dist/mcp-server/types/index.d.mts +10 -0
- package/dist/mcp-server/types/index.d.mts.map +1 -0
- package/dist/mcp-server/types/index.mjs +5 -0
- package/dist/mcp-server/types/index.mjs.map +1 -0
- package/dist/mcp-server/types/knowledge.cjs +3 -0
- package/dist/mcp-server/types/knowledge.cjs.map +1 -0
- package/dist/mcp-server/types/knowledge.d.cts +116 -0
- package/dist/mcp-server/types/knowledge.d.cts.map +1 -0
- package/dist/mcp-server/types/knowledge.d.mts +116 -0
- package/dist/mcp-server/types/knowledge.d.mts.map +1 -0
- package/dist/mcp-server/types/knowledge.mjs +2 -0
- package/dist/mcp-server/types/knowledge.mjs.map +1 -0
- package/dist/mcp-server/types/responses.cjs +3 -0
- package/dist/mcp-server/types/responses.cjs.map +1 -0
- package/dist/mcp-server/types/responses.d.cts +22 -0
- package/dist/mcp-server/types/responses.d.cts.map +1 -0
- package/dist/mcp-server/types/responses.d.mts +22 -0
- package/dist/mcp-server/types/responses.d.mts.map +1 -0
- package/dist/mcp-server/types/responses.mjs +2 -0
- package/dist/mcp-server/types/responses.mjs.map +1 -0
- package/dist/mcp-server/types/seeding.cjs +34 -0
- package/dist/mcp-server/types/seeding.cjs.map +1 -0
- package/dist/mcp-server/types/seeding.d.cts +40 -0
- package/dist/mcp-server/types/seeding.d.cts.map +1 -0
- package/dist/mcp-server/types/seeding.d.mts +40 -0
- package/dist/mcp-server/types/seeding.d.mts.map +1 -0
- package/dist/mcp-server/types/seeding.mjs +31 -0
- package/dist/mcp-server/types/seeding.mjs.map +1 -0
- package/dist/mcp-server/types/session.cjs +3 -0
- package/dist/mcp-server/types/session.cjs.map +1 -0
- package/dist/mcp-server/types/session.d.cts +11 -0
- package/dist/mcp-server/types/session.d.cts.map +1 -0
- package/dist/mcp-server/types/session.d.mts +11 -0
- package/dist/mcp-server/types/session.d.mts.map +1 -0
- package/dist/mcp-server/types/session.mjs +2 -0
- package/dist/mcp-server/types/session.mjs.map +1 -0
- package/dist/mcp-server/types/step-record.cjs +20 -0
- package/dist/mcp-server/types/step-record.cjs.map +1 -0
- package/dist/mcp-server/types/step-record.d.cts +86 -0
- package/dist/mcp-server/types/step-record.d.cts.map +1 -0
- package/dist/mcp-server/types/step-record.d.mts +86 -0
- package/dist/mcp-server/types/step-record.d.mts.map +1 -0
- package/dist/mcp-server/types/step-record.mjs +17 -0
- package/dist/mcp-server/types/step-record.mjs.map +1 -0
- package/dist/mcp-server/types/tool-inputs.cjs +3 -0
- package/dist/mcp-server/types/tool-inputs.cjs.map +1 -0
- package/dist/mcp-server/types/tool-inputs.d.cts +118 -0
- package/dist/mcp-server/types/tool-inputs.d.cts.map +1 -0
- package/dist/mcp-server/types/tool-inputs.d.mts +118 -0
- package/dist/mcp-server/types/tool-inputs.d.mts.map +1 -0
- package/dist/mcp-server/types/tool-inputs.mjs +2 -0
- package/dist/mcp-server/types/tool-inputs.mjs.map +1 -0
- package/dist/mcp-server/types/tool-outputs.cjs +3 -0
- package/dist/mcp-server/types/tool-outputs.cjs.map +1 -0
- package/dist/mcp-server/types/tool-outputs.d.cts +121 -0
- package/dist/mcp-server/types/tool-outputs.d.cts.map +1 -0
- package/dist/mcp-server/types/tool-outputs.d.mts +121 -0
- package/dist/mcp-server/types/tool-outputs.d.mts.map +1 -0
- package/dist/mcp-server/types/tool-outputs.mjs +2 -0
- package/dist/mcp-server/types/tool-outputs.mjs.map +1 -0
- package/dist/mcp-server/utils/errors.cjs +14 -0
- package/dist/mcp-server/utils/errors.cjs.map +1 -0
- package/dist/mcp-server/utils/errors.d.cts +9 -0
- package/dist/mcp-server/utils/errors.d.cts.map +1 -0
- package/dist/mcp-server/utils/errors.d.mts +9 -0
- package/dist/mcp-server/utils/errors.d.mts.map +1 -0
- package/dist/mcp-server/utils/errors.mjs +11 -0
- package/dist/mcp-server/utils/errors.mjs.map +1 -0
- package/dist/mcp-server/utils/index.cjs +22 -0
- package/dist/mcp-server/utils/index.cjs.map +1 -0
- package/dist/mcp-server/utils/index.d.cts +8 -0
- package/dist/mcp-server/utils/index.d.cts.map +1 -0
- package/dist/mcp-server/utils/index.d.mts +8 -0
- package/dist/mcp-server/utils/index.d.mts.map +1 -0
- package/dist/mcp-server/utils/index.mjs +8 -0
- package/dist/mcp-server/utils/index.mjs.map +1 -0
- package/dist/mcp-server/utils/logger.cjs +25 -0
- package/dist/mcp-server/utils/logger.cjs.map +1 -0
- package/dist/mcp-server/utils/logger.d.cts +9 -0
- package/dist/mcp-server/utils/logger.d.cts.map +1 -0
- package/dist/mcp-server/utils/logger.d.mts +9 -0
- package/dist/mcp-server/utils/logger.d.mts.map +1 -0
- package/dist/mcp-server/utils/logger.mjs +22 -0
- package/dist/mcp-server/utils/logger.mjs.map +1 -0
- package/dist/mcp-server/utils/redaction.cjs +24 -0
- package/dist/mcp-server/utils/redaction.cjs.map +1 -0
- package/dist/mcp-server/utils/redaction.d.cts +9 -0
- package/dist/mcp-server/utils/redaction.d.cts.map +1 -0
- package/dist/mcp-server/utils/redaction.d.mts +9 -0
- package/dist/mcp-server/utils/redaction.d.mts.map +1 -0
- package/dist/mcp-server/utils/redaction.mjs +20 -0
- package/dist/mcp-server/utils/redaction.mjs.map +1 -0
- package/dist/mcp-server/utils/response.cjs +49 -0
- package/dist/mcp-server/utils/response.cjs.map +1 -0
- package/dist/mcp-server/utils/response.d.cts +22 -0
- package/dist/mcp-server/utils/response.d.cts.map +1 -0
- package/dist/mcp-server/utils/response.d.mts +22 -0
- package/dist/mcp-server/utils/response.d.mts.map +1 -0
- package/dist/mcp-server/utils/response.mjs +45 -0
- package/dist/mcp-server/utils/response.mjs.map +1 -0
- package/dist/mcp-server/utils/targets.cjs +32 -0
- package/dist/mcp-server/utils/targets.cjs.map +1 -0
- package/dist/mcp-server/utils/targets.d.cts +25 -0
- package/dist/mcp-server/utils/targets.d.cts.map +1 -0
- package/dist/mcp-server/utils/targets.d.mts +25 -0
- package/dist/mcp-server/utils/targets.d.mts.map +1 -0
- package/dist/mcp-server/utils/targets.mjs +29 -0
- package/dist/mcp-server/utils/targets.mjs.map +1 -0
- package/dist/mcp-server/utils/time.cjs +39 -0
- package/dist/mcp-server/utils/time.cjs.map +1 -0
- package/dist/mcp-server/utils/time.d.cts +15 -0
- package/dist/mcp-server/utils/time.d.cts.map +1 -0
- package/dist/mcp-server/utils/time.d.mts +15 -0
- package/dist/mcp-server/utils/time.d.mts.map +1 -0
- package/dist/mcp-server/utils/time.mjs +35 -0
- package/dist/mcp-server/utils/time.mjs.map +1 -0
- package/dist/mcp-server/utils/type-guards.cjs +42 -0
- package/dist/mcp-server/utils/type-guards.cjs.map +1 -0
- package/dist/mcp-server/utils/type-guards.d.cts +30 -0
- package/dist/mcp-server/utils/type-guards.d.cts.map +1 -0
- package/dist/mcp-server/utils/type-guards.d.mts +30 -0
- package/dist/mcp-server/utils/type-guards.d.mts.map +1 -0
- package/dist/mcp-server/utils/type-guards.mjs +38 -0
- package/dist/mcp-server/utils/type-guards.mjs.map +1 -0
- package/dist/utils/fetch.cjs +36 -0
- package/dist/utils/fetch.cjs.map +1 -0
- package/dist/utils/fetch.d.cts +20 -0
- package/dist/utils/fetch.d.cts.map +1 -0
- package/dist/utils/fetch.d.mts +20 -0
- package/dist/utils/fetch.d.mts.map +1 -0
- package/dist/utils/fetch.mjs +33 -0
- package/dist/utils/fetch.mjs.map +1 -0
- package/dist/utils/index.cjs +11 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +6 -0
- package/dist/utils/index.d.cts.map +1 -0
- package/dist/utils/index.d.mts +6 -0
- package/dist/utils/index.d.mts.map +1 -0
- package/dist/utils/index.mjs +6 -0
- package/dist/utils/index.mjs.map +1 -0
- package/dist/utils/service-readiness.cjs +75 -0
- package/dist/utils/service-readiness.cjs.map +1 -0
- package/dist/utils/service-readiness.d.cts +61 -0
- package/dist/utils/service-readiness.d.cts.map +1 -0
- package/dist/utils/service-readiness.d.mts +61 -0
- package/dist/utils/service-readiness.d.mts.map +1 -0
- package/dist/utils/service-readiness.mjs +72 -0
- package/dist/utils/service-readiness.mjs.map +1 -0
- package/package.json +119 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { BuildCapability } from "../../capabilities/types.cjs";
|
|
2
|
+
import type { BuildInput, BuildToolResult, McpResponse, HandlerOptions } from "../types/index.cjs";
|
|
3
|
+
/**
|
|
4
|
+
* Options for the build tool handler.
|
|
5
|
+
*
|
|
6
|
+
* @returns Handler options with optional build capability
|
|
7
|
+
*/
|
|
8
|
+
export type BuildToolOptions = HandlerOptions & {
|
|
9
|
+
/**
|
|
10
|
+
* Optional build capability for extension building
|
|
11
|
+
*/
|
|
12
|
+
buildCapability?: BuildCapability;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Handles the build tool request to build the extension.
|
|
16
|
+
*
|
|
17
|
+
* @param input Build configuration with optional buildType and force flag
|
|
18
|
+
* @param options Optional handler options with build capability
|
|
19
|
+
* @returns Promise resolving to MCP response with build result
|
|
20
|
+
*/
|
|
21
|
+
export declare function handleBuild(input: BuildInput, options?: BuildToolOptions): Promise<McpResponse<BuildToolResult>>;
|
|
22
|
+
//# sourceMappingURL=build.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.cts","sourceRoot":"","sources":["../../../src/mcp-server/tools/build.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,qCAAoC;AACnE,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,WAAW,EACX,cAAc,EACf,2BAAiB;AAQlB;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,cAAc,GAAG;IAC9C;;OAEG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,WAAW,CAC/B,KAAK,EAAE,UAAU,EACjB,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,CAcvC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { BuildCapability } from "../../capabilities/types.mjs";
|
|
2
|
+
import type { BuildInput, BuildToolResult, McpResponse, HandlerOptions } from "../types/index.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Options for the build tool handler.
|
|
5
|
+
*
|
|
6
|
+
* @returns Handler options with optional build capability
|
|
7
|
+
*/
|
|
8
|
+
export type BuildToolOptions = HandlerOptions & {
|
|
9
|
+
/**
|
|
10
|
+
* Optional build capability for extension building
|
|
11
|
+
*/
|
|
12
|
+
buildCapability?: BuildCapability;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Handles the build tool request to build the extension.
|
|
16
|
+
*
|
|
17
|
+
* @param input Build configuration with optional buildType and force flag
|
|
18
|
+
* @param options Optional handler options with build capability
|
|
19
|
+
* @returns Promise resolving to MCP response with build result
|
|
20
|
+
*/
|
|
21
|
+
export declare function handleBuild(input: BuildInput, options?: BuildToolOptions): Promise<McpResponse<BuildToolResult>>;
|
|
22
|
+
//# sourceMappingURL=build.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.mts","sourceRoot":"","sources":["../../../src/mcp-server/tools/build.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,qCAAoC;AACnE,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,WAAW,EACX,cAAc,EACf,2BAAiB;AAQlB;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,cAAc,GAAG;IAC9C;;OAEG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,WAAW,CAC/B,KAAK,EAAE,UAAU,EACjB,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,CAcvC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ErrorCodes } from "../types/index.mjs";
|
|
2
|
+
import { createSuccessResponse, createErrorResponse, extractErrorMessage } from "../utils/index.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Handles the build tool request to build the extension.
|
|
5
|
+
*
|
|
6
|
+
* @param input Build configuration with optional buildType and force flag
|
|
7
|
+
* @param options Optional handler options with build capability
|
|
8
|
+
* @returns Promise resolving to MCP response with build result
|
|
9
|
+
*/
|
|
10
|
+
export async function handleBuild(input, options) {
|
|
11
|
+
const startTime = Date.now();
|
|
12
|
+
if (options?.buildCapability) {
|
|
13
|
+
return handleBuildWithCapability(input, options.buildCapability, startTime);
|
|
14
|
+
}
|
|
15
|
+
return createErrorResponse(ErrorCodes.MM_CAPABILITY_NOT_AVAILABLE, 'BuildCapability not available. The mm_build tool requires either: (1) running in e2e mode with the MetaMask extension wrapper, or (2) running directly in the metamask-extension repository with dependencies installed.', { capability: 'BuildCapability' }, undefined, startTime);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Handles build using the provided build capability.
|
|
19
|
+
*
|
|
20
|
+
* @param input Build configuration with optional buildType and force flag
|
|
21
|
+
* @param buildCapability Build capability instance for executing the build
|
|
22
|
+
* @param startTime Timestamp when the operation started
|
|
23
|
+
* @returns Promise resolving to MCP response with build result
|
|
24
|
+
*/
|
|
25
|
+
async function handleBuildWithCapability(input, buildCapability, startTime) {
|
|
26
|
+
try {
|
|
27
|
+
const result = await buildCapability.build({
|
|
28
|
+
buildType: input.buildType,
|
|
29
|
+
force: input.force,
|
|
30
|
+
});
|
|
31
|
+
if (!result.success) {
|
|
32
|
+
return createErrorResponse(ErrorCodes.MM_BUILD_FAILED, `Build failed: ${result.error ?? 'Unknown error'}`, { buildType: input.buildType ?? 'build:test' }, undefined, startTime);
|
|
33
|
+
}
|
|
34
|
+
return createSuccessResponse({
|
|
35
|
+
buildType: input.buildType ?? 'build:test',
|
|
36
|
+
extensionPathResolved: result.extensionPath,
|
|
37
|
+
}, undefined, startTime);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
const message = extractErrorMessage(error);
|
|
41
|
+
return createErrorResponse(ErrorCodes.MM_BUILD_FAILED, `Build failed: ${message}`, { buildType: input.buildType ?? 'build:test' }, undefined, startTime);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=build.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.mjs","sourceRoot":"","sources":["../../../src/mcp-server/tools/build.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,2BAAiB;AACtC,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACpB,2BAAiB;AAclB;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,KAAiB,EACjB,OAA0B;IAE1B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE7B,IAAI,OAAO,EAAE,eAAe,EAAE,CAAC;QAC7B,OAAO,yBAAyB,CAAC,KAAK,EAAE,OAAO,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;IAC9E,CAAC;IAED,OAAO,mBAAmB,CACxB,UAAU,CAAC,2BAA2B,EACtC,0NAA0N,EAC1N,EAAE,UAAU,EAAE,iBAAiB,EAAE,EACjC,SAAS,EACT,SAAS,CACV,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,KAAK,UAAU,yBAAyB,CACtC,KAAiB,EACjB,eAAgC,EAChC,SAAiB;IAEjB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,KAAK,CAAC;YACzC,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,KAAK,EAAE,KAAK,CAAC,KAAK;SACnB,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO,mBAAmB,CACxB,UAAU,CAAC,eAAe,EAC1B,iBAAiB,MAAM,CAAC,KAAK,IAAI,eAAe,EAAE,EAClD,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,YAAY,EAAE,EAC9C,SAAS,EACT,SAAS,CACV,CAAC;QACJ,CAAC;QAED,OAAO,qBAAqB,CAC1B;YACE,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,YAAY;YAC1C,qBAAqB,EAAE,MAAM,CAAC,aAAa;SAC5C,EACD,SAAS,EACT,SAAS,CACV,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAC3C,OAAO,mBAAmB,CACxB,UAAU,CAAC,eAAe,EAC1B,iBAAiB,OAAO,EAAE,EAC1B,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,YAAY,EAAE,EAC9C,SAAS,EACT,SAAS,CACV,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import type { BuildCapability } from '../../capabilities/types.js';\nimport type {\n BuildInput,\n BuildToolResult,\n McpResponse,\n HandlerOptions,\n} from '../types';\nimport { ErrorCodes } from '../types';\nimport {\n createSuccessResponse,\n createErrorResponse,\n extractErrorMessage,\n} from '../utils';\n\n/**\n * Options for the build tool handler.\n *\n * @returns Handler options with optional build capability\n */\nexport type BuildToolOptions = HandlerOptions & {\n /**\n * Optional build capability for extension building\n */\n buildCapability?: BuildCapability;\n};\n\n/**\n * Handles the build tool request to build the extension.\n *\n * @param input Build configuration with optional buildType and force flag\n * @param options Optional handler options with build capability\n * @returns Promise resolving to MCP response with build result\n */\nexport async function handleBuild(\n input: BuildInput,\n options?: BuildToolOptions,\n): Promise<McpResponse<BuildToolResult>> {\n const startTime = Date.now();\n\n if (options?.buildCapability) {\n return handleBuildWithCapability(input, options.buildCapability, startTime);\n }\n\n return createErrorResponse(\n ErrorCodes.MM_CAPABILITY_NOT_AVAILABLE,\n 'BuildCapability not available. The mm_build tool requires either: (1) running in e2e mode with the MetaMask extension wrapper, or (2) running directly in the metamask-extension repository with dependencies installed.',\n { capability: 'BuildCapability' },\n undefined,\n startTime,\n );\n}\n\n/**\n * Handles build using the provided build capability.\n *\n * @param input Build configuration with optional buildType and force flag\n * @param buildCapability Build capability instance for executing the build\n * @param startTime Timestamp when the operation started\n * @returns Promise resolving to MCP response with build result\n */\nasync function handleBuildWithCapability(\n input: BuildInput,\n buildCapability: BuildCapability,\n startTime: number,\n): Promise<McpResponse<BuildToolResult>> {\n try {\n const result = await buildCapability.build({\n buildType: input.buildType,\n force: input.force,\n });\n\n if (!result.success) {\n return createErrorResponse(\n ErrorCodes.MM_BUILD_FAILED,\n `Build failed: ${result.error ?? 'Unknown error'}`,\n { buildType: input.buildType ?? 'build:test' },\n undefined,\n startTime,\n );\n }\n\n return createSuccessResponse<BuildToolResult>(\n {\n buildType: input.buildType ?? 'build:test',\n extensionPathResolved: result.extensionPath,\n },\n undefined,\n startTime,\n );\n } catch (error) {\n const message = extractErrorMessage(error);\n return createErrorResponse(\n ErrorCodes.MM_BUILD_FAILED,\n `Build failed: ${message}`,\n { buildType: input.buildType ?? 'build:test' },\n undefined,\n startTime,\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleCleanup = handleCleanup;
|
|
4
|
+
const session_manager_js_1 = require("../session-manager.cjs");
|
|
5
|
+
const utils_1 = require("../utils/index.cjs");
|
|
6
|
+
/**
|
|
7
|
+
* Handles the cleanup tool request to stop browser and services.
|
|
8
|
+
*
|
|
9
|
+
* @param input - The cleanup input parameters.
|
|
10
|
+
* @param _options - Handler options (unused).
|
|
11
|
+
* @returns Response indicating if cleanup was performed.
|
|
12
|
+
*/
|
|
13
|
+
async function handleCleanup(input, _options) {
|
|
14
|
+
const startTime = Date.now();
|
|
15
|
+
const sessionManager = (0, session_manager_js_1.getSessionManager)();
|
|
16
|
+
const sessionId = input.sessionId ?? sessionManager.getSessionId();
|
|
17
|
+
const cleanedUp = await sessionManager.cleanup();
|
|
18
|
+
return (0, utils_1.createSuccessResponse)({ cleanedUp }, sessionId, startTime);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=cleanup.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleanup.cjs","sourceRoot":"","sources":["../../../src/mcp-server/tools/cleanup.ts"],"names":[],"mappings":";;AAgBA,sCAeC;AA/BD,+DAA0D;AAO1D,8CAAiD;AAEjD;;;;;;GAMG;AACI,KAAK,UAAU,aAAa,CACjC,KAAmB,EACnB,QAAyB;IAEzB,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC7B,MAAM,cAAc,GAAG,IAAA,sCAAiB,GAAE,CAAC;IAC3C,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,IAAI,cAAc,CAAC,YAAY,EAAE,CAAC;IAEnE,MAAM,SAAS,GAAG,MAAM,cAAc,CAAC,OAAO,EAAE,CAAC;IAEjD,OAAO,IAAA,6BAAqB,EAC1B,EAAE,SAAS,EAAE,EACb,SAAS,EACT,SAAS,CACV,CAAC;AACJ,CAAC","sourcesContent":["import { getSessionManager } from '../session-manager.js';\nimport type {\n CleanupInput,\n CleanupResult,\n McpResponse,\n HandlerOptions,\n} from '../types';\nimport { createSuccessResponse } from '../utils';\n\n/**\n * Handles the cleanup tool request to stop browser and services.\n *\n * @param input - The cleanup input parameters.\n * @param _options - Handler options (unused).\n * @returns Response indicating if cleanup was performed.\n */\nexport async function handleCleanup(\n input: CleanupInput,\n _options?: HandlerOptions,\n): Promise<McpResponse<CleanupResult>> {\n const startTime = Date.now();\n const sessionManager = getSessionManager();\n const sessionId = input.sessionId ?? sessionManager.getSessionId();\n\n const cleanedUp = await sessionManager.cleanup();\n\n return createSuccessResponse<CleanupResult>(\n { cleanedUp },\n sessionId,\n startTime,\n );\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CleanupInput, CleanupResult, McpResponse, HandlerOptions } from "../types/index.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* Handles the cleanup tool request to stop browser and services.
|
|
4
|
+
*
|
|
5
|
+
* @param input - The cleanup input parameters.
|
|
6
|
+
* @param _options - Handler options (unused).
|
|
7
|
+
* @returns Response indicating if cleanup was performed.
|
|
8
|
+
*/
|
|
9
|
+
export declare function handleCleanup(input: CleanupInput, _options?: HandlerOptions): Promise<McpResponse<CleanupResult>>;
|
|
10
|
+
//# sourceMappingURL=cleanup.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleanup.d.cts","sourceRoot":"","sources":["../../../src/mcp-server/tools/cleanup.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,WAAW,EACX,cAAc,EACf,2BAAiB;AAGlB;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,KAAK,EAAE,YAAY,EACnB,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAYrC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CleanupInput, CleanupResult, McpResponse, HandlerOptions } from "../types/index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Handles the cleanup tool request to stop browser and services.
|
|
4
|
+
*
|
|
5
|
+
* @param input - The cleanup input parameters.
|
|
6
|
+
* @param _options - Handler options (unused).
|
|
7
|
+
* @returns Response indicating if cleanup was performed.
|
|
8
|
+
*/
|
|
9
|
+
export declare function handleCleanup(input: CleanupInput, _options?: HandlerOptions): Promise<McpResponse<CleanupResult>>;
|
|
10
|
+
//# sourceMappingURL=cleanup.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleanup.d.mts","sourceRoot":"","sources":["../../../src/mcp-server/tools/cleanup.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,WAAW,EACX,cAAc,EACf,2BAAiB;AAGlB;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,KAAK,EAAE,YAAY,EACnB,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAYrC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { getSessionManager } from "../session-manager.mjs";
|
|
2
|
+
import { createSuccessResponse } from "../utils/index.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Handles the cleanup tool request to stop browser and services.
|
|
5
|
+
*
|
|
6
|
+
* @param input - The cleanup input parameters.
|
|
7
|
+
* @param _options - Handler options (unused).
|
|
8
|
+
* @returns Response indicating if cleanup was performed.
|
|
9
|
+
*/
|
|
10
|
+
export async function handleCleanup(input, _options) {
|
|
11
|
+
const startTime = Date.now();
|
|
12
|
+
const sessionManager = getSessionManager();
|
|
13
|
+
const sessionId = input.sessionId ?? sessionManager.getSessionId();
|
|
14
|
+
const cleanedUp = await sessionManager.cleanup();
|
|
15
|
+
return createSuccessResponse({ cleanedUp }, sessionId, startTime);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=cleanup.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleanup.mjs","sourceRoot":"","sources":["../../../src/mcp-server/tools/cleanup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,+BAA8B;AAO1D,OAAO,EAAE,qBAAqB,EAAE,2BAAiB;AAEjD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,KAAmB,EACnB,QAAyB;IAEzB,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC7B,MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;IAC3C,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,IAAI,cAAc,CAAC,YAAY,EAAE,CAAC;IAEnE,MAAM,SAAS,GAAG,MAAM,cAAc,CAAC,OAAO,EAAE,CAAC;IAEjD,OAAO,qBAAqB,CAC1B,EAAE,SAAS,EAAE,EACb,SAAS,EACT,SAAS,CACV,CAAC;AACJ,CAAC","sourcesContent":["import { getSessionManager } from '../session-manager.js';\nimport type {\n CleanupInput,\n CleanupResult,\n McpResponse,\n HandlerOptions,\n} from '../types';\nimport { createSuccessResponse } from '../utils';\n\n/**\n * Handles the cleanup tool request to stop browser and services.\n *\n * @param input - The cleanup input parameters.\n * @param _options - Handler options (unused).\n * @returns Response indicating if cleanup was performed.\n */\nexport async function handleCleanup(\n input: CleanupInput,\n _options?: HandlerOptions,\n): Promise<McpResponse<CleanupResult>> {\n const startTime = Date.now();\n const sessionManager = getSessionManager();\n const sessionId = input.sessionId ?? sessionManager.getSessionId();\n\n const cleanedUp = await sessionManager.cleanup();\n\n return createSuccessResponse<CleanupResult>(\n { cleanedUp },\n sessionId,\n startTime,\n );\n}\n"]}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleClipboard = handleClipboard;
|
|
4
|
+
const run_tool_js_1 = require("./run-tool.cjs");
|
|
5
|
+
/**
|
|
6
|
+
* Clipboard handler using CDP (Chrome DevTools Protocol) to bypass LavaMoat restrictions.
|
|
7
|
+
*
|
|
8
|
+
* Why CDP instead of page.evaluate()?
|
|
9
|
+
* - page.evaluate() runs JavaScript inside the page context, which is wrapped by LavaMoat
|
|
10
|
+
* - LavaMoat restricts access to navigator.clipboard in the page context
|
|
11
|
+
* - CDP's Runtime.evaluate runs at the browser/DevTools level, bypassing LavaMoat
|
|
12
|
+
* - userGesture: true simulates a user gesture to satisfy clipboard security requirements
|
|
13
|
+
*
|
|
14
|
+
* @param input Clipboard action ('read' or 'write') with optional text content
|
|
15
|
+
* @param options Optional handler configuration
|
|
16
|
+
* @returns Promise resolving to MCP response with clipboard operation result
|
|
17
|
+
*/
|
|
18
|
+
async function handleClipboard(input, options) {
|
|
19
|
+
return (0, run_tool_js_1.runTool)({
|
|
20
|
+
toolName: 'mm_clipboard',
|
|
21
|
+
input,
|
|
22
|
+
options,
|
|
23
|
+
/**
|
|
24
|
+
* Executes the clipboard operation using CDP.
|
|
25
|
+
*
|
|
26
|
+
* @param context Tool execution context with page and session info
|
|
27
|
+
* @returns Promise resolving to clipboard operation result
|
|
28
|
+
*/
|
|
29
|
+
execute: async (context) => {
|
|
30
|
+
const { page } = context;
|
|
31
|
+
const cdpSession = await page.context().newCDPSession(page);
|
|
32
|
+
try {
|
|
33
|
+
if (input.action === 'write') {
|
|
34
|
+
await cdpSession.send('Runtime.evaluate', {
|
|
35
|
+
expression: `navigator.clipboard.writeText(${JSON.stringify(input.text)})`,
|
|
36
|
+
awaitPromise: true,
|
|
37
|
+
userGesture: true,
|
|
38
|
+
});
|
|
39
|
+
return {
|
|
40
|
+
action: 'write',
|
|
41
|
+
success: true,
|
|
42
|
+
text: input.text,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const result = await cdpSession.send('Runtime.evaluate', {
|
|
46
|
+
expression: `navigator.clipboard.readText()`,
|
|
47
|
+
awaitPromise: true,
|
|
48
|
+
userGesture: true,
|
|
49
|
+
});
|
|
50
|
+
const clipboardText = result.result?.value ?? result.result?.description ?? '';
|
|
51
|
+
return {
|
|
52
|
+
action: 'read',
|
|
53
|
+
success: true,
|
|
54
|
+
text: clipboardText,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
finally {
|
|
58
|
+
// eslint-disable-next-line no-empty-function
|
|
59
|
+
await cdpSession.detach().catch(() => { });
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
/**
|
|
63
|
+
* Classifies clipboard errors into specific error codes.
|
|
64
|
+
*
|
|
65
|
+
* @param error The error to classify
|
|
66
|
+
* @returns Error classification with code and message
|
|
67
|
+
*/
|
|
68
|
+
classifyError: (error) => {
|
|
69
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
70
|
+
if (message.includes('permissions') || message.includes('denied')) {
|
|
71
|
+
return {
|
|
72
|
+
code: 'MM_CLIPBOARD_PERMISSION_DENIED',
|
|
73
|
+
message: `Clipboard permission denied: ${message}`,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
if (message.includes('LavaMoat') || message.includes('policy')) {
|
|
77
|
+
return {
|
|
78
|
+
code: 'MM_CLIPBOARD_LAVAMOAT_BLOCKED',
|
|
79
|
+
message: `Clipboard blocked by LavaMoat policy: ${message}`,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
code: 'MM_CLIPBOARD_FAILED',
|
|
84
|
+
message: `Clipboard operation failed: ${message}`,
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
/**
|
|
88
|
+
* Sanitizes clipboard input for recording (removes sensitive text).
|
|
89
|
+
*
|
|
90
|
+
* @param inp The clipboard input to sanitize
|
|
91
|
+
* @returns Sanitized input with text length instead of actual text
|
|
92
|
+
*/
|
|
93
|
+
sanitizeInputForRecording: (inp) => ({
|
|
94
|
+
action: inp.action,
|
|
95
|
+
// Don't record the actual text content for privacy (could be SRP, passwords, etc.)
|
|
96
|
+
textLength: inp.text?.length ?? 0,
|
|
97
|
+
}),
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=clipboard.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clipboard.cjs","sourceRoot":"","sources":["../../../src/mcp-server/tools/clipboard.ts"],"names":[],"mappings":";;AAqBA,0CA+FC;AApHD,gDAAwC;AAQxC;;;;;;;;;;;;GAYG;AACI,KAAK,UAAU,eAAe,CACnC,KAAqB,EACrB,OAAwB;IAExB,OAAO,IAAA,qBAAO,EAAkC;QAC9C,QAAQ,EAAE,cAAc;QACxB,KAAK;QACL,OAAO;QAEP;;;;;WAKG;QACH,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YACzB,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;YACzB,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YAE5D,IAAI,CAAC;gBACH,IAAI,KAAK,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;oBAC7B,MAAM,UAAU,CAAC,IAAI,CAAC,kBAAkB,EAAE;wBACxC,UAAU,EAAE,iCAAiC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG;wBAC1E,YAAY,EAAE,IAAI;wBAClB,WAAW,EAAE,IAAI;qBAClB,CAAC,CAAC;oBAEH,OAAO;wBACL,MAAM,EAAE,OAAO;wBACf,OAAO,EAAE,IAAI;wBACb,IAAI,EAAE,KAAK,CAAC,IAAI;qBACjB,CAAC;gBACJ,CAAC;gBAED,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,kBAAkB,EAAE;oBACvD,UAAU,EAAE,gCAAgC;oBAC5C,YAAY,EAAE,IAAI;oBAClB,WAAW,EAAE,IAAI;iBAClB,CAAC,CAAC;gBAEH,MAAM,aAAa,GACjB,MAAM,CAAC,MAAM,EAAE,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,WAAW,IAAI,EAAE,CAAC;gBAE3D,OAAO;oBACL,MAAM,EAAE,MAAM;oBACd,OAAO,EAAE,IAAI;oBACb,IAAI,EAAE,aAAuB;iBAC9B,CAAC;YACJ,CAAC;oBAAS,CAAC;gBACT,6CAA6C;gBAC7C,MAAM,UAAU,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;YAC5C,CAAC;QACH,CAAC;QAED;;;;;WAKG;QACH,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE;YACvB,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAEvE,IAAI,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAClE,OAAO;oBACL,IAAI,EAAE,gCAAgC;oBACtC,OAAO,EAAE,gCAAgC,OAAO,EAAE;iBACnD,CAAC;YACJ,CAAC;YAED,IAAI,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC/D,OAAO;oBACL,IAAI,EAAE,+BAA+B;oBACrC,OAAO,EAAE,yCAAyC,OAAO,EAAE;iBAC5D,CAAC;YACJ,CAAC;YAED,OAAO;gBACL,IAAI,EAAE,qBAAqB;gBAC3B,OAAO,EAAE,+BAA+B,OAAO,EAAE;aAClD,CAAC;QACJ,CAAC;QAED;;;;;WAKG;QACH,yBAAyB,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YACnC,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,mFAAmF;YACnF,UAAU,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC;SAClC,CAAC;KACH,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { runTool } from './run-tool.js';\nimport type {\n ClipboardInput,\n ClipboardResult,\n McpResponse,\n HandlerOptions,\n} from '../types';\n\n/**\n * Clipboard handler using CDP (Chrome DevTools Protocol) to bypass LavaMoat restrictions.\n *\n * Why CDP instead of page.evaluate()?\n * - page.evaluate() runs JavaScript inside the page context, which is wrapped by LavaMoat\n * - LavaMoat restricts access to navigator.clipboard in the page context\n * - CDP's Runtime.evaluate runs at the browser/DevTools level, bypassing LavaMoat\n * - userGesture: true simulates a user gesture to satisfy clipboard security requirements\n *\n * @param input Clipboard action ('read' or 'write') with optional text content\n * @param options Optional handler configuration\n * @returns Promise resolving to MCP response with clipboard operation result\n */\nexport async function handleClipboard(\n input: ClipboardInput,\n options?: HandlerOptions,\n): Promise<McpResponse<ClipboardResult>> {\n return runTool<ClipboardInput, ClipboardResult>({\n toolName: 'mm_clipboard',\n input,\n options,\n\n /**\n * Executes the clipboard operation using CDP.\n *\n * @param context Tool execution context with page and session info\n * @returns Promise resolving to clipboard operation result\n */\n execute: async (context) => {\n const { page } = context;\n const cdpSession = await page.context().newCDPSession(page);\n\n try {\n if (input.action === 'write') {\n await cdpSession.send('Runtime.evaluate', {\n expression: `navigator.clipboard.writeText(${JSON.stringify(input.text)})`,\n awaitPromise: true,\n userGesture: true,\n });\n\n return {\n action: 'write',\n success: true,\n text: input.text,\n };\n }\n\n const result = await cdpSession.send('Runtime.evaluate', {\n expression: `navigator.clipboard.readText()`,\n awaitPromise: true,\n userGesture: true,\n });\n\n const clipboardText =\n result.result?.value ?? result.result?.description ?? '';\n\n return {\n action: 'read',\n success: true,\n text: clipboardText as string,\n };\n } finally {\n // eslint-disable-next-line no-empty-function\n await cdpSession.detach().catch(() => {});\n }\n },\n\n /**\n * Classifies clipboard errors into specific error codes.\n *\n * @param error The error to classify\n * @returns Error classification with code and message\n */\n classifyError: (error) => {\n const message = error instanceof Error ? error.message : String(error);\n\n if (message.includes('permissions') || message.includes('denied')) {\n return {\n code: 'MM_CLIPBOARD_PERMISSION_DENIED',\n message: `Clipboard permission denied: ${message}`,\n };\n }\n\n if (message.includes('LavaMoat') || message.includes('policy')) {\n return {\n code: 'MM_CLIPBOARD_LAVAMOAT_BLOCKED',\n message: `Clipboard blocked by LavaMoat policy: ${message}`,\n };\n }\n\n return {\n code: 'MM_CLIPBOARD_FAILED',\n message: `Clipboard operation failed: ${message}`,\n };\n },\n\n /**\n * Sanitizes clipboard input for recording (removes sensitive text).\n *\n * @param inp The clipboard input to sanitize\n * @returns Sanitized input with text length instead of actual text\n */\n sanitizeInputForRecording: (inp) => ({\n action: inp.action,\n // Don't record the actual text content for privacy (could be SRP, passwords, etc.)\n textLength: inp.text?.length ?? 0,\n }),\n });\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ClipboardInput, ClipboardResult, McpResponse, HandlerOptions } from "../types/index.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* Clipboard handler using CDP (Chrome DevTools Protocol) to bypass LavaMoat restrictions.
|
|
4
|
+
*
|
|
5
|
+
* Why CDP instead of page.evaluate()?
|
|
6
|
+
* - page.evaluate() runs JavaScript inside the page context, which is wrapped by LavaMoat
|
|
7
|
+
* - LavaMoat restricts access to navigator.clipboard in the page context
|
|
8
|
+
* - CDP's Runtime.evaluate runs at the browser/DevTools level, bypassing LavaMoat
|
|
9
|
+
* - userGesture: true simulates a user gesture to satisfy clipboard security requirements
|
|
10
|
+
*
|
|
11
|
+
* @param input Clipboard action ('read' or 'write') with optional text content
|
|
12
|
+
* @param options Optional handler configuration
|
|
13
|
+
* @returns Promise resolving to MCP response with clipboard operation result
|
|
14
|
+
*/
|
|
15
|
+
export declare function handleClipboard(input: ClipboardInput, options?: HandlerOptions): Promise<McpResponse<ClipboardResult>>;
|
|
16
|
+
//# sourceMappingURL=clipboard.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clipboard.d.cts","sourceRoot":"","sources":["../../../src/mcp-server/tools/clipboard.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,WAAW,EACX,cAAc,EACf,2BAAiB;AAElB;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,cAAc,EACrB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,CA4FvC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ClipboardInput, ClipboardResult, McpResponse, HandlerOptions } from "../types/index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Clipboard handler using CDP (Chrome DevTools Protocol) to bypass LavaMoat restrictions.
|
|
4
|
+
*
|
|
5
|
+
* Why CDP instead of page.evaluate()?
|
|
6
|
+
* - page.evaluate() runs JavaScript inside the page context, which is wrapped by LavaMoat
|
|
7
|
+
* - LavaMoat restricts access to navigator.clipboard in the page context
|
|
8
|
+
* - CDP's Runtime.evaluate runs at the browser/DevTools level, bypassing LavaMoat
|
|
9
|
+
* - userGesture: true simulates a user gesture to satisfy clipboard security requirements
|
|
10
|
+
*
|
|
11
|
+
* @param input Clipboard action ('read' or 'write') with optional text content
|
|
12
|
+
* @param options Optional handler configuration
|
|
13
|
+
* @returns Promise resolving to MCP response with clipboard operation result
|
|
14
|
+
*/
|
|
15
|
+
export declare function handleClipboard(input: ClipboardInput, options?: HandlerOptions): Promise<McpResponse<ClipboardResult>>;
|
|
16
|
+
//# sourceMappingURL=clipboard.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clipboard.d.mts","sourceRoot":"","sources":["../../../src/mcp-server/tools/clipboard.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,WAAW,EACX,cAAc,EACf,2BAAiB;AAElB;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,cAAc,EACrB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,CA4FvC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { runTool } from "./run-tool.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Clipboard handler using CDP (Chrome DevTools Protocol) to bypass LavaMoat restrictions.
|
|
4
|
+
*
|
|
5
|
+
* Why CDP instead of page.evaluate()?
|
|
6
|
+
* - page.evaluate() runs JavaScript inside the page context, which is wrapped by LavaMoat
|
|
7
|
+
* - LavaMoat restricts access to navigator.clipboard in the page context
|
|
8
|
+
* - CDP's Runtime.evaluate runs at the browser/DevTools level, bypassing LavaMoat
|
|
9
|
+
* - userGesture: true simulates a user gesture to satisfy clipboard security requirements
|
|
10
|
+
*
|
|
11
|
+
* @param input Clipboard action ('read' or 'write') with optional text content
|
|
12
|
+
* @param options Optional handler configuration
|
|
13
|
+
* @returns Promise resolving to MCP response with clipboard operation result
|
|
14
|
+
*/
|
|
15
|
+
export async function handleClipboard(input, options) {
|
|
16
|
+
return runTool({
|
|
17
|
+
toolName: 'mm_clipboard',
|
|
18
|
+
input,
|
|
19
|
+
options,
|
|
20
|
+
/**
|
|
21
|
+
* Executes the clipboard operation using CDP.
|
|
22
|
+
*
|
|
23
|
+
* @param context Tool execution context with page and session info
|
|
24
|
+
* @returns Promise resolving to clipboard operation result
|
|
25
|
+
*/
|
|
26
|
+
execute: async (context) => {
|
|
27
|
+
const { page } = context;
|
|
28
|
+
const cdpSession = await page.context().newCDPSession(page);
|
|
29
|
+
try {
|
|
30
|
+
if (input.action === 'write') {
|
|
31
|
+
await cdpSession.send('Runtime.evaluate', {
|
|
32
|
+
expression: `navigator.clipboard.writeText(${JSON.stringify(input.text)})`,
|
|
33
|
+
awaitPromise: true,
|
|
34
|
+
userGesture: true,
|
|
35
|
+
});
|
|
36
|
+
return {
|
|
37
|
+
action: 'write',
|
|
38
|
+
success: true,
|
|
39
|
+
text: input.text,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const result = await cdpSession.send('Runtime.evaluate', {
|
|
43
|
+
expression: `navigator.clipboard.readText()`,
|
|
44
|
+
awaitPromise: true,
|
|
45
|
+
userGesture: true,
|
|
46
|
+
});
|
|
47
|
+
const clipboardText = result.result?.value ?? result.result?.description ?? '';
|
|
48
|
+
return {
|
|
49
|
+
action: 'read',
|
|
50
|
+
success: true,
|
|
51
|
+
text: clipboardText,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
finally {
|
|
55
|
+
// eslint-disable-next-line no-empty-function
|
|
56
|
+
await cdpSession.detach().catch(() => { });
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
/**
|
|
60
|
+
* Classifies clipboard errors into specific error codes.
|
|
61
|
+
*
|
|
62
|
+
* @param error The error to classify
|
|
63
|
+
* @returns Error classification with code and message
|
|
64
|
+
*/
|
|
65
|
+
classifyError: (error) => {
|
|
66
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
67
|
+
if (message.includes('permissions') || message.includes('denied')) {
|
|
68
|
+
return {
|
|
69
|
+
code: 'MM_CLIPBOARD_PERMISSION_DENIED',
|
|
70
|
+
message: `Clipboard permission denied: ${message}`,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
if (message.includes('LavaMoat') || message.includes('policy')) {
|
|
74
|
+
return {
|
|
75
|
+
code: 'MM_CLIPBOARD_LAVAMOAT_BLOCKED',
|
|
76
|
+
message: `Clipboard blocked by LavaMoat policy: ${message}`,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
code: 'MM_CLIPBOARD_FAILED',
|
|
81
|
+
message: `Clipboard operation failed: ${message}`,
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
/**
|
|
85
|
+
* Sanitizes clipboard input for recording (removes sensitive text).
|
|
86
|
+
*
|
|
87
|
+
* @param inp The clipboard input to sanitize
|
|
88
|
+
* @returns Sanitized input with text length instead of actual text
|
|
89
|
+
*/
|
|
90
|
+
sanitizeInputForRecording: (inp) => ({
|
|
91
|
+
action: inp.action,
|
|
92
|
+
// Don't record the actual text content for privacy (could be SRP, passwords, etc.)
|
|
93
|
+
textLength: inp.text?.length ?? 0,
|
|
94
|
+
}),
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=clipboard.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clipboard.mjs","sourceRoot":"","sources":["../../../src/mcp-server/tools/clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,uBAAsB;AAQxC;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,KAAqB,EACrB,OAAwB;IAExB,OAAO,OAAO,CAAkC;QAC9C,QAAQ,EAAE,cAAc;QACxB,KAAK;QACL,OAAO;QAEP;;;;;WAKG;QACH,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YACzB,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;YACzB,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YAE5D,IAAI,CAAC;gBACH,IAAI,KAAK,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;oBAC7B,MAAM,UAAU,CAAC,IAAI,CAAC,kBAAkB,EAAE;wBACxC,UAAU,EAAE,iCAAiC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG;wBAC1E,YAAY,EAAE,IAAI;wBAClB,WAAW,EAAE,IAAI;qBAClB,CAAC,CAAC;oBAEH,OAAO;wBACL,MAAM,EAAE,OAAO;wBACf,OAAO,EAAE,IAAI;wBACb,IAAI,EAAE,KAAK,CAAC,IAAI;qBACjB,CAAC;gBACJ,CAAC;gBAED,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,kBAAkB,EAAE;oBACvD,UAAU,EAAE,gCAAgC;oBAC5C,YAAY,EAAE,IAAI;oBAClB,WAAW,EAAE,IAAI;iBAClB,CAAC,CAAC;gBAEH,MAAM,aAAa,GACjB,MAAM,CAAC,MAAM,EAAE,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,WAAW,IAAI,EAAE,CAAC;gBAE3D,OAAO;oBACL,MAAM,EAAE,MAAM;oBACd,OAAO,EAAE,IAAI;oBACb,IAAI,EAAE,aAAuB;iBAC9B,CAAC;YACJ,CAAC;oBAAS,CAAC;gBACT,6CAA6C;gBAC7C,MAAM,UAAU,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;YAC5C,CAAC;QACH,CAAC;QAED;;;;;WAKG;QACH,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE;YACvB,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAEvE,IAAI,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAClE,OAAO;oBACL,IAAI,EAAE,gCAAgC;oBACtC,OAAO,EAAE,gCAAgC,OAAO,EAAE;iBACnD,CAAC;YACJ,CAAC;YAED,IAAI,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC/D,OAAO;oBACL,IAAI,EAAE,+BAA+B;oBACrC,OAAO,EAAE,yCAAyC,OAAO,EAAE;iBAC5D,CAAC;YACJ,CAAC;YAED,OAAO;gBACL,IAAI,EAAE,qBAAqB;gBAC3B,OAAO,EAAE,+BAA+B,OAAO,EAAE;aAClD,CAAC;QACJ,CAAC;QAED;;;;;WAKG;QACH,yBAAyB,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YACnC,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,mFAAmF;YACnF,UAAU,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC;SAClC,CAAC;KACH,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { runTool } from './run-tool.js';\nimport type {\n ClipboardInput,\n ClipboardResult,\n McpResponse,\n HandlerOptions,\n} from '../types';\n\n/**\n * Clipboard handler using CDP (Chrome DevTools Protocol) to bypass LavaMoat restrictions.\n *\n * Why CDP instead of page.evaluate()?\n * - page.evaluate() runs JavaScript inside the page context, which is wrapped by LavaMoat\n * - LavaMoat restricts access to navigator.clipboard in the page context\n * - CDP's Runtime.evaluate runs at the browser/DevTools level, bypassing LavaMoat\n * - userGesture: true simulates a user gesture to satisfy clipboard security requirements\n *\n * @param input Clipboard action ('read' or 'write') with optional text content\n * @param options Optional handler configuration\n * @returns Promise resolving to MCP response with clipboard operation result\n */\nexport async function handleClipboard(\n input: ClipboardInput,\n options?: HandlerOptions,\n): Promise<McpResponse<ClipboardResult>> {\n return runTool<ClipboardInput, ClipboardResult>({\n toolName: 'mm_clipboard',\n input,\n options,\n\n /**\n * Executes the clipboard operation using CDP.\n *\n * @param context Tool execution context with page and session info\n * @returns Promise resolving to clipboard operation result\n */\n execute: async (context) => {\n const { page } = context;\n const cdpSession = await page.context().newCDPSession(page);\n\n try {\n if (input.action === 'write') {\n await cdpSession.send('Runtime.evaluate', {\n expression: `navigator.clipboard.writeText(${JSON.stringify(input.text)})`,\n awaitPromise: true,\n userGesture: true,\n });\n\n return {\n action: 'write',\n success: true,\n text: input.text,\n };\n }\n\n const result = await cdpSession.send('Runtime.evaluate', {\n expression: `navigator.clipboard.readText()`,\n awaitPromise: true,\n userGesture: true,\n });\n\n const clipboardText =\n result.result?.value ?? result.result?.description ?? '';\n\n return {\n action: 'read',\n success: true,\n text: clipboardText as string,\n };\n } finally {\n // eslint-disable-next-line no-empty-function\n await cdpSession.detach().catch(() => {});\n }\n },\n\n /**\n * Classifies clipboard errors into specific error codes.\n *\n * @param error The error to classify\n * @returns Error classification with code and message\n */\n classifyError: (error) => {\n const message = error instanceof Error ? error.message : String(error);\n\n if (message.includes('permissions') || message.includes('denied')) {\n return {\n code: 'MM_CLIPBOARD_PERMISSION_DENIED',\n message: `Clipboard permission denied: ${message}`,\n };\n }\n\n if (message.includes('LavaMoat') || message.includes('policy')) {\n return {\n code: 'MM_CLIPBOARD_LAVAMOAT_BLOCKED',\n message: `Clipboard blocked by LavaMoat policy: ${message}`,\n };\n }\n\n return {\n code: 'MM_CLIPBOARD_FAILED',\n message: `Clipboard operation failed: ${message}`,\n };\n },\n\n /**\n * Sanitizes clipboard input for recording (removes sensitive text).\n *\n * @param inp The clipboard input to sanitize\n * @returns Sanitized input with text length instead of actual text\n */\n sanitizeInputForRecording: (inp) => ({\n action: inp.action,\n // Don't record the actual text content for privacy (could be SRP, passwords, etc.)\n textLength: inp.text?.length ?? 0,\n }),\n });\n}\n"]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleSetContext = handleSetContext;
|
|
4
|
+
exports.handleGetContext = handleGetContext;
|
|
5
|
+
const run_tool_js_1 = require("./run-tool.cjs");
|
|
6
|
+
const session_manager_js_1 = require("../session-manager.cjs");
|
|
7
|
+
const error_classification_js_1 = require("./error-classification.cjs");
|
|
8
|
+
/**
|
|
9
|
+
* Handle setting the workflow context (e2e or prod).
|
|
10
|
+
*
|
|
11
|
+
* @param input The context input containing the desired context mode
|
|
12
|
+
* @param options Optional handler options for the operation
|
|
13
|
+
* @returns Promise resolving to the context change result with previous and new context
|
|
14
|
+
*/
|
|
15
|
+
async function handleSetContext(input, options) {
|
|
16
|
+
return (0, run_tool_js_1.runTool)({
|
|
17
|
+
toolName: 'mm_set_context',
|
|
18
|
+
input,
|
|
19
|
+
options,
|
|
20
|
+
requiresSession: false,
|
|
21
|
+
observationPolicy: 'none',
|
|
22
|
+
/**
|
|
23
|
+
* Execute the context switch operation.
|
|
24
|
+
*
|
|
25
|
+
* @returns The result containing previous context, new context, and available capabilities
|
|
26
|
+
*/
|
|
27
|
+
execute: async () => {
|
|
28
|
+
const sessionManager = (0, session_manager_js_1.getSessionManager)();
|
|
29
|
+
const previousContext = sessionManager.getEnvironmentMode();
|
|
30
|
+
sessionManager.setContext(input.context);
|
|
31
|
+
const info = sessionManager.getContextInfo();
|
|
32
|
+
return {
|
|
33
|
+
previousContext,
|
|
34
|
+
newContext: input.context,
|
|
35
|
+
availableCapabilities: info.capabilities.available,
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
classifyError: error_classification_js_1.classifyContextError,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Handle getting the current workflow context and capabilities.
|
|
43
|
+
*
|
|
44
|
+
* @param input Empty input object for this operation
|
|
45
|
+
* @param options Optional handler options for the operation
|
|
46
|
+
* @returns Promise resolving to the current context, session state, and available capabilities
|
|
47
|
+
*/
|
|
48
|
+
async function handleGetContext(input, options) {
|
|
49
|
+
return (0, run_tool_js_1.runTool)({
|
|
50
|
+
toolName: 'mm_get_context',
|
|
51
|
+
input,
|
|
52
|
+
options,
|
|
53
|
+
requiresSession: false,
|
|
54
|
+
observationPolicy: 'none',
|
|
55
|
+
/**
|
|
56
|
+
* Execute the get context operation.
|
|
57
|
+
*
|
|
58
|
+
* @returns The result containing current context, session state, and capabilities
|
|
59
|
+
*/
|
|
60
|
+
execute: async () => {
|
|
61
|
+
const sessionManager = (0, session_manager_js_1.getSessionManager)();
|
|
62
|
+
return sessionManager.getContextInfo();
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=context.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.cjs","sourceRoot":"","sources":["../../../src/mcp-server/tools/context.ts"],"names":[],"mappings":";;AAqBA,4CA+BC;AAmBD,4CAqBC;AA5FD,gDAAwC;AACxC,+DAA0D;AAC1D,wEAAiE;AAYjE;;;;;;GAMG;AACI,KAAK,UAAU,gBAAgB,CACpC,KAAsB,EACtB,OAAwB;IAExB,OAAO,IAAA,qBAAO,EAAoC;QAChD,QAAQ,EAAE,gBAAgB;QAC1B,KAAK;QACL,OAAO;QACP,eAAe,EAAE,KAAK;QACtB,iBAAiB,EAAE,MAAM;QAEzB;;;;WAIG;QACH,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,MAAM,cAAc,GAAG,IAAA,sCAAiB,GAAE,CAAC;YAC3C,MAAM,eAAe,GAAG,cAAc,CAAC,kBAAkB,EAAE,CAAC;YAC5D,cAAc,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACzC,MAAM,IAAI,GAAG,cAAc,CAAC,cAAc,EAAE,CAAC;YAE7C,OAAO;gBACL,eAAe;gBACf,UAAU,EAAE,KAAK,CAAC,OAAO;gBACzB,qBAAqB,EAAE,IAAI,CAAC,YAAY,CAAC,SAAS;aACnD,CAAC;QACJ,CAAC;QAED,aAAa,EAAE,8CAAoB;KACpC,CAAC,CAAC;AACL,CAAC;AAYD;;;;;;GAMG;AACI,KAAK,UAAU,gBAAgB,CACpC,KAA4B,EAC5B,OAAwB;IAExB,OAAO,IAAA,qBAAO,EAA0C;QACtD,QAAQ,EAAE,gBAAgB;QAC1B,KAAK;QACL,OAAO;QACP,eAAe,EAAE,KAAK;QACtB,iBAAiB,EAAE,MAAM;QAEzB;;;;WAIG;QACH,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,MAAM,cAAc,GAAG,IAAA,sCAAiB,GAAE,CAAC;YAC3C,OAAO,cAAc,CAAC,cAAc,EAAE,CAAC;QACzC,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { runTool } from './run-tool.js';\nimport { getSessionManager } from '../session-manager.js';\nimport { classifyContextError } from './error-classification.js';\nimport type { McpResponse, HandlerOptions } from '../types';\n\nexport type SetContextInput = {\n context: 'e2e' | 'prod';\n};\nexport type SetContextResult = {\n previousContext: 'e2e' | 'prod';\n newContext: 'e2e' | 'prod';\n availableCapabilities: string[];\n};\n\n/**\n * Handle setting the workflow context (e2e or prod).\n *\n * @param input The context input containing the desired context mode\n * @param options Optional handler options for the operation\n * @returns Promise resolving to the context change result with previous and new context\n */\nexport async function handleSetContext(\n input: SetContextInput,\n options?: HandlerOptions,\n): Promise<McpResponse<SetContextResult>> {\n return runTool<SetContextInput, SetContextResult>({\n toolName: 'mm_set_context',\n input,\n options,\n requiresSession: false,\n observationPolicy: 'none',\n\n /**\n * Execute the context switch operation.\n *\n * @returns The result containing previous context, new context, and available capabilities\n */\n execute: async () => {\n const sessionManager = getSessionManager();\n const previousContext = sessionManager.getEnvironmentMode();\n sessionManager.setContext(input.context);\n const info = sessionManager.getContextInfo();\n\n return {\n previousContext,\n newContext: input.context,\n availableCapabilities: info.capabilities.available,\n };\n },\n\n classifyError: classifyContextError,\n });\n}\n\nexport type GetContextResult = {\n currentContext: 'e2e' | 'prod';\n hasActiveSession: boolean;\n sessionId: string | null;\n capabilities: {\n available: string[];\n };\n canSwitchContext: boolean;\n};\n\n/**\n * Handle getting the current workflow context and capabilities.\n *\n * @param input Empty input object for this operation\n * @param options Optional handler options for the operation\n * @returns Promise resolving to the current context, session state, and available capabilities\n */\nexport async function handleGetContext(\n input: Record<string, never>,\n options?: HandlerOptions,\n): Promise<McpResponse<GetContextResult>> {\n return runTool<Record<string, never>, GetContextResult>({\n toolName: 'mm_get_context',\n input,\n options,\n requiresSession: false,\n observationPolicy: 'none',\n\n /**\n * Execute the get context operation.\n *\n * @returns The result containing current context, session state, and capabilities\n */\n execute: async () => {\n const sessionManager = getSessionManager();\n return sessionManager.getContextInfo();\n },\n });\n}\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { McpResponse, HandlerOptions } from "../types/index.cjs";
|
|
2
|
+
export type SetContextInput = {
|
|
3
|
+
context: 'e2e' | 'prod';
|
|
4
|
+
};
|
|
5
|
+
export type SetContextResult = {
|
|
6
|
+
previousContext: 'e2e' | 'prod';
|
|
7
|
+
newContext: 'e2e' | 'prod';
|
|
8
|
+
availableCapabilities: string[];
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Handle setting the workflow context (e2e or prod).
|
|
12
|
+
*
|
|
13
|
+
* @param input The context input containing the desired context mode
|
|
14
|
+
* @param options Optional handler options for the operation
|
|
15
|
+
* @returns Promise resolving to the context change result with previous and new context
|
|
16
|
+
*/
|
|
17
|
+
export declare function handleSetContext(input: SetContextInput, options?: HandlerOptions): Promise<McpResponse<SetContextResult>>;
|
|
18
|
+
export type GetContextResult = {
|
|
19
|
+
currentContext: 'e2e' | 'prod';
|
|
20
|
+
hasActiveSession: boolean;
|
|
21
|
+
sessionId: string | null;
|
|
22
|
+
capabilities: {
|
|
23
|
+
available: string[];
|
|
24
|
+
};
|
|
25
|
+
canSwitchContext: boolean;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Handle getting the current workflow context and capabilities.
|
|
29
|
+
*
|
|
30
|
+
* @param input Empty input object for this operation
|
|
31
|
+
* @param options Optional handler options for the operation
|
|
32
|
+
* @returns Promise resolving to the current context, session state, and available capabilities
|
|
33
|
+
*/
|
|
34
|
+
export declare function handleGetContext(input: Record<string, never>, options?: HandlerOptions): Promise<McpResponse<GetContextResult>>;
|
|
35
|
+
//# sourceMappingURL=context.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.cts","sourceRoot":"","sources":["../../../src/mcp-server/tools/context.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,2BAAiB;AAE5D,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,KAAK,GAAG,MAAM,CAAC;CACzB,CAAC;AACF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,eAAe,EAAE,KAAK,GAAG,MAAM,CAAC;IAChC,UAAU,EAAE,KAAK,GAAG,MAAM,CAAC;IAC3B,qBAAqB,EAAE,MAAM,EAAE,CAAC;CACjC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,eAAe,EACtB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,CA4BxC;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,cAAc,EAAE,KAAK,GAAG,MAAM,CAAC;IAC/B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,YAAY,EAAE;QACZ,SAAS,EAAE,MAAM,EAAE,CAAC;KACrB,CAAC;IACF,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAC5B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAkBxC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { McpResponse, HandlerOptions } from "../types/index.mjs";
|
|
2
|
+
export type SetContextInput = {
|
|
3
|
+
context: 'e2e' | 'prod';
|
|
4
|
+
};
|
|
5
|
+
export type SetContextResult = {
|
|
6
|
+
previousContext: 'e2e' | 'prod';
|
|
7
|
+
newContext: 'e2e' | 'prod';
|
|
8
|
+
availableCapabilities: string[];
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Handle setting the workflow context (e2e or prod).
|
|
12
|
+
*
|
|
13
|
+
* @param input The context input containing the desired context mode
|
|
14
|
+
* @param options Optional handler options for the operation
|
|
15
|
+
* @returns Promise resolving to the context change result with previous and new context
|
|
16
|
+
*/
|
|
17
|
+
export declare function handleSetContext(input: SetContextInput, options?: HandlerOptions): Promise<McpResponse<SetContextResult>>;
|
|
18
|
+
export type GetContextResult = {
|
|
19
|
+
currentContext: 'e2e' | 'prod';
|
|
20
|
+
hasActiveSession: boolean;
|
|
21
|
+
sessionId: string | null;
|
|
22
|
+
capabilities: {
|
|
23
|
+
available: string[];
|
|
24
|
+
};
|
|
25
|
+
canSwitchContext: boolean;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Handle getting the current workflow context and capabilities.
|
|
29
|
+
*
|
|
30
|
+
* @param input Empty input object for this operation
|
|
31
|
+
* @param options Optional handler options for the operation
|
|
32
|
+
* @returns Promise resolving to the current context, session state, and available capabilities
|
|
33
|
+
*/
|
|
34
|
+
export declare function handleGetContext(input: Record<string, never>, options?: HandlerOptions): Promise<McpResponse<GetContextResult>>;
|
|
35
|
+
//# sourceMappingURL=context.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.mts","sourceRoot":"","sources":["../../../src/mcp-server/tools/context.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,2BAAiB;AAE5D,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,KAAK,GAAG,MAAM,CAAC;CACzB,CAAC;AACF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,eAAe,EAAE,KAAK,GAAG,MAAM,CAAC;IAChC,UAAU,EAAE,KAAK,GAAG,MAAM,CAAC;IAC3B,qBAAqB,EAAE,MAAM,EAAE,CAAC;CACjC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,eAAe,EACtB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,CA4BxC;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,cAAc,EAAE,KAAK,GAAG,MAAM,CAAC;IAC/B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,YAAY,EAAE;QACZ,SAAS,EAAE,MAAM,EAAE,CAAC;KACrB,CAAC;IACF,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAC5B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAkBxC"}
|