@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,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: 'Goals and requirements for mcporter generate-cli, including outputs, runtimes, and schema-aware UX.'
|
|
3
|
+
read_when:
|
|
4
|
+
- 'Changing generate-cli behavior or bundler integrations'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# CLI Generator Plan
|
|
8
|
+
|
|
9
|
+
Default behavior: generating `<server>.ts` in the working directory if no output path is provided. Bundling is opt-in via `--bundle` and produces a single JS file with shebang; otherwise we emit TypeScript targeting Node.js. Rolldown handles bundling by default unless the runtime resolves to Bun—in that case Bun’s native bundler is selected automatically (still requires `--runtime bun` or Bun auto-detection); `--bundler` lets you override either choice.
|
|
10
|
+
|
|
11
|
+
## Goal
|
|
12
|
+
Create an `mcporter generate-cli` command that produces a standalone CLI for a single MCP server. The generated CLI should feel like a Unix tool: subcommands map to MCP tools, arguments translate to schema fields, and output can be piped/redirected easily.
|
|
13
|
+
|
|
14
|
+
## High-Level Requirements
|
|
15
|
+
- **Input**: Identify the target server either by shorthand name or by providing an explicit MCP server definition.
|
|
16
|
+
- **Output**: Emit a TypeScript file (ESM) targeting Node.js by default (`<server>.ts` unless `--output` overrides). Bundling to a standalone JS file happens only when `--bundle` is passed.
|
|
17
|
+
- **Runtime Selection**: Prefer Bun when it is available (`bun --version` succeeds); otherwise fall back to Node.js. Callers can force either runtime via `--runtime bun|node`.
|
|
18
|
+
- **Schema-Aware CLI**: Leverage `createServerProxy` to map positional/flag arguments to MCP tool schemas, including defaults and required validation.
|
|
19
|
+
- **Unix-Friendly Output**: Provide `--output text|json|markdown|raw` flags so results can be piped; default to human-readable text. Include `--timeout` (default 30s) to cap call duration.
|
|
20
|
+
- **Shell Completion (optional)**: Generate completion scripts for bash/zsh/fish if requested.
|
|
21
|
+
- **Documentation**: Update README (or similar) to show how to generate and use the CLI.
|
|
22
|
+
|
|
23
|
+
## Steps
|
|
24
|
+
1. **Command Scaffolding**
|
|
25
|
+
- Add `generate-cli` subcommand to the existing CLI.
|
|
26
|
+
- Parse flags: `--server`, `--name`, `--command`, optional `--description`, plus `--output`, `--runtime=node|bun`, `--bundle`, `--bundler=rolldown|bun`, `--minify`, `--compile`, `--include-tools`, `--exclude-tools`, etc. Runtime auto-detects Bun when available, and the bundler inherits that choice unless overridden.
|
|
27
|
+
- Optional `--include-tools` / `--exclude-tools` flags allow generating a CLI that exposes only a subset of tools (mutually exclusive).
|
|
28
|
+
2. **Server Resolution**
|
|
29
|
+
- If `--server` matches a configured name (via `loadServerDefinitions`), use that server definition.
|
|
30
|
+
- Otherwise, if the value looks like a file path, load a Cursor-style JSON definition from disk.
|
|
31
|
+
- Otherwise, attempt to parse inline JSON/JSON5.
|
|
32
|
+
- When `--command` (or the first positional argument) looks like a shell command (contains whitespace), split it into `command` + `args` and treat it as stdio. Otherwise, normalize HTTP selectors (`https://`, `http://`, or `host/path.tool`) so `generate-cli mcp.context7.com/mcp` autoconfigures an HTTP transport.
|
|
33
|
+
- Validate that a definition is found; prompt on failure.
|
|
34
|
+
3. **Tool Introspection**
|
|
35
|
+
- Use `listTools(server, { includeSchema: true })` to inspect MCP tool schemas.
|
|
36
|
+
- For each tool, extract required/optional arguments, types, and defaults.
|
|
37
|
+
4. **Template Generation**
|
|
38
|
+
- Build a template (probably EJS or string interpolation) that:
|
|
39
|
+
- Imports `createRuntime` and `createServerProxy`.
|
|
40
|
+
- Creates a CLI (likely using `commander` or a minimal custom parser) with subcommands per tool.
|
|
41
|
+
- Bakes in server metadata (command/url, headers, etc.) or references config path if preferred.
|
|
42
|
+
- Adds output-format handling.
|
|
43
|
+
- Include `package.json` scaffolding if `--bundle` or `--package` is set.
|
|
44
|
+
5. **Optional Bundling**
|
|
45
|
+
- If requested, run Rolldown (default when targeting Node) or Bun’s bundler (default when the runtime is Bun, or when `--bundler bun` is passed) to emit a single JS file with shebang (Node or Bun), with optional minification.
|
|
46
|
+
- When targeting Bun, allow `--compile` to delegate to `bun build --compile` and generate a self-contained binary. Bun bundling requires staging the template inside the package tree so dependencies resolve even when invoked from empty directories.
|
|
47
|
+
- Otherwise, leave as TypeScript/ESM and document how to run (`node path/to/cli.js` or `bun path/to/cli.ts`).
|
|
48
|
+
6. **Testing**
|
|
49
|
+
- Add generator unit tests (snapshot the emitted CLI for known schemas).
|
|
50
|
+
- Add integration tests that run the generated script against a mock MCP server.
|
|
51
|
+
7. **Docs/Examples**
|
|
52
|
+
- Document usage in README.
|
|
53
|
+
- Provide an example generated CLI under `examples/generated/<server>.ts` (if we keep an examples directory).
|
|
54
|
+
|
|
55
|
+
## Notes
|
|
56
|
+
- Generated CLI depends on the latest `commander` for argument parsing.
|
|
57
|
+
- Default timeout for tool calls is 30 seconds, overridable via `--timeout`.
|
|
58
|
+
- Runtime flag remains (`--runtime bun`) to tailor shebang/usage instructions, but Node.js is the default.
|
|
59
|
+
- Generated CLI embeds the resolved server definition and always targets that snapshot (no external `--config` or `--server` overrides at runtime).
|
|
60
|
+
|
|
61
|
+
## Usage Examples
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Minimal: infer the name from the command URL and emit TypeScript (optionally bundle)
|
|
65
|
+
npx mcporter generate-cli \
|
|
66
|
+
--command https://mcp.context7.com/mcp \
|
|
67
|
+
--minify
|
|
68
|
+
|
|
69
|
+
# Provide explicit name/description and compile a Bun binary (falls back to Node if Bun missing)
|
|
70
|
+
npx mcporter generate-cli \
|
|
71
|
+
--name context7 \
|
|
72
|
+
--command https://mcp.context7.com/mcp \
|
|
73
|
+
--description "Context7 docs MCP" \
|
|
74
|
+
--runtime bun \
|
|
75
|
+
--compile
|
|
76
|
+
|
|
77
|
+
chmod +x context7
|
|
78
|
+
./context7
|
|
79
|
+
# show the embedded help + tool list
|
|
80
|
+
|
|
81
|
+
# Shareable "one weird trick" for chrome-devtools (no config required)
|
|
82
|
+
npx mcporter generate-cli --command "npx -y chrome-devtools-mcp@latest"
|
|
83
|
+
|
|
84
|
+
- `--minify` shrinks the bundled output via the selected bundler (output defaults to `<server>.js`).
|
|
85
|
+
- `--compile [path]` implies bundling and invokes `bun build --compile` to create the native executable (Bun only). When you omit the path, the compiled binary inherits the server name.
|
|
86
|
+
- Use `--server '{...}'` when you need advanced configuration (headers, env vars, stdio commands, OAuth metadata).
|
|
87
|
+
- Omit `--name` to let mcporter infer it from the command URL (for example, `https://mcp.context7.com/mcp` becomes `context7`).
|
|
88
|
+
- When targeting an existing config entry, you can skip `--server` and pass the name as a positional argument:
|
|
89
|
+
`npx mcporter generate-cli linear --bundle dist/linear.js`.
|
|
90
|
+
- When the MCP server is a stdio command, you can also skip `--command` by quoting the inline command as the first positional argument (e.g., `npx mcporter generate-cli "npx -y chrome-devtools-mcp@latest"`).
|
|
91
|
+
- Narrow the CLI to a specific subset of tools with `--include-tools`:
|
|
92
|
+
`npx mcporter generate-cli linear --include-tools issues_list,issues_create`.
|
|
93
|
+
- Hide debug or admin tools with `--exclude-tools`:
|
|
94
|
+
`npx mcporter generate-cli linear --exclude-tools debug_tool,admin_reset`.
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
## Artifact Metadata & Regeneration
|
|
100
|
+
|
|
101
|
+
- Every generated artifact embeds its metadata (generator version, resolved server definition, invocation flags). A hidden `__mcporter_inspect` subcommand prints the payload without contacting the MCP server, so binaries remain self-describing even after being copied to another machine.
|
|
102
|
+
- `mcporter inspect-cli <artifact>` shells out to that embedded command and prints a human summary (pass `--json` for raw output). The summary includes a ready-to-run `generate-cli` command you can reuse directly.
|
|
103
|
+
- `mcporter generate-cli --from <artifact>` replays the stored invocation against the latest mcporter build. `--server`, `--runtime`, `--timeout`, `--minify/--no-minify`, `--bundle`, `--compile`, `--output`, and `--dry-run` let you override specific pieces of the stored metadata when necessary.
|
|
104
|
+
- Because the metadata lives inside the artifact, any template, bundle, or compiled binary can be refreshed after a generator upgrade without juggling sidecar files.
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
## Status
|
|
109
|
+
- ✅ `generate-cli` subcommand implemented with schema-aware proxy generation.
|
|
110
|
+
- ✅ Inline JSON / file / shorthand server resolution wired up.
|
|
111
|
+
- ✅ Bundling via Rolldown by default (or Bun automatically when the runtime is Bun, with `--bundler` available for overrides) plus optional minification and Bun bytecode compilation.
|
|
112
|
+
- ✅ Integration tests cover bundling, minification, compiled binaries, and metadata/regeneration flows against the mock MCP server.
|
|
113
|
+
|
|
114
|
+
Next steps:
|
|
115
|
+
1. Add optional shell completion scaffolding if demand arises.
|
|
116
|
+
2. Explore templated TypeScript definitions for generated CLIs to improve editor tooling.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: 'Quick reference for mcporter subcommands, their arguments, and shared global flags.'
|
|
3
|
+
read_when:
|
|
4
|
+
- 'Need a refresher on available CLI commands'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# mcporter CLI Reference
|
|
8
|
+
|
|
9
|
+
A quick reference for the primary `mcporter` subcommands. Each command inherits
|
|
10
|
+
`--config <file>` and `--root <dir>` to override where servers are loaded from.
|
|
11
|
+
|
|
12
|
+
## `mcporter list [server]`
|
|
13
|
+
- Without arguments, lists every configured server (with live discovery + brief
|
|
14
|
+
status).
|
|
15
|
+
- With a server name, prints TypeScript-style signatures for each tool, doc
|
|
16
|
+
comments, and optional summaries.
|
|
17
|
+
- Hidden alias: `list-tools` (kept for muscle memory; not advertised in help output).
|
|
18
|
+
- Hidden ad-hoc flag aliases: `--sse` for `--http-url`, `--insecure` for `--allow-http` (for plain HTTP testing).
|
|
19
|
+
- Flags:
|
|
20
|
+
- `--all-parameters` – include every optional parameter in the signature.
|
|
21
|
+
- `--schema` – pretty-print the JSON schema for each tool.
|
|
22
|
+
- `--timeout <ms>` – per-server timeout when enumerating all servers.
|
|
23
|
+
|
|
24
|
+
## `mcporter call <server.tool>`
|
|
25
|
+
- Invokes a tool once and prints the response; supports positional arguments via
|
|
26
|
+
pseudo-TS syntax and `--arg` flags.
|
|
27
|
+
- Useful flags:
|
|
28
|
+
- `--server`, `--tool` – alternate way to target a tool.
|
|
29
|
+
- `--timeout <ms>` – override call timeout (defaults to `CALL_TIMEOUT_MS`).
|
|
30
|
+
- `--output text|markdown|json|raw` – choose how to render the `CallResult`.
|
|
31
|
+
- `--save-images <dir>` – persist image content blocks to files under the specified directory.
|
|
32
|
+
- `--raw-strings` – disable numeric coercion for flag-style and positional values.
|
|
33
|
+
- `--no-coerce` – disable all flag-style/positional value coercion.
|
|
34
|
+
- `--tail-log` – stream tail output when the tool returns log handles.
|
|
35
|
+
|
|
36
|
+
## `mcporter generate-cli`
|
|
37
|
+
- Produces a standalone CLI for a single MCP server (optionally bundling or
|
|
38
|
+
compiling with Bun).
|
|
39
|
+
- Key flags:
|
|
40
|
+
- `--server <name>` (or inline JSON) – choose the server definition.
|
|
41
|
+
- `--command <url|command>` – point at an ad-hoc HTTP endpoint (include `https://` or use `host/path.tool`) or a stdio command (anything with spaces, e.g., `"npx -y chrome-devtools-mcp@latest"`). If you omit `--command`, the first positional argument is inspected: whitespace → stdio, otherwise the parser probes for HTTP/HTTPS and falls back to config names.
|
|
42
|
+
- `--output <path>` – where to write the TypeScript template.
|
|
43
|
+
- `--bundle <path>` – emit a bundle (Node/Bun) ready for `bun x`.
|
|
44
|
+
- `--bundler rolldown|bun` – pick the bundler implementation (defaults to Rolldown unless the runtime resolves to Bun, in which case Bun’s bundler is used automatically; still requires a local Bun install).
|
|
45
|
+
- `--compile <path>` – compile with Bun (implies `--runtime bun`).
|
|
46
|
+
- `--include-tools <a,b,c>` – only generate subcommands for the specified tools (exact MCP tool names). It is an error if any requested tool is missing.
|
|
47
|
+
- `--exclude-tools <a,b,c>` – generate subcommands for every tool except the ones listed. Unknown tool names are ignored. If all tools are excluded, generation fails.
|
|
48
|
+
- `--include-tools` and `--exclude-tools` are mutually exclusive.
|
|
49
|
+
- `--timeout <ms>` / `--runtime node|bun` – shared via the generator flag
|
|
50
|
+
parser so defaults stay consistent.
|
|
51
|
+
- `--from <artifact>` – reuse metadata from an existing CLI artifact (legacy
|
|
52
|
+
`regenerate-cli` behavior, must point at an existing CLI).
|
|
53
|
+
- `--dry-run` – print the resolved `mcporter generate-cli ...` command without
|
|
54
|
+
executing (requires `--from`).
|
|
55
|
+
- Positional shorthand: `npx mcporter generate-cli linear` uses the configured
|
|
56
|
+
`linear` definition; `npx mcporter generate-cli https://example.com/mcp`
|
|
57
|
+
treats the URL as an ad-hoc server definition.
|
|
58
|
+
|
|
59
|
+
## `mcporter emit-ts <server>`
|
|
60
|
+
- Emits TypeScript definitions (and optionally a ready-to-use client) describing
|
|
61
|
+
a server’s tools. This reuses the same formatter as `mcporter list` so doc
|
|
62
|
+
comments, signatures, and examples stay in sync.
|
|
63
|
+
- Modes:
|
|
64
|
+
- `--mode types --out <file.d.ts>` (default) – export an interface whose
|
|
65
|
+
methods return `Promise<CallResult>`, with doc comments and optional
|
|
66
|
+
summaries.
|
|
67
|
+
- `--mode client --out <file.ts>` – emit both the interface (`<file>.d.ts`)
|
|
68
|
+
and a factory that wraps `createServerProxy`, returning objects whose
|
|
69
|
+
methods resolve to `CallResult`.
|
|
70
|
+
- Other flags:
|
|
71
|
+
- `--include-optional` (alias `--all-parameters`) – show every optional field.
|
|
72
|
+
- `--types-out <file>` – override where the `.d.ts` sits when using client
|
|
73
|
+
mode.
|
|
74
|
+
|
|
75
|
+
For more detail (behavioral nuances, OAuth flows, etc.), see `docs/spec.md` and
|
|
76
|
+
command-specific docs under `docs/`.
|
package/docs/config.md
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: 'How mcporter discovers, merges, and mutates configuration files (project + home + imports), including OAuth and persistence.'
|
|
3
|
+
read_when:
|
|
4
|
+
- 'Working on config resolution, imports, or mcporter config subcommands'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# CLI Help Menu Snapshot
|
|
8
|
+
```
|
|
9
|
+
mcporter config
|
|
10
|
+
Usage: mcporter config [options] <command>
|
|
11
|
+
|
|
12
|
+
Manage configured MCP servers, imports, and ad-hoc discoveries.
|
|
13
|
+
|
|
14
|
+
Commands:
|
|
15
|
+
list [options] [filter] Show merged servers (local + imports + ad-hoc cache)
|
|
16
|
+
get <name> Inspect a single server with resolved source info
|
|
17
|
+
add [options] <name> [target] Persist a server definition (URL or stdio command)
|
|
18
|
+
remove [options] <name> Delete a local entry or copy from an import
|
|
19
|
+
import <kind> [options] Copy entries from cursor/claude/codex/etc. into config
|
|
20
|
+
login <name|url> Complete OAuth/auth flows for a server
|
|
21
|
+
logout <name> Clear cached credentials for a server
|
|
22
|
+
doctor [options] Validate config files and report common mistakes
|
|
23
|
+
help [command] Show CLI or subcommand help
|
|
24
|
+
|
|
25
|
+
Global Options:
|
|
26
|
+
--config <path> Use an explicit config file (default: config/mcporter.json)
|
|
27
|
+
--root <dir> Set project root for import discovery (default: cwd)
|
|
28
|
+
--json Emit machine-readable output when supported
|
|
29
|
+
-h, --help Display help for mcporter config
|
|
30
|
+
|
|
31
|
+
Run `mcporter config help add` to see transport flags, ad-hoc persistence tips, and schema docs.
|
|
32
|
+
See https://github.com/sweetistics/mcporter/blob/main/docs/config.md for config anatomy, import precedence, and troubleshooting guidance.
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
# Configuration Guide
|
|
36
|
+
|
|
37
|
+
## Overview
|
|
38
|
+
mcporter keeps three configuration buckets in sync: repository-scoped JSON (`config/mcporter.json`), imported editor configs (Cursor, Claude, Codex, Windsurf, OpenCode, VS Code), and ad-hoc definitions supplied on the CLI. This guide explains how those sources merge, how to mutate them with `mcporter config ...`, and the safety rails around OAuth, env interpolation, and persistence.
|
|
39
|
+
|
|
40
|
+
## Quick Start
|
|
41
|
+
1. Create `config/mcporter.json` at the repo root:
|
|
42
|
+
```jsonc
|
|
43
|
+
{
|
|
44
|
+
"$schema": "https://raw.githubusercontent.com/steipete/mcporter/main/mcporter.schema.json",
|
|
45
|
+
"mcpServers": {
|
|
46
|
+
"linear": {
|
|
47
|
+
"description": "Linear issues",
|
|
48
|
+
"baseUrl": "https://mcp.linear.app/mcp",
|
|
49
|
+
"headers": { "Authorization": "Bearer ${LINEAR_API_KEY}" }
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"imports": ["cursor", "claude-code", "claude-desktop", "codex", "windsurf", "opencode", "vscode"]
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
The `$schema` property enables IDE autocomplete and validation. Use the raw GitHub URL for the latest schema, or copy `mcporter.schema.json` locally.
|
|
56
|
+
2. Run `mcporter list linear` (or `mcporter config list linear`) to make sure the runtime can reach it.
|
|
57
|
+
3. Use `mcporter config add shadcn https://www.shadcn.io/api/mcp` to persist another server without editing JSON.
|
|
58
|
+
4. Authenticate any OAuth-backed server with either `mcporter auth <name>` or `mcporter config login <name>`; tokens land under `~/.mcporter/<name>/` unless you override `tokenCacheDir`.
|
|
59
|
+
|
|
60
|
+
## Config Resolution Order
|
|
61
|
+
|
|
62
|
+
mcporter now merges home and project config files by default so global servers stay available inside repos. The order depends on how you invoke the CLI:
|
|
63
|
+
|
|
64
|
+
1. If you pass `--config <file>` (or set `--config` programmatically), only that file is used—no merging.
|
|
65
|
+
2. If `MCPORTER_CONFIG` is set, only that file is used—no merging.
|
|
66
|
+
3. Otherwise, mcporter loads both of these layers (when present):
|
|
67
|
+
- `~/.mcporter/mcporter.json` or `~/.mcporter/mcporter.jsonc`
|
|
68
|
+
- `<root>/config/mcporter.json`
|
|
69
|
+
Entries from the project file override entries with the same name from the home file. Each layer still pulls in its own imports before merging.
|
|
70
|
+
|
|
71
|
+
All `mcporter config …` mutations still write back to a single file: the explicit path when provided; otherwise the project config path (`<root>/config/mcporter.json`). To edit the home file explicitly, run commands like `mcporter config --config ~/.mcporter/mcporter.json add <name> …` or set `MCPORTER_CONFIG` in your shell profile.
|
|
72
|
+
|
|
73
|
+
## Discovery & Precedence
|
|
74
|
+
mcporter builds a merged view of all known servers before executing any command. The sources load in this order:
|
|
75
|
+
|
|
76
|
+
| Priority | Source | Notes |
|
|
77
|
+
| --- | --- | --- |
|
|
78
|
+
| 1 | Explicit `--http-url`, `--stdio`, or bare URL passed to commands | Highest priority, never cached unless `--persist` is supplied. Requires `--allow-http` for plain HTTP URLs. |
|
|
79
|
+
| 2 | `config/mcporter.json` (or the file passed via `--config`) | Default path is `<root>/config/mcporter.json`; missing file returns an empty config so commands continue to work. |
|
|
80
|
+
| 3 | Imports listed in `"imports"` | When you omit `imports`, mcporter loads `['cursor','claude-code','claude-desktop','codex','windsurf','opencode','vscode']`. When you specify a non-empty array, mcporter appends any omitted defaults after your list so shared presets remain available. |
|
|
81
|
+
|
|
82
|
+
Rules:
|
|
83
|
+
- Later sources never override earlier ones. Local config always wins over imports; ad-hoc descriptors override both for the duration of a command.
|
|
84
|
+
- Each merged server tracks its origin (local path vs. import path), so `mcporter config get <name>` can show you the path before you edit or remove the local copy with `mcporter config remove <name>`.
|
|
85
|
+
- Imports remain read-only until you explicitly copy an entry via `mcporter config import <kind> --copy` or run `mcporter config add --copy-from claude-code:linear` (feature planned alongside the CLI work).
|
|
86
|
+
|
|
87
|
+
## CLI Workflows
|
|
88
|
+
`mcporter config` is the entry point for reading and writing configuration files. Use the existing ad-hoc flags on `mcporter list|call|auth` when you want ephemeral definitions; once you’re ready to persist them, switch back to `mcporter config add`.
|
|
89
|
+
|
|
90
|
+
Use `--scope home|project` with `mcporter config add` to pick the write target explicitly. `project` is always the default (creating `config/mcporter.json` if needed); `home` writes to `~/.mcporter/mcporter.json` even when a project config is present. `--persist <path>` still takes precedence when you need a custom file.
|
|
91
|
+
|
|
92
|
+
### `mcporter config list [filter]`
|
|
93
|
+
- Shows **local** entries by default. Pass `--source import` to list imported editor configs, or `--json` for machine output.
|
|
94
|
+
- Always appends a summary of other config files (paths, counts, sample names) so you know where imported entries live.
|
|
95
|
+
- `filter` accepts a name, glob fragment, or `source:cursor` selector.
|
|
96
|
+
- Adds informational notes when we auto-correct names (same machinery as `mcporter list`).
|
|
97
|
+
|
|
98
|
+
### `mcporter config get <name>`
|
|
99
|
+
- Prints the resolved definition for a single server, including the on-disk path, inherited headers/env, and transport details.
|
|
100
|
+
- Near-miss names are auto-corrected with the same heuristics as `mcporter list`/`call`, and you’ll see suggestions whenever ambiguity remains.
|
|
101
|
+
- Supports ad-hoc descriptors so you can inspect a URL before persisting it.
|
|
102
|
+
|
|
103
|
+
### `mcporter config add <name> [target]`
|
|
104
|
+
- Persists a server into the writable config file. Accepts both positional shortcuts (`mcporter config add sentry https://mcp.sentry.dev/mcp`) and flag-driven definitions:
|
|
105
|
+
- `--transport http|sse|stdio`
|
|
106
|
+
- `--url` or `--command`/`--stdio`
|
|
107
|
+
- `--env`, `--header`, `--token-cache-dir`, `--description`, `--tag`, `--client-name`, `--oauth-redirect-url`
|
|
108
|
+
- `--copy-from importKind:name` to clone settings from an imported entry before editing.
|
|
109
|
+
- `--dry-run` shows the JSON diff without writing, while `--persist <path>` overrides the destination file.
|
|
110
|
+
|
|
111
|
+
### `mcporter config remove <name>`
|
|
112
|
+
- Removes the local definition. Names sourced exclusively from imports remain untouched until you copy them locally.
|
|
113
|
+
|
|
114
|
+
### `mcporter config import <kind>`
|
|
115
|
+
- Displays (and optionally copies) entries from editor-specific configs:
|
|
116
|
+
- `cursor`: `.cursor/mcp.json` in the repo, falling back to `~/.config/Cursor/User/mcp.json` (or `%APPDATA%/Cursor/User` on Windows).
|
|
117
|
+
- `claude-code`: `<root>/.claude/settings.local.json`, `<root>/.claude/settings.json`, `<root>/.claude/mcp.json`, then `~/.claude/settings.json`, `~/.claude/mcp.json`, `~/.claude.json`. `settings.local.json` is meant for untracked per-developer overrides, while `settings.json` is the shared project config.
|
|
118
|
+
- `claude-desktop`: platform-specific `Claude/claude_desktop_config.json` paths.
|
|
119
|
+
- `codex`: `<root>/.codex/config.toml`, then `~/.codex/config.toml`.
|
|
120
|
+
- `windsurf`: Codeium’s Windsurf config under `%APPDATA%/Codeium/windsurf/mcp_config.json` or `~/.codeium/windsurf/mcp_config.json`.
|
|
121
|
+
- `opencode`: Honors `OPENCODE_CONFIG` when set, then `<root>/opencode.json(c)`, `OPENCODE_CONFIG_DIR/opencode.json(c)`, and finally `${XDG_CONFIG_HOME:-~/.config}/opencode/opencode.json(c)` (or `%APPDATA%/opencode/opencode.json(c)` on Windows). Both `.json` and `.jsonc` extensions are supported.
|
|
122
|
+
- `vscode`: `Code/User/mcp.json` (stable + Insiders) inside the OS-appropriate config directory.
|
|
123
|
+
- `--copy` writes selected entries into your local config; `--filter <glob>` narrows the import list; `--path <file>` lets you point at bespoke locations.
|
|
124
|
+
|
|
125
|
+
### `mcporter config login <name|url>` / `logout`
|
|
126
|
+
- Mirrors `mcporter auth`. `login` completes OAuth (or token provisioning) for either a named server or an ad-hoc URL. When a hosted MCP returns 401/403, mcporter automatically promotes that target to OAuth and re-runs the flow, matching the behavior documented in `docs/adhoc.md`.
|
|
127
|
+
- `--browser none` starts a manual remote-friendly OAuth flow: mcporter prints the authorization URL, does not open a browser, and does not bind a local callback server.
|
|
128
|
+
- Finish manual flows with `mcporter auth complete '<pasted-redirect-url>'`. The pasted callback must contain the same OAuth `state` that mcporter persisted when the flow started.
|
|
129
|
+
- `logout` wipes token caches under `~/.mcporter/<name>/` (or the custom `tokenCacheDir`). Pass `--all` to clear everything.
|
|
130
|
+
|
|
131
|
+
### `mcporter config doctor`
|
|
132
|
+
- Early validator that checks for simple issues (e.g., OAuth entries missing cache paths). Future iterations will add fixes for Accept headers, duplicate imports, and more.
|
|
133
|
+
|
|
134
|
+
## Ad-hoc & Persistence
|
|
135
|
+
- `--http-url` and `--stdio` flags live on `mcporter list|call|auth`, keeping `mcporter config` focused on persistent config files.
|
|
136
|
+
- Names default to slugified hostnames or executable/script combos. Supply `--name` to improve reuse; mcporter uses that slug for OAuth caches even before persistence.
|
|
137
|
+
- `--allow-http` is mandatory for cleartext endpoints so we never downgrade transport silently.
|
|
138
|
+
- Add `--persist <path>` (defaulting to `config/mcporter.json` when omitted) to copy the ad-hoc definition into config. We reuse the same serializer as the import pipeline, so copying from Cursor → local config produces identical structure and preserves custom env/header fields.
|
|
139
|
+
- `--env KEY=VAL` entries merge with existing `env` dictionaries if you later persist the same server; nothing is lost when you alternate between CLI flags and JSON edits.
|
|
140
|
+
|
|
141
|
+
## JSON Schema for IDE Support
|
|
142
|
+
mcporter provides a JSON Schema for config file validation and autocompletion. Add the `$schema` property to your config file:
|
|
143
|
+
|
|
144
|
+
```jsonc
|
|
145
|
+
{
|
|
146
|
+
"$schema": "https://raw.githubusercontent.com/steipete/mcporter/main/mcporter.schema.json",
|
|
147
|
+
"mcpServers": { ... }
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
For local development, you can reference the schema from the repo root:
|
|
152
|
+
```jsonc
|
|
153
|
+
{
|
|
154
|
+
"$schema": "../mcporter.schema.json",
|
|
155
|
+
"mcpServers": { ... }
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
The schema is auto-generated from the Zod validation schemas using `pnpm generate:schema`.
|
|
160
|
+
|
|
161
|
+
## Schema Reference
|
|
162
|
+
Top-level structure:
|
|
163
|
+
|
|
164
|
+
| Key | Type | Description |
|
|
165
|
+
| --- | --- | --- |
|
|
166
|
+
| `mcpServers` | object | Map of server names → definitions. Required even if empty. |
|
|
167
|
+
| `imports` | string[] | Optional list of import kinds. Empty array disables imports entirely; omitting the key falls back to the default list. |
|
|
168
|
+
|
|
169
|
+
Server definition fields (subset of what `RawEntrySchema` accepts):
|
|
170
|
+
|
|
171
|
+
| Field | Description |
|
|
172
|
+
| --- | --- |
|
|
173
|
+
| `description` | Free-form summary printed by `mcporter list`/`config list`. |
|
|
174
|
+
| `baseUrl` / `url` / `serverUrl` | HTTPS or HTTP endpoint. `http://` requires `--allow-http` in ad-hoc mode but works in config if you explicitly set it. |
|
|
175
|
+
| `command` / `args` | Stdio executable definition (string or array). Arrays are preferred because they avoid shell quoting issues. |
|
|
176
|
+
| `env` | Key/value pairs applied when launching stdio commands. Supports `${VAR}` interpolation and `${VAR:-fallback}` defaults. Existing process env values win over fallbacks. |
|
|
177
|
+
| `headers` | Request headers for HTTP/SSE transports. Values can reference `$env:VAR` or `${VAR}` placeholders, which must be set at runtime or mcporter aborts with a helpful error.
|
|
178
|
+
| `auth` | Currently only `oauth` is recognized. Any other string is ignored (treated as undefined) to avoid stale state from other clients. |
|
|
179
|
+
| `tokenCacheDir` | Directory for OAuth tokens; still honored, but mcporter now keeps a centralized vault in `~/.mcporter/credentials.json` (legacy per-server caches are auto-migrated). Supports `~` expansion. |
|
|
180
|
+
| `clientName` | Optional identifier some servers use for telemetry/audience segmentation. |
|
|
181
|
+
| `oauthRedirectUrl` | Override the default localhost callback. Useful when tunneling OAuth through Codespaces or remote dev boxes. |
|
|
182
|
+
| `oauthScope` | Optional explicit OAuth scope string. If omitted, mcporter lets the MCP SDK derive scope from server/auth metadata. Use this as an escape hatch for providers that require explicit scopes but don’t publish `scopes_supported`. |
|
|
183
|
+
| `oauthCommand.args` | For STDIO servers that ship a custom auth subcommand (e.g., Gmail MCP). mcporter will spawn the stdio command with these args when you run `mcporter auth <name>`, so you don’t need to call `npx ... auth` manually. |
|
|
184
|
+
|
|
185
|
+
mcporter normalizes headers to include `Accept: application/json, text/event-stream` automatically, matching the runtime’s streaming expectations.
|
|
186
|
+
|
|
187
|
+
## Imports & Conflict Resolution
|
|
188
|
+
- `pathsForImport(kind, rootDir)` determines every candidate path. mcporter searches the repo first, then user-level directories, and stops at the first file that parses.
|
|
189
|
+
- Entries pulled from imports are treated as read-only snapshots. The merge process keeps the first definition for each name; later sources with the same name are skipped until you override locally.
|
|
190
|
+
- To copy an imported entry, either run `mcporter config import <kind> --copy --filter name` or use `mcporter config add name --copy-from kind:name`. The copy operation writes through the same JSON normalization stack, so the resulting file matches our schema even if the source format was TOML (Codex) or legacy JSON shapes (`servers` vs `mcpServers`).
|
|
191
|
+
|
|
192
|
+
## Project vs. Machine Layers
|
|
193
|
+
- Keep `config/mcporter.json` under version control. Encourage contributors to add sensitive data via env vars (`${LINEAR_API_KEY}`) rather than inline secrets.
|
|
194
|
+
- Machine-specific additions can live in `~/.mcporter/local.json`; point `mcporter config --config ~/.mcporter/local.json add ...` there when you prefer not to touch the repo. Since the runtime only watches one config at a time, CI jobs should always pass `--config config/mcporter.json` (or run from the repo root) for deterministic behavior.
|
|
195
|
+
- OAuth tokens, cached server metadata, and generated CLIs should remain outside the repo (`~/.mcporter/<name>/`, `dist/`).
|
|
196
|
+
|
|
197
|
+
## Validation & Troubleshooting
|
|
198
|
+
- `mcporter list --http-url ...` refuses to auto-run OAuth to keep listing commands quick; use `mcporter config login ...` or `mcporter auth ...` to finish credential setup.
|
|
199
|
+
- For remote pods/dev boxes, prefer `mcporter auth <name|url> --browser none`, open the printed URL in your local browser, then paste the failed localhost redirect into `mcporter auth complete`.
|
|
200
|
+
- When env placeholders are missing, commands fail fast with the exact variable name. Add the variable or wrap it in `${VAR:-fallback}` to provide defaults.
|
|
201
|
+
- Use `mcporter config get <name> --show-source` (planned flag) to confirm whether a server came from an import. If a teammate’s Cursor config keeps overriding your local entry, reorder the `imports` array to move Cursor later or set it to `[]` to disable imports entirely.
|
|
202
|
+
- `docs/adhoc.md` covers deeper debugging, including tmux workflows and OAuth promotion logs.
|
|
203
|
+
|
|
204
|
+
## Outstanding Coverage Items
|
|
205
|
+
- Describe how `--persist` writes through the same import merge pipeline (especially once `mcporter config add --copy-from` ships) so users know exactly which file changes.
|
|
206
|
+
- Call out that `--allow-http` remains required for cleartext URLs even in config mutations, and reiterate that `--env KEY=VAL` merges with on-disk env blocks rather than replacing them entirely.
|
|
207
|
+
- Clarify and illustrate the automatic OAuth promotion path for ad-hoc HTTP entries in both this doc and future `mcporter config login` help output.
|
|
208
|
+
- Flesh out `mcporter config doctor` once the validator is implemented so we can show real output samples and suggested fixes.
|
package/docs/daemon.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: 'Design plan for the persistent MCP daemon used to keep long-lived servers (e.g., chrome-devtools) alive.'
|
|
3
|
+
read_when:
|
|
4
|
+
- 'Implementing daemon/keep-alive behavior or maintaining its CLI commands.'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# MCPorter Daemon Plan
|
|
8
|
+
|
|
9
|
+
## Goals
|
|
10
|
+
|
|
11
|
+
- **Invisible keep-alive:** `mcporter call` should transparently start (and reuse) a per-login daemon whenever a configured server requires persistence (e.g., `chrome-devtools`). No extra flags for agents.
|
|
12
|
+
- **Shared state:** Multiple CLI invocations/agents within the same user session must reuse the same warm transport so STDIO servers can hold tabs, cookies, and other stateful context.
|
|
13
|
+
- **Per-login scope:** The daemon lives under the current user account (`~/.mcporter/daemon.sock`) and never crosses user boundaries.
|
|
14
|
+
- **Resilience:** If the daemon or a keep-alive server crashes, the next CLI call restarts it automatically.
|
|
15
|
+
- **Explicit shutdown:** Provide `mcporter daemon stop` to tear everything down (plus `status` for debugging).
|
|
16
|
+
- **Configurable participation:** Only servers marked keep-alive participate; others keep current ephemeral behavior. Support opt-in/out via config/env plus a default allowlist.
|
|
17
|
+
|
|
18
|
+
## Architecture
|
|
19
|
+
|
|
20
|
+
- **Daemon process (`mcporter daemon start`):**
|
|
21
|
+
- Loads the same config as the CLI.
|
|
22
|
+
- Hosts a long-lived `McpRuntime`.
|
|
23
|
+
- Listens on a Unix domain socket (per-login path, chmod 600).
|
|
24
|
+
- Exposes a minimal JSON-RPC interface that mirrors the existing `list/call/resources` APIs so CLI commands can proxy requests.
|
|
25
|
+
- Lazily connects keep-alive servers on first use and keeps transports open until shutdown or idle timeout.
|
|
26
|
+
|
|
27
|
+
- **Client shim (CLI side):**
|
|
28
|
+
- When a command targets a keep-alive server:
|
|
29
|
+
1. Look for a ready daemon socket; if missing, spawn `mcporter daemon start --detach`.
|
|
30
|
+
2. Proxy the list/call/auth request over the socket and print the response as usual.
|
|
31
|
+
3. If the socket handshake fails (daemon crashed mid-call), re-spawn once before surfacing the error.
|
|
32
|
+
- Non keep-alive servers continue using the local runtime in the current process.
|
|
33
|
+
|
|
34
|
+
- **Keep-alive detection:**
|
|
35
|
+
- Extend `ServerDefinition` with `lifecycle?: "ephemeral" | { mode: "keep-alive", idleTimeoutMs?: number }`.
|
|
36
|
+
- Provide a config-level `defaultKeepAlive` array or `MCPORTER_KEEPALIVE` env var for quick overrides.
|
|
37
|
+
- Ship a hardcoded allowlist (initially `chrome-devtools`, `mobile-mcp`, `playwright`) so existing configs benefit immediately; users can opt out per server.
|
|
38
|
+
|
|
39
|
+
## CLI Surface
|
|
40
|
+
|
|
41
|
+
- `mcporter daemon start [--foreground]`: boot the daemon; default behavior is background (detached) launch that writes its metadata file (`~/.mcporter/daemon.json` with PID/socket).
|
|
42
|
+
- `mcporter daemon status`: show whether the daemon is running, the socket path, uptime, and which servers are currently connected/idle.
|
|
43
|
+
- `mcporter daemon stop`: instruct the daemon to close all transports and remove its socket/metadata; if the daemon is missing, exit 0 with a hint.
|
|
44
|
+
- `mcporter daemon restart`: convenience wrapper that stops the daemon (if it exists), waits for the socket to disappear, and launches a fresh instance while reusing the same logging flags/env overrides.
|
|
45
|
+
- Existing commands (`list`, `call`, `auth`, `emit-ts`, etc.) continue to work; only those touching keep-alive servers will route through the daemon.
|
|
46
|
+
|
|
47
|
+
## Lifecycle & Fault Handling
|
|
48
|
+
|
|
49
|
+
- **Auto start:** First call requiring the daemon triggers a lightweight bootstrap (fork/exec via `child_process.spawn` inside the CLI). We ensure the original command waits for the socket to become available (with a short timeout).
|
|
50
|
+
- **Auto restart:** The client shim treats `ECONNREFUSED`/broken pipe as a signal that the daemon died. It retries once by re-launching the daemon before surfacing the error.
|
|
51
|
+
- **Idle timeout:** Each keep-alive server can specify `idleTimeoutMs` (default `null` = never). The daemon tracks last activity timestamps and auto-closes transports (and associated external processes) after the idle window. A global `daemonIdleTimeoutMs` can shut down the entire daemon after long inactivity.
|
|
52
|
+
- **Logging:** Daemon writes structured logs under `~/.mcporter/logs/daemon.log` plus per-server logs for STDIO stderr so users can debug crashing servers.
|
|
53
|
+
|
|
54
|
+
## Testing Plan
|
|
55
|
+
|
|
56
|
+
1. **Unit tests**
|
|
57
|
+
- Config parsing for the new `lifecycle` shape and env overrides.
|
|
58
|
+
- Daemon controller: socket path resolution, metadata persistence, auto-restart logic.
|
|
59
|
+
2. **Integration tests (Vitest)**
|
|
60
|
+
- Spin up a fake STDIO MCP server (script under `tests/fixtures/daemon-server.ts`) that increments a counter so we can assert the transport stays alive across multiple CLI invocations.
|
|
61
|
+
- Verify `mcporter call` auto-starts the daemon, reuses the server, and `mcporter daemon stop` shuts it down.
|
|
62
|
+
- Simulate daemon crash by killing the background process and ensure the next call restarts it automatically.
|
|
63
|
+
|
|
64
|
+
## Implementation Steps
|
|
65
|
+
|
|
66
|
+
1. **Config/schema changes:** Update `src/config.ts` plus fixtures to accept `lifecycle`. Provide helpers like `requiresKeepAlive(definition)`.
|
|
67
|
+
2. **Daemon service:** New module (e.g., `src/daemon/host.ts`) that runs the socket server, wraps `McpRuntime`, and exposes RPC handlers.
|
|
68
|
+
3. **CLI wiring:** Add `daemon` subcommand + option parsing; create a client helper `ensureDaemon()` used by `call/list` paths when a keep-alive server is detected.
|
|
69
|
+
4. **Transport proxying:** Implement request/response translation so CLI commands can await daemon responses as if they were local.
|
|
70
|
+
5. **Auto-detection + env overrides:** Hook into command selectors to decide when to proxy.
|
|
71
|
+
6. **Tests + docs:** Add Vitest coverage, update README/cli reference snippets, and keep this doc synced with actual behavior.
|
|
72
|
+
|
|
73
|
+
## Logging & Diagnostics
|
|
74
|
+
|
|
75
|
+
You can capture the daemon’s stdout/stderr (and per-server call traces) when debugging long-lived STDIO servers:
|
|
76
|
+
|
|
77
|
+
- `mcporter daemon start --log` enables logging with the default path `~/.mcporter/daemon/daemon-<config-hash>.log`. Use `--log-file <path>` to override it.
|
|
78
|
+
- `--log-servers chrome-devtools,mobile-mcp` restricts per-call logging to the listed servers. Without it, `--log` records every keep-alive server’s activity.
|
|
79
|
+
- Environment equivalents:
|
|
80
|
+
- `MCPORTER_DAEMON_LOG=1` – enable logging.
|
|
81
|
+
- `MCPORTER_DAEMON_LOG_PATH=/tmp/mcporter-daemon.log` – explicit log file.
|
|
82
|
+
- `MCPORTER_DAEMON_LOG_SERVERS=chrome-devtools` – only log specified servers.
|
|
83
|
+
- `mcporter daemon status` now prints the socket path and the active log file (if any) so it’s easy to tail.
|
|
84
|
+
- Per-server opt-in: add `"logging": { "daemon": { "enabled": true } }` next to `"lifecycle": "keep-alive"` in a server definition to force detailed call logging for that server (handy when only one or two STDIO transports are noisy). Combined with `--log`/`MCPORTER_DAEMON_LOG`, those entries always emit call start/end/error lines.
|
|
85
|
+
|
|
86
|
+
Logs include timestamped entries such as:
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
[daemon] 2025-11-10T15:08:21.123Z callTool start server=chrome-devtools tool=take_snapshot
|
|
90
|
+
[daemon] 2025-11-10T15:08:22.004Z callTool success server=chrome-devtools tool=take_snapshot
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Tailing the file (`tail -f ~/.mcporter/daemon/daemon-*.log`) surfaces crashes or repeated failures without needing to re-run the daemon in the foreground.
|
|
94
|
+
|
|
95
|
+
Once these steps land, agents can freely use persistent MCP servers without juggling multiple Chrome launches, while still retaining an explicit shutdown path.
|
package/docs/emit-ts.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: 'How to generate `.d.ts` files or typed client helpers with mcporter emit-ts.'
|
|
3
|
+
read_when:
|
|
4
|
+
- 'Adding new emit-ts behavior or troubleshooting generated clients'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# `mcporter emit-ts`
|
|
8
|
+
|
|
9
|
+
`mcporter emit-ts` turns a configured MCP server into TypeScript artifacts so
|
|
10
|
+
agents, tests, and tooling can consume the server through strongly typed APIs.
|
|
11
|
+
It reuses the same `buildToolDoc()` data that powers `mcporter list`, so doc
|
|
12
|
+
comments, parameter hints, and signatures stay perfectly in sync. For a broader
|
|
13
|
+
overview of every CLI command, see `docs/cli-reference.md`.
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
mcporter emit-ts <server> --out linear-client.ts \
|
|
17
|
+
[--mode types|client] \
|
|
18
|
+
[--include-optional]
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
- `--mode types` (default) emits a `.d.ts` interface (`LinearTools`) with
|
|
22
|
+
docblocks + promisified signatures. Missing output schemas fall back to
|
|
23
|
+
`CallResult`.
|
|
24
|
+
- `--mode client` emits both the interface (auto-derived `.d.ts`) **and** an
|
|
25
|
+
executable `.ts` helper that wraps `createServerProxy`. Each method returns a
|
|
26
|
+
`CallResult`, and the factory exposes a `close()` helper for runtimes the client
|
|
27
|
+
creates.
|
|
28
|
+
- `--include-optional` mirrors `mcporter list --all-parameters`, ensuring every
|
|
29
|
+
parameter is shown even when optional.
|
|
30
|
+
|
|
31
|
+
Outputs overwrite existing files automatically so you can regenerate artifacts
|
|
32
|
+
whenever the server schema changes.
|
|
33
|
+
|
|
34
|
+
## Examples
|
|
35
|
+
|
|
36
|
+
### 1. Types-only header
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
mcporter emit-ts linear --out types/linear-tools.d.ts
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Produces:
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import type { CallResult } from 'mcporter';
|
|
46
|
+
|
|
47
|
+
export interface LinearTools {
|
|
48
|
+
/**
|
|
49
|
+
* List comments for a specific Linear issue.
|
|
50
|
+
*
|
|
51
|
+
* @param issueId The issue ID
|
|
52
|
+
*/
|
|
53
|
+
list_comments(params: { issueId: string }): Promise<CallResult>;
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Include the file in your agent/project and you can type-check code like
|
|
58
|
+
`const result = await proxy.list_comments({ issueId: '...' });`.
|
|
59
|
+
|
|
60
|
+
### 2. Client wrappers
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
mcporter emit-ts linear --mode client --out clients/linear.ts
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Generates two files:
|
|
67
|
+
|
|
68
|
+
- `clients/linear.d.ts` – same interface as the types-only mode.
|
|
69
|
+
- `clients/linear.ts` – imports `createRuntime`, `createServerProxy`, and
|
|
70
|
+
`createCallResult`, then exposes a `createLinearClient()` factory:
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
const client = await createLinearClient({ configPath: './mcporter.json' });
|
|
74
|
+
const comments = await client.list_comments({ issueId: 'LIN-1234' });
|
|
75
|
+
console.log(comments.text());
|
|
76
|
+
await client.close();
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
If you pass an existing runtime (`{ runtime }`), the factory reuses it; the
|
|
80
|
+
returned object’s `close()` becomes a no-op.
|
|
81
|
+
|
|
82
|
+
## Flags
|
|
83
|
+
|
|
84
|
+
| Flag | Description |
|
|
85
|
+
| --- | --- |
|
|
86
|
+
| `--out <path>` | Required. `.d.ts` target for `types`, `.ts` target for `client`. |
|
|
87
|
+
| `--mode types|client` | Output kind (defaults to `types`). |
|
|
88
|
+
| `--types-out <path>` | Optional override for the `.d.ts` file when `--mode client`. Default: derive from `--out`. |
|
|
89
|
+
| `--include-optional` | Include every parameter (not just the minimum 5 + required). |
|
|
90
|
+
| `--json` | Emit a JSON summary describing the emitted file(s) instead of plain-text logs. |
|
|
91
|
+
|
|
92
|
+
## Testing
|
|
93
|
+
|
|
94
|
+
`tests/emit-ts.test.ts` covers:
|
|
95
|
+
|
|
96
|
+
- Template rendering (doc comments, `Promise<…>` return types, proxy wrappers).
|
|
97
|
+
- End-to-end CLI invocation with a stub runtime, ensuring both `.ts` and `.d.ts`
|
|
98
|
+
files are written successfully.
|