@nimrobo/mcporter-remote 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/.claude/settings.local.json +7 -0
- package/.gitattributes +2 -0
- package/.github/workflows/ci.yml +26 -0
- package/AGENTS.md +109 -0
- package/CHANGELOG.md +361 -0
- package/LICENSE +21 -0
- package/README.md +449 -0
- package/bin/git +180 -0
- package/biome.json +43 -0
- package/config/mcporter.json +134 -0
- package/dist/cli/adhoc-server.d.ts +21 -0
- package/dist/cli/adhoc-server.d.ts.map +1 -0
- package/dist/cli/adhoc-server.js +228 -0
- package/dist/cli/adhoc-server.js.map +1 -0
- package/dist/cli/auth-command.d.ts +6 -0
- package/dist/cli/auth-command.d.ts.map +1 -0
- package/dist/cli/auth-command.js +257 -0
- package/dist/cli/auth-command.js.map +1 -0
- package/dist/cli/call-argument-expression.d.ts +5 -0
- package/dist/cli/call-argument-expression.d.ts.map +1 -0
- package/dist/cli/call-argument-expression.js +57 -0
- package/dist/cli/call-argument-expression.js.map +1 -0
- package/dist/cli/call-argument-values.d.ts +10 -0
- package/dist/cli/call-argument-values.d.ts.map +1 -0
- package/dist/cli/call-argument-values.js +83 -0
- package/dist/cli/call-argument-values.js.map +1 -0
- package/dist/cli/call-arguments.d.ts +17 -0
- package/dist/cli/call-arguments.d.ts.map +1 -0
- package/dist/cli/call-arguments.js +183 -0
- package/dist/cli/call-arguments.js.map +1 -0
- package/dist/cli/call-command.d.ts +5 -0
- package/dist/cli/call-command.d.ts.map +1 -0
- package/dist/cli/call-command.js +371 -0
- package/dist/cli/call-command.js.map +1 -0
- package/dist/cli/call-expression-parser.d.ts +9 -0
- package/dist/cli/call-expression-parser.d.ts.map +1 -0
- package/dist/cli/call-expression-parser.js +177 -0
- package/dist/cli/call-expression-parser.js.map +1 -0
- package/dist/cli/cli-factory.d.ts +16 -0
- package/dist/cli/cli-factory.d.ts.map +1 -0
- package/dist/cli/cli-factory.js +37 -0
- package/dist/cli/cli-factory.js.map +1 -0
- package/dist/cli/command-inference.d.ts +12 -0
- package/dist/cli/command-inference.d.ts.map +1 -0
- package/dist/cli/command-inference.js +75 -0
- package/dist/cli/command-inference.js.map +1 -0
- package/dist/cli/config/add.d.ts +23 -0
- package/dist/cli/config/add.d.ts.map +1 -0
- package/dist/cli/config/add.js +267 -0
- package/dist/cli/config/add.js.map +1 -0
- package/dist/cli/config/auth.d.ts +4 -0
- package/dist/cli/config/auth.d.ts.map +1 -0
- package/dist/cli/config/auth.js +21 -0
- package/dist/cli/config/auth.js.map +1 -0
- package/dist/cli/config/doctor.d.ts +3 -0
- package/dist/cli/config/doctor.d.ts.map +1 -0
- package/dist/cli/config/doctor.js +26 -0
- package/dist/cli/config/doctor.js.map +1 -0
- package/dist/cli/config/get.d.ts +3 -0
- package/dist/cli/config/get.d.ts.map +1 -0
- package/dist/cli/config/get.js +45 -0
- package/dist/cli/config/get.js.map +1 -0
- package/dist/cli/config/help.d.ts +18 -0
- package/dist/cli/config/help.d.ts.map +1 -0
- package/dist/cli/config/help.js +193 -0
- package/dist/cli/config/help.js.map +1 -0
- package/dist/cli/config/import.d.ts +9 -0
- package/dist/cli/config/import.d.ts.map +1 -0
- package/dist/cli/config/import.js +88 -0
- package/dist/cli/config/import.js.map +1 -0
- package/dist/cli/config/index.d.ts +2 -0
- package/dist/cli/config/index.d.ts.map +1 -0
- package/dist/cli/config/index.js +2 -0
- package/dist/cli/config/index.js.map +1 -0
- package/dist/cli/config/list.d.ts +7 -0
- package/dist/cli/config/list.d.ts.map +1 -0
- package/dist/cli/config/list.js +71 -0
- package/dist/cli/config/list.js.map +1 -0
- package/dist/cli/config/remove.d.ts +3 -0
- package/dist/cli/config/remove.d.ts.map +1 -0
- package/dist/cli/config/remove.js +19 -0
- package/dist/cli/config/remove.js.map +1 -0
- package/dist/cli/config/render.d.ts +26 -0
- package/dist/cli/config/render.d.ts.map +1 -0
- package/dist/cli/config/render.js +99 -0
- package/dist/cli/config/render.js.map +1 -0
- package/dist/cli/config/shared.d.ts +21 -0
- package/dist/cli/config/shared.d.ts.map +1 -0
- package/dist/cli/config/shared.js +130 -0
- package/dist/cli/config/shared.js.map +1 -0
- package/dist/cli/config/types.d.ts +7 -0
- package/dist/cli/config/types.d.ts.map +1 -0
- package/dist/cli/config/types.js +2 -0
- package/dist/cli/config/types.js.map +1 -0
- package/dist/cli/config-command.d.ts +7 -0
- package/dist/cli/config-command.d.ts.map +1 -0
- package/dist/cli/config-command.js +67 -0
- package/dist/cli/config-command.js.map +1 -0
- package/dist/cli/daemon-command.d.ts +8 -0
- package/dist/cli/daemon-command.d.ts.map +1 -0
- package/dist/cli/daemon-command.js +219 -0
- package/dist/cli/daemon-command.js.map +1 -0
- package/dist/cli/emit-ts-command.d.ts +31 -0
- package/dist/cli/emit-ts-command.d.ts.map +1 -0
- package/dist/cli/emit-ts-command.js +217 -0
- package/dist/cli/emit-ts-command.js.map +1 -0
- package/dist/cli/emit-ts-templates.d.ts +23 -0
- package/dist/cli/emit-ts-templates.d.ts.map +1 -0
- package/dist/cli/emit-ts-templates.js +130 -0
- package/dist/cli/emit-ts-templates.js.map +1 -0
- package/dist/cli/ephemeral-flags.d.ts +7 -0
- package/dist/cli/ephemeral-flags.d.ts.map +1 -0
- package/dist/cli/ephemeral-flags.js +108 -0
- package/dist/cli/ephemeral-flags.js.map +1 -0
- package/dist/cli/ephemeral-target.d.ts +16 -0
- package/dist/cli/ephemeral-target.d.ts.map +1 -0
- package/dist/cli/ephemeral-target.js +105 -0
- package/dist/cli/ephemeral-target.js.map +1 -0
- package/dist/cli/errors.d.ts +4 -0
- package/dist/cli/errors.d.ts.map +1 -0
- package/dist/cli/errors.js +7 -0
- package/dist/cli/errors.js.map +1 -0
- package/dist/cli/flag-utils.d.ts +4 -0
- package/dist/cli/flag-utils.d.ts.map +1 -0
- package/dist/cli/flag-utils.js +27 -0
- package/dist/cli/flag-utils.js.map +1 -0
- package/dist/cli/generate/artifacts.d.ts +15 -0
- package/dist/cli/generate/artifacts.d.ts.map +1 -0
- package/dist/cli/generate/artifacts.js +247 -0
- package/dist/cli/generate/artifacts.js.map +1 -0
- package/dist/cli/generate/definition.d.ts +22 -0
- package/dist/cli/generate/definition.d.ts.map +1 -0
- package/dist/cli/generate/definition.js +265 -0
- package/dist/cli/generate/definition.js.map +1 -0
- package/dist/cli/generate/flag-parser.d.ts +11 -0
- package/dist/cli/generate/flag-parser.d.ts.map +1 -0
- package/dist/cli/generate/flag-parser.js +41 -0
- package/dist/cli/generate/flag-parser.js.map +1 -0
- package/dist/cli/generate/flags.d.ts +20 -0
- package/dist/cli/generate/flags.d.ts.map +1 -0
- package/dist/cli/generate/flags.js +220 -0
- package/dist/cli/generate/flags.js.map +1 -0
- package/dist/cli/generate/fs-helpers.d.ts +3 -0
- package/dist/cli/generate/fs-helpers.d.ts.map +1 -0
- package/dist/cli/generate/fs-helpers.js +34 -0
- package/dist/cli/generate/fs-helpers.js.map +1 -0
- package/dist/cli/generate/name-utils.d.ts +5 -0
- package/dist/cli/generate/name-utils.d.ts.map +1 -0
- package/dist/cli/generate/name-utils.js +170 -0
- package/dist/cli/generate/name-utils.js.map +1 -0
- package/dist/cli/generate/output.d.ts +5 -0
- package/dist/cli/generate/output.d.ts.map +1 -0
- package/dist/cli/generate/output.js +24 -0
- package/dist/cli/generate/output.js.map +1 -0
- package/dist/cli/generate/runtime.d.ts +3 -0
- package/dist/cli/generate/runtime.d.ts.map +1 -0
- package/dist/cli/generate/runtime.js +34 -0
- package/dist/cli/generate/runtime.js.map +1 -0
- package/dist/cli/generate/server-utils.d.ts +3 -0
- package/dist/cli/generate/server-utils.d.ts.map +1 -0
- package/dist/cli/generate/server-utils.js +33 -0
- package/dist/cli/generate/server-utils.js.map +1 -0
- package/dist/cli/generate/template-data.d.ts +25 -0
- package/dist/cli/generate/template-data.d.ts.map +1 -0
- package/dist/cli/generate/template-data.js +90 -0
- package/dist/cli/generate/template-data.js.map +1 -0
- package/dist/cli/generate/template-help.d.ts +2 -0
- package/dist/cli/generate/template-help.d.ts.map +1 -0
- package/dist/cli/generate/template-help.js +113 -0
- package/dist/cli/generate/template-help.js.map +1 -0
- package/dist/cli/generate/template.d.ts +30 -0
- package/dist/cli/generate/template.d.ts.map +1 -0
- package/dist/cli/generate/template.js +366 -0
- package/dist/cli/generate/template.js.map +1 -0
- package/dist/cli/generate/tools.d.ts +46 -0
- package/dist/cli/generate/tools.d.ts.map +1 -0
- package/dist/cli/generate/tools.js +304 -0
- package/dist/cli/generate/tools.js.map +1 -0
- package/dist/cli/generate/types.d.ts +5 -0
- package/dist/cli/generate/types.d.ts.map +1 -0
- package/dist/cli/generate/types.js +2 -0
- package/dist/cli/generate/types.js.map +1 -0
- package/dist/cli/generate-cli-runner.d.ts +3 -0
- package/dist/cli/generate-cli-runner.d.ts.map +1 -0
- package/dist/cli/generate-cli-runner.js +72 -0
- package/dist/cli/generate-cli-runner.js.map +1 -0
- package/dist/cli/help-output.d.ts +6 -0
- package/dist/cli/help-output.d.ts.map +1 -0
- package/dist/cli/help-output.js +186 -0
- package/dist/cli/help-output.js.map +1 -0
- package/dist/cli/http-utils.d.ts +9 -0
- package/dist/cli/http-utils.d.ts.map +1 -0
- package/dist/cli/http-utils.js +88 -0
- package/dist/cli/http-utils.js.map +1 -0
- package/dist/cli/identifier-helpers.d.ts +20 -0
- package/dist/cli/identifier-helpers.d.ts.map +1 -0
- package/dist/cli/identifier-helpers.js +84 -0
- package/dist/cli/identifier-helpers.js.map +1 -0
- package/dist/cli/image-output.d.ts +3 -0
- package/dist/cli/image-output.d.ts.map +1 -0
- package/dist/cli/image-output.js +57 -0
- package/dist/cli/image-output.js.map +1 -0
- package/dist/cli/inspect-cli-command.d.ts +11 -0
- package/dist/cli/inspect-cli-command.d.ts.map +1 -0
- package/dist/cli/inspect-cli-command.js +78 -0
- package/dist/cli/inspect-cli-command.js.map +1 -0
- package/dist/cli/json-output.d.ts +23 -0
- package/dist/cli/json-output.d.ts.map +1 -0
- package/dist/cli/json-output.js +38 -0
- package/dist/cli/json-output.js.map +1 -0
- package/dist/cli/list-command.d.ts +15 -0
- package/dist/cli/list-command.d.ts.map +1 -0
- package/dist/cli/list-command.js +372 -0
- package/dist/cli/list-command.js.map +1 -0
- package/dist/cli/list-detail-helpers.d.ts +41 -0
- package/dist/cli/list-detail-helpers.d.ts.map +1 -0
- package/dist/cli/list-detail-helpers.js +99 -0
- package/dist/cli/list-detail-helpers.js.map +1 -0
- package/dist/cli/list-doc-comments.d.ts +6 -0
- package/dist/cli/list-doc-comments.d.ts.map +1 -0
- package/dist/cli/list-doc-comments.js +114 -0
- package/dist/cli/list-doc-comments.js.map +1 -0
- package/dist/cli/list-format.d.ts +38 -0
- package/dist/cli/list-format.d.ts.map +1 -0
- package/dist/cli/list-format.js +98 -0
- package/dist/cli/list-format.js.map +1 -0
- package/dist/cli/list-output.d.ts +39 -0
- package/dist/cli/list-output.d.ts.map +1 -0
- package/dist/cli/list-output.js +159 -0
- package/dist/cli/list-output.js.map +1 -0
- package/dist/cli/list-signature.d.ts +26 -0
- package/dist/cli/list-signature.d.ts.map +1 -0
- package/dist/cli/list-signature.js +176 -0
- package/dist/cli/list-signature.js.map +1 -0
- package/dist/cli/logger-context.d.ts +9 -0
- package/dist/cli/logger-context.d.ts.map +1 -0
- package/dist/cli/logger-context.js +29 -0
- package/dist/cli/logger-context.js.map +1 -0
- package/dist/cli/output-format.d.ts +11 -0
- package/dist/cli/output-format.d.ts.map +1 -0
- package/dist/cli/output-format.js +51 -0
- package/dist/cli/output-format.js.map +1 -0
- package/dist/cli/output-utils.d.ts +5 -0
- package/dist/cli/output-utils.d.ts.map +1 -0
- package/dist/cli/output-utils.js +143 -0
- package/dist/cli/output-utils.js.map +1 -0
- package/dist/cli/path-utils.d.ts +2 -0
- package/dist/cli/path-utils.d.ts.map +1 -0
- package/dist/cli/path-utils.js +12 -0
- package/dist/cli/path-utils.js.map +1 -0
- package/dist/cli/runtime-debug.d.ts +4 -0
- package/dist/cli/runtime-debug.d.ts.map +1 -0
- package/dist/cli/runtime-debug.js +134 -0
- package/dist/cli/runtime-debug.js.map +1 -0
- package/dist/cli/server-lookup.d.ts +3 -0
- package/dist/cli/server-lookup.d.ts.map +1 -0
- package/dist/cli/server-lookup.js +21 -0
- package/dist/cli/server-lookup.js.map +1 -0
- package/dist/cli/terminal.d.ts +10 -0
- package/dist/cli/terminal.d.ts.map +1 -0
- package/dist/cli/terminal.js +33 -0
- package/dist/cli/terminal.js.map +1 -0
- package/dist/cli/timeouts.d.ts +9 -0
- package/dist/cli/timeouts.d.ts.map +1 -0
- package/dist/cli/timeouts.js +55 -0
- package/dist/cli/timeouts.js.map +1 -0
- package/dist/cli/tool-cache.d.ts +9 -0
- package/dist/cli/tool-cache.d.ts.map +1 -0
- package/dist/cli/tool-cache.js +31 -0
- package/dist/cli/tool-cache.js.map +1 -0
- package/dist/cli/transport-utils.d.ts +3 -0
- package/dist/cli/transport-utils.d.ts.map +1 -0
- package/dist/cli/transport-utils.js +9 -0
- package/dist/cli/transport-utils.js.map +1 -0
- package/dist/cli-metadata.d.ts +57 -0
- package/dist/cli-metadata.d.ts.map +1 -0
- package/dist/cli-metadata.js +92 -0
- package/dist/cli-metadata.js.map +1 -0
- package/dist/cli.d.ts +10 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +217 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/imports/external.d.ts +8 -0
- package/dist/config/imports/external.d.ts.map +1 -0
- package/dist/config/imports/external.js +231 -0
- package/dist/config/imports/external.js.map +1 -0
- package/dist/config/imports/paths-utils.d.ts +3 -0
- package/dist/config/imports/paths-utils.d.ts.map +1 -0
- package/dist/config/imports/paths-utils.js +27 -0
- package/dist/config/imports/paths-utils.js.map +1 -0
- package/dist/config/imports/paths.d.ts +3 -0
- package/dist/config/imports/paths.d.ts.map +1 -0
- package/dist/config/imports/paths.js +135 -0
- package/dist/config/imports/paths.js.map +1 -0
- package/dist/config/imports/shared.d.ts +4 -0
- package/dist/config/imports/shared.d.ts.map +1 -0
- package/dist/config/imports/shared.js +25 -0
- package/dist/config/imports/shared.js.map +1 -0
- package/dist/config/path-discovery.d.ts +11 -0
- package/dist/config/path-discovery.d.ts.map +1 -0
- package/dist/config/path-discovery.js +65 -0
- package/dist/config/path-discovery.js.map +1 -0
- package/dist/config/read-config.d.ts +9 -0
- package/dist/config/read-config.d.ts.map +1 -0
- package/dist/config/read-config.js +74 -0
- package/dist/config/read-config.js.map +1 -0
- package/dist/config-imports.d.ts +7 -0
- package/dist/config-imports.d.ts.map +1 -0
- package/dist/config-imports.js +8 -0
- package/dist/config-imports.js.map +1 -0
- package/dist/config-normalize.d.ts +8 -0
- package/dist/config-normalize.d.ts.map +1 -0
- package/dist/config-normalize.js +184 -0
- package/dist/config-normalize.js.map +1 -0
- package/dist/config-schema.d.ts +164 -0
- package/dist/config-schema.d.ts.map +1 -0
- package/dist/config-schema.js +103 -0
- package/dist/config-schema.js.map +1 -0
- package/dist/config.d.ts +17 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +91 -0
- package/dist/config.js.map +1 -0
- package/dist/daemon/client.d.ts +34 -0
- package/dist/daemon/client.d.ts.map +1 -0
- package/dist/daemon/client.js +291 -0
- package/dist/daemon/client.js.map +1 -0
- package/dist/daemon/config-layers.d.ts +7 -0
- package/dist/daemon/config-layers.d.ts.map +1 -0
- package/dist/daemon/config-layers.js +20 -0
- package/dist/daemon/config-layers.js.map +1 -0
- package/dist/daemon/host.d.ts +32 -0
- package/dist/daemon/host.d.ts.map +1 -0
- package/dist/daemon/host.js +345 -0
- package/dist/daemon/host.js.map +1 -0
- package/dist/daemon/launch.d.ts +10 -0
- package/dist/daemon/launch.d.ts.map +1 -0
- package/dist/daemon/launch.js +35 -0
- package/dist/daemon/launch.js.map +1 -0
- package/dist/daemon/log-context.d.ts +18 -0
- package/dist/daemon/log-context.d.ts.map +1 -0
- package/dist/daemon/log-context.js +64 -0
- package/dist/daemon/log-context.js.map +1 -0
- package/dist/daemon/paths.d.ts +5 -0
- package/dist/daemon/paths.d.ts.map +1 -0
- package/dist/daemon/paths.js +30 -0
- package/dist/daemon/paths.js.map +1 -0
- package/dist/daemon/protocol.d.ts +51 -0
- package/dist/daemon/protocol.d.ts.map +1 -0
- package/dist/daemon/protocol.js +2 -0
- package/dist/daemon/protocol.js.map +1 -0
- package/dist/daemon/request-utils.d.ts +12 -0
- package/dist/daemon/request-utils.d.ts.map +1 -0
- package/dist/daemon/request-utils.js +52 -0
- package/dist/daemon/request-utils.js.map +1 -0
- package/dist/daemon/runtime-wrapper.d.ts +9 -0
- package/dist/daemon/runtime-wrapper.d.ts.map +1 -0
- package/dist/daemon/runtime-wrapper.js +110 -0
- package/dist/daemon/runtime-wrapper.js.map +1 -0
- package/dist/env.d.ts +5 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +93 -0
- package/dist/env.js.map +1 -0
- package/dist/error-classifier.d.ts +11 -0
- package/dist/error-classifier.d.ts.map +1 -0
- package/dist/error-classifier.js +141 -0
- package/dist/error-classifier.js.map +1 -0
- package/dist/fs-json.d.ts +3 -0
- package/dist/fs-json.d.ts.map +1 -0
- package/dist/fs-json.js +21 -0
- package/dist/fs-json.js.map +1 -0
- package/dist/generate-cli.d.ts +32 -0
- package/dist/generate-cli.d.ts.map +1 -0
- package/dist/generate-cli.js +155 -0
- package/dist/generate-cli.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/lifecycle.d.ts +8 -0
- package/dist/lifecycle.d.ts.map +1 -0
- package/dist/lifecycle.js +106 -0
- package/dist/lifecycle.js.map +1 -0
- package/dist/logging.d.ts +19 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/logging.js +76 -0
- package/dist/logging.js.map +1 -0
- package/dist/oauth-manual.d.ts +9 -0
- package/dist/oauth-manual.d.ts.map +1 -0
- package/dist/oauth-manual.js +84 -0
- package/dist/oauth-manual.js.map +1 -0
- package/dist/oauth-persistence.d.ts +20 -0
- package/dist/oauth-persistence.d.ts.map +1 -0
- package/dist/oauth-persistence.js +254 -0
- package/dist/oauth-persistence.js.map +1 -0
- package/dist/oauth-vault.d.ts +19 -0
- package/dist/oauth-vault.d.ts.map +1 -0
- package/dist/oauth-vault.js +100 -0
- package/dist/oauth-vault.js.map +1 -0
- package/dist/oauth.d.ts +31 -0
- package/dist/oauth.d.ts.map +1 -0
- package/dist/oauth.js +414 -0
- package/dist/oauth.js.map +1 -0
- package/dist/result-utils.d.ts +22 -0
- package/dist/result-utils.d.ts.map +1 -0
- package/dist/result-utils.js +229 -0
- package/dist/result-utils.js.map +1 -0
- package/dist/runtime/errors.d.ts +2 -0
- package/dist/runtime/errors.d.ts.map +1 -0
- package/dist/runtime/errors.js +16 -0
- package/dist/runtime/errors.js.map +1 -0
- package/dist/runtime/http-transport.d.ts +15 -0
- package/dist/runtime/http-transport.d.ts.map +1 -0
- package/dist/runtime/http-transport.js +91 -0
- package/dist/runtime/http-transport.js.map +1 -0
- package/dist/runtime/manual-oauth.d.ts +8 -0
- package/dist/runtime/manual-oauth.d.ts.map +1 -0
- package/dist/runtime/manual-oauth.js +81 -0
- package/dist/runtime/manual-oauth.js.map +1 -0
- package/dist/runtime/oauth.d.ts +22 -0
- package/dist/runtime/oauth.d.ts.map +1 -0
- package/dist/runtime/oauth.js +83 -0
- package/dist/runtime/oauth.js.map +1 -0
- package/dist/runtime/transport.d.ts +24 -0
- package/dist/runtime/transport.d.ts.map +1 -0
- package/dist/runtime/transport.js +165 -0
- package/dist/runtime/transport.js.map +1 -0
- package/dist/runtime/utils.d.ts +5 -0
- package/dist/runtime/utils.d.ts.map +1 -0
- package/dist/runtime/utils.js +47 -0
- package/dist/runtime/utils.js.map +1 -0
- package/dist/runtime-header-utils.d.ts +2 -0
- package/dist/runtime-header-utils.d.ts.map +1 -0
- package/dist/runtime-header-utils.js +19 -0
- package/dist/runtime-header-utils.js.map +1 -0
- package/dist/runtime-oauth-support.d.ts +5 -0
- package/dist/runtime-oauth-support.d.ts.map +1 -0
- package/dist/runtime-oauth-support.js +21 -0
- package/dist/runtime-oauth-support.js.map +1 -0
- package/dist/runtime-process-utils.d.ts +11 -0
- package/dist/runtime-process-utils.d.ts.map +1 -0
- package/dist/runtime-process-utils.js +299 -0
- package/dist/runtime-process-utils.js.map +1 -0
- package/dist/runtime.d.ts +55 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +245 -0
- package/dist/runtime.js.map +1 -0
- package/dist/schema-cache.d.ts +10 -0
- package/dist/schema-cache.d.ts.map +1 -0
- package/dist/schema-cache.js +40 -0
- package/dist/schema-cache.js.map +1 -0
- package/dist/sdk-patches.d.ts +5 -0
- package/dist/sdk-patches.d.ts.map +1 -0
- package/dist/sdk-patches.js +399 -0
- package/dist/sdk-patches.js.map +1 -0
- package/dist/server-proxy.d.ts +17 -0
- package/dist/server-proxy.d.ts.map +1 -0
- package/dist/server-proxy.js +342 -0
- package/dist/server-proxy.js.map +1 -0
- package/docs/RELEASE.md +96 -0
- package/docs/adhoc.md +76 -0
- package/docs/call-heuristic.md +31 -0
- package/docs/call-syntax.md +75 -0
- package/docs/cli-generator.md +116 -0
- package/docs/cli-reference.md +76 -0
- package/docs/config.md +208 -0
- package/docs/daemon.md +95 -0
- package/docs/emit-ts.md +98 -0
- package/docs/hang-debug.md +88 -0
- package/docs/import.md +59 -0
- package/docs/known-issues.md +33 -0
- package/docs/livetests.md +31 -0
- package/docs/local.md +73 -0
- package/docs/logging.md +67 -0
- package/docs/manual-testing.md +78 -0
- package/docs/mcp.md +44 -0
- package/docs/migration.md +77 -0
- package/docs/pnpm-mcp-migration.md +15 -0
- package/docs/refactor.md +76 -0
- package/docs/shortcuts.md +31 -0
- package/docs/spec.md +86 -0
- package/docs/subagent.md +39 -0
- package/docs/supabase-auth-issue.md +53 -0
- package/docs/tmux.md +30 -0
- package/docs/tool-calling.md +73 -0
- package/docs/windows.md +25 -0
- package/examples/context7-headlines.ts +72 -0
- package/git +3 -0
- package/mcporter.png +0 -0
- package/mcporter.schema.json +263 -0
- package/package.json +105 -0
- package/pnpm-workspace.yaml +2 -0
- package/runner +13 -0
- package/scripts/agent-send.ts +179 -0
- package/scripts/build-bun.ts +125 -0
- package/scripts/committer +53 -0
- package/scripts/docs-list.ts +132 -0
- package/scripts/generate-json-schema.ts +50 -0
- package/scripts/git-policy.ts +165 -0
- package/scripts/mcp_signoz_retry_patch.cjs +9 -0
- package/scripts/release.sh +86 -0
- package/scripts/runner.ts +1556 -0
- package/scripts/test-runner.js +39 -0
- package/src/cli/adhoc-server.ts +263 -0
- package/src/cli/auth-command.ts +290 -0
- package/src/cli/call-argument-expression.ts +61 -0
- package/src/cli/call-argument-values.ts +95 -0
- package/src/cli/call-arguments.ts +246 -0
- package/src/cli/call-command.ts +478 -0
- package/src/cli/call-expression-parser.ts +210 -0
- package/src/cli/cli-factory.ts +51 -0
- package/src/cli/command-inference.ts +99 -0
- package/src/cli/config/add.ts +308 -0
- package/src/cli/config/auth.ts +23 -0
- package/src/cli/config/doctor.ts +27 -0
- package/src/cli/config/get.ts +47 -0
- package/src/cli/config/help.ts +213 -0
- package/src/cli/config/import.ts +97 -0
- package/src/cli/config/index.ts +1 -0
- package/src/cli/config/list.ts +81 -0
- package/src/cli/config/remove.ts +20 -0
- package/src/cli/config/render.ts +119 -0
- package/src/cli/config/shared.ts +159 -0
- package/src/cli/config/types.ts +8 -0
- package/src/cli/config-command.ts +72 -0
- package/src/cli/daemon-command.ts +260 -0
- package/src/cli/emit-ts-command.ts +260 -0
- package/src/cli/emit-ts-templates.ts +161 -0
- package/src/cli/ephemeral-flags.ts +128 -0
- package/src/cli/ephemeral-target.ts +134 -0
- package/src/cli/errors.ts +6 -0
- package/src/cli/flag-utils.ts +29 -0
- package/src/cli/generate/artifacts.ts +308 -0
- package/src/cli/generate/definition.ts +325 -0
- package/src/cli/generate/flag-parser.ts +50 -0
- package/src/cli/generate/flags.ts +248 -0
- package/src/cli/generate/fs-helpers.ts +34 -0
- package/src/cli/generate/name-utils.ts +176 -0
- package/src/cli/generate/output.ts +27 -0
- package/src/cli/generate/runtime.ts +38 -0
- package/src/cli/generate/server-utils.ts +38 -0
- package/src/cli/generate/template-data.ts +126 -0
- package/src/cli/generate/template-help.ts +112 -0
- package/src/cli/generate/template.ts +407 -0
- package/src/cli/generate/tools.ts +354 -0
- package/src/cli/generate/types.ts +1 -0
- package/src/cli/generate-cli-runner.ts +82 -0
- package/src/cli/help-output.ts +207 -0
- package/src/cli/http-utils.ts +89 -0
- package/src/cli/identifier-helpers.ts +107 -0
- package/src/cli/image-output.ts +62 -0
- package/src/cli/inspect-cli-command.ts +89 -0
- package/src/cli/json-output.ts +60 -0
- package/src/cli/list-command.ts +432 -0
- package/src/cli/list-detail-helpers.ts +179 -0
- package/src/cli/list-doc-comments.ts +129 -0
- package/src/cli/list-format.ts +150 -0
- package/src/cli/list-output.ts +224 -0
- package/src/cli/list-signature.ts +217 -0
- package/src/cli/logger-context.ts +36 -0
- package/src/cli/output-format.ts +63 -0
- package/src/cli/output-utils.ts +161 -0
- package/src/cli/path-utils.ts +13 -0
- package/src/cli/runtime-debug.ts +141 -0
- package/src/cli/server-lookup.ts +22 -0
- package/src/cli/terminal.ts +41 -0
- package/src/cli/timeouts.ts +67 -0
- package/src/cli/tool-cache.ts +43 -0
- package/src/cli/transport-utils.ts +10 -0
- package/src/cli-metadata.ts +164 -0
- package/src/cli.ts +234 -0
- package/src/config/imports/external.ts +284 -0
- package/src/config/imports/paths-utils.ts +29 -0
- package/src/config/imports/paths.ts +145 -0
- package/src/config/imports/shared.ts +27 -0
- package/src/config/path-discovery.ts +79 -0
- package/src/config/read-config.ts +91 -0
- package/src/config-imports.ts +12 -0
- package/src/config-normalize.ts +220 -0
- package/src/config-schema.ts +175 -0
- package/src/config.ts +136 -0
- package/src/daemon/client.ts +350 -0
- package/src/daemon/config-layers.ts +23 -0
- package/src/daemon/host.ts +455 -0
- package/src/daemon/launch.ts +45 -0
- package/src/daemon/log-context.ts +78 -0
- package/src/daemon/paths.ts +35 -0
- package/src/daemon/protocol.ts +57 -0
- package/src/daemon/request-utils.ts +67 -0
- package/src/daemon/runtime-wrapper.ts +135 -0
- package/src/env.ts +107 -0
- package/src/error-classifier.ts +158 -0
- package/src/fs-json.ts +21 -0
- package/src/generate-cli.ts +211 -0
- package/src/index.ts +14 -0
- package/src/lifecycle.ts +138 -0
- package/src/logging.ts +93 -0
- package/src/oauth-manual.ts +103 -0
- package/src/oauth-persistence.ts +316 -0
- package/src/oauth-vault.ts +128 -0
- package/src/oauth.ts +494 -0
- package/src/result-utils.ts +278 -0
- package/src/runtime/errors.ts +17 -0
- package/src/runtime/oauth.ts +112 -0
- package/src/runtime/transport.ts +198 -0
- package/src/runtime/utils.ts +54 -0
- package/src/runtime-header-utils.ts +23 -0
- package/src/runtime-oauth-support.ts +24 -0
- package/src/runtime-process-utils.ts +324 -0
- package/src/runtime.ts +321 -0
- package/src/schema-cache.ts +49 -0
- package/src/sdk-patches.ts +498 -0
- package/src/server-proxy.ts +407 -0
- package/tests/adhoc-server.test.ts +49 -0
- package/tests/call-arguments.test.ts +111 -0
- package/tests/cli-auth-help.test.ts +43 -0
- package/tests/cli-auth-retry.test.ts +41 -0
- package/tests/cli-auth.test.ts +96 -0
- package/tests/cli-call-args.test.ts +69 -0
- package/tests/cli-call-errors.test.ts +27 -0
- package/tests/cli-call-execution.test.ts +279 -0
- package/tests/cli-call-help.test.ts +43 -0
- package/tests/cli-command-inference.test.ts +73 -0
- package/tests/cli-config-command.test.ts +371 -0
- package/tests/cli-config-fallback.test.ts +259 -0
- package/tests/cli-config-routing.test.ts +20 -0
- package/tests/cli-ephemeral-flags.test.ts +54 -0
- package/tests/cli-flag-utils.test.ts +17 -0
- package/tests/cli-generate-artifacts.test.ts +52 -0
- package/tests/cli-generate-cli.integration.test.ts +675 -0
- package/tests/cli-generate-runner.test.ts +156 -0
- package/tests/cli-global-flags.test.ts +61 -0
- package/tests/cli-help-shortcuts.test.ts +42 -0
- package/tests/cli-image-output.test.ts +65 -0
- package/tests/cli-inspect-command.test.ts +15 -0
- package/tests/cli-list-classification.test.ts +291 -0
- package/tests/cli-list-flags.test.ts +83 -0
- package/tests/cli-list-formatting.test.ts +358 -0
- package/tests/cli-list-help.test.ts +43 -0
- package/tests/cli-list-json.test.ts +55 -0
- package/tests/cli-list-stdio-logs.test.ts +108 -0
- package/tests/cli-list-verbose-e2e.test.ts +83 -0
- package/tests/cli-oauth-timeout-flag.test.ts +94 -0
- package/tests/cli-output-utils.test.ts +129 -0
- package/tests/cli-regenerate.test.ts +261 -0
- package/tests/cli-version.test.ts +24 -0
- package/tests/config-add-dry-run.test.ts +45 -0
- package/tests/config-add-flags.test.ts +61 -0
- package/tests/config-add-imports.test.ts +28 -0
- package/tests/config-add-persist.test.ts +27 -0
- package/tests/config-add-scope-behavior.test.ts +46 -0
- package/tests/config-add-scope.test.ts +101 -0
- package/tests/config-add-sse.test.ts +23 -0
- package/tests/config-command-string.test.ts +96 -0
- package/tests/config-doctor.test.ts +45 -0
- package/tests/config-get-json.test.ts +24 -0
- package/tests/config-import-dedupe.test.ts +27 -0
- package/tests/config-import-paths.test.ts +49 -0
- package/tests/config-import.test.ts +64 -0
- package/tests/config-imports-unit.test.ts +337 -0
- package/tests/config-imports.test.ts +417 -0
- package/tests/config-layered.test.ts +178 -0
- package/tests/config-list-text-footer.test.ts +33 -0
- package/tests/config-list.test.ts +62 -0
- package/tests/config-missing.test.ts +140 -0
- package/tests/config-normalize.test.ts +71 -0
- package/tests/config-remove.test.ts +44 -0
- package/tests/config-render.test.ts +61 -0
- package/tests/config-resolution.test.ts +94 -0
- package/tests/config-schema-file.test.ts +29 -0
- package/tests/config-shared.test.ts +41 -0
- package/tests/config-sources.test.ts +58 -0
- package/tests/daemon-cli-command.test.ts +112 -0
- package/tests/daemon-client-config-stale.test.ts +222 -0
- package/tests/daemon-client-timeout.test.ts +114 -0
- package/tests/daemon-client.test.ts +61 -0
- package/tests/daemon-host.test.ts +33 -0
- package/tests/daemon.integration.test.ts +175 -0
- package/tests/emit-ts.test.ts +125 -0
- package/tests/ephemeral-target.test.ts +26 -0
- package/tests/error-classifier.test.ts +46 -0
- package/tests/fixtures/ansi.ts +18 -0
- package/tests/fixtures/cli-list-fixtures.ts +43 -0
- package/tests/fixtures/config-fixture.ts +29 -0
- package/tests/fixtures/imports/.claude/mcp.json +8 -0
- package/tests/fixtures/imports/.claude/settings.json +10 -0
- package/tests/fixtures/imports/.claude/settings.local.json +10 -0
- package/tests/fixtures/imports/.codeium/windsurf/mcp_config.json +14 -0
- package/tests/fixtures/imports/.codex/config.toml +7 -0
- package/tests/fixtures/imports/.config/opencode/opencode.jsonc +10 -0
- package/tests/fixtures/imports/.cursor/mcp.json +14 -0
- package/tests/fixtures/imports/Library/Application Support/Code/User/mcp.json +11 -0
- package/tests/fixtures/imports/config/mcporter.json +11 -0
- package/tests/fixtures/imports/home/.claude/settings.json +7 -0
- package/tests/fixtures/imports/home/.codeium/windsurf/mcp_config.json +14 -0
- package/tests/fixtures/imports/home/.codex/config.toml +7 -0
- package/tests/fixtures/imports/home/Library/Application Support/Code/User/mcp.json +11 -0
- package/tests/fixtures/imports/opencode.jsonc +11 -0
- package/tests/fixtures/mcporter.json +64 -0
- package/tests/fixtures/stdio-filesystem-server.mjs +63 -0
- package/tests/fixtures/stdio-memory-server.mjs +58 -0
- package/tests/fixtures/test-helpers.ts +24 -0
- package/tests/fixtures/tool-fixtures.ts +35 -0
- package/tests/fs-json.test.ts +35 -0
- package/tests/generate-cli-helpers.test.ts +162 -0
- package/tests/generate-cli.test.ts +595 -0
- package/tests/generate-definition.test.ts +25 -0
- package/tests/generator-flag-parser.test.ts +19 -0
- package/tests/index-api.test.ts +136 -0
- package/tests/keep-alive-runtime.test.ts +152 -0
- package/tests/lifecycle.test.ts +29 -0
- package/tests/list-detail-helpers.test.ts +204 -0
- package/tests/list-format.test.ts +40 -0
- package/tests/list-inline-stdio.test.ts +71 -0
- package/tests/list-output.test.ts +138 -0
- package/tests/live/deepwiki-live.test.ts +53 -0
- package/tests/oauth-callback.test.ts +108 -0
- package/tests/oauth-open-external.test.ts +29 -0
- package/tests/oauth-persistence.test.ts +146 -0
- package/tests/oauth-session.test.ts +216 -0
- package/tests/result-utils.test.ts +254 -0
- package/tests/runtime-call-timeout.test.ts +75 -0
- package/tests/runtime-compose.test.ts +298 -0
- package/tests/runtime-error-reset.test.ts +65 -0
- package/tests/runtime-header-utils.test.ts +36 -0
- package/tests/runtime-integration.test.ts +113 -0
- package/tests/runtime-oauth-connect.test.ts +72 -0
- package/tests/runtime-oauth-detection.test.ts +72 -0
- package/tests/runtime-oauth-timeout.test.ts +60 -0
- package/tests/runtime-oauth-utils.test.ts +14 -0
- package/tests/runtime-process-utils.test.ts +53 -0
- package/tests/runtime-transport.test.ts +69 -0
- package/tests/runtime-utils.test.ts +31 -0
- package/tests/runtime.test.ts +94 -0
- package/tests/sdk-patches.test.ts +24 -0
- package/tests/server-proxy.test.ts +336 -0
- package/tests/stdio-servers.integration.test.ts +139 -0
- package/tests/tool-cache.test.ts +42 -0
- package/tests/version-consistency.test.ts +11 -0
- package/tsconfig.build.json +11 -0
- package/tsconfig.json +17 -0
- package/vitest.config.ts +18 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import type { ServerDefinition } from '../src/config.js';
|
|
3
|
+
|
|
4
|
+
process.env.MCPORTER_DISABLE_AUTORUN = '1';
|
|
5
|
+
const cliModulePromise = import('../src/cli.js');
|
|
6
|
+
|
|
7
|
+
const createRuntimeDouble = () => {
|
|
8
|
+
const definitions = new Map<string, Record<string, unknown>>();
|
|
9
|
+
const registerDefinition = vi.fn((definition: Record<string, unknown>) => {
|
|
10
|
+
definitions.set(definition.name as string, { ...definition });
|
|
11
|
+
});
|
|
12
|
+
const getDefinition = vi.fn((name: string) => {
|
|
13
|
+
const definition = definitions.get(name);
|
|
14
|
+
if (!definition) {
|
|
15
|
+
throw new Error(`Unknown MCP server '${name}'.`);
|
|
16
|
+
}
|
|
17
|
+
return definition;
|
|
18
|
+
});
|
|
19
|
+
const listTools = vi.fn().mockResolvedValue([{ name: 'ok' }]);
|
|
20
|
+
const runtime = {
|
|
21
|
+
registerDefinition,
|
|
22
|
+
getDefinition,
|
|
23
|
+
getDefinitions: () => Array.from(definitions.values()),
|
|
24
|
+
listTools,
|
|
25
|
+
} as unknown as Awaited<ReturnType<typeof import('../src/runtime.js')['createRuntime']>>;
|
|
26
|
+
return { runtime, listTools };
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
describe('mcporter auth ad-hoc support', () => {
|
|
30
|
+
it('registers ad-hoc HTTP servers via --http-url', async () => {
|
|
31
|
+
const { handleAuth } = await cliModulePromise;
|
|
32
|
+
const { runtime, listTools } = createRuntimeDouble();
|
|
33
|
+
|
|
34
|
+
await handleAuth(runtime, ['--http-url', 'https://mcp.deepwiki.com/sse']);
|
|
35
|
+
|
|
36
|
+
expect(listTools).toHaveBeenCalledWith('mcp-deepwiki-com-sse', { autoAuthorize: true });
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('accepts bare URLs as the auth target', async () => {
|
|
40
|
+
const { handleAuth } = await cliModulePromise;
|
|
41
|
+
const { runtime, listTools } = createRuntimeDouble();
|
|
42
|
+
|
|
43
|
+
await handleAuth(runtime, ['https://mcp.supabase.com/mcp']);
|
|
44
|
+
|
|
45
|
+
expect(listTools).toHaveBeenCalledWith('mcp-supabase-com-mcp', { autoAuthorize: true });
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('reuses configured servers when auth target is a URL', async () => {
|
|
49
|
+
const { handleAuth } = await cliModulePromise;
|
|
50
|
+
const definition = {
|
|
51
|
+
name: 'vercel',
|
|
52
|
+
command: { kind: 'http', url: new URL('https://mcp.vercel.com') },
|
|
53
|
+
tokenCacheDir: '/tmp/cache',
|
|
54
|
+
} as ServerDefinition;
|
|
55
|
+
const registerDefinition = vi.fn();
|
|
56
|
+
const listTools = vi.fn().mockResolvedValue([{ name: 'ok' }]);
|
|
57
|
+
const runtime = {
|
|
58
|
+
getDefinitions: () => [definition],
|
|
59
|
+
registerDefinition,
|
|
60
|
+
listTools,
|
|
61
|
+
getDefinition: () => definition,
|
|
62
|
+
} as unknown as Awaited<ReturnType<typeof import('../src/runtime.js')['createRuntime']>>;
|
|
63
|
+
|
|
64
|
+
await handleAuth(runtime, ['https://mcp.vercel.com']);
|
|
65
|
+
|
|
66
|
+
expect(listTools).toHaveBeenCalledWith('vercel', { autoAuthorize: true });
|
|
67
|
+
expect(registerDefinition).not.toHaveBeenCalled();
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('emits JSON envelopes when auth fails and --json is provided', async () => {
|
|
71
|
+
const { handleAuth } = await cliModulePromise;
|
|
72
|
+
const definition = {
|
|
73
|
+
name: 'linear',
|
|
74
|
+
command: { kind: 'http', url: new URL('https://mcp.linear.app/mcp') },
|
|
75
|
+
} as ServerDefinition;
|
|
76
|
+
const runtime = {
|
|
77
|
+
getDefinitions: () => [definition],
|
|
78
|
+
registerDefinition: vi.fn(),
|
|
79
|
+
listTools: vi.fn().mockRejectedValue(new Error('fetch failed: connect ECONNREFUSED 127.0.0.1:9000')),
|
|
80
|
+
getDefinition: () => definition,
|
|
81
|
+
} as unknown as Awaited<ReturnType<typeof import('../src/runtime.js')['createRuntime']>>;
|
|
82
|
+
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
83
|
+
const errorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
84
|
+
|
|
85
|
+
await expect(handleAuth(runtime, ['linear', '--json'])).resolves.toBeUndefined();
|
|
86
|
+
|
|
87
|
+
expect(process.exitCode).toBe(1);
|
|
88
|
+
const payload = JSON.parse(logSpy.mock.calls.at(-1)?.[0] ?? '{}');
|
|
89
|
+
expect(payload.server).toBe('linear');
|
|
90
|
+
expect(payload.issue.kind).toBe('offline');
|
|
91
|
+
|
|
92
|
+
logSpy.mockRestore();
|
|
93
|
+
errorSpy.mockRestore();
|
|
94
|
+
process.exitCode = undefined;
|
|
95
|
+
});
|
|
96
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { CliUsageError } from '../src/cli/errors.js';
|
|
3
|
+
|
|
4
|
+
process.env.MCPORTER_DISABLE_AUTORUN = '1';
|
|
5
|
+
const cliModulePromise = import('../src/cli.js');
|
|
6
|
+
|
|
7
|
+
describe('CLI call argument parsing', () => {
|
|
8
|
+
it('treats quoted stdio commands as ad-hoc servers without --stdio', async () => {
|
|
9
|
+
const { parseCallArguments } = await cliModulePromise;
|
|
10
|
+
const parsed = parseCallArguments(['npx -y vercel-domains-mcp', 'domain=answeroverflow.com']);
|
|
11
|
+
expect(parsed.selector).toBeUndefined();
|
|
12
|
+
expect(parsed.ephemeral?.stdioCommand).toBe('npx -y vercel-domains-mcp');
|
|
13
|
+
expect(parsed.args).toEqual({ domain: 'answeroverflow.com' });
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('falls back to default call timeout when env is empty', async () => {
|
|
17
|
+
vi.stubEnv('MCPORTER_CALL_TIMEOUT', '');
|
|
18
|
+
try {
|
|
19
|
+
const { resolveCallTimeout } = await cliModulePromise;
|
|
20
|
+
expect(resolveCallTimeout()).toBe(60_000);
|
|
21
|
+
} finally {
|
|
22
|
+
vi.unstubAllEnvs();
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('accepts server and tool as separate positional arguments', async () => {
|
|
27
|
+
const { parseCallArguments } = await cliModulePromise;
|
|
28
|
+
const parsed = parseCallArguments(['chrome-devtools', 'list_pages']);
|
|
29
|
+
expect(parsed.selector).toBe('chrome-devtools');
|
|
30
|
+
expect(parsed.tool).toBe('list_pages');
|
|
31
|
+
expect(parsed.args).toEqual({});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('captures timeout flag values', async () => {
|
|
35
|
+
const { parseCallArguments } = await cliModulePromise;
|
|
36
|
+
const parsed = parseCallArguments(['chrome-devtools', '--timeout', '2500', '--tool', 'list_pages']);
|
|
37
|
+
expect(parsed.selector).toBe('chrome-devtools');
|
|
38
|
+
expect(parsed.tool).toBe('list_pages');
|
|
39
|
+
expect(parsed.timeoutMs).toBe(2500);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('parses function-call syntax with named arguments', async () => {
|
|
43
|
+
const { parseCallArguments } = await cliModulePromise;
|
|
44
|
+
const parsed = parseCallArguments(['linear.create_comment(issueId: "ISSUE-123", notify: false)']);
|
|
45
|
+
expect(parsed.server).toBe('linear');
|
|
46
|
+
expect(parsed.tool).toBe('create_comment');
|
|
47
|
+
expect(parsed.args).toEqual({ issueId: 'ISSUE-123', notify: false });
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('parses HTTP call expressions with named arguments', async () => {
|
|
51
|
+
const { parseCallArguments } = await cliModulePromise;
|
|
52
|
+
const parsed = parseCallArguments(['https://www.shadcn.io/api/mcp.getComponent(component: "vortex")']);
|
|
53
|
+
expect(parsed.server).toBe('https://www.shadcn.io/api/mcp');
|
|
54
|
+
expect(parsed.tool).toBe('getComponent');
|
|
55
|
+
expect(parsed.args).toEqual({ component: 'vortex' });
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('rejects conflicting server names between flags and call syntax', async () => {
|
|
59
|
+
const { parseCallArguments } = await cliModulePromise;
|
|
60
|
+
expect(() => parseCallArguments(['--server', 'github', 'linear.create_comment(issueId: "123")'])).toThrow(
|
|
61
|
+
/Conflicting server names/
|
|
62
|
+
);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('surfaces a helpful error when function-call syntax cannot be parsed', async () => {
|
|
66
|
+
const { parseCallArguments } = await cliModulePromise;
|
|
67
|
+
expect(() => parseCallArguments(['linear.create_comment(oops)'])).toThrow(CliUsageError);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
|
|
3
|
+
process.env.MCPORTER_DISABLE_AUTORUN = '1';
|
|
4
|
+
const cliModulePromise = import('../src/cli.js');
|
|
5
|
+
|
|
6
|
+
describe('CLI call error reporting', () => {
|
|
7
|
+
it('reports connection issues and emits JSON payloads when requested', async () => {
|
|
8
|
+
const { handleCall } = await cliModulePromise;
|
|
9
|
+
const callTool = vi.fn().mockRejectedValue(new Error('SSE error: Non-200 status code (401)'));
|
|
10
|
+
const runtime = {
|
|
11
|
+
callTool,
|
|
12
|
+
close: vi.fn().mockResolvedValue(undefined),
|
|
13
|
+
} as unknown as Awaited<ReturnType<typeof import('../src/runtime.js')['createRuntime']>>;
|
|
14
|
+
|
|
15
|
+
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
16
|
+
const errorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
17
|
+
|
|
18
|
+
await handleCall(runtime, ['github.list_repos', '--output', 'json']);
|
|
19
|
+
|
|
20
|
+
const payload = JSON.parse(logSpy.mock.calls.at(-1)?.[0] ?? '{}');
|
|
21
|
+
expect(payload.issue?.kind).toBe('auth');
|
|
22
|
+
expect(errorSpy.mock.calls.some((call) => call.join(' ').includes('Authorization required'))).toBe(true);
|
|
23
|
+
|
|
24
|
+
logSpy.mockRestore();
|
|
25
|
+
errorSpy.mockRestore();
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { resolveEphemeralServer } from '../src/cli/adhoc-server.js';
|
|
3
|
+
import type { ServerDefinition } from '../src/config.js';
|
|
4
|
+
|
|
5
|
+
process.env.MCPORTER_DISABLE_AUTORUN = '1';
|
|
6
|
+
const cliModulePromise = import('../src/cli.js');
|
|
7
|
+
|
|
8
|
+
describe('CLI call execution behavior', () => {
|
|
9
|
+
it('auto-selects the sole tool when omitted', async () => {
|
|
10
|
+
const toolName = 'list_issues';
|
|
11
|
+
const { handleCall } = await cliModulePromise;
|
|
12
|
+
const { runtime, callTool } = createRuntimeStub(
|
|
13
|
+
{
|
|
14
|
+
linear: [
|
|
15
|
+
{
|
|
16
|
+
name: toolName,
|
|
17
|
+
description: 'List issues',
|
|
18
|
+
inputSchema: {
|
|
19
|
+
type: 'object',
|
|
20
|
+
properties: {
|
|
21
|
+
limit: { type: 'number' },
|
|
22
|
+
},
|
|
23
|
+
required: [],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
definitions: [
|
|
30
|
+
{
|
|
31
|
+
name: 'linear',
|
|
32
|
+
command: { kind: 'stdio', command: 'linear', args: [], cwd: process.cwd() },
|
|
33
|
+
source: { kind: 'local', path: '<test>' },
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
39
|
+
await handleCall(runtime, ['linear', 'limit=5']);
|
|
40
|
+
expect(callTool).toHaveBeenCalledWith('linear', toolName, expect.objectContaining({ args: { limit: 5 } }));
|
|
41
|
+
logSpy.mockRestore();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('still requires an explicit tool when multiple are available', async () => {
|
|
45
|
+
const { handleCall } = await cliModulePromise;
|
|
46
|
+
const { runtime, callTool } = createRuntimeStub(
|
|
47
|
+
{
|
|
48
|
+
linear: [
|
|
49
|
+
{ name: 'list_issues', inputSchema: {} },
|
|
50
|
+
{ name: 'create_issue', inputSchema: {} },
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
definitions: [
|
|
55
|
+
{
|
|
56
|
+
name: 'linear',
|
|
57
|
+
command: { kind: 'stdio', command: 'linear', args: [], cwd: process.cwd() },
|
|
58
|
+
source: { kind: 'local', path: '<test>' },
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
await expect(handleCall(runtime, ['linear'])).rejects.toThrow(
|
|
64
|
+
'Missing tool name. Provide it via <server>.<tool> or --tool.'
|
|
65
|
+
);
|
|
66
|
+
expect(callTool).not.toHaveBeenCalled();
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('runs quoted stdio commands without --stdio and infers the tool automatically', async () => {
|
|
70
|
+
const command = 'npx -y vercel-domains-mcp';
|
|
71
|
+
const { name: adhocName } = resolveEphemeralServer({ stdioCommand: command });
|
|
72
|
+
const { handleCall } = await cliModulePromise;
|
|
73
|
+
const { runtime, callTool } = createRuntimeStub({
|
|
74
|
+
[adhocName]: [
|
|
75
|
+
{
|
|
76
|
+
name: 'getDomainAvailability',
|
|
77
|
+
inputSchema: {
|
|
78
|
+
type: 'object',
|
|
79
|
+
properties: { domain: { type: 'string' } },
|
|
80
|
+
required: ['domain'],
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
});
|
|
85
|
+
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
86
|
+
await handleCall(runtime, [command, 'domain=answeroverflow.com']);
|
|
87
|
+
expect(callTool).toHaveBeenCalledWith(
|
|
88
|
+
adhocName,
|
|
89
|
+
'getDomainAvailability',
|
|
90
|
+
expect.objectContaining({
|
|
91
|
+
args: { domain: 'answeroverflow.com' },
|
|
92
|
+
})
|
|
93
|
+
);
|
|
94
|
+
logSpy.mockRestore();
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('aborts long-running tools when the timeout elapses', async () => {
|
|
98
|
+
vi.useFakeTimers();
|
|
99
|
+
try {
|
|
100
|
+
const { handleCall } = await cliModulePromise;
|
|
101
|
+
const close = vi.fn().mockResolvedValue(undefined);
|
|
102
|
+
const runtime = {
|
|
103
|
+
callTool: () =>
|
|
104
|
+
new Promise((resolve) => {
|
|
105
|
+
setTimeout(() => resolve('done'), 1000);
|
|
106
|
+
}),
|
|
107
|
+
close,
|
|
108
|
+
};
|
|
109
|
+
const promise = handleCall(runtime as never, ['chrome-devtools.list_pages', '--timeout', '10']);
|
|
110
|
+
const expectation = expect(promise).rejects.toThrow('Call to chrome-devtools.list_pages timed out after 10ms.');
|
|
111
|
+
await vi.runOnlyPendingTimersAsync();
|
|
112
|
+
await expectation;
|
|
113
|
+
expect(close).toHaveBeenCalledWith('chrome-devtools');
|
|
114
|
+
} finally {
|
|
115
|
+
vi.useRealTimers();
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('auto-corrects near-miss tool names', async () => {
|
|
120
|
+
const { handleCall } = await cliModulePromise;
|
|
121
|
+
const callTool = vi
|
|
122
|
+
.fn()
|
|
123
|
+
.mockRejectedValueOnce(new Error('MCP error -32602: Tool listIssues not found'))
|
|
124
|
+
.mockResolvedValueOnce({ ok: true });
|
|
125
|
+
const listTools = vi.fn().mockResolvedValue([{ name: 'list_issues' }]);
|
|
126
|
+
const runtime = {
|
|
127
|
+
callTool,
|
|
128
|
+
listTools,
|
|
129
|
+
close: vi.fn().mockResolvedValue(undefined),
|
|
130
|
+
} as unknown as Awaited<ReturnType<typeof import('../src/runtime.js')['createRuntime']>>;
|
|
131
|
+
|
|
132
|
+
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
133
|
+
|
|
134
|
+
await handleCall(runtime, ['linear.listIssues']);
|
|
135
|
+
|
|
136
|
+
const notes = logSpy.mock.calls.map((call) => call.join(' '));
|
|
137
|
+
expect(notes.some((line) => line.includes('Auto-corrected tool call to linear.list_issues'))).toBe(true);
|
|
138
|
+
expect(callTool).toHaveBeenCalledTimes(2);
|
|
139
|
+
expect(callTool).toHaveBeenNthCalledWith(1, 'linear', 'listIssues', expect.objectContaining({ args: {} }));
|
|
140
|
+
expect(callTool).toHaveBeenNthCalledWith(2, 'linear', 'list_issues', expect.objectContaining({ args: {} }));
|
|
141
|
+
expect(listTools).toHaveBeenCalledWith('linear', { autoAuthorize: true, includeSchema: false });
|
|
142
|
+
|
|
143
|
+
logSpy.mockRestore();
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it('suggests similar tool names when the match is uncertain', async () => {
|
|
147
|
+
const { handleCall } = await cliModulePromise;
|
|
148
|
+
const callTool = vi.fn().mockRejectedValue(new Error('MCP error -32602: Tool listIssues not found'));
|
|
149
|
+
const listTools = vi.fn().mockResolvedValue([{ name: 'list_issue_statuses' }]);
|
|
150
|
+
const runtime = {
|
|
151
|
+
callTool,
|
|
152
|
+
listTools,
|
|
153
|
+
close: vi.fn().mockResolvedValue(undefined),
|
|
154
|
+
} as unknown as Awaited<ReturnType<typeof import('../src/runtime.js')['createRuntime']>>;
|
|
155
|
+
|
|
156
|
+
const errorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
157
|
+
|
|
158
|
+
await expect(handleCall(runtime, ['linear.listIssues'])).rejects.toThrow('listIssues not found');
|
|
159
|
+
|
|
160
|
+
const messages = errorSpy.mock.calls.map((call) => call.join(' '));
|
|
161
|
+
expect(messages.some((line) => line.includes('Did you mean linear.list_issue_statuses'))).toBe(true);
|
|
162
|
+
|
|
163
|
+
errorSpy.mockRestore();
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it("falls back to 'list' output when calling a missing help tool", async () => {
|
|
167
|
+
const listModule = await import('../src/cli/list-command.js');
|
|
168
|
+
const listSpy = vi.spyOn(listModule, 'handleList').mockResolvedValue(undefined);
|
|
169
|
+
const { handleCall } = await cliModulePromise;
|
|
170
|
+
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
171
|
+
const definition: ServerDefinition = {
|
|
172
|
+
name: 'chrome-devtools',
|
|
173
|
+
description: 'Chrome DevTools MCP server',
|
|
174
|
+
command: { kind: 'stdio', command: 'chrome-devtools', args: [], cwd: process.cwd() },
|
|
175
|
+
source: { kind: 'local', path: '<test>' },
|
|
176
|
+
};
|
|
177
|
+
const { runtime, callTool } = createRuntimeStub(
|
|
178
|
+
{
|
|
179
|
+
'chrome-devtools': [
|
|
180
|
+
{
|
|
181
|
+
name: 'take_snapshot',
|
|
182
|
+
description: 'Takes a snapshot.',
|
|
183
|
+
inputSchema: {
|
|
184
|
+
type: 'object',
|
|
185
|
+
properties: { url: { type: 'string' } },
|
|
186
|
+
required: ['url'],
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
],
|
|
190
|
+
},
|
|
191
|
+
{ definitions: [definition] }
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
try {
|
|
195
|
+
await handleCall(runtime, ['chrome-devtools.help']);
|
|
196
|
+
expect(listSpy).toHaveBeenNthCalledWith(1, runtime, ['chrome-devtools']);
|
|
197
|
+
expect(
|
|
198
|
+
logSpy.mock.calls.some((call) => call.some((line) => line.includes("does not expose a 'help' tool")))
|
|
199
|
+
).toBe(true);
|
|
200
|
+
logSpy.mockClear();
|
|
201
|
+
await handleCall(runtime, ['chrome-devtools.help', '--output', 'json']);
|
|
202
|
+
expect(listSpy).toHaveBeenNthCalledWith(2, runtime, ['chrome-devtools', '--json']);
|
|
203
|
+
expect(callTool).not.toHaveBeenCalled();
|
|
204
|
+
} finally {
|
|
205
|
+
listSpy.mockRestore();
|
|
206
|
+
logSpy.mockRestore();
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it('treats list_tools selector as a shortcut for mcporter list', async () => {
|
|
211
|
+
const listModule = await import('../src/cli/list-command.js');
|
|
212
|
+
const listSpy = vi.spyOn(listModule, 'handleList').mockResolvedValue(undefined);
|
|
213
|
+
const { handleCall } = await cliModulePromise;
|
|
214
|
+
const definition: ServerDefinition = {
|
|
215
|
+
name: 'chrome-devtools',
|
|
216
|
+
description: 'Chrome DevTools MCP server',
|
|
217
|
+
command: { kind: 'stdio', command: 'chrome-devtools', args: [], cwd: process.cwd() },
|
|
218
|
+
source: { kind: 'local', path: '<test>' },
|
|
219
|
+
};
|
|
220
|
+
const { runtime, callTool } = createRuntimeStub({ 'chrome-devtools': [] }, { definitions: [definition] });
|
|
221
|
+
|
|
222
|
+
try {
|
|
223
|
+
await handleCall(runtime, ['chrome-devtools.list_tools']);
|
|
224
|
+
await handleCall(runtime, ['chrome-devtools.list_tools', '--output', 'json']);
|
|
225
|
+
expect(listSpy).toHaveBeenNthCalledWith(1, runtime, ['chrome-devtools']);
|
|
226
|
+
expect(listSpy).toHaveBeenNthCalledWith(2, runtime, ['chrome-devtools', '--json']);
|
|
227
|
+
expect(callTool).not.toHaveBeenCalled();
|
|
228
|
+
} finally {
|
|
229
|
+
listSpy.mockRestore();
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
function createRuntimeStub(
|
|
235
|
+
toolCatalog: Record<
|
|
236
|
+
string,
|
|
237
|
+
Array<{
|
|
238
|
+
name: string;
|
|
239
|
+
description?: string;
|
|
240
|
+
inputSchema?: unknown;
|
|
241
|
+
}>
|
|
242
|
+
>,
|
|
243
|
+
options: { definitions?: ServerDefinition[] } = {}
|
|
244
|
+
): {
|
|
245
|
+
runtime: Awaited<ReturnType<typeof import('../src/runtime.js')['createRuntime']>>;
|
|
246
|
+
callTool: ReturnType<typeof vi.fn>;
|
|
247
|
+
listTools: ReturnType<typeof vi.fn>;
|
|
248
|
+
} {
|
|
249
|
+
const definitions = new Map<string, ServerDefinition>();
|
|
250
|
+
for (const entry of options.definitions ?? []) {
|
|
251
|
+
definitions.set(entry.name, entry);
|
|
252
|
+
}
|
|
253
|
+
const callTool = vi.fn().mockResolvedValue({ ok: true });
|
|
254
|
+
const listTools = vi.fn().mockImplementation(async (server: string) => {
|
|
255
|
+
const tools = toolCatalog[server];
|
|
256
|
+
if (!tools) {
|
|
257
|
+
throw new Error(`Unknown MCP server '${server}'.`);
|
|
258
|
+
}
|
|
259
|
+
return tools;
|
|
260
|
+
});
|
|
261
|
+
const close = vi.fn().mockResolvedValue(undefined);
|
|
262
|
+
const runtime = {
|
|
263
|
+
getDefinitions: () => [...definitions.values()],
|
|
264
|
+
getDefinition: vi.fn().mockImplementation((name: string) => {
|
|
265
|
+
const definition = definitions.get(name);
|
|
266
|
+
if (!definition) {
|
|
267
|
+
throw new Error(`Unknown MCP server '${name}'.`);
|
|
268
|
+
}
|
|
269
|
+
return definition;
|
|
270
|
+
}),
|
|
271
|
+
registerDefinition: vi.fn().mockImplementation((definition: ServerDefinition) => {
|
|
272
|
+
definitions.set(definition.name, definition);
|
|
273
|
+
}),
|
|
274
|
+
listTools,
|
|
275
|
+
callTool,
|
|
276
|
+
close,
|
|
277
|
+
} as unknown as Awaited<ReturnType<typeof import('../src/runtime.js')['createRuntime']>>;
|
|
278
|
+
return { runtime, callTool, listTools };
|
|
279
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
|
|
3
|
+
process.env.MCPORTER_DISABLE_AUTORUN = '1';
|
|
4
|
+
const cliModulePromise = import('../src/cli.js');
|
|
5
|
+
|
|
6
|
+
describe('mcporter call help shortcut', () => {
|
|
7
|
+
let previousNoForceExit: string | undefined;
|
|
8
|
+
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
previousNoForceExit = process.env.MCPORTER_NO_FORCE_EXIT;
|
|
11
|
+
process.env.MCPORTER_NO_FORCE_EXIT = '1';
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
afterEach(() => {
|
|
15
|
+
vi.restoreAllMocks();
|
|
16
|
+
process.exitCode = undefined;
|
|
17
|
+
if (previousNoForceExit === undefined) {
|
|
18
|
+
delete process.env.MCPORTER_NO_FORCE_EXIT;
|
|
19
|
+
} else {
|
|
20
|
+
process.env.MCPORTER_NO_FORCE_EXIT = previousNoForceExit;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('prints call-specific help when --help is used', async () => {
|
|
25
|
+
const { runCli } = await cliModulePromise;
|
|
26
|
+
const errorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
27
|
+
|
|
28
|
+
await runCli(['call', '--help']);
|
|
29
|
+
|
|
30
|
+
expect(errorSpy).toHaveBeenCalledWith(expect.stringContaining('Usage: mcporter call'));
|
|
31
|
+
expect(process.exitCode).toBe(0);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('prints call-specific help when the bare help token follows the command', async () => {
|
|
35
|
+
const { runCli } = await cliModulePromise;
|
|
36
|
+
const errorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
37
|
+
|
|
38
|
+
await runCli(['call', 'help']);
|
|
39
|
+
|
|
40
|
+
expect(errorSpy).toHaveBeenCalledWith(expect.stringContaining('Usage: mcporter call'));
|
|
41
|
+
expect(process.exitCode).toBe(0);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { inferCommandRouting } from '../src/cli/command-inference.js';
|
|
4
|
+
|
|
5
|
+
const definitions = [
|
|
6
|
+
{ name: 'firecrawl', description: '', command: { kind: 'http' as const, url: new URL('https://example.com') } },
|
|
7
|
+
{ name: 'vercel', description: '', command: { kind: 'http' as const, url: new URL('https://api.vercel.com') } },
|
|
8
|
+
];
|
|
9
|
+
|
|
10
|
+
describe('command inference', () => {
|
|
11
|
+
it('routes bare server names to list', () => {
|
|
12
|
+
const result = inferCommandRouting('firecrawl', ['--schema'], definitions);
|
|
13
|
+
expect(result).toEqual({ kind: 'command', command: 'list', args: ['firecrawl', '--schema'] });
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('respects explicit list command tokens', () => {
|
|
17
|
+
const result = inferCommandRouting('list', [], definitions);
|
|
18
|
+
expect(result).toEqual({ kind: 'command', command: 'list', args: [] });
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('treats describe as a hidden list alias', () => {
|
|
22
|
+
const result = inferCommandRouting('describe', ['chrome-devtools'], definitions);
|
|
23
|
+
expect(result).toEqual({ kind: 'command', command: 'list', args: ['chrome-devtools'] });
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('treats list-tools as a hidden list alias', () => {
|
|
27
|
+
const result = inferCommandRouting('list-tools', ['linear'], definitions);
|
|
28
|
+
expect(result).toEqual({ kind: 'command', command: 'list', args: ['linear'] });
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('auto-corrects close server names', () => {
|
|
32
|
+
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
33
|
+
const result = inferCommandRouting('vercek', [], definitions);
|
|
34
|
+
expect(result).toEqual({ kind: 'command', command: 'list', args: ['vercel'] });
|
|
35
|
+
expect(logSpy).toHaveBeenCalledWith(expect.stringContaining('Auto-corrected server name to vercel'));
|
|
36
|
+
logSpy.mockRestore();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('routes HTTP URLs to list for ad-hoc mode', () => {
|
|
40
|
+
const result = inferCommandRouting('https://mcp.deepwiki.com/sse', [], definitions);
|
|
41
|
+
expect(result).toEqual({ kind: 'command', command: 'list', args: ['https://mcp.deepwiki.com/sse'] });
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('routes scheme-less HTTP URLs to list for ad-hoc mode', () => {
|
|
45
|
+
const result = inferCommandRouting('shadcn.io/api/mcp', [], definitions);
|
|
46
|
+
expect(result).toEqual({ kind: 'command', command: 'list', args: ['shadcn.io/api/mcp'] });
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('routes HTTP tool selectors directly to call', () => {
|
|
50
|
+
const token = 'https://api.example.com/mcp.getStatus';
|
|
51
|
+
const result = inferCommandRouting(token, ['limit=1'], definitions);
|
|
52
|
+
expect(result).toEqual({ kind: 'command', command: 'call', args: [token, 'limit=1'] });
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('routes HTTP tool expressions with arguments directly to call', () => {
|
|
56
|
+
const token = 'https://api.example.com/mcp.getStatus(component: "foo")';
|
|
57
|
+
const result = inferCommandRouting(token, [], definitions);
|
|
58
|
+
expect(result).toEqual({ kind: 'command', command: 'call', args: [token] });
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('suggests names when edit distance is large', () => {
|
|
62
|
+
const errorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
63
|
+
const result = inferCommandRouting('unknown', [], definitions);
|
|
64
|
+
expect(result).toEqual({ kind: 'abort', exitCode: 1 });
|
|
65
|
+
expect(errorSpy).toHaveBeenCalled();
|
|
66
|
+
errorSpy.mockRestore();
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('treats dotted selectors as call expressions', () => {
|
|
70
|
+
const result = inferCommandRouting('firecrawl.scrape', ['--foo'], definitions);
|
|
71
|
+
expect(result).toEqual({ kind: 'command', command: 'call', args: ['firecrawl.scrape', '--foo'] });
|
|
72
|
+
});
|
|
73
|
+
});
|