mcpmake 0.1.0 → 0.2.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/dist/commands/bundle.d.ts +1 -0
- package/dist/commands/bundle.d.ts.map +1 -0
- package/dist/commands/bundle.js +5 -4
- package/dist/commands/bundle.js.map +1 -0
- package/dist/commands/ci.d.ts +1 -0
- package/dist/commands/ci.d.ts.map +1 -0
- package/dist/commands/ci.js +3 -2
- package/dist/commands/ci.js.map +1 -0
- package/dist/commands/deploy.d.ts +1 -0
- package/dist/commands/deploy.d.ts.map +1 -0
- package/dist/commands/deploy.js +4 -3
- package/dist/commands/deploy.js.map +1 -0
- package/dist/commands/diff.d.ts +1 -0
- package/dist/commands/diff.d.ts.map +1 -0
- package/dist/commands/diff.js +5 -4
- package/dist/commands/diff.js.map +1 -0
- package/dist/commands/from/describe.d.ts +1 -0
- package/dist/commands/from/describe.d.ts.map +1 -0
- package/dist/commands/from/describe.js +11 -10
- package/dist/commands/from/describe.js.map +1 -0
- package/dist/commands/from/har.d.ts +1 -0
- package/dist/commands/from/har.d.ts.map +1 -0
- package/dist/commands/from/har.js +14 -13
- package/dist/commands/from/har.js.map +1 -0
- package/dist/commands/from/openapi.d.ts +1 -0
- package/dist/commands/from/openapi.d.ts.map +1 -0
- package/dist/commands/from/openapi.js +17 -16
- package/dist/commands/from/openapi.js.map +1 -0
- package/dist/commands/from/postman.d.ts +1 -0
- package/dist/commands/from/postman.d.ts.map +1 -0
- package/dist/commands/from/postman.js +13 -12
- package/dist/commands/from/postman.js.map +1 -0
- package/dist/commands/from/stainless.d.ts +110 -0
- package/dist/commands/from/stainless.d.ts.map +1 -0
- package/dist/commands/from/stainless.js +272 -0
- package/dist/commands/from/stainless.js.map +1 -0
- package/dist/commands/from/target-support.d.ts +1 -0
- package/dist/commands/from/target-support.d.ts.map +1 -0
- package/dist/commands/from/target-support.js +2 -1
- package/dist/commands/from/target-support.js.map +1 -0
- package/dist/commands/from/url.d.ts +1 -0
- package/dist/commands/from/url.d.ts.map +1 -0
- package/dist/commands/from/url.js +14 -13
- package/dist/commands/from/url.js.map +1 -0
- package/dist/commands/from/website.d.ts +1 -0
- package/dist/commands/from/website.d.ts.map +1 -0
- package/dist/commands/from/website.js +17 -16
- package/dist/commands/from/website.js.map +1 -0
- package/dist/commands/lint.d.ts +1 -0
- package/dist/commands/lint.d.ts.map +1 -0
- package/dist/commands/lint.js +6 -5
- package/dist/commands/lint.js.map +1 -0
- package/dist/commands/merge.d.ts +1 -0
- package/dist/commands/merge.d.ts.map +1 -0
- package/dist/commands/merge.js +3 -2
- package/dist/commands/merge.js.map +1 -0
- package/dist/commands/publish.d.ts +1 -0
- package/dist/commands/publish.d.ts.map +1 -0
- package/dist/commands/publish.js +4 -3
- package/dist/commands/publish.js.map +1 -0
- package/dist/commands/rescan.d.ts +1 -0
- package/dist/commands/rescan.d.ts.map +1 -0
- package/dist/commands/rescan.js +12 -11
- package/dist/commands/rescan.js.map +1 -0
- package/dist/commands/update.d.ts +1 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +10 -9
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/verify.d.ts +1 -0
- package/dist/commands/verify.d.ts.map +1 -0
- package/dist/commands/verify.js +7 -6
- package/dist/commands/verify.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -2
- package/dist/index.js.map +1 -0
- package/dist/registry/official-registry.d.ts +1 -0
- package/dist/registry/official-registry.d.ts.map +1 -0
- package/dist/registry/official-registry.js +1 -0
- package/dist/registry/official-registry.js.map +1 -0
- package/package.json +24 -42
- package/README.md +0 -691
- package/dist/analyzer/auth-detector.d.ts +0 -12
- package/dist/analyzer/auth-detector.js +0 -142
- package/dist/analyzer/dom-parser.d.ts +0 -10
- package/dist/analyzer/dom-parser.js +0 -259
- package/dist/analyzer/goal-crawler.d.ts +0 -25
- package/dist/analyzer/goal-crawler.js +0 -177
- package/dist/analyzer/hybrid-detector.d.ts +0 -28
- package/dist/analyzer/hybrid-detector.js +0 -96
- package/dist/analyzer/index.d.ts +0 -12
- package/dist/analyzer/index.js +0 -8
- package/dist/analyzer/screenshot-capture.d.ts +0 -29
- package/dist/analyzer/screenshot-capture.js +0 -42
- package/dist/analyzer/selector-builder.d.ts +0 -19
- package/dist/analyzer/selector-builder.js +0 -199
- package/dist/analyzer/semantic-analyzer.d.ts +0 -13
- package/dist/analyzer/semantic-analyzer.js +0 -145
- package/dist/analyzer/site-crawler.d.ts +0 -38
- package/dist/analyzer/site-crawler.js +0 -235
- package/dist/cloud/billing/billing-engine.d.ts +0 -44
- package/dist/cloud/billing/billing-engine.js +0 -81
- package/dist/cloud/billing/credit-store.d.ts +0 -64
- package/dist/cloud/billing/credit-store.js +0 -168
- package/dist/cloud/billing/index.d.ts +0 -4
- package/dist/cloud/billing/index.js +0 -2
- package/dist/cloud/billing/usage-store.d.ts +0 -42
- package/dist/cloud/billing/usage-store.js +0 -85
- package/dist/cloud/billing/usage-tracker.d.ts +0 -38
- package/dist/cloud/billing/usage-tracker.js +0 -95
- package/dist/cloud/build-pipeline.d.ts +0 -39
- package/dist/cloud/build-pipeline.js +0 -310
- package/dist/cloud/build-queue.d.ts +0 -30
- package/dist/cloud/build-queue.js +0 -70
- package/dist/cloud/caddy-manager.d.ts +0 -18
- package/dist/cloud/caddy-manager.js +0 -97
- package/dist/cloud/container-backend.d.ts +0 -62
- package/dist/cloud/container-backend.js +0 -59
- package/dist/cloud/container-manager.d.ts +0 -64
- package/dist/cloud/container-manager.js +0 -301
- package/dist/cloud/crypto.d.ts +0 -27
- package/dist/cloud/crypto.js +0 -63
- package/dist/cloud/db/index.d.ts +0 -27
- package/dist/cloud/db/index.js +0 -53
- package/dist/cloud/db/migrations.d.ts +0 -12
- package/dist/cloud/db/migrations.js +0 -329
- package/dist/cloud/db/pg-store.d.ts +0 -45
- package/dist/cloud/db/pg-store.js +0 -336
- package/dist/cloud/failure-tracker.d.ts +0 -51
- package/dist/cloud/failure-tracker.js +0 -102
- package/dist/cloud/idle-monitor.d.ts +0 -30
- package/dist/cloud/idle-monitor.js +0 -70
- package/dist/cloud/mailer.d.ts +0 -21
- package/dist/cloud/mailer.js +0 -193
- package/dist/cloud/mcp-proxy.d.ts +0 -58
- package/dist/cloud/mcp-proxy.js +0 -203
- package/dist/cloud/metric-samples.d.ts +0 -43
- package/dist/cloud/metric-samples.js +0 -85
- package/dist/cloud/metrics.d.ts +0 -26
- package/dist/cloud/metrics.js +0 -59
- package/dist/cloud/multipart.d.ts +0 -26
- package/dist/cloud/multipart.js +0 -132
- package/dist/cloud/observability.d.ts +0 -27
- package/dist/cloud/observability.js +0 -98
- package/dist/cloud/rate-limiter.d.ts +0 -31
- package/dist/cloud/rate-limiter.js +0 -58
- package/dist/cloud/request-security.d.ts +0 -5
- package/dist/cloud/request-security.js +0 -74
- package/dist/cloud/resource-monitor.d.ts +0 -69
- package/dist/cloud/resource-monitor.js +0 -130
- package/dist/cloud/secret-store.d.ts +0 -38
- package/dist/cloud/secret-store.js +0 -103
- package/dist/cloud/security.d.ts +0 -26
- package/dist/cloud/security.js +0 -142
- package/dist/cloud/server.d.ts +0 -21
- package/dist/cloud/server.js +0 -1079
- package/dist/cloud/shared-state.d.ts +0 -72
- package/dist/cloud/shared-state.js +0 -159
- package/dist/cloud/ssrf.d.ts +0 -43
- package/dist/cloud/ssrf.js +0 -150
- package/dist/cloud/store.d.ts +0 -41
- package/dist/cloud/store.js +0 -75
- package/dist/cloud/stripe.d.ts +0 -78
- package/dist/cloud/stripe.js +0 -317
- package/dist/cloud/telemetry-store.d.ts +0 -53
- package/dist/cloud/telemetry-store.js +0 -108
- package/dist/cloud/web/auth.d.ts +0 -225
- package/dist/cloud/web/auth.js +0 -555
- package/dist/cloud/web/charts.d.ts +0 -70
- package/dist/cloud/web/charts.js +0 -178
- package/dist/cloud/web/csrf.d.ts +0 -14
- package/dist/cloud/web/csrf.js +0 -22
- package/dist/cloud/web/docs.d.ts +0 -40
- package/dist/cloud/web/docs.js +0 -174
- package/dist/cloud/web/router.d.ts +0 -25
- package/dist/cloud/web/router.js +0 -1921
- package/dist/cloud/web/static/alpine.min.js +0 -5
- package/dist/cloud/web/static/favicon.svg +0 -4
- package/dist/cloud/web/static/htmx-sse.js +0 -290
- package/dist/cloud/web/static/htmx.min.js +0 -1
- package/dist/cloud/web/static/style.css +0 -2683
- package/dist/cloud/web/static-server.d.ts +0 -13
- package/dist/cloud/web/static-server.js +0 -73
- package/dist/cloud/web/template-engine.d.ts +0 -27
- package/dist/cloud/web/template-engine.js +0 -146
- package/dist/cloud/web/templates/layouts/admin.hbs +0 -57
- package/dist/cloud/web/templates/layouts/auth.hbs +0 -138
- package/dist/cloud/web/templates/layouts/base.hbs +0 -16
- package/dist/cloud/web/templates/layouts/dashboard.hbs +0 -39
- package/dist/cloud/web/templates/layouts/landing.hbs +0 -82
- package/dist/cloud/web/templates/pages/admin/overview.hbs +0 -123
- package/dist/cloud/web/templates/pages/admin/servers.hbs +0 -129
- package/dist/cloud/web/templates/pages/admin/telemetry.hbs +0 -39
- package/dist/cloud/web/templates/pages/admin/user-edit.hbs +0 -91
- package/dist/cloud/web/templates/pages/admin/users.hbs +0 -179
- package/dist/cloud/web/templates/pages/auth/forgot-password.hbs +0 -25
- package/dist/cloud/web/templates/pages/auth/login.hbs +0 -33
- package/dist/cloud/web/templates/pages/auth/register.hbs +0 -32
- package/dist/cloud/web/templates/pages/auth/reset-password.hbs +0 -34
- package/dist/cloud/web/templates/pages/dashboard/billing.hbs +0 -140
- package/dist/cloud/web/templates/pages/dashboard/create.hbs +0 -173
- package/dist/cloud/web/templates/pages/dashboard/index.hbs +0 -8
- package/dist/cloud/web/templates/pages/dashboard/server-detail.hbs +0 -280
- package/dist/cloud/web/templates/pages/dashboard/server-logs.hbs +0 -35
- package/dist/cloud/web/templates/pages/dashboard/server-metrics.hbs +0 -63
- package/dist/cloud/web/templates/pages/dashboard/servers-partial.hbs +0 -21
- package/dist/cloud/web/templates/pages/dashboard/servers.hbs +0 -44
- package/dist/cloud/web/templates/pages/docs/show.hbs +0 -16
- package/dist/cloud/web/templates/pages/errors/404.hbs +0 -9
- package/dist/cloud/web/templates/pages/errors/500.hbs +0 -8
- package/dist/cloud/web/templates/pages/landing/index.hbs +0 -223
- package/dist/cloud/web/templates/pages/legal/privacy.hbs +0 -71
- package/dist/cloud/web/templates/pages/legal/terms.hbs +0 -73
- package/dist/cloud/web/templates/partials/admin-stats.hbs +0 -52
- package/dist/cloud/web/templates/partials/flash-message.hbs +0 -6
- package/dist/cloud/web/templates/partials/pricing-table.hbs +0 -103
- package/dist/cloud/web/templates/partials/server-card.hbs +0 -19
- package/dist/cloud/web/templates/partials/status-badge.hbs +0 -1
- package/dist/config/configurable-command.d.ts +0 -13
- package/dist/config/configurable-command.js +0 -70
- package/dist/config/mcpmake-config.d.ts +0 -68
- package/dist/config/mcpmake-config.js +0 -207
- package/dist/docs/cli.md +0 -400
- package/dist/docs/mcp-2026-07-28-migration.md +0 -78
- package/dist/docs/migrate-from-stainless.md +0 -94
- package/dist/docs/quickstart.md +0 -166
- package/dist/docs/show-hn.md +0 -26
- package/dist/docs/website-servers.md +0 -169
- package/dist/emitter/code-writer.d.ts +0 -8
- package/dist/emitter/code-writer.js +0 -25
- package/dist/emitter/index.d.ts +0 -32
- package/dist/emitter/index.js +0 -280
- package/dist/emitter/mcpb-bundler.d.ts +0 -31
- package/dist/emitter/mcpb-bundler.js +0 -172
- package/dist/emitter/project-scaffolder.d.ts +0 -4
- package/dist/emitter/project-scaffolder.js +0 -89
- package/dist/emitter/python-template-loader.d.ts +0 -4
- package/dist/emitter/python-template-loader.js +0 -30
- package/dist/emitter/python-templates/dockerfile.hbs +0 -14
- package/dist/emitter/python-templates/env.example.hbs +0 -6
- package/dist/emitter/python-templates/requirements.txt.hbs +0 -4
- package/dist/emitter/python-templates/server.py.hbs +0 -77
- package/dist/emitter/site-scaffolder.d.ts +0 -13
- package/dist/emitter/site-scaffolder.js +0 -70
- package/dist/emitter/site-template-loader.d.ts +0 -5
- package/dist/emitter/site-template-loader.js +0 -47
- package/dist/emitter/site-templates/browser-manager.ts.hbs +0 -233
- package/dist/emitter/site-templates/config.ts.hbs +0 -28
- package/dist/emitter/site-templates/dockerfile.hbs +0 -31
- package/dist/emitter/site-templates/env.example.hbs +0 -19
- package/dist/emitter/site-templates/package.json.hbs +0 -26
- package/dist/emitter/site-templates/server-main-http.ts.hbs +0 -108
- package/dist/emitter/site-templates/server-main.ts.hbs +0 -23
- package/dist/emitter/site-templates/tool-handler-action.ts.hbs +0 -86
- package/dist/emitter/site-templates/tool-handler-form.ts.hbs +0 -116
- package/dist/emitter/site-templates/tool-handler-lifecycle.ts.hbs +0 -146
- package/dist/emitter/site-templates/tool-index.ts.hbs +0 -11
- package/dist/emitter/template-loader.d.ts +0 -1
- package/dist/emitter/template-loader.js +0 -27
- package/dist/emitter/templates/auth-provider.ts.hbs +0 -57
- package/dist/emitter/templates/config.ts.hbs +0 -63
- package/dist/emitter/templates/discovery.ts.hbs +0 -301
- package/dist/emitter/templates/dockerfile.hbs +0 -34
- package/dist/emitter/templates/env.example.hbs +0 -28
- package/dist/emitter/templates/gitignore.hbs +0 -5
- package/dist/emitter/templates/http-executor.ts.hbs +0 -117
- package/dist/emitter/templates/oauth.ts.hbs +0 -188
- package/dist/emitter/templates/package.json.hbs +0 -25
- package/dist/emitter/templates/prompts.ts.hbs +0 -22
- package/dist/emitter/templates/readme.md.hbs +0 -123
- package/dist/emitter/templates/resources.ts.hbs +0 -63
- package/dist/emitter/templates/server-main-http.ts.hbs +0 -407
- package/dist/emitter/templates/server-main.ts.hbs +0 -40
- package/dist/emitter/templates/task-handlers.ts.hbs +0 -189
- package/dist/emitter/templates/task-manager.ts.hbs +0 -139
- package/dist/emitter/templates/task-sse.ts.hbs +0 -105
- package/dist/emitter/templates/tool-handler.ts.hbs +0 -124
- package/dist/emitter/templates/tool-index.ts.hbs +0 -11
- package/dist/emitter/templates/tool-test.ts.hbs +0 -57
- package/dist/emitter/templates/trace.ts.hbs +0 -79
- package/dist/emitter/templates/tsconfig.json.hbs +0 -16
- package/dist/emitter/templates/types.ts.hbs +0 -5
- package/dist/emitter/worker-template-loader.d.ts +0 -5
- package/dist/emitter/worker-template-loader.js +0 -33
- package/dist/emitter/worker-templates/config.ts.hbs +0 -54
- package/dist/emitter/worker-templates/dev-vars.example.hbs +0 -10
- package/dist/emitter/worker-templates/gitignore.hbs +0 -6
- package/dist/emitter/worker-templates/package.json.hbs +0 -24
- package/dist/emitter/worker-templates/readme.md.hbs +0 -53
- package/dist/emitter/worker-templates/server.test.ts.hbs +0 -20
- package/dist/emitter/worker-templates/tool-handler.ts.hbs +0 -85
- package/dist/emitter/worker-templates/tool-index.ts.hbs +0 -28
- package/dist/emitter/worker-templates/tsconfig.json.hbs +0 -17
- package/dist/emitter/worker-templates/worker.ts.hbs +0 -242
- package/dist/emitter/worker-templates/wrangler.toml.hbs +0 -19
- package/dist/generator/spec-generator.d.ts +0 -6
- package/dist/generator/spec-generator.js +0 -50
- package/dist/parser/har-filter.d.ts +0 -8
- package/dist/parser/har-filter.js +0 -71
- package/dist/parser/har-loader.d.ts +0 -2
- package/dist/parser/har-loader.js +0 -14
- package/dist/parser/har-normalizer.d.ts +0 -20
- package/dist/parser/har-normalizer.js +0 -78
- package/dist/parser/index.d.ts +0 -10
- package/dist/parser/index.js +0 -6
- package/dist/parser/openapi-loader.d.ts +0 -6
- package/dist/parser/openapi-loader.js +0 -308
- package/dist/parser/operation-extractor.d.ts +0 -13
- package/dist/parser/operation-extractor.js +0 -155
- package/dist/parser/overlay-loader.d.ts +0 -10
- package/dist/parser/overlay-loader.js +0 -184
- package/dist/parser/postman-loader.d.ts +0 -9
- package/dist/parser/postman-loader.js +0 -106
- package/dist/parser/schema-converter.d.ts +0 -12
- package/dist/parser/schema-converter.js +0 -117
- package/dist/plugins/adapter.d.ts +0 -40
- package/dist/plugins/adapter.js +0 -15
- package/dist/plugins/loader.d.ts +0 -25
- package/dist/plugins/loader.js +0 -58
- package/dist/pricing.d.ts +0 -55
- package/dist/pricing.js +0 -133
- package/dist/providers/index.d.ts +0 -15
- package/dist/providers/index.js +0 -56
- package/dist/recorder/browser-recorder.d.ts +0 -22
- package/dist/recorder/browser-recorder.js +0 -205
- package/dist/rescan/diff-engine.d.ts +0 -5
- package/dist/rescan/diff-engine.js +0 -312
- package/dist/rescan/index.d.ts +0 -3
- package/dist/rescan/index.js +0 -2
- package/dist/rescan/rescan-runner.d.ts +0 -42
- package/dist/rescan/rescan-runner.js +0 -69
- package/dist/rescan/rescan-scheduler.d.ts +0 -41
- package/dist/rescan/rescan-scheduler.js +0 -179
- package/dist/site-transformer/browser-tools.d.ts +0 -10
- package/dist/site-transformer/browser-tools.js +0 -59
- package/dist/site-transformer/index.d.ts +0 -2
- package/dist/site-transformer/index.js +0 -2
- package/dist/site-transformer/selector-healer.d.ts +0 -8
- package/dist/site-transformer/selector-healer.js +0 -106
- package/dist/site-transformer/tool-generator.d.ts +0 -13
- package/dist/site-transformer/tool-generator.js +0 -245
- package/dist/transformer/auth-detector.d.ts +0 -13
- package/dist/transformer/auth-detector.js +0 -90
- package/dist/transformer/catalog-builder.d.ts +0 -18
- package/dist/transformer/catalog-builder.js +0 -56
- package/dist/transformer/client-compat.d.ts +0 -6
- package/dist/transformer/client-compat.js +0 -44
- package/dist/transformer/har-clusterer.d.ts +0 -9
- package/dist/transformer/har-clusterer.js +0 -27
- package/dist/transformer/har-dedup.d.ts +0 -10
- package/dist/transformer/har-dedup.js +0 -81
- package/dist/transformer/har-schema-inferrer.d.ts +0 -15
- package/dist/transformer/har-schema-inferrer.js +0 -90
- package/dist/transformer/har-to-operations.d.ts +0 -13
- package/dist/transformer/har-to-operations.js +0 -192
- package/dist/transformer/index.d.ts +0 -8
- package/dist/transformer/index.js +0 -6
- package/dist/transformer/llm-namer.d.ts +0 -6
- package/dist/transformer/llm-namer.js +0 -59
- package/dist/transformer/naming.d.ts +0 -4
- package/dist/transformer/naming.js +0 -30
- package/dist/transformer/operation-filter.d.ts +0 -13
- package/dist/transformer/operation-filter.js +0 -52
- package/dist/transformer/resource-builder.d.ts +0 -12
- package/dist/transformer/resource-builder.js +0 -80
- package/dist/transformer/schema-merger.d.ts +0 -14
- package/dist/transformer/schema-merger.js +0 -65
- package/dist/transformer/tool-builder.d.ts +0 -3
- package/dist/transformer/tool-builder.js +0 -114
- package/dist/types/index.d.ts +0 -131
- package/dist/types/index.js +0 -1
- package/dist/types/site.d.ts +0 -284
- package/dist/types/site.js +0 -8
- package/dist/utils/fail.d.ts +0 -48
- package/dist/utils/fail.js +0 -204
- package/dist/utils/fs.d.ts +0 -5
- package/dist/utils/fs.js +0 -28
- package/dist/utils/interactive.d.ts +0 -6
- package/dist/utils/interactive.js +0 -30
- package/dist/utils/logger.d.ts +0 -1
- package/dist/utils/logger.js +0 -2
- package/dist/utils/sanitize.d.ts +0 -28
- package/dist/utils/sanitize.js +0 -44
- package/dist/utils/watcher.d.ts +0 -11
- package/dist/utils/watcher.js +0 -36
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { escapeTemplateLiteral, escapeStringLiteral, sanitizeIdentifier, } from '../utils/sanitize.js';
|
|
2
|
-
import { toToolName } from './naming.js';
|
|
3
|
-
/**
|
|
4
|
-
* Generate MCP resources from GET operations.
|
|
5
|
-
* - List endpoints (no path params) → static resources
|
|
6
|
-
* - Detail endpoints (with path params) → URI template resources
|
|
7
|
-
*/
|
|
8
|
-
export function buildResources(operations) {
|
|
9
|
-
const resources = [];
|
|
10
|
-
for (const op of operations) {
|
|
11
|
-
if (op.method !== 'get')
|
|
12
|
-
continue;
|
|
13
|
-
const name = toToolName(op.operationId);
|
|
14
|
-
const description = escapeTemplateLiteral(op.summary ?? `${op.method.toUpperCase()} ${op.path}`);
|
|
15
|
-
if (!op.path.includes('{')) {
|
|
16
|
-
// Static resource — list endpoint
|
|
17
|
-
resources.push({
|
|
18
|
-
name,
|
|
19
|
-
uri: `api://${name}`,
|
|
20
|
-
path: op.path,
|
|
21
|
-
description,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
// Template resource — detail endpoint with path params
|
|
26
|
-
const pathParams = op.parameters.filter((p) => p.in === 'path').map((p) => p.name);
|
|
27
|
-
const uriTemplate = `api://${name}/${pathParams.map((p) => `{${p}}`).join('/')}`;
|
|
28
|
-
// Pre-compute URL body to avoid Handlebars/curly-brace conflicts.
|
|
29
|
-
// Resource handler receives (uri: URL, extra) — extract params from uri.pathname.
|
|
30
|
-
const urlLines = [];
|
|
31
|
-
urlLines.push(` const pathParts = uri.pathname.split('/').filter(Boolean);`);
|
|
32
|
-
urlLines.push(` let url = \`\${config.baseUrl}${escapeStringLiteral(op.path)}\`;`);
|
|
33
|
-
// Replace path params using positional extraction from the URI
|
|
34
|
-
const pathSegments = op.path.split('/').filter(Boolean);
|
|
35
|
-
for (let i = 0; i < pathSegments.length; i++) {
|
|
36
|
-
const seg = pathSegments[i];
|
|
37
|
-
if (seg.startsWith('{') && seg.endsWith('}')) {
|
|
38
|
-
const safe = sanitizeIdentifier(seg.slice(1, -1));
|
|
39
|
-
urlLines.push(` if (pathParts[${i}]) url = url.replace('${escapeStringLiteral(seg)}', encodeURIComponent(pathParts[${i}]));`);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
resources.push({
|
|
43
|
-
name,
|
|
44
|
-
uri: uriTemplate,
|
|
45
|
-
path: op.path,
|
|
46
|
-
description,
|
|
47
|
-
isTemplate: true,
|
|
48
|
-
templateParams: pathParams,
|
|
49
|
-
urlBody: urlLines.join('\n'),
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return resources;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Generate MCP prompts — one per tag as a "workflow" prompt.
|
|
57
|
-
*/
|
|
58
|
-
export function buildPrompts(operations) {
|
|
59
|
-
const tagGroups = new Map();
|
|
60
|
-
for (const op of operations) {
|
|
61
|
-
const tag = op.tags[0] ?? 'default';
|
|
62
|
-
const existing = tagGroups.get(tag);
|
|
63
|
-
if (existing)
|
|
64
|
-
existing.push(op);
|
|
65
|
-
else
|
|
66
|
-
tagGroups.set(tag, [op]);
|
|
67
|
-
}
|
|
68
|
-
const prompts = [];
|
|
69
|
-
for (const [tag, ops] of tagGroups) {
|
|
70
|
-
const toolList = ops
|
|
71
|
-
.map((op) => `- ${toToolName(op.operationId)}: ${op.summary ?? op.path}`)
|
|
72
|
-
.join('\\n');
|
|
73
|
-
prompts.push({
|
|
74
|
-
name: `${tag}_workflow`,
|
|
75
|
-
description: escapeTemplateLiteral(`Work with ${tag} — available operations`),
|
|
76
|
-
template: escapeTemplateLiteral(`You have the following ${tag} tools available:\\n${toolList}\\n\\nWhat would you like to do?`),
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
return prompts;
|
|
80
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { JsonSchema } from '../types/index.js';
|
|
2
|
-
/**
|
|
3
|
-
* Merge multiple JSON schemas into one that covers all observed fields.
|
|
4
|
-
* Uses a union approach: if a field appears in any sample, it's included
|
|
5
|
-
* (marked optional if not present in all samples).
|
|
6
|
-
*/
|
|
7
|
-
export declare function mergeSchemas(schemas: JsonSchema[]): JsonSchema;
|
|
8
|
-
/**
|
|
9
|
-
* Merge request body schemas from multiple HAR entries in a cluster.
|
|
10
|
-
*/
|
|
11
|
-
export declare function mergeRequestBodySchemas(bodies: Array<{
|
|
12
|
-
text: string;
|
|
13
|
-
mimeType: string;
|
|
14
|
-
}>): JsonSchema | undefined;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { inferJsonSchema } from './har-schema-inferrer.js';
|
|
2
|
-
/**
|
|
3
|
-
* Merge multiple JSON schemas into one that covers all observed fields.
|
|
4
|
-
* Uses a union approach: if a field appears in any sample, it's included
|
|
5
|
-
* (marked optional if not present in all samples).
|
|
6
|
-
*/
|
|
7
|
-
export function mergeSchemas(schemas) {
|
|
8
|
-
if (schemas.length === 0)
|
|
9
|
-
return { type: 'object' };
|
|
10
|
-
if (schemas.length === 1)
|
|
11
|
-
return schemas[0];
|
|
12
|
-
// Only merge object schemas
|
|
13
|
-
if (!schemas.every((s) => s.type === 'object'))
|
|
14
|
-
return schemas[0];
|
|
15
|
-
const allProperties = new Map();
|
|
16
|
-
const requiredCounts = new Map();
|
|
17
|
-
for (const schema of schemas) {
|
|
18
|
-
const props = (schema.properties ?? {});
|
|
19
|
-
const required = new Set(schema.required ?? []);
|
|
20
|
-
for (const [key, propSchema] of Object.entries(props)) {
|
|
21
|
-
const existing = allProperties.get(key);
|
|
22
|
-
if (existing)
|
|
23
|
-
existing.push(propSchema);
|
|
24
|
-
else
|
|
25
|
-
allProperties.set(key, [propSchema]);
|
|
26
|
-
if (required.has(key)) {
|
|
27
|
-
requiredCounts.set(key, (requiredCounts.get(key) ?? 0) + 1);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
const mergedProperties = {};
|
|
32
|
-
const mergedRequired = [];
|
|
33
|
-
for (const [key, propSchemas] of allProperties) {
|
|
34
|
-
// Use the most common type
|
|
35
|
-
mergedProperties[key] = propSchemas[0];
|
|
36
|
-
// Only required if present in ALL samples
|
|
37
|
-
if ((requiredCounts.get(key) ?? 0) === schemas.length) {
|
|
38
|
-
mergedRequired.push(key);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return {
|
|
42
|
-
type: 'object',
|
|
43
|
-
properties: mergedProperties,
|
|
44
|
-
...(mergedRequired.length > 0 ? { required: mergedRequired } : {}),
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Merge request body schemas from multiple HAR entries in a cluster.
|
|
49
|
-
*/
|
|
50
|
-
export function mergeRequestBodySchemas(bodies) {
|
|
51
|
-
const schemas = [];
|
|
52
|
-
for (const body of bodies) {
|
|
53
|
-
if (!body.text || !body.mimeType.includes('json'))
|
|
54
|
-
continue;
|
|
55
|
-
try {
|
|
56
|
-
schemas.push(inferJsonSchema(JSON.parse(body.text)));
|
|
57
|
-
}
|
|
58
|
-
catch {
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
if (schemas.length === 0)
|
|
63
|
-
return undefined;
|
|
64
|
-
return mergeSchemas(schemas);
|
|
65
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { buildOperationInputSchema, jsonSchemaToOutputZodCode, } from '../parser/schema-converter.js';
|
|
2
|
-
import { toToolName, toToolTitle, toFileName, toFunctionName } from './naming.js';
|
|
3
|
-
import { escapeTemplateLiteral, escapeStringLiteral, sanitizeIdentifier, sanitizePathTemplate, } from '../utils/sanitize.js';
|
|
4
|
-
export function buildToolDefinition(op) {
|
|
5
|
-
const inputSchemaCode = buildOperationInputSchema(op);
|
|
6
|
-
const descParts = [];
|
|
7
|
-
if (op.summary)
|
|
8
|
-
descParts.push(op.summary);
|
|
9
|
-
if (op.description && op.description !== op.summary)
|
|
10
|
-
descParts.push(op.description);
|
|
11
|
-
if (op.deprecated)
|
|
12
|
-
descParts.push('[DEPRECATED]');
|
|
13
|
-
if (op.mcpExtensions?.deprecationMessage) {
|
|
14
|
-
descParts.push(`[DEPRECATED: ${op.mcpExtensions.deprecationMessage}]`);
|
|
15
|
-
}
|
|
16
|
-
if (op.mcpExtensions?.deprecationReplacement) {
|
|
17
|
-
descParts.push(`Use ${op.mcpExtensions.deprecationReplacement} instead.`);
|
|
18
|
-
}
|
|
19
|
-
const description = escapeTemplateLiteral(descParts.join(' — ') || `${op.method.toUpperCase()} ${op.path}`);
|
|
20
|
-
const pathParams = op.parameters.filter((p) => p.in === 'path').map((p) => p.name);
|
|
21
|
-
const queryParams = op.parameters.filter((p) => p.in === 'query').map((p) => p.name);
|
|
22
|
-
// Apply x-mcp-* extension overrides
|
|
23
|
-
const mcpName = op.mcpExtensions?.name;
|
|
24
|
-
const mcpDesc = op.mcpExtensions?.description;
|
|
25
|
-
// Output schema from 200 response
|
|
26
|
-
const successResponse = op.responses.find((r) => r.statusCode === '200' || r.statusCode === '201');
|
|
27
|
-
const outputSchemaCode = successResponse?.schema
|
|
28
|
-
? jsonSchemaToOutputZodCode(successResponse.schema)
|
|
29
|
-
: undefined;
|
|
30
|
-
// Annotations from HTTP method semantics
|
|
31
|
-
const annotations = buildAnnotations(op.method);
|
|
32
|
-
return {
|
|
33
|
-
name: mcpName ? sanitizeIdentifier(mcpName) : toToolName(op.operationId),
|
|
34
|
-
title: mcpName ? mcpName : toToolTitle(op.operationId),
|
|
35
|
-
description: mcpDesc ? escapeTemplateLiteral(mcpDesc) : description,
|
|
36
|
-
inputSchemaCode,
|
|
37
|
-
outputSchemaCode,
|
|
38
|
-
operationId: op.operationId,
|
|
39
|
-
method: op.method,
|
|
40
|
-
pathTemplate: op.path,
|
|
41
|
-
pathParams,
|
|
42
|
-
queryParams,
|
|
43
|
-
headerParams: op.parameters.filter((p) => p.in === 'header').map((p) => p.name),
|
|
44
|
-
hasRequestBody: !!op.requestBody,
|
|
45
|
-
requestBodyContentType: op.requestBody?.contentType ?? 'application/json',
|
|
46
|
-
fileName: toFileName(op.operationId),
|
|
47
|
-
functionName: toFunctionName(op.operationId),
|
|
48
|
-
buildUrlBody: generateBuildUrlBody(op.path, pathParams, queryParams),
|
|
49
|
-
annotations,
|
|
50
|
-
isAsync: op.responses.some((r) => r.statusCode === '202'),
|
|
51
|
-
isDestructive: op.method === 'delete',
|
|
52
|
-
jqFilter: op.mcpExtensions?.jqFilter,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function buildAnnotations(method) {
|
|
56
|
-
switch (method) {
|
|
57
|
-
case 'get':
|
|
58
|
-
case 'head':
|
|
59
|
-
case 'options':
|
|
60
|
-
return { readOnlyHint: true };
|
|
61
|
-
case 'delete':
|
|
62
|
-
return { destructiveHint: true };
|
|
63
|
-
case 'put':
|
|
64
|
-
return { idempotentHint: true };
|
|
65
|
-
default:
|
|
66
|
-
return undefined;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
function generateBuildUrlBody(pathTemplate, pathParams, queryParams) {
|
|
70
|
-
const safePath = sanitizePathTemplate(pathTemplate);
|
|
71
|
-
const lines = [];
|
|
72
|
-
lines.push(` let url = baseUrl + '${escapeStringLiteral(safePath)}';`);
|
|
73
|
-
for (const p of pathParams) {
|
|
74
|
-
const safeP = sanitizeIdentifier(p);
|
|
75
|
-
lines.push(` url = url.replace('${escapeStringLiteral(`{${safeP}}`)}', encodeURIComponent(String(params['${escapeStringLiteral(safeP)}'])));`);
|
|
76
|
-
}
|
|
77
|
-
if (queryParams.length > 0) {
|
|
78
|
-
lines.push(' const query = new URLSearchParams();');
|
|
79
|
-
for (const q of queryParams) {
|
|
80
|
-
const safeQ = sanitizeIdentifier(q);
|
|
81
|
-
lines.push(` if (params['${escapeStringLiteral(safeQ)}'] !== undefined) query.set('${escapeStringLiteral(safeQ)}', String(params['${escapeStringLiteral(safeQ)}']));`);
|
|
82
|
-
}
|
|
83
|
-
lines.push(' const qs = query.toString();');
|
|
84
|
-
lines.push(' return qs ? `${url}?${qs}` : url;');
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
lines.push(' return url;');
|
|
88
|
-
}
|
|
89
|
-
return lines.join('\n');
|
|
90
|
-
}
|
|
91
|
-
export function buildAllTools(operations) {
|
|
92
|
-
// Filter out operations marked with x-mcp-emit: skip
|
|
93
|
-
const filtered = operations.filter((op) => op.mcpExtensions?.emit !== 'skip');
|
|
94
|
-
const tools = filtered.map(buildToolDefinition);
|
|
95
|
-
// Handle name collisions by appending method
|
|
96
|
-
const nameCount = new Map();
|
|
97
|
-
for (const t of tools) {
|
|
98
|
-
nameCount.set(t.name, (nameCount.get(t.name) ?? 0) + 1);
|
|
99
|
-
}
|
|
100
|
-
for (const tool of tools) {
|
|
101
|
-
if ((nameCount.get(tool.name) ?? 0) > 1) {
|
|
102
|
-
tool.name = `${tool.name}_${tool.method}`;
|
|
103
|
-
tool.fileName = `${tool.fileName}-${tool.method}`;
|
|
104
|
-
tool.functionName = `${tool.functionName}${tool.method.charAt(0).toUpperCase() + tool.method.slice(1)}`;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
// Enforce MCP spec name length limit (128 chars)
|
|
108
|
-
for (const tool of tools) {
|
|
109
|
-
if (tool.name.length > 128) {
|
|
110
|
-
tool.name = tool.name.slice(0, 128);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return tools;
|
|
114
|
-
}
|
package/dist/types/index.d.ts
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
export type HttpMethod = 'get' | 'post' | 'put' | 'patch' | 'delete' | 'head' | 'options';
|
|
2
|
-
export interface ParameterDescriptor {
|
|
3
|
-
name: string;
|
|
4
|
-
in: 'path' | 'query' | 'header' | 'cookie';
|
|
5
|
-
required: boolean;
|
|
6
|
-
description?: string;
|
|
7
|
-
schema: JsonSchema;
|
|
8
|
-
}
|
|
9
|
-
export interface RequestBodyDescriptor {
|
|
10
|
-
required: boolean;
|
|
11
|
-
description?: string;
|
|
12
|
-
contentType: string;
|
|
13
|
-
schema: JsonSchema;
|
|
14
|
-
}
|
|
15
|
-
export interface ResponseDescriptor {
|
|
16
|
-
statusCode: string;
|
|
17
|
-
description?: string;
|
|
18
|
-
contentType?: string;
|
|
19
|
-
schema?: JsonSchema;
|
|
20
|
-
}
|
|
21
|
-
export interface SecurityRequirement {
|
|
22
|
-
schemeName: string;
|
|
23
|
-
scopes: string[];
|
|
24
|
-
}
|
|
25
|
-
export interface McpExtensions {
|
|
26
|
-
name?: string;
|
|
27
|
-
description?: string;
|
|
28
|
-
emit?: 'tool' | 'resource' | 'prompt' | 'skip';
|
|
29
|
-
scope?: 'read' | 'write' | 'destructive';
|
|
30
|
-
/** Deprecation message surfaced in tool description */
|
|
31
|
-
deprecationMessage?: string;
|
|
32
|
-
/** Replacement tool name for deprecated operations */
|
|
33
|
-
deprecationReplacement?: string;
|
|
34
|
-
/** JQ filter expression to trim API responses before returning to agent */
|
|
35
|
-
jqFilter?: string;
|
|
36
|
-
/** Allow unknown enum values for forward compatibility */
|
|
37
|
-
unknownValues?: 'allow' | 'reject';
|
|
38
|
-
}
|
|
39
|
-
export interface OperationDescriptor {
|
|
40
|
-
operationId: string;
|
|
41
|
-
method: HttpMethod;
|
|
42
|
-
path: string;
|
|
43
|
-
summary?: string;
|
|
44
|
-
description?: string;
|
|
45
|
-
tags: string[];
|
|
46
|
-
parameters: ParameterDescriptor[];
|
|
47
|
-
requestBody?: RequestBodyDescriptor;
|
|
48
|
-
responses: ResponseDescriptor[];
|
|
49
|
-
security: SecurityRequirement[];
|
|
50
|
-
deprecated: boolean;
|
|
51
|
-
mcpExtensions?: McpExtensions;
|
|
52
|
-
}
|
|
53
|
-
export interface ToolAnnotations {
|
|
54
|
-
readOnlyHint?: boolean;
|
|
55
|
-
destructiveHint?: boolean;
|
|
56
|
-
idempotentHint?: boolean;
|
|
57
|
-
}
|
|
58
|
-
export interface ToolDefinition {
|
|
59
|
-
name: string;
|
|
60
|
-
title: string;
|
|
61
|
-
description: string;
|
|
62
|
-
inputSchemaCode: string;
|
|
63
|
-
outputSchemaCode?: string;
|
|
64
|
-
operationId: string;
|
|
65
|
-
method: HttpMethod;
|
|
66
|
-
pathTemplate: string;
|
|
67
|
-
pathParams: string[];
|
|
68
|
-
queryParams: string[];
|
|
69
|
-
headerParams: string[];
|
|
70
|
-
hasRequestBody: boolean;
|
|
71
|
-
requestBodyContentType: string;
|
|
72
|
-
fileName: string;
|
|
73
|
-
functionName: string;
|
|
74
|
-
buildUrlBody: string;
|
|
75
|
-
annotations?: ToolAnnotations;
|
|
76
|
-
isAsync?: boolean;
|
|
77
|
-
isDestructive?: boolean;
|
|
78
|
-
/** JQ filter to apply to API response before returning to agent */
|
|
79
|
-
jqFilter?: string;
|
|
80
|
-
}
|
|
81
|
-
export type AuthType = 'apiKey' | 'http-bearer' | 'http-basic' | 'oauth2';
|
|
82
|
-
export interface AuthScheme {
|
|
83
|
-
type: AuthType;
|
|
84
|
-
envVarName: string;
|
|
85
|
-
headerName?: string;
|
|
86
|
-
in?: 'header' | 'query' | 'cookie';
|
|
87
|
-
description?: string;
|
|
88
|
-
}
|
|
89
|
-
export interface EnvVarDescriptor {
|
|
90
|
-
name: string;
|
|
91
|
-
description: string;
|
|
92
|
-
required: boolean;
|
|
93
|
-
example?: string;
|
|
94
|
-
}
|
|
95
|
-
export type TransportMode = 'stdio' | 'http';
|
|
96
|
-
/**
|
|
97
|
-
* Deployment target for the generated TypeScript server.
|
|
98
|
-
* `node` (default) emits a Node.js server (stdio or node:http); `cloudflare`
|
|
99
|
-
* emits a stateless Cloudflare Workers Fetch handler.
|
|
100
|
-
*/
|
|
101
|
-
export type EmitTarget = 'node' | 'cloudflare';
|
|
102
|
-
export interface ResourceDefinition {
|
|
103
|
-
name: string;
|
|
104
|
-
uri: string;
|
|
105
|
-
path: string;
|
|
106
|
-
description: string;
|
|
107
|
-
isTemplate?: boolean;
|
|
108
|
-
templateParams?: string[];
|
|
109
|
-
urlBody?: string;
|
|
110
|
-
}
|
|
111
|
-
export interface PromptDefinition {
|
|
112
|
-
name: string;
|
|
113
|
-
description: string;
|
|
114
|
-
template: string;
|
|
115
|
-
}
|
|
116
|
-
export interface ProjectManifest {
|
|
117
|
-
serverName: string;
|
|
118
|
-
serverVersion: string;
|
|
119
|
-
baseUrl: string;
|
|
120
|
-
transport: TransportMode;
|
|
121
|
-
tools: ToolDefinition[];
|
|
122
|
-
resources?: ResourceDefinition[];
|
|
123
|
-
prompts?: PromptDefinition[];
|
|
124
|
-
authSchemes: AuthScheme[];
|
|
125
|
-
envVars: EnvVarDescriptor[];
|
|
126
|
-
dynamicDiscovery?: boolean;
|
|
127
|
-
staticToolCount?: number;
|
|
128
|
-
/** Deployment target (default `node`). `cloudflare` emits a Workers project. */
|
|
129
|
-
target?: EmitTarget;
|
|
130
|
-
}
|
|
131
|
-
export type JsonSchema = Record<string, unknown>;
|
package/dist/types/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|