mcpmake 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/README.md +691 -0
- package/bin/mcpmake.mjs +2 -0
- package/dist/analyzer/auth-detector.d.ts +12 -0
- package/dist/analyzer/auth-detector.js +142 -0
- package/dist/analyzer/dom-parser.d.ts +10 -0
- package/dist/analyzer/dom-parser.js +259 -0
- package/dist/analyzer/goal-crawler.d.ts +25 -0
- package/dist/analyzer/goal-crawler.js +177 -0
- package/dist/analyzer/hybrid-detector.d.ts +28 -0
- package/dist/analyzer/hybrid-detector.js +96 -0
- package/dist/analyzer/index.d.ts +12 -0
- package/dist/analyzer/index.js +8 -0
- package/dist/analyzer/screenshot-capture.d.ts +29 -0
- package/dist/analyzer/screenshot-capture.js +42 -0
- package/dist/analyzer/selector-builder.d.ts +19 -0
- package/dist/analyzer/selector-builder.js +199 -0
- package/dist/analyzer/semantic-analyzer.d.ts +13 -0
- package/dist/analyzer/semantic-analyzer.js +145 -0
- package/dist/analyzer/site-crawler.d.ts +38 -0
- package/dist/analyzer/site-crawler.js +235 -0
- package/dist/cloud/billing/billing-engine.d.ts +44 -0
- package/dist/cloud/billing/billing-engine.js +81 -0
- package/dist/cloud/billing/credit-store.d.ts +64 -0
- package/dist/cloud/billing/credit-store.js +168 -0
- package/dist/cloud/billing/index.d.ts +4 -0
- package/dist/cloud/billing/index.js +2 -0
- package/dist/cloud/billing/usage-store.d.ts +42 -0
- package/dist/cloud/billing/usage-store.js +85 -0
- package/dist/cloud/billing/usage-tracker.d.ts +38 -0
- package/dist/cloud/billing/usage-tracker.js +95 -0
- package/dist/cloud/build-pipeline.d.ts +39 -0
- package/dist/cloud/build-pipeline.js +310 -0
- package/dist/cloud/build-queue.d.ts +30 -0
- package/dist/cloud/build-queue.js +70 -0
- package/dist/cloud/caddy-manager.d.ts +18 -0
- package/dist/cloud/caddy-manager.js +97 -0
- package/dist/cloud/container-backend.d.ts +62 -0
- package/dist/cloud/container-backend.js +59 -0
- package/dist/cloud/container-manager.d.ts +64 -0
- package/dist/cloud/container-manager.js +301 -0
- package/dist/cloud/crypto.d.ts +27 -0
- package/dist/cloud/crypto.js +63 -0
- package/dist/cloud/db/index.d.ts +27 -0
- package/dist/cloud/db/index.js +53 -0
- package/dist/cloud/db/migrations.d.ts +12 -0
- package/dist/cloud/db/migrations.js +329 -0
- package/dist/cloud/db/pg-store.d.ts +45 -0
- package/dist/cloud/db/pg-store.js +336 -0
- package/dist/cloud/failure-tracker.d.ts +51 -0
- package/dist/cloud/failure-tracker.js +102 -0
- package/dist/cloud/idle-monitor.d.ts +30 -0
- package/dist/cloud/idle-monitor.js +70 -0
- package/dist/cloud/mailer.d.ts +21 -0
- package/dist/cloud/mailer.js +193 -0
- package/dist/cloud/mcp-proxy.d.ts +58 -0
- package/dist/cloud/mcp-proxy.js +203 -0
- package/dist/cloud/metric-samples.d.ts +43 -0
- package/dist/cloud/metric-samples.js +85 -0
- package/dist/cloud/metrics.d.ts +26 -0
- package/dist/cloud/metrics.js +59 -0
- package/dist/cloud/multipart.d.ts +26 -0
- package/dist/cloud/multipart.js +132 -0
- package/dist/cloud/observability.d.ts +27 -0
- package/dist/cloud/observability.js +98 -0
- package/dist/cloud/rate-limiter.d.ts +31 -0
- package/dist/cloud/rate-limiter.js +58 -0
- package/dist/cloud/request-security.d.ts +5 -0
- package/dist/cloud/request-security.js +74 -0
- package/dist/cloud/resource-monitor.d.ts +69 -0
- package/dist/cloud/resource-monitor.js +130 -0
- package/dist/cloud/secret-store.d.ts +38 -0
- package/dist/cloud/secret-store.js +103 -0
- package/dist/cloud/security.d.ts +26 -0
- package/dist/cloud/security.js +142 -0
- package/dist/cloud/server.d.ts +21 -0
- package/dist/cloud/server.js +1079 -0
- package/dist/cloud/shared-state.d.ts +72 -0
- package/dist/cloud/shared-state.js +159 -0
- package/dist/cloud/ssrf.d.ts +43 -0
- package/dist/cloud/ssrf.js +150 -0
- package/dist/cloud/store.d.ts +41 -0
- package/dist/cloud/store.js +75 -0
- package/dist/cloud/stripe.d.ts +78 -0
- package/dist/cloud/stripe.js +317 -0
- package/dist/cloud/telemetry-store.d.ts +53 -0
- package/dist/cloud/telemetry-store.js +108 -0
- package/dist/cloud/web/auth.d.ts +225 -0
- package/dist/cloud/web/auth.js +555 -0
- package/dist/cloud/web/charts.d.ts +70 -0
- package/dist/cloud/web/charts.js +178 -0
- package/dist/cloud/web/csrf.d.ts +14 -0
- package/dist/cloud/web/csrf.js +22 -0
- package/dist/cloud/web/docs.d.ts +40 -0
- package/dist/cloud/web/docs.js +174 -0
- package/dist/cloud/web/router.d.ts +25 -0
- package/dist/cloud/web/router.js +1921 -0
- package/dist/cloud/web/static/alpine.min.js +5 -0
- package/dist/cloud/web/static/favicon.svg +4 -0
- package/dist/cloud/web/static/htmx-sse.js +290 -0
- package/dist/cloud/web/static/htmx.min.js +1 -0
- package/dist/cloud/web/static/style.css +2683 -0
- package/dist/cloud/web/static-server.d.ts +13 -0
- package/dist/cloud/web/static-server.js +73 -0
- package/dist/cloud/web/template-engine.d.ts +27 -0
- package/dist/cloud/web/template-engine.js +146 -0
- package/dist/cloud/web/templates/layouts/admin.hbs +57 -0
- package/dist/cloud/web/templates/layouts/auth.hbs +138 -0
- package/dist/cloud/web/templates/layouts/base.hbs +16 -0
- package/dist/cloud/web/templates/layouts/dashboard.hbs +39 -0
- package/dist/cloud/web/templates/layouts/landing.hbs +82 -0
- package/dist/cloud/web/templates/pages/admin/overview.hbs +123 -0
- package/dist/cloud/web/templates/pages/admin/servers.hbs +129 -0
- package/dist/cloud/web/templates/pages/admin/telemetry.hbs +39 -0
- package/dist/cloud/web/templates/pages/admin/user-edit.hbs +91 -0
- package/dist/cloud/web/templates/pages/admin/users.hbs +179 -0
- package/dist/cloud/web/templates/pages/auth/forgot-password.hbs +25 -0
- package/dist/cloud/web/templates/pages/auth/login.hbs +33 -0
- package/dist/cloud/web/templates/pages/auth/register.hbs +32 -0
- package/dist/cloud/web/templates/pages/auth/reset-password.hbs +34 -0
- package/dist/cloud/web/templates/pages/dashboard/billing.hbs +140 -0
- package/dist/cloud/web/templates/pages/dashboard/create.hbs +173 -0
- package/dist/cloud/web/templates/pages/dashboard/index.hbs +8 -0
- package/dist/cloud/web/templates/pages/dashboard/server-detail.hbs +280 -0
- package/dist/cloud/web/templates/pages/dashboard/server-logs.hbs +35 -0
- package/dist/cloud/web/templates/pages/dashboard/server-metrics.hbs +63 -0
- package/dist/cloud/web/templates/pages/dashboard/servers-partial.hbs +21 -0
- package/dist/cloud/web/templates/pages/dashboard/servers.hbs +44 -0
- package/dist/cloud/web/templates/pages/docs/show.hbs +16 -0
- package/dist/cloud/web/templates/pages/errors/404.hbs +9 -0
- package/dist/cloud/web/templates/pages/errors/500.hbs +8 -0
- package/dist/cloud/web/templates/pages/landing/index.hbs +223 -0
- package/dist/cloud/web/templates/pages/legal/privacy.hbs +71 -0
- package/dist/cloud/web/templates/pages/legal/terms.hbs +73 -0
- package/dist/cloud/web/templates/partials/admin-stats.hbs +52 -0
- package/dist/cloud/web/templates/partials/flash-message.hbs +6 -0
- package/dist/cloud/web/templates/partials/pricing-table.hbs +103 -0
- package/dist/cloud/web/templates/partials/server-card.hbs +19 -0
- package/dist/cloud/web/templates/partials/status-badge.hbs +1 -0
- package/dist/commands/bundle.d.ts +18 -0
- package/dist/commands/bundle.js +82 -0
- package/dist/commands/ci.d.ts +25 -0
- package/dist/commands/ci.js +149 -0
- package/dist/commands/deploy.d.ts +24 -0
- package/dist/commands/deploy.js +145 -0
- package/dist/commands/diff.d.ts +18 -0
- package/dist/commands/diff.js +185 -0
- package/dist/commands/from/describe.d.ts +65 -0
- package/dist/commands/from/describe.js +173 -0
- package/dist/commands/from/har.d.ts +81 -0
- package/dist/commands/from/har.js +255 -0
- package/dist/commands/from/openapi.d.ts +105 -0
- package/dist/commands/from/openapi.js +302 -0
- package/dist/commands/from/postman.d.ts +51 -0
- package/dist/commands/from/postman.js +146 -0
- package/dist/commands/from/target-support.d.ts +11 -0
- package/dist/commands/from/target-support.js +33 -0
- package/dist/commands/from/url.d.ts +75 -0
- package/dist/commands/from/url.js +244 -0
- package/dist/commands/from/website.d.ts +75 -0
- package/dist/commands/from/website.js +284 -0
- package/dist/commands/lint.d.ts +24 -0
- package/dist/commands/lint.js +184 -0
- package/dist/commands/merge.d.ts +18 -0
- package/dist/commands/merge.js +161 -0
- package/dist/commands/publish.d.ts +27 -0
- package/dist/commands/publish.js +334 -0
- package/dist/commands/rescan.d.ts +40 -0
- package/dist/commands/rescan.js +255 -0
- package/dist/commands/update.d.ts +14 -0
- package/dist/commands/update.js +87 -0
- package/dist/commands/verify.d.ts +14 -0
- package/dist/commands/verify.js +71 -0
- package/dist/config/configurable-command.d.ts +13 -0
- package/dist/config/configurable-command.js +70 -0
- package/dist/config/mcpmake-config.d.ts +68 -0
- package/dist/config/mcpmake-config.js +207 -0
- package/dist/docs/cli.md +400 -0
- package/dist/docs/mcp-2026-07-28-migration.md +78 -0
- package/dist/docs/migrate-from-stainless.md +94 -0
- package/dist/docs/quickstart.md +166 -0
- package/dist/docs/show-hn.md +26 -0
- package/dist/docs/website-servers.md +169 -0
- package/dist/emitter/code-writer.d.ts +8 -0
- package/dist/emitter/code-writer.js +25 -0
- package/dist/emitter/index.d.ts +32 -0
- package/dist/emitter/index.js +280 -0
- package/dist/emitter/mcpb-bundler.d.ts +31 -0
- package/dist/emitter/mcpb-bundler.js +172 -0
- package/dist/emitter/project-scaffolder.d.ts +4 -0
- package/dist/emitter/project-scaffolder.js +89 -0
- package/dist/emitter/python-template-loader.d.ts +4 -0
- package/dist/emitter/python-template-loader.js +30 -0
- package/dist/emitter/python-templates/dockerfile.hbs +14 -0
- package/dist/emitter/python-templates/env.example.hbs +6 -0
- package/dist/emitter/python-templates/requirements.txt.hbs +4 -0
- package/dist/emitter/python-templates/server.py.hbs +77 -0
- package/dist/emitter/site-scaffolder.d.ts +13 -0
- package/dist/emitter/site-scaffolder.js +70 -0
- package/dist/emitter/site-template-loader.d.ts +5 -0
- package/dist/emitter/site-template-loader.js +47 -0
- package/dist/emitter/site-templates/browser-manager.ts.hbs +233 -0
- package/dist/emitter/site-templates/config.ts.hbs +28 -0
- package/dist/emitter/site-templates/dockerfile.hbs +31 -0
- package/dist/emitter/site-templates/env.example.hbs +19 -0
- package/dist/emitter/site-templates/package.json.hbs +26 -0
- package/dist/emitter/site-templates/server-main-http.ts.hbs +108 -0
- package/dist/emitter/site-templates/server-main.ts.hbs +23 -0
- package/dist/emitter/site-templates/tool-handler-action.ts.hbs +86 -0
- package/dist/emitter/site-templates/tool-handler-form.ts.hbs +116 -0
- package/dist/emitter/site-templates/tool-handler-lifecycle.ts.hbs +146 -0
- package/dist/emitter/site-templates/tool-index.ts.hbs +11 -0
- package/dist/emitter/template-loader.d.ts +1 -0
- package/dist/emitter/template-loader.js +27 -0
- package/dist/emitter/templates/auth-provider.ts.hbs +57 -0
- package/dist/emitter/templates/config.ts.hbs +63 -0
- package/dist/emitter/templates/discovery.ts.hbs +301 -0
- package/dist/emitter/templates/dockerfile.hbs +34 -0
- package/dist/emitter/templates/env.example.hbs +28 -0
- package/dist/emitter/templates/gitignore.hbs +5 -0
- package/dist/emitter/templates/http-executor.ts.hbs +117 -0
- package/dist/emitter/templates/oauth.ts.hbs +188 -0
- package/dist/emitter/templates/package.json.hbs +25 -0
- package/dist/emitter/templates/prompts.ts.hbs +22 -0
- package/dist/emitter/templates/readme.md.hbs +123 -0
- package/dist/emitter/templates/resources.ts.hbs +63 -0
- package/dist/emitter/templates/server-main-http.ts.hbs +407 -0
- package/dist/emitter/templates/server-main.ts.hbs +40 -0
- package/dist/emitter/templates/task-handlers.ts.hbs +189 -0
- package/dist/emitter/templates/task-manager.ts.hbs +139 -0
- package/dist/emitter/templates/task-sse.ts.hbs +105 -0
- package/dist/emitter/templates/tool-handler.ts.hbs +124 -0
- package/dist/emitter/templates/tool-index.ts.hbs +11 -0
- package/dist/emitter/templates/tool-test.ts.hbs +57 -0
- package/dist/emitter/templates/trace.ts.hbs +79 -0
- package/dist/emitter/templates/tsconfig.json.hbs +16 -0
- package/dist/emitter/templates/types.ts.hbs +5 -0
- package/dist/emitter/worker-template-loader.d.ts +5 -0
- package/dist/emitter/worker-template-loader.js +33 -0
- package/dist/emitter/worker-templates/config.ts.hbs +54 -0
- package/dist/emitter/worker-templates/dev-vars.example.hbs +10 -0
- package/dist/emitter/worker-templates/gitignore.hbs +6 -0
- package/dist/emitter/worker-templates/package.json.hbs +24 -0
- package/dist/emitter/worker-templates/readme.md.hbs +53 -0
- package/dist/emitter/worker-templates/server.test.ts.hbs +20 -0
- package/dist/emitter/worker-templates/tool-handler.ts.hbs +85 -0
- package/dist/emitter/worker-templates/tool-index.ts.hbs +28 -0
- package/dist/emitter/worker-templates/tsconfig.json.hbs +17 -0
- package/dist/emitter/worker-templates/worker.ts.hbs +242 -0
- package/dist/emitter/worker-templates/wrangler.toml.hbs +19 -0
- package/dist/generator/spec-generator.d.ts +6 -0
- package/dist/generator/spec-generator.js +50 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +64 -0
- package/dist/parser/har-filter.d.ts +8 -0
- package/dist/parser/har-filter.js +71 -0
- package/dist/parser/har-loader.d.ts +2 -0
- package/dist/parser/har-loader.js +14 -0
- package/dist/parser/har-normalizer.d.ts +20 -0
- package/dist/parser/har-normalizer.js +78 -0
- package/dist/parser/index.d.ts +10 -0
- package/dist/parser/index.js +6 -0
- package/dist/parser/openapi-loader.d.ts +6 -0
- package/dist/parser/openapi-loader.js +308 -0
- package/dist/parser/operation-extractor.d.ts +13 -0
- package/dist/parser/operation-extractor.js +155 -0
- package/dist/parser/overlay-loader.d.ts +10 -0
- package/dist/parser/overlay-loader.js +184 -0
- package/dist/parser/postman-loader.d.ts +9 -0
- package/dist/parser/postman-loader.js +106 -0
- package/dist/parser/schema-converter.d.ts +12 -0
- package/dist/parser/schema-converter.js +117 -0
- package/dist/plugins/adapter.d.ts +40 -0
- package/dist/plugins/adapter.js +15 -0
- package/dist/plugins/loader.d.ts +25 -0
- package/dist/plugins/loader.js +58 -0
- package/dist/pricing.d.ts +55 -0
- package/dist/pricing.js +133 -0
- package/dist/providers/index.d.ts +15 -0
- package/dist/providers/index.js +56 -0
- package/dist/recorder/browser-recorder.d.ts +22 -0
- package/dist/recorder/browser-recorder.js +205 -0
- package/dist/registry/official-registry.d.ts +90 -0
- package/dist/registry/official-registry.js +129 -0
- package/dist/rescan/diff-engine.d.ts +5 -0
- package/dist/rescan/diff-engine.js +312 -0
- package/dist/rescan/index.d.ts +3 -0
- package/dist/rescan/index.js +2 -0
- package/dist/rescan/rescan-runner.d.ts +42 -0
- package/dist/rescan/rescan-runner.js +69 -0
- package/dist/rescan/rescan-scheduler.d.ts +41 -0
- package/dist/rescan/rescan-scheduler.js +179 -0
- package/dist/site-transformer/browser-tools.d.ts +10 -0
- package/dist/site-transformer/browser-tools.js +59 -0
- package/dist/site-transformer/index.d.ts +2 -0
- package/dist/site-transformer/index.js +2 -0
- package/dist/site-transformer/selector-healer.d.ts +8 -0
- package/dist/site-transformer/selector-healer.js +106 -0
- package/dist/site-transformer/tool-generator.d.ts +13 -0
- package/dist/site-transformer/tool-generator.js +245 -0
- package/dist/transformer/auth-detector.d.ts +13 -0
- package/dist/transformer/auth-detector.js +90 -0
- package/dist/transformer/catalog-builder.d.ts +18 -0
- package/dist/transformer/catalog-builder.js +56 -0
- package/dist/transformer/client-compat.d.ts +6 -0
- package/dist/transformer/client-compat.js +44 -0
- package/dist/transformer/har-clusterer.d.ts +9 -0
- package/dist/transformer/har-clusterer.js +27 -0
- package/dist/transformer/har-dedup.d.ts +10 -0
- package/dist/transformer/har-dedup.js +81 -0
- package/dist/transformer/har-schema-inferrer.d.ts +15 -0
- package/dist/transformer/har-schema-inferrer.js +90 -0
- package/dist/transformer/har-to-operations.d.ts +13 -0
- package/dist/transformer/har-to-operations.js +192 -0
- package/dist/transformer/index.d.ts +8 -0
- package/dist/transformer/index.js +6 -0
- package/dist/transformer/llm-namer.d.ts +6 -0
- package/dist/transformer/llm-namer.js +59 -0
- package/dist/transformer/naming.d.ts +4 -0
- package/dist/transformer/naming.js +30 -0
- package/dist/transformer/operation-filter.d.ts +13 -0
- package/dist/transformer/operation-filter.js +52 -0
- package/dist/transformer/resource-builder.d.ts +12 -0
- package/dist/transformer/resource-builder.js +80 -0
- package/dist/transformer/schema-merger.d.ts +14 -0
- package/dist/transformer/schema-merger.js +65 -0
- package/dist/transformer/tool-builder.d.ts +3 -0
- package/dist/transformer/tool-builder.js +114 -0
- package/dist/types/index.d.ts +131 -0
- package/dist/types/index.js +1 -0
- package/dist/types/site.d.ts +284 -0
- package/dist/types/site.js +8 -0
- package/dist/utils/fail.d.ts +48 -0
- package/dist/utils/fail.js +204 -0
- package/dist/utils/fs.d.ts +5 -0
- package/dist/utils/fs.js +28 -0
- package/dist/utils/interactive.d.ts +6 -0
- package/dist/utils/interactive.js +30 -0
- package/dist/utils/logger.d.ts +1 -0
- package/dist/utils/logger.js +2 -0
- package/dist/utils/sanitize.d.ts +28 -0
- package/dist/utils/sanitize.js +44 -0
- package/dist/utils/watcher.d.ts +11 -0
- package/dist/utils/watcher.js +36 -0
- package/package.json +65 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { defineCommand } from 'citty';
|
|
2
|
+
import { loadOpenApiSpec } from '../parser/openapi-loader.js';
|
|
3
|
+
import { extractOperations } from '../parser/operation-extractor.js';
|
|
4
|
+
import { buildAllTools } from '../transformer/tool-builder.js';
|
|
5
|
+
import { logger } from '../utils/logger.js';
|
|
6
|
+
function diffTools(oldTools, newTools) {
|
|
7
|
+
const oldByName = new Map(oldTools.map((t) => [t.name, t]));
|
|
8
|
+
const newByName = new Map(newTools.map((t) => [t.name, t]));
|
|
9
|
+
const added = [];
|
|
10
|
+
const removed = [];
|
|
11
|
+
const changed = [];
|
|
12
|
+
let unchanged = 0;
|
|
13
|
+
// Find removed and changed
|
|
14
|
+
for (const [name, oldTool] of oldByName) {
|
|
15
|
+
const newTool = newByName.get(name);
|
|
16
|
+
if (!newTool) {
|
|
17
|
+
removed.push(oldTool);
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
const changes = [];
|
|
21
|
+
if (oldTool.method !== newTool.method) {
|
|
22
|
+
changes.push({
|
|
23
|
+
field: 'method',
|
|
24
|
+
old: oldTool.method.toUpperCase(),
|
|
25
|
+
new: newTool.method.toUpperCase(),
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
if (oldTool.pathTemplate !== newTool.pathTemplate) {
|
|
29
|
+
changes.push({
|
|
30
|
+
field: 'path',
|
|
31
|
+
old: oldTool.pathTemplate,
|
|
32
|
+
new: newTool.pathTemplate,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
if (oldTool.description !== newTool.description) {
|
|
36
|
+
changes.push({
|
|
37
|
+
field: 'description',
|
|
38
|
+
old: oldTool.description.slice(0, 80) + (oldTool.description.length > 80 ? '...' : ''),
|
|
39
|
+
new: newTool.description.slice(0, 80) + (newTool.description.length > 80 ? '...' : ''),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
// Compare parameters
|
|
43
|
+
const oldParams = new Set([
|
|
44
|
+
...oldTool.pathParams,
|
|
45
|
+
...oldTool.queryParams,
|
|
46
|
+
...oldTool.headerParams,
|
|
47
|
+
]);
|
|
48
|
+
const newParams = new Set([
|
|
49
|
+
...newTool.pathParams,
|
|
50
|
+
...newTool.queryParams,
|
|
51
|
+
...newTool.headerParams,
|
|
52
|
+
]);
|
|
53
|
+
const addedParams = [...newParams].filter((p) => !oldParams.has(p));
|
|
54
|
+
const removedParams = [...oldParams].filter((p) => !newParams.has(p));
|
|
55
|
+
if (addedParams.length > 0) {
|
|
56
|
+
changes.push({
|
|
57
|
+
field: 'parameters (added)',
|
|
58
|
+
old: '',
|
|
59
|
+
new: addedParams.join(', '),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
if (removedParams.length > 0) {
|
|
63
|
+
changes.push({
|
|
64
|
+
field: 'parameters (removed)',
|
|
65
|
+
old: removedParams.join(', '),
|
|
66
|
+
new: '',
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
if (oldTool.hasRequestBody !== newTool.hasRequestBody) {
|
|
70
|
+
changes.push({
|
|
71
|
+
field: 'request body',
|
|
72
|
+
old: oldTool.hasRequestBody ? 'present' : 'absent',
|
|
73
|
+
new: newTool.hasRequestBody ? 'present' : 'absent',
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
if (changes.length > 0) {
|
|
77
|
+
changed.push({ tool: newTool, changes });
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
unchanged++;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// Find added
|
|
84
|
+
for (const [name, newTool] of newByName) {
|
|
85
|
+
if (!oldByName.has(name)) {
|
|
86
|
+
added.push(newTool);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return { added, removed, changed, unchanged };
|
|
90
|
+
}
|
|
91
|
+
// Simple ANSI color helpers
|
|
92
|
+
const green = (s) => `\x1b[32m${s}\x1b[0m`;
|
|
93
|
+
const red = (s) => `\x1b[31m${s}\x1b[0m`;
|
|
94
|
+
const yellow = (s) => `\x1b[33m${s}\x1b[0m`;
|
|
95
|
+
const dim = (s) => `\x1b[2m${s}\x1b[0m`;
|
|
96
|
+
export default defineCommand({
|
|
97
|
+
meta: {
|
|
98
|
+
name: 'diff',
|
|
99
|
+
description: 'Compare tools generated from two OpenAPI specs',
|
|
100
|
+
},
|
|
101
|
+
args: {
|
|
102
|
+
oldSpec: {
|
|
103
|
+
type: 'positional',
|
|
104
|
+
description: 'Path or URL to the old OpenAPI spec',
|
|
105
|
+
required: true,
|
|
106
|
+
},
|
|
107
|
+
newSpec: {
|
|
108
|
+
type: 'positional',
|
|
109
|
+
description: 'Path or URL to the new OpenAPI spec',
|
|
110
|
+
required: true,
|
|
111
|
+
},
|
|
112
|
+
format: {
|
|
113
|
+
type: 'string',
|
|
114
|
+
description: 'Output format: "text" (default) or "json"',
|
|
115
|
+
default: 'text',
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
async run({ args }) {
|
|
119
|
+
const oldSpec = args.oldSpec;
|
|
120
|
+
const newSpec = args.newSpec;
|
|
121
|
+
logger.info(`Comparing specs...`);
|
|
122
|
+
logger.info(` Old: ${oldSpec}`);
|
|
123
|
+
logger.info(` New: ${newSpec}`);
|
|
124
|
+
const [oldLoad, newLoad] = await Promise.all([
|
|
125
|
+
loadOpenApiSpec(oldSpec),
|
|
126
|
+
loadOpenApiSpec(newSpec),
|
|
127
|
+
]);
|
|
128
|
+
const oldOps = extractOperations(oldLoad.api);
|
|
129
|
+
const newOps = extractOperations(newLoad.api);
|
|
130
|
+
const oldTools = buildAllTools(oldOps.operations);
|
|
131
|
+
const newTools = buildAllTools(newOps.operations);
|
|
132
|
+
const result = diffTools(oldTools, newTools);
|
|
133
|
+
if (args.format === 'json') {
|
|
134
|
+
console.log(JSON.stringify({
|
|
135
|
+
added: result.added.map((t) => t.name),
|
|
136
|
+
removed: result.removed.map((t) => t.name),
|
|
137
|
+
changed: result.changed.map((c) => ({
|
|
138
|
+
tool: c.tool.name,
|
|
139
|
+
changes: c.changes,
|
|
140
|
+
})),
|
|
141
|
+
unchanged: result.unchanged,
|
|
142
|
+
}, null, 2));
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
console.log('');
|
|
146
|
+
// Added
|
|
147
|
+
if (result.added.length > 0) {
|
|
148
|
+
console.log(green(`+ ${result.added.length} added tool(s):`));
|
|
149
|
+
for (const tool of result.added) {
|
|
150
|
+
console.log(green(` + ${tool.name}`) + dim(` (${tool.method.toUpperCase()} ${tool.pathTemplate})`));
|
|
151
|
+
}
|
|
152
|
+
console.log('');
|
|
153
|
+
}
|
|
154
|
+
// Removed
|
|
155
|
+
if (result.removed.length > 0) {
|
|
156
|
+
console.log(red(`- ${result.removed.length} removed tool(s):`));
|
|
157
|
+
for (const tool of result.removed) {
|
|
158
|
+
console.log(red(` - ${tool.name}`) + dim(` (${tool.method.toUpperCase()} ${tool.pathTemplate})`));
|
|
159
|
+
}
|
|
160
|
+
console.log('');
|
|
161
|
+
}
|
|
162
|
+
// Changed
|
|
163
|
+
if (result.changed.length > 0) {
|
|
164
|
+
console.log(yellow(`~ ${result.changed.length} changed tool(s):`));
|
|
165
|
+
for (const { tool, changes } of result.changed) {
|
|
166
|
+
console.log(yellow(` ~ ${tool.name}`));
|
|
167
|
+
for (const change of changes) {
|
|
168
|
+
if (change.old && change.new) {
|
|
169
|
+
console.log(` ${change.field}: ${red(change.old)} -> ${green(change.new)}`);
|
|
170
|
+
}
|
|
171
|
+
else if (change.new) {
|
|
172
|
+
console.log(` ${change.field}: ${green(change.new)}`);
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
console.log(` ${change.field}: ${red(change.old)}`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
console.log('');
|
|
180
|
+
}
|
|
181
|
+
// Summary
|
|
182
|
+
const total = result.added.length + result.removed.length + result.changed.length + result.unchanged;
|
|
183
|
+
console.log(`Summary: ${total} tools total — ${green(`${result.added.length} added`)}, ${red(`${result.removed.length} removed`)}, ${yellow(`${result.changed.length} changed`)}, ${result.unchanged} unchanged`);
|
|
184
|
+
},
|
|
185
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
declare const _default: import("citty").CommandDef<{
|
|
2
|
+
description: {
|
|
3
|
+
type: "positional";
|
|
4
|
+
description: string;
|
|
5
|
+
required: true;
|
|
6
|
+
};
|
|
7
|
+
output: {
|
|
8
|
+
type: "string";
|
|
9
|
+
alias: string;
|
|
10
|
+
description: string;
|
|
11
|
+
required: true;
|
|
12
|
+
};
|
|
13
|
+
name: {
|
|
14
|
+
type: "string";
|
|
15
|
+
alias: string;
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
'base-url': {
|
|
19
|
+
type: "string";
|
|
20
|
+
alias: string;
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
model: {
|
|
24
|
+
type: "string";
|
|
25
|
+
alias: string;
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
'save-spec': {
|
|
29
|
+
type: "string";
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
transport: {
|
|
33
|
+
type: "string";
|
|
34
|
+
alias: string;
|
|
35
|
+
description: string;
|
|
36
|
+
default: string;
|
|
37
|
+
};
|
|
38
|
+
target: {
|
|
39
|
+
type: "string";
|
|
40
|
+
description: string;
|
|
41
|
+
default: string;
|
|
42
|
+
};
|
|
43
|
+
include: {
|
|
44
|
+
type: "string";
|
|
45
|
+
alias: string;
|
|
46
|
+
description: string;
|
|
47
|
+
};
|
|
48
|
+
exclude: {
|
|
49
|
+
type: "string";
|
|
50
|
+
alias: string;
|
|
51
|
+
description: string;
|
|
52
|
+
};
|
|
53
|
+
force: {
|
|
54
|
+
type: "boolean";
|
|
55
|
+
alias: string;
|
|
56
|
+
description: string;
|
|
57
|
+
default: false;
|
|
58
|
+
};
|
|
59
|
+
'dry-run': {
|
|
60
|
+
type: "boolean";
|
|
61
|
+
description: string;
|
|
62
|
+
default: false;
|
|
63
|
+
};
|
|
64
|
+
}>;
|
|
65
|
+
export default _default;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { defineConfigurableCommand } from '../../config/configurable-command.js';
|
|
2
|
+
import { writeFile, mkdtemp, rm } from 'node:fs/promises';
|
|
3
|
+
import { resolve } from 'node:path';
|
|
4
|
+
import { tmpdir } from 'node:os';
|
|
5
|
+
import { generateSpecFromDescription } from '../../generator/spec-generator.js';
|
|
6
|
+
import { loadOpenApiSpec } from '../../parser/openapi-loader.js';
|
|
7
|
+
import { extractOperations } from '../../parser/operation-extractor.js';
|
|
8
|
+
import { detectAuthSchemes } from '../../transformer/auth-detector.js';
|
|
9
|
+
import { buildAllTools } from '../../transformer/tool-builder.js';
|
|
10
|
+
import { filterOperations } from '../../transformer/operation-filter.js';
|
|
11
|
+
import { emitProject } from '../../emitter/index.js';
|
|
12
|
+
import { targetArg, resolveTarget, resolveTransport, printWorkerNextSteps, } from './target-support.js';
|
|
13
|
+
import { logger } from '../../utils/logger.js';
|
|
14
|
+
import { fail } from '../../utils/fail.js';
|
|
15
|
+
function toPackageName(title) {
|
|
16
|
+
return title
|
|
17
|
+
.toLowerCase()
|
|
18
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
19
|
+
.replace(/^-|-$/g, '');
|
|
20
|
+
}
|
|
21
|
+
export default defineConfigurableCommand('describe', {
|
|
22
|
+
meta: {
|
|
23
|
+
name: 'describe',
|
|
24
|
+
description: 'Generate an MCP server from a natural language description using AI',
|
|
25
|
+
},
|
|
26
|
+
args: {
|
|
27
|
+
description: {
|
|
28
|
+
type: 'positional',
|
|
29
|
+
description: 'Natural language description of the API (e.g., "manage GitHub issues")',
|
|
30
|
+
required: true,
|
|
31
|
+
},
|
|
32
|
+
output: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
alias: 'o',
|
|
35
|
+
description: 'Output directory for generated project',
|
|
36
|
+
required: true,
|
|
37
|
+
},
|
|
38
|
+
name: {
|
|
39
|
+
type: 'string',
|
|
40
|
+
alias: 'n',
|
|
41
|
+
description: 'Server name',
|
|
42
|
+
},
|
|
43
|
+
'base-url': {
|
|
44
|
+
type: 'string',
|
|
45
|
+
alias: 'b',
|
|
46
|
+
description: 'Base URL for the API',
|
|
47
|
+
},
|
|
48
|
+
model: {
|
|
49
|
+
type: 'string',
|
|
50
|
+
alias: 'm',
|
|
51
|
+
description: 'Claude model to use (default: claude-sonnet-4-20250514)',
|
|
52
|
+
},
|
|
53
|
+
'save-spec': {
|
|
54
|
+
type: 'string',
|
|
55
|
+
description: 'Save the generated OpenAPI spec to this path',
|
|
56
|
+
},
|
|
57
|
+
transport: {
|
|
58
|
+
type: 'string',
|
|
59
|
+
alias: 't',
|
|
60
|
+
description: 'Transport mode: "stdio" (default) or "http"',
|
|
61
|
+
default: 'stdio',
|
|
62
|
+
},
|
|
63
|
+
target: targetArg,
|
|
64
|
+
include: {
|
|
65
|
+
type: 'string',
|
|
66
|
+
alias: 'i',
|
|
67
|
+
description: 'Only include operations matching these patterns (comma-separated)',
|
|
68
|
+
},
|
|
69
|
+
exclude: {
|
|
70
|
+
type: 'string',
|
|
71
|
+
alias: 'e',
|
|
72
|
+
description: 'Exclude operations matching these patterns (comma-separated)',
|
|
73
|
+
},
|
|
74
|
+
force: {
|
|
75
|
+
type: 'boolean',
|
|
76
|
+
alias: 'f',
|
|
77
|
+
description: 'Overwrite existing output directory',
|
|
78
|
+
default: false,
|
|
79
|
+
},
|
|
80
|
+
'dry-run': {
|
|
81
|
+
type: 'boolean',
|
|
82
|
+
description: 'Preview generated files without writing',
|
|
83
|
+
default: false,
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
async run({ args }) {
|
|
87
|
+
// Generate OpenAPI spec from description
|
|
88
|
+
const specJson = await generateSpecFromDescription({
|
|
89
|
+
description: args.description,
|
|
90
|
+
baseUrl: args['base-url'],
|
|
91
|
+
model: args.model,
|
|
92
|
+
});
|
|
93
|
+
// Save spec if requested
|
|
94
|
+
if (args['save-spec']) {
|
|
95
|
+
await writeFile(args['save-spec'], specJson, 'utf-8');
|
|
96
|
+
logger.info(`Saved generated spec to: ${args['save-spec']}`);
|
|
97
|
+
}
|
|
98
|
+
// Write spec to temp file and parse through the OpenAPI pipeline
|
|
99
|
+
const tempDir = await mkdtemp(resolve(tmpdir(), 'mcpmake-describe-'));
|
|
100
|
+
const tempSpecPath = resolve(tempDir, 'generated-spec.json');
|
|
101
|
+
try {
|
|
102
|
+
await writeFile(tempSpecPath, specJson, 'utf-8');
|
|
103
|
+
const { api } = await loadOpenApiSpec(tempSpecPath);
|
|
104
|
+
const { operations, baseUrl, securitySchemes, info } = extractOperations(api);
|
|
105
|
+
if (operations.length === 0) {
|
|
106
|
+
await fail('Generated spec has no operations. Try a more specific description.');
|
|
107
|
+
}
|
|
108
|
+
logger.info(`Generated ${operations.length} operations`);
|
|
109
|
+
const filtered = filterOperations(operations, {
|
|
110
|
+
include: args.include?.split(',').map((s) => s.trim()),
|
|
111
|
+
exclude: args.exclude?.split(',').map((s) => s.trim()),
|
|
112
|
+
});
|
|
113
|
+
if (filtered.length === 0) {
|
|
114
|
+
await fail('No operations left after filtering.');
|
|
115
|
+
}
|
|
116
|
+
if (filtered.length !== operations.length) {
|
|
117
|
+
logger.info(`${filtered.length} operations after filtering`);
|
|
118
|
+
}
|
|
119
|
+
const tools = buildAllTools(filtered);
|
|
120
|
+
const { authSchemes, envVars } = detectAuthSchemes(securitySchemes);
|
|
121
|
+
const serverName = args.name ?? toPackageName(info.title);
|
|
122
|
+
const resolvedBaseUrl = args['base-url'] ?? baseUrl;
|
|
123
|
+
const target = resolveTarget(args.target);
|
|
124
|
+
const transport = resolveTransport(target, args.transport);
|
|
125
|
+
const manifest = {
|
|
126
|
+
serverName,
|
|
127
|
+
serverVersion: info.version ?? '1.0.0',
|
|
128
|
+
baseUrl: resolvedBaseUrl || 'https://api.example.com',
|
|
129
|
+
transport,
|
|
130
|
+
tools,
|
|
131
|
+
authSchemes,
|
|
132
|
+
envVars: [
|
|
133
|
+
{
|
|
134
|
+
name: 'BASE_URL',
|
|
135
|
+
description: 'API base URL',
|
|
136
|
+
required: true,
|
|
137
|
+
example: resolvedBaseUrl,
|
|
138
|
+
},
|
|
139
|
+
...envVars,
|
|
140
|
+
],
|
|
141
|
+
target,
|
|
142
|
+
};
|
|
143
|
+
logger.info(`Generating MCP server: ${serverName}` +
|
|
144
|
+
(target === 'cloudflare' ? ' (Cloudflare Workers)' : ''));
|
|
145
|
+
await emitProject(manifest, {
|
|
146
|
+
outputDir: args.output,
|
|
147
|
+
force: args.force ?? false,
|
|
148
|
+
dryRun: args['dry-run'] ?? false,
|
|
149
|
+
});
|
|
150
|
+
logger.success(`MCP server generated at: ${args.output}`);
|
|
151
|
+
logger.info('');
|
|
152
|
+
logger.info(`Tools generated: ${tools.length}`);
|
|
153
|
+
for (const tool of tools) {
|
|
154
|
+
logger.info(` - ${tool.name}: ${tool.description}`);
|
|
155
|
+
}
|
|
156
|
+
if (target === 'cloudflare') {
|
|
157
|
+
printWorkerNextSteps(args.output);
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
logger.info('');
|
|
161
|
+
logger.info('Next steps:');
|
|
162
|
+
logger.info(` cd ${args.output}`);
|
|
163
|
+
logger.info(' cp .env.example .env # fill in your credentials');
|
|
164
|
+
logger.info(' npm install');
|
|
165
|
+
logger.info(' npm run build');
|
|
166
|
+
logger.info(' npm start');
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
finally {
|
|
170
|
+
await rm(tempDir, { recursive: true, force: true });
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
declare const _default: import("citty").CommandDef<{
|
|
2
|
+
file: {
|
|
3
|
+
type: "positional";
|
|
4
|
+
description: string;
|
|
5
|
+
required: true;
|
|
6
|
+
};
|
|
7
|
+
output: {
|
|
8
|
+
type: "string";
|
|
9
|
+
alias: string;
|
|
10
|
+
description: string;
|
|
11
|
+
required: true;
|
|
12
|
+
};
|
|
13
|
+
name: {
|
|
14
|
+
type: "string";
|
|
15
|
+
alias: string;
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
domain: {
|
|
19
|
+
type: "string";
|
|
20
|
+
alias: string;
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
'include-errors': {
|
|
24
|
+
type: "boolean";
|
|
25
|
+
description: string;
|
|
26
|
+
default: false;
|
|
27
|
+
};
|
|
28
|
+
'improve-names': {
|
|
29
|
+
type: "boolean";
|
|
30
|
+
description: string;
|
|
31
|
+
default: false;
|
|
32
|
+
};
|
|
33
|
+
dedup: {
|
|
34
|
+
type: "boolean";
|
|
35
|
+
description: string;
|
|
36
|
+
default: true;
|
|
37
|
+
};
|
|
38
|
+
interactive: {
|
|
39
|
+
type: "boolean";
|
|
40
|
+
description: string;
|
|
41
|
+
default: false;
|
|
42
|
+
};
|
|
43
|
+
force: {
|
|
44
|
+
type: "boolean";
|
|
45
|
+
alias: string;
|
|
46
|
+
description: string;
|
|
47
|
+
default: false;
|
|
48
|
+
};
|
|
49
|
+
transport: {
|
|
50
|
+
type: "string";
|
|
51
|
+
alias: string;
|
|
52
|
+
description: string;
|
|
53
|
+
default: string;
|
|
54
|
+
};
|
|
55
|
+
include: {
|
|
56
|
+
type: "string";
|
|
57
|
+
alias: string;
|
|
58
|
+
description: string;
|
|
59
|
+
};
|
|
60
|
+
exclude: {
|
|
61
|
+
type: "string";
|
|
62
|
+
alias: string;
|
|
63
|
+
description: string;
|
|
64
|
+
};
|
|
65
|
+
'dry-run': {
|
|
66
|
+
type: "boolean";
|
|
67
|
+
description: string;
|
|
68
|
+
default: false;
|
|
69
|
+
};
|
|
70
|
+
format: {
|
|
71
|
+
type: "string";
|
|
72
|
+
description: string;
|
|
73
|
+
default: string;
|
|
74
|
+
};
|
|
75
|
+
target: {
|
|
76
|
+
type: "string";
|
|
77
|
+
description: string;
|
|
78
|
+
default: string;
|
|
79
|
+
};
|
|
80
|
+
}>;
|
|
81
|
+
export default _default;
|