@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,342 @@
|
|
|
1
|
+
import { createCallResult } from './result-utils.js';
|
|
2
|
+
import { readSchemaCache, writeSchemaCache } from './schema-cache.js';
|
|
3
|
+
const KNOWN_OPTION_KEYS = new Set(['tailLog', 'timeout', 'stream', 'streamLog', 'mimeType', 'metadata', 'log']);
|
|
4
|
+
// defaultToolNameMapper converts camelCase property access into kebab-case tool names.
|
|
5
|
+
function defaultToolNameMapper(propertyKey) {
|
|
6
|
+
if (typeof propertyKey !== 'string') {
|
|
7
|
+
throw new TypeError('Tool name must be a string when using server proxy.');
|
|
8
|
+
}
|
|
9
|
+
return propertyKey.replace(/([a-z\d])([A-Z])/g, '$1-$2').toLowerCase();
|
|
10
|
+
}
|
|
11
|
+
// canonicalizeToolName strips punctuation for loose matching of tool names.
|
|
12
|
+
function canonicalizeToolName(name) {
|
|
13
|
+
return name.toLowerCase().replace(/[^a-z0-9]/g, '');
|
|
14
|
+
}
|
|
15
|
+
// isPlainObject narrows unknown values to plain object records.
|
|
16
|
+
function isPlainObject(value) {
|
|
17
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
18
|
+
}
|
|
19
|
+
// createToolSchemaInfo normalizes schema metadata used for argument mapping.
|
|
20
|
+
function createToolSchemaInfo(schemaRaw) {
|
|
21
|
+
if (!schemaRaw || typeof schemaRaw !== 'object') {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
const schema = schemaRaw;
|
|
25
|
+
const propertiesRaw = schema.properties;
|
|
26
|
+
const propertyKeys = propertiesRaw && typeof propertiesRaw === 'object' ? Object.keys(propertiesRaw) : [];
|
|
27
|
+
const requiredKeys = Array.isArray(schema.required) ? schema.required : [];
|
|
28
|
+
const orderedKeys = [];
|
|
29
|
+
const seen = new Set();
|
|
30
|
+
for (const key of requiredKeys) {
|
|
31
|
+
if (typeof key === 'string' && !seen.has(key)) {
|
|
32
|
+
orderedKeys.push(key);
|
|
33
|
+
seen.add(key);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
for (const key of propertyKeys) {
|
|
37
|
+
if (!seen.has(key)) {
|
|
38
|
+
orderedKeys.push(key);
|
|
39
|
+
seen.add(key);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
schema,
|
|
44
|
+
orderedKeys,
|
|
45
|
+
requiredKeys,
|
|
46
|
+
propertySet: new Set([...propertyKeys, ...requiredKeys]),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
// applyDefaults merges JSON-schema default values into the provided arguments.
|
|
50
|
+
function applyDefaults(meta, args) {
|
|
51
|
+
const propertiesRaw = meta.schema.properties;
|
|
52
|
+
if (!propertiesRaw || typeof propertiesRaw !== 'object') {
|
|
53
|
+
return args;
|
|
54
|
+
}
|
|
55
|
+
const result = isPlainObject(args) ? { ...args } : {};
|
|
56
|
+
for (const [key, value] of Object.entries(propertiesRaw)) {
|
|
57
|
+
if (value &&
|
|
58
|
+
typeof value === 'object' &&
|
|
59
|
+
'default' in value &&
|
|
60
|
+
result[key] === undefined) {
|
|
61
|
+
result[key] = value.default;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (Object.keys(result).length === 0 && !isPlainObject(args)) {
|
|
65
|
+
return args;
|
|
66
|
+
}
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
// validateRequired ensures all schema-required fields are present before invocation.
|
|
70
|
+
function validateRequired(meta, args) {
|
|
71
|
+
if (meta.requiredKeys.length === 0) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (!isPlainObject(args)) {
|
|
75
|
+
throw new Error(`Missing required arguments: ${meta.requiredKeys.join(', ')}`);
|
|
76
|
+
}
|
|
77
|
+
const missing = meta.requiredKeys.filter((key) => args[key] === undefined);
|
|
78
|
+
if (missing.length > 0) {
|
|
79
|
+
throw new Error(`Missing required arguments: ${missing.join(', ')}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
// createServerProxy returns a proxy that maps property access to MCP tool invocations.
|
|
83
|
+
export function createServerProxy(runtime, serverName, mapOrOptions, maybeOptions) {
|
|
84
|
+
let mapPropertyToTool = defaultToolNameMapper;
|
|
85
|
+
let options;
|
|
86
|
+
if (typeof mapOrOptions === 'function') {
|
|
87
|
+
mapPropertyToTool = mapOrOptions;
|
|
88
|
+
options = maybeOptions;
|
|
89
|
+
}
|
|
90
|
+
else if (mapOrOptions) {
|
|
91
|
+
options = mapOrOptions;
|
|
92
|
+
if (typeof mapOrOptions.mapPropertyToTool === 'function') {
|
|
93
|
+
mapPropertyToTool = mapOrOptions.mapPropertyToTool;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const cacheSchemas = options?.cacheSchemas ?? true;
|
|
97
|
+
const initialSchemas = options?.initialSchemas ?? undefined;
|
|
98
|
+
const toolSchemaCache = new Map();
|
|
99
|
+
const persistedSchemas = new Map();
|
|
100
|
+
const toolAliasMap = new Map();
|
|
101
|
+
let schemaFetch = null;
|
|
102
|
+
let diskLoad = null;
|
|
103
|
+
let persistPromise = null;
|
|
104
|
+
let refreshPending = false;
|
|
105
|
+
let definitionForCache;
|
|
106
|
+
if (cacheSchemas) {
|
|
107
|
+
try {
|
|
108
|
+
definitionForCache = runtime.getDefinition(serverName);
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
definitionForCache = undefined;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (cacheSchemas && !initialSchemas && definitionForCache) {
|
|
115
|
+
diskLoad = loadSchemasFromDisk(definitionForCache);
|
|
116
|
+
refreshPending = true;
|
|
117
|
+
}
|
|
118
|
+
if (initialSchemas) {
|
|
119
|
+
for (const [key, schemaRaw] of Object.entries(initialSchemas)) {
|
|
120
|
+
storeSchema(key, schemaRaw);
|
|
121
|
+
}
|
|
122
|
+
persistPromise = persistSchemas();
|
|
123
|
+
}
|
|
124
|
+
// consumePersist waits for any in-flight disk persistence to finish before reading from cache maps.
|
|
125
|
+
async function consumePersist() {
|
|
126
|
+
if (!persistPromise) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
try {
|
|
130
|
+
await persistPromise;
|
|
131
|
+
}
|
|
132
|
+
finally {
|
|
133
|
+
persistPromise = null;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
// ensureMetadata loads schema information for the requested tool, optionally refreshing from the server.
|
|
137
|
+
async function ensureMetadata(toolName) {
|
|
138
|
+
await consumePersist();
|
|
139
|
+
const cached = toolSchemaCache.get(toolName);
|
|
140
|
+
if (cached && !refreshPending) {
|
|
141
|
+
return cached;
|
|
142
|
+
}
|
|
143
|
+
if (diskLoad) {
|
|
144
|
+
try {
|
|
145
|
+
await diskLoad;
|
|
146
|
+
}
|
|
147
|
+
finally {
|
|
148
|
+
diskLoad = null;
|
|
149
|
+
}
|
|
150
|
+
if (toolSchemaCache.has(toolName) && !refreshPending) {
|
|
151
|
+
return toolSchemaCache.get(toolName);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (!schemaFetch) {
|
|
155
|
+
schemaFetch = runtime
|
|
156
|
+
.listTools(serverName, { includeSchema: true })
|
|
157
|
+
.then((tools) => {
|
|
158
|
+
for (const tool of tools) {
|
|
159
|
+
if (!tool.inputSchema || typeof tool.inputSchema !== 'object') {
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
storeSchema(tool.name, tool.inputSchema);
|
|
163
|
+
}
|
|
164
|
+
persistPromise = persistSchemas();
|
|
165
|
+
refreshPending = false;
|
|
166
|
+
})
|
|
167
|
+
.catch((error) => {
|
|
168
|
+
schemaFetch = null;
|
|
169
|
+
throw error;
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
await schemaFetch;
|
|
173
|
+
await consumePersist();
|
|
174
|
+
return toolSchemaCache.get(toolName);
|
|
175
|
+
}
|
|
176
|
+
// storeSchema caches schema info locally and records aliases for lookup.
|
|
177
|
+
function storeSchema(key, schemaRaw) {
|
|
178
|
+
const info = createToolSchemaInfo(schemaRaw);
|
|
179
|
+
if (!info) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const canonical = mapPropertyToTool(key);
|
|
183
|
+
toolSchemaCache.set(canonical, info);
|
|
184
|
+
if (canonical !== key) {
|
|
185
|
+
toolSchemaCache.set(key, info);
|
|
186
|
+
}
|
|
187
|
+
const canonicalAlias = canonicalizeToolName(key);
|
|
188
|
+
if (!toolAliasMap.has(canonicalAlias)) {
|
|
189
|
+
toolAliasMap.set(canonicalAlias, key);
|
|
190
|
+
}
|
|
191
|
+
const mapperAlias = canonicalizeToolName(canonical);
|
|
192
|
+
if (!toolAliasMap.has(mapperAlias)) {
|
|
193
|
+
toolAliasMap.set(mapperAlias, key);
|
|
194
|
+
}
|
|
195
|
+
if (cacheSchemas && definitionForCache && isPlainObject(schemaRaw)) {
|
|
196
|
+
persistedSchemas.set(canonical, schemaRaw);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
// loadSchemasFromDisk hydrates the in-memory cache from the persisted schema snapshot.
|
|
200
|
+
async function loadSchemasFromDisk(definition) {
|
|
201
|
+
try {
|
|
202
|
+
const snapshot = await readSchemaCache(definition);
|
|
203
|
+
if (!snapshot) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
for (const [key, schemaRaw] of Object.entries(snapshot.tools)) {
|
|
207
|
+
storeSchema(key, schemaRaw);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
catch {
|
|
211
|
+
// ignore cache read failures
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
// persistSchemas writes cached schema data to disk when enabled.
|
|
215
|
+
function persistSchemas() {
|
|
216
|
+
if (!cacheSchemas || !definitionForCache || persistedSchemas.size === 0) {
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
const definition = definitionForCache;
|
|
220
|
+
const snapshot = {
|
|
221
|
+
updatedAt: new Date().toISOString(),
|
|
222
|
+
tools: Object.fromEntries(persistedSchemas.entries()),
|
|
223
|
+
};
|
|
224
|
+
return writeSchemaCache(definition, snapshot).catch(() => {
|
|
225
|
+
// best-effort persistence
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
const base = {
|
|
229
|
+
call: async (toolName, options) => {
|
|
230
|
+
const result = await runtime.callTool(serverName, toolName, options ?? {});
|
|
231
|
+
return createCallResult(result);
|
|
232
|
+
},
|
|
233
|
+
listTools: (options) => runtime.listTools(serverName, options),
|
|
234
|
+
};
|
|
235
|
+
return new Proxy(base, {
|
|
236
|
+
get(target, property, receiver) {
|
|
237
|
+
if (Reflect.has(target, property)) {
|
|
238
|
+
return Reflect.get(target, property, receiver);
|
|
239
|
+
}
|
|
240
|
+
const propertyKey = property;
|
|
241
|
+
const canonicalKey = typeof propertyKey === 'string' ? canonicalizeToolName(propertyKey) : null;
|
|
242
|
+
let resolvedToolName = typeof propertyKey === 'string' && canonicalKey
|
|
243
|
+
? (toolAliasMap.get(canonicalKey) ?? mapPropertyToTool(propertyKey))
|
|
244
|
+
: mapPropertyToTool(propertyKey);
|
|
245
|
+
return async (...callArgs) => {
|
|
246
|
+
let schemaInfo;
|
|
247
|
+
try {
|
|
248
|
+
schemaInfo = await ensureMetadata(resolvedToolName);
|
|
249
|
+
}
|
|
250
|
+
catch {
|
|
251
|
+
schemaInfo = undefined;
|
|
252
|
+
}
|
|
253
|
+
if (typeof propertyKey === 'string' && canonicalKey) {
|
|
254
|
+
const alias = toolAliasMap.get(canonicalKey);
|
|
255
|
+
if (alias && alias !== resolvedToolName) {
|
|
256
|
+
resolvedToolName = alias;
|
|
257
|
+
try {
|
|
258
|
+
schemaInfo = await ensureMetadata(resolvedToolName);
|
|
259
|
+
}
|
|
260
|
+
catch {
|
|
261
|
+
// ignore and keep prior schema if available
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
const positional = [];
|
|
266
|
+
const argsAccumulator = {};
|
|
267
|
+
const optionsAccumulator = {};
|
|
268
|
+
for (const arg of callArgs) {
|
|
269
|
+
if (isPlainObject(arg)) {
|
|
270
|
+
const keys = Object.keys(arg);
|
|
271
|
+
const treatAsArgs = schemaInfo !== undefined &&
|
|
272
|
+
keys.length > 0 &&
|
|
273
|
+
(keys.every((key) => schemaInfo.propertySet.has(key)) ||
|
|
274
|
+
keys.every((key) => !KNOWN_OPTION_KEYS.has(key)));
|
|
275
|
+
if (treatAsArgs) {
|
|
276
|
+
Object.assign(argsAccumulator, arg);
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
Object.assign(optionsAccumulator, arg);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
positional.push(arg);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
const explicitArgs = optionsAccumulator.args;
|
|
287
|
+
if (explicitArgs !== undefined) {
|
|
288
|
+
delete optionsAccumulator.args;
|
|
289
|
+
}
|
|
290
|
+
const finalOptions = { ...optionsAccumulator };
|
|
291
|
+
let combinedArgs = explicitArgs;
|
|
292
|
+
if (schemaInfo) {
|
|
293
|
+
const schema = schemaInfo;
|
|
294
|
+
if (positional.length > schema.orderedKeys.length) {
|
|
295
|
+
throw new Error(`Too many positional arguments for tool "${resolvedToolName}"`);
|
|
296
|
+
}
|
|
297
|
+
if (positional.length > 0) {
|
|
298
|
+
const baseArgs = isPlainObject(combinedArgs) ? { ...combinedArgs } : {};
|
|
299
|
+
positional.forEach((value, idx) => {
|
|
300
|
+
const key = schema.orderedKeys[idx];
|
|
301
|
+
if (key) {
|
|
302
|
+
baseArgs[key] = value;
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
combinedArgs = baseArgs;
|
|
306
|
+
}
|
|
307
|
+
if (Object.keys(argsAccumulator).length > 0) {
|
|
308
|
+
const baseArgs = isPlainObject(combinedArgs) ? { ...combinedArgs } : {};
|
|
309
|
+
Object.assign(baseArgs, argsAccumulator);
|
|
310
|
+
combinedArgs = baseArgs;
|
|
311
|
+
}
|
|
312
|
+
if (combinedArgs !== undefined) {
|
|
313
|
+
combinedArgs = applyDefaults(schema, combinedArgs);
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
const defaults = applyDefaults(schema, undefined);
|
|
317
|
+
if (defaults && typeof defaults === 'object') {
|
|
318
|
+
combinedArgs = defaults;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
validateRequired(schema, combinedArgs);
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
if (positional.length > 0) {
|
|
325
|
+
combinedArgs = positional;
|
|
326
|
+
}
|
|
327
|
+
if (Object.keys(argsAccumulator).length > 0) {
|
|
328
|
+
const baseArgs = isPlainObject(combinedArgs) ? { ...combinedArgs } : {};
|
|
329
|
+
Object.assign(baseArgs, argsAccumulator);
|
|
330
|
+
combinedArgs = baseArgs;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
if (combinedArgs !== undefined) {
|
|
334
|
+
finalOptions.args = combinedArgs;
|
|
335
|
+
}
|
|
336
|
+
const result = await runtime.callTool(serverName, resolvedToolName, finalOptions);
|
|
337
|
+
return createCallResult(result);
|
|
338
|
+
};
|
|
339
|
+
},
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
//# sourceMappingURL=server-proxy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-proxy.js","sourceRoot":"","sources":["../src/server-proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAiBtE,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC;AAQhH,uFAAuF;AACvF,SAAS,qBAAqB,CAAC,WAA4B;IACzD,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;QACpC,MAAM,IAAI,SAAS,CAAC,qDAAqD,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,WAAW,CAAC,OAAO,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;AACzE,CAAC;AAED,4EAA4E;AAC5E,SAAS,oBAAoB,CAAC,IAAY;IACxC,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AACtD,CAAC;AAED,gEAAgE;AAChE,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,I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,CAAC;oBAC3C,CAAC;gBACH,CAAC;gBAED,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;oBAC/B,YAAY,CAAC,IAAI,GAAG,YAAY,CAAC;gBACnC,CAAC;gBAED,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,UAAU,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAAC;gBAClF,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;YAClC,CAAC,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
package/docs/RELEASE.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: 'Release checklist for mcporter: versioning, tests, build artifacts, npm publish, GitHub release assets, and Homebrew tap updates.'
|
|
3
|
+
read_when:
|
|
4
|
+
- 'Cutting a release or updating release automation'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Release Checklist
|
|
8
|
+
|
|
9
|
+
> **Runner note:** From the repo root run `export MCP_RUNNER="$PWD/runner"` and use `$MCP_RUNNER <command>` for every shell command listed below unless the step explicitly says otherwise. This keeps the guardrails active even when the checklist jumps between directories.
|
|
10
|
+
|
|
11
|
+
> **Helper script:** You can run `./scripts/release.sh <phase>` (gates | artifacts | publish | smoke | tag | all) to execute the steps below with the runner by default. It stops on first error; rerun the next phase after fixing issues.
|
|
12
|
+
|
|
13
|
+
> **No-warning policy:** Every command below must finish without warnings (Biome, Oxlint, tsgo, Vitest, npm pack, etc.). Fix issues before continuing; releases cannot ship with outstanding warnings.
|
|
14
|
+
|
|
15
|
+
## Definition of “released”
|
|
16
|
+
|
|
17
|
+
Shipping a release means **all** of:
|
|
18
|
+
- Tag pushed (`v<version>`).
|
|
19
|
+
- npm published (`mcporter@<version>` visible via `npm view mcporter version`).
|
|
20
|
+
- GitHub release published for the tag **with assets + checksums**.
|
|
21
|
+
- Homebrew tap updated (and verified) after assets propagate.
|
|
22
|
+
|
|
23
|
+
1. Update version in package.json and src/runtime.ts.
|
|
24
|
+
2. Run pnpm install to refresh the lockfile if dependencies changed.
|
|
25
|
+
3. pnpm check (zero warnings allowed; abort immediately on any error)
|
|
26
|
+
4. pnpm test (must finish with **0 failed**; if Vitest prints any red FAIL lines or a non-zero exit code, stop and fix it before proceeding)
|
|
27
|
+
5. pnpm build
|
|
28
|
+
6. pnpm build:bun
|
|
29
|
+
7. tar -C dist-bun -czf dist-bun/mcporter-macos-arm64-v<version>.tar.gz mcporter
|
|
30
|
+
8. shasum -a 256 dist-bun/mcporter-macos-arm64-v<version>.tar.gz | tee dist-bun/mcporter-macos-arm64-v<version>.tar.gz.sha256
|
|
31
|
+
9. npm pack --pack-destination /tmp && mv /tmp/mcporter-<version>.tgz . # keep the real tarball
|
|
32
|
+
10. shasum mcporter-<version>.tgz > mcporter-<version>.tgz.sha1 && shasum -a 256 mcporter-<version>.tgz > mcporter-<version>.tgz.sha256
|
|
33
|
+
11. Verify git status is clean.
|
|
34
|
+
11. git commit && git push.
|
|
35
|
+
12. pnpm publish --tag latest *(the runner already has npm credentials configured, so you can run this directly in the release shell; bump `timeout_ms` if needed because prepublish re-runs check/test/build and can take several minutes.)*
|
|
36
|
+
13. `npm view mcporter version` (and `npm view mcporter time`) to ensure the registry reflects the new release before proceeding. If the new version isn’t visible yet, wait a minute and retry—npm’s replication can lag briefly.
|
|
37
|
+
14. Sanity-check the “one weird trick” workflow from a **completely empty** directory (no package.json/node_modules) via:
|
|
38
|
+
```bash
|
|
39
|
+
rm -rf /tmp/mcporter-empty && mkdir -p /tmp/mcporter-empty
|
|
40
|
+
cd /tmp/mcporter-empty
|
|
41
|
+
# run this without the runner because we are outside the repo and npx handles its own logging
|
|
42
|
+
npx mcporter@<version> generate-cli "npx -y chrome-devtools-mcp" --compile
|
|
43
|
+
./chrome-devtools-mcp --help | head -n 5
|
|
44
|
+
```
|
|
45
|
+
Only continue once the CLI compiles and the help banner prints.
|
|
46
|
+
15. Draft the GitHub release notes using this template (copy/paste and edit). **Title the release `mcporter v<version>` (project name + version) to keep GitHub’s releases list consistent.**
|
|
47
|
+
```markdown
|
|
48
|
+
## Highlights
|
|
49
|
+
- <top feature>
|
|
50
|
+
- <second feature>
|
|
51
|
+
- <bugfix or UX callout>
|
|
52
|
+
|
|
53
|
+
SHA256 (mcporter-macos-arm64-v<version>.tar.gz): `<sha from step 8>`
|
|
54
|
+
SHA256 (mcporter-<version>.tgz): `<sha from npm pack>`
|
|
55
|
+
```
|
|
56
|
+
Then **create the GitHub release for tag v<version>** and upload all assets:
|
|
57
|
+
- `mcporter-macos-arm64-v<version>.tar.gz`
|
|
58
|
+
- `mcporter-macos-arm64-v<version>.tar.gz.sha256` (from step 8; add a `.sha256` file)
|
|
59
|
+
- `mcporter-<version>.tgz` (from `npm pack`)
|
|
60
|
+
- `mcporter-<version>.tgz.sha1` and `mcporter-<version>.tgz.sha256`
|
|
61
|
+
Double-check the uploaded checksums match your local files.
|
|
62
|
+
16. Tag the release (git tag v<version> && git push --tags).
|
|
63
|
+
17. Post-tag housekeeping: add a fresh "Unreleased" stub to CHANGELOG.md (set to "- Nothing yet.") and start a new version section for the just-released patch if it isn’t already recorded.
|
|
64
|
+
|
|
65
|
+
After the release is live, always update the Homebrew tap and re-verify both installers. That flow should be:
|
|
66
|
+
|
|
67
|
+
1. Uninstall any existing `mcporter` binaries to avoid PATH conflicts:
|
|
68
|
+
```bash
|
|
69
|
+
brew uninstall mcporter || true
|
|
70
|
+
npm uninstall -g mcporter || true
|
|
71
|
+
```
|
|
72
|
+
2. Install from Homebrew, run `brew test` equivalents (`mcporter list --help`), then uninstall so the npm install owns the global `mcporter` binary. If the install fails with a linking conflict (`bin/mcporter already exists`), run `brew link --overwrite mcporter` and rerun the smoke command before uninstalling:
|
|
73
|
+
```bash
|
|
74
|
+
brew install steipete/tap/mcporter
|
|
75
|
+
# If you still have /opt/homebrew/bin/mcporter from npm, fix conflicts with:
|
|
76
|
+
# brew link --overwrite mcporter
|
|
77
|
+
mcporter list --help | head -n 5
|
|
78
|
+
brew uninstall mcporter
|
|
79
|
+
```
|
|
80
|
+
3. Install the npm package globally (or leave it to npx) and keep that version in place for day-to-day use:
|
|
81
|
+
```bash
|
|
82
|
+
npm install -g mcporter@<version>
|
|
83
|
+
mcporter --version
|
|
84
|
+
```
|
|
85
|
+
4. Finally, run a fresh `npx mcporter@<version>` smoke test from an empty temp directory (no runner needed) to ensure the package is usable without global installs.
|
|
86
|
+
|
|
87
|
+
17. Update `steipete/homebrew-tap` → `Formula/mcporter.rb` with the new version, tarball URL, and SHA256. Refresh the tap README highlights and changelog snippets so Homebrew users see the new version callouts. (That repo doesn’t include `runner`, so use regular git commands there.)
|
|
88
|
+
18. Commit and push the tap update.
|
|
89
|
+
19. Verify the Homebrew flow (after GitHub release assets propagate):
|
|
90
|
+
```bash
|
|
91
|
+
brew update
|
|
92
|
+
brew install steipete/tap/mcporter
|
|
93
|
+
# If you previously installed mcporter via npm (or another tap) and see a link error,
|
|
94
|
+
# run `brew link --overwrite mcporter` to replace /opt/homebrew/bin/mcporter with the tap binary.
|
|
95
|
+
mcporter list --help
|
|
96
|
+
```
|
package/docs/adhoc.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: 'How to use mcporter’s ad-hoc HTTP/stdio flags to try MCP servers without editing config files.'
|
|
3
|
+
read_when:
|
|
4
|
+
- 'Exploring or debugging unknown MCP endpoints'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Ad-hoc MCP Servers
|
|
8
|
+
|
|
9
|
+
mcporter is gaining support for "just try it" workflows where you point the CLI at a raw MCP endpoint without first editing a config file. This doc tracks the behavior and heuristics we use to make that experience smooth while keeping the runtime predictable.
|
|
10
|
+
|
|
11
|
+
## Entry Points
|
|
12
|
+
|
|
13
|
+
Two new flag sets let you describe a server on the command line:
|
|
14
|
+
|
|
15
|
+
- `mcporter list --http-url https://mcp.linear.app/mcp [--name linear]`
|
|
16
|
+
- `mcporter call --stdio "bun run ./server.ts" --name local-tools`
|
|
17
|
+
|
|
18
|
+
You can also pass a bare URL as the selector (`mcporter list https://mcp.linear.app/mcp`) or embed the URL in a `call` expression (`mcporter call 'https://mcp.example.com/tools.generate({ topic: "release" })'`).
|
|
19
|
+
- Add `--json` to `mcporter list …` when you need a machine-readable summary of status counts and per-server failures, use `--output json`/`--output raw` with `mcporter call` to receive structured `{ server, tool, issue }` envelopes whenever a transport error occurs, and run `mcporter auth … --json` to capture the same envelope if OAuth or transport setup fails.
|
|
20
|
+
|
|
21
|
+
### Example: HTTP ad-hoc workflow
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Inspect the server directly via URL (no config entry needed)
|
|
25
|
+
mcporter list 'https://mcp.sentry.dev/mcp?agent=1'
|
|
26
|
+
|
|
27
|
+
# Call a tool by repeating the same URL + tool suffix
|
|
28
|
+
mcporter call 'https://mcp.sentry.dev/mcp?agent=1.use_sentry(request: "yo whats up")'
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Notice that the second command repeats the URL. Ad-hoc definitions are ephemeral unless you pass `--persist`, so there is no stored server named `mcp-sentry-dev-mcp` yet. Reusing the printed slug only works after you persist the definition (see "Naming & Identity" below) or add the server to your config; otherwise keep passing the URL/stdio selector each time.
|
|
32
|
+
|
|
33
|
+
## Transport Detection
|
|
34
|
+
|
|
35
|
+
- **HTTP(S)**: Providing a URL defaults to the streamable HTTP transport. `https://` works out of the box; `http://` requires `--allow-http` (or the hidden alias `--insecure`) to acknowledge cleartext traffic. The `--sse` flag is a hidden alias for `--http-url` to match older examples.
|
|
36
|
+
- **STDIO**: Supplying `--stdio` (with a command string) or `--stdio-bin` (binary + args) selects the stdio transport. Your current shell environment is inherited automatically; use `--env KEY=value` only when you need to inject/override specific variables (and `--cwd` to change directories).
|
|
37
|
+
- **Conflict guard**: Passing both URL and stdio flags errors out so we don’t guess.
|
|
38
|
+
|
|
39
|
+
## Naming & Identity
|
|
40
|
+
|
|
41
|
+
- `--name` wins when provided.
|
|
42
|
+
- Otherwise we derive a slug:
|
|
43
|
+
- HTTP: `<host>` plus a sanitized path fragment (e.g. `mcp-linear-app-mcp`).
|
|
44
|
+
- STDIO: executable basename + script (`node-singlestep`).
|
|
45
|
+
- Until you persist the definition (via `--persist`, `mcporter config add`, etc.), the slug is **only** used as the cache key for OAuth tokens/log prefs—you still need to supply the ad-hoc descriptor (`--http-url`, `--stdio`, or bare URL) every time you invoke `mcporter list|call|auth`.
|
|
46
|
+
- Once persisted, the slug becomes a normal server name so `mcporter call <slug>.tool` and `mcporter auth <slug>` work just like any other configured entry.
|
|
47
|
+
- If you don’t persist the definition, run `mcporter auth https://mcp.linear.app/mcp` (or supply `--name linear` so `mcporter auth linear` also works) to finish OAuth with the same settings.
|
|
48
|
+
|
|
49
|
+
This name becomes the cache key for OAuth tokens and log preferences, so repeated ad-hoc calls still benefit from credential reuse.
|
|
50
|
+
|
|
51
|
+
## OAuth Auto-Detection
|
|
52
|
+
|
|
53
|
+
Many hosted MCP servers (Supabase, Vercel, etc.) advertise OAuth capabilities but expect clients to discover this dynamically. When an ad-hoc HTTP server responds with `401/403` during the initial handshake, mcporter now:
|
|
54
|
+
|
|
55
|
+
1. **Promotes the definition to OAuth** and spins up the default browser flow—no need to edit config or supply `auth: "oauth"` manually.
|
|
56
|
+
2. **Persists the change** whenever you pass `--persist`, so future runs remember that the endpoint requires OAuth without repeating the detection step.
|
|
57
|
+
|
|
58
|
+
The CLI still avoids surprise prompts during `mcporter list`; the upgrade happens the first time you run `mcporter auth <url>` or any other command that allows OAuth (i.e., not in `--autoAuthorize=false` mode).
|
|
59
|
+
|
|
60
|
+
## Auth & Persistence
|
|
61
|
+
|
|
62
|
+
- OAuth flows are allowed; successful tokens store under the inferred name just like regular definitions.
|
|
63
|
+
- `mcporter auth` accepts the same `--http-url/--stdio` flags (and even bare URLs), so you can immediately re-run `mcporter auth https://…` after a 401 without touching a config file.
|
|
64
|
+
- For remote environments, run `mcporter auth <url> --browser none`, open the printed URL locally, then complete the flow with `mcporter auth complete '<failed-localhost-redirect>'`.
|
|
65
|
+
- Nothing is written to disk unless you pass `--persist /path/to/config.json`. When set, we merge the generated definition into that file (creating it if necessary) so future runs can rely on the standard config pipeline.
|
|
66
|
+
|
|
67
|
+
## Safety Nets
|
|
68
|
+
|
|
69
|
+
- Non-HTTPS endpoints require `--allow-http`.
|
|
70
|
+
- For stdio commands we print a confirmation snippet the first time we see a new command unless `--yes` is present.
|
|
71
|
+
- Missing transports or malformed combinations throw descriptive errors, pointing to `docs/adhoc.md` for guidance.
|
|
72
|
+
|
|
73
|
+
## Follow-ups
|
|
74
|
+
|
|
75
|
+
- Extend `mcporter config add` to leverage the same helper, making it the one-stop path from exploration to permanence.
|
|
76
|
+
- Consider caching inference results so repeated URL calls automatically rehydrate the previous settings (env/cwd).
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: 'Explains mcporter call’s typo heuristics, auto-correction thresholds, and suggestion behavior.'
|
|
3
|
+
read_when:
|
|
4
|
+
- 'Tool invocations fail due to misspelled names'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Call Command Auto-Correction
|
|
8
|
+
|
|
9
|
+
`mcporter call` aims to help when a tool name is *almost* correct without hiding real mistakes.
|
|
10
|
+
|
|
11
|
+
## Confident Matches → Auto-Correct
|
|
12
|
+
- We normalise tool names (strip punctuation, lowercase) and compute a Levenshtein distance.
|
|
13
|
+
- If the distance is ≤ `max(2, floor(length × 0.3))`, or the names only differ by case/punctuation, we retry automatically.
|
|
14
|
+
- A dim informational line explains the correction: `[mcporter] Auto-corrected tool call to linear.list_issues (input: linear.listIssues).`
|
|
15
|
+
|
|
16
|
+
## Low-Confidence Matches → Suggest
|
|
17
|
+
- When the best candidate falls outside the threshold we keep the original failure.
|
|
18
|
+
- We still print a hint so the user learns the canonical name: `[mcporter] Did you mean linear.list_issue_statuses?`
|
|
19
|
+
- No second call is attempted in this case.
|
|
20
|
+
|
|
21
|
+
## Edge Cases
|
|
22
|
+
- We only inspect the tool catalog if the server explicitly replied with “Tool … not found”. Other MCP errors surface untouched.
|
|
23
|
+
- If listing tools itself fails (auth, offline, etc.) we skip both auto-correct and hints.
|
|
24
|
+
- Behaviour is covered by `tests/cli-call.test.ts`.
|
|
25
|
+
|
|
26
|
+
## Server Selection Heuristic
|
|
27
|
+
|
|
28
|
+
- `mcporter list <server>` now applies the same edit-distance heuristic to server names. If you type `vercek`, the CLI auto-corrects to `vercel` (and logs `[mcporter] Auto-corrected server name to vercel (input: vercek).`).
|
|
29
|
+
- When the typo is too large, we keep the original failure but emit a hint: `[mcporter] Did you mean linear?` followed by the usual “Unknown MCP server …” line. This avoids giant stack traces while pointing to the right name.
|
|
30
|
+
- The heuristic considers every configured server (including ad-hoc ones registered via `--http-url/--stdio`). Tests covering this behaviour live in `tests/cli-list.test.ts`.
|
|
31
|
+
- `mcporter auth` shares the same routing logic, so `mcporter auth https://mcp.example.com/mcp` (or even `mcporter auth vercek`) will spin up the temporary definition, auto-correct close names, and launch OAuth without touching the config file.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: 'Reference for mcporter call argument styles, CLI signatures, and structured output modes.'
|
|
3
|
+
read_when:
|
|
4
|
+
- 'Working on call CLI UX or documenting invocation examples'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Call Syntax Reference
|
|
8
|
+
|
|
9
|
+
`mcporter call` now understands two complementary styles:
|
|
10
|
+
|
|
11
|
+
| Style | Example | Notes |
|
|
12
|
+
|-------|---------|-------|
|
|
13
|
+
| Flag-based (compatible) | `mcporter call linear.create_comment --issue-id LNR-123 --body "Hi"` | Use `key=value`, `key:value`, or `key: value` pairs—ideal for shell scripts. |
|
|
14
|
+
| Function-call (expressive) | `mcporter call 'linear.create_comment(issueId: "LNR-123", body: "Hi")'` | Mirrors the pseudo-TypeScript signature shown by `mcporter list`; unlabeled values map to schema order. |
|
|
15
|
+
| Structured output | `mcporter call 'linear.create_comment(...)' --output json` | Successful calls emit JSON bodies; failures emit `{ server, tool, issue }` envelopes so automation can react to auth/offline/http errors. |
|
|
16
|
+
|
|
17
|
+
Both forms share the same validation pipeline, so required parameters, enums, and formats behave identically.
|
|
18
|
+
|
|
19
|
+
## Reading the CLI Signatures
|
|
20
|
+
|
|
21
|
+
`mcporter list <server>` prints each tool as a compact TypeScript declaration:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
/**
|
|
25
|
+
* Create a comment on a specific Linear issue.
|
|
26
|
+
* @param issueId The issue ID
|
|
27
|
+
* @param body The content of the comment as Markdown
|
|
28
|
+
* @param parentId? A parent comment ID to reply to
|
|
29
|
+
*/
|
|
30
|
+
function create_comment(issueId: string, body: string, parentId?: string): Comment;
|
|
31
|
+
// optional (3): notifySubscribers, labelIds, mentionIds, ...
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Key details:
|
|
35
|
+
|
|
36
|
+
- Doc blocks use `@param` lines so every parameter description (even optional ones) stays in view.
|
|
37
|
+
- Required parameters appear without `?`; optional parameters use `?` and inherit enum literals (e.g. `"json" | "markdown"`).
|
|
38
|
+
- Known format hints are appended inline: `dueDate?: string /* ISO 8601 */` (we suppress the hint when the description already calls it out).
|
|
39
|
+
- When a tool exposes more than two optional parameters (or has ≥4 required parameters), the default output hides the extras and replaces them with an inline summary like `// optional (8): limit, before, after, orderBy, projectId, ...`.
|
|
40
|
+
- Run `mcporter list <server> --all-parameters` whenever you want the full signature; the footer repeats `Optional parameters hidden; run with --all-parameters to view all fields.` any time truncation occurs.
|
|
41
|
+
- Return types come from each tool’s output schema, so you’ll see concrete names when providers include `title` metadata (e.g. `DocumentConnection`). When no schema is advertised we omit the `: Type` suffix entirely instead of showing `unknown`.
|
|
42
|
+
- Each server concludes with a short `Examples:` block that mirrors the preferred function-call syntax.
|
|
43
|
+
|
|
44
|
+
## Function-Call Syntax Details
|
|
45
|
+
|
|
46
|
+
- **Named arguments preferred**: `issueId: "123"` keeps calls self-documenting. When labels are omitted, mcporter falls back to positional order defined by the tool schema.
|
|
47
|
+
- **Optional positional fallback**: omit labels when calling `mcporter 'context7.resolve-library-id("react")'`—arguments map to the schema order after any explicitly named parameters.
|
|
48
|
+
- **Literals supported**: strings, numbers, booleans, `null`, arrays, and nested objects. For strings containing spaces or commas, wrap the entire call in single quotes to keep the shell happy.
|
|
49
|
+
- **Error feedback**: invalid keys, unsupported expressions, or parser failures bubble up with actionable messages (`Unsupported argument expression: Identifier`, `Unable to parse call expression: …`).
|
|
50
|
+
- **Server selection**: You can embed the server in the expression (`linear.create_comment(...)`) or pass it separately (`--server linear create_comment(...)`).
|
|
51
|
+
|
|
52
|
+
## HTTP Selectors & Ad-hoc URLs
|
|
53
|
+
|
|
54
|
+
- You can skip `--server` entirely by pasting the MCP endpoint + tool name directly: `mcporter call 'https://www.shadcn.io/api/mcp.getComponent(component: "vortex")'`.
|
|
55
|
+
- Mcporter strips the `.tool` suffix to derive the base server URL, reuses any configured definition that already points at that endpoint, and only registers a new ad-hoc server when necessary (`--allow-http` still guards plain HTTP URLs).
|
|
56
|
+
- Function-call arguments continue to work in this form; if you omit parentheses you can still append `key=value` pairs (`https://.../mcp.getComponent component=vortex`).
|
|
57
|
+
- This is especially handy for copy/pasting tool listings or experimenting with anonymous HTTP MCP servers—you get the same parsing, auto-correction, and logging pipeline as the regular `server.tool` syntax.
|
|
58
|
+
- Protocols are optional; bare domains such as `shadcn.io/api/mcp.getComponents` automatically assume `https://`. If you really need plain HTTP, spell out `http://` and pass `--allow-http`.
|
|
59
|
+
- Hostname comparisons ignore a leading `www.` so `https://shadcn.io/api/mcp` and `https://www.shadcn.io/api/mcp` resolve to the same configured server when possible.
|
|
60
|
+
|
|
61
|
+
## Tips
|
|
62
|
+
|
|
63
|
+
- Use `--args '{ "issueId": "LNR-123" }'` if you already have JSON payloads—nothing changed for that workflow.
|
|
64
|
+
- The new syntax respects all existing features (timeouts, `--output`, auto-correction).
|
|
65
|
+
- Required fields show by default; pass `--all-parameters` when you want the full parameter list (or `--schema` for raw JSON schemas).
|
|
66
|
+
- When in doubt, run `mcporter list <server>` to see the current signature and sample invocation.
|
|
67
|
+
|
|
68
|
+
## Flag-Based Syntax Details
|
|
69
|
+
|
|
70
|
+
- `key=value`, `key:value`, and `key: value` all map to the same named-argument handling, so you can type whichever feels most natural for your shell.
|
|
71
|
+
- By default, arguments keep the same validation pipeline as the function-call syntax—enums, numbers, and booleans are coerced automatically, and missing required fields raise errors.
|
|
72
|
+
- `--raw-strings` disables numeric coercion for flag-style and positional values so IDs/codes stay literal strings (`code=12345` stays `"12345"`).
|
|
73
|
+
- `--no-coerce` disables all coercion for flag-style and positional values (`true`, `null`, and JSON-like values remain strings).
|
|
74
|
+
- `--save-images <dir>` keeps stdout formatting untouched while writing image content blocks to disk when a tool response includes `type: "image"` entries.
|
|
75
|
+
- `tool=value`/`tool:value` and `server=value` still act as aliases for `--tool` / `--server` when you need to override the selector.
|