codeport 0.3.1 → 0.4.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.
Files changed (3) hide show
  1. package/README.md +4 -2
  2. package/index.js +249 -107
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -17,6 +17,8 @@ into it, and your session token is kept in the OS keychain and never shown to th
17
17
  | `analyze_project` | Detect the stack, save the project in your organization's catalog, first estimate |
18
18
  | `estimate_cost` | Monthly cost on every platform for a load (Team / Department / Company or your numbers); `platform` gives an itemized bill with sources |
19
19
  | `recommend_target` | Ranking by simplicity, cost and fit, with reasons; names the best platform Codeport can deploy to |
20
+ | `connect_github` | Link that installs the Codeport GitHub App (read-only, repositories you pick); lists connected repositories |
21
+ | `analyze_repository` | Analyze a connected repository in Codeport's cloud, without the code on this machine: stack, costs, recommendation |
20
22
 
21
23
  ## Set up
22
24
 
@@ -57,8 +59,8 @@ claude mcp add codeport -- node /path/to/codeport/apps/mcp/dist/index.js
57
59
  `pnpm --filter @codeport/mcp pack:npm` bundles the server into `apps/mcp/npm/` (the
58
60
  `@codeport/*` workspace packages are inlined; only the MCP SDK, zod and the OS keychain binding
59
61
  stay as dependencies). Bump `version` in `package.json` and `src/version.ts`, merge, then push a
60
- tag `mcp-v<version>`: the "Release codeport to npm" workflow tests, packs and publishes it
61
- with npm trusted publishing.
62
+ tag `mcp-v<version>`, or press "Run workflow" on "Release codeport to npm" for `main`: the workflow
63
+ tests, packs and publishes it with npm trusted publishing, and refuses a version already on npm.
62
64
 
63
65
  Then, in a project folder, ask: _"Sign in to Codeport with me@company.com"_, paste the code, and
64
66
  _"Analyze this project with Codeport and tell me where to host it."_
package/index.js CHANGED
@@ -213,7 +213,7 @@ async function defaultStore() {
213
213
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
214
214
  import { z as z2 } from "zod";
215
215
  var text = (t) => ({ content: [{ type: "text", text: t }] });
216
- function createServer(flow2, tools, version) {
216
+ function createServer(flow2, tools, version, github) {
217
217
  const server2 = new McpServer({ name: "codeport", version });
218
218
  server2.registerTool(
219
219
  "auth_start",
@@ -296,9 +296,253 @@ function createServer(flow2, tools, version) {
296
296
  },
297
297
  async (a) => text(await tools.recommend(a))
298
298
  );
299
+ if (github) {
300
+ server2.registerTool(
301
+ "connect_github",
302
+ {
303
+ title: "Connect GitHub repositories to Codeport",
304
+ description: "Give the link that installs the Codeport GitHub App, so Codeport can analyze repositories in its cloud without the code on this machine (read-only access to code and metadata, for the repositories the user picks). Also lists the repositories already connected."
305
+ },
306
+ async () => text(await github.connect())
307
+ );
308
+ server2.registerTool(
309
+ "analyze_repository",
310
+ {
311
+ title: "Analyze a connected GitHub repository",
312
+ description: "Analyze a GitHub repository connected through connect_github, in Codeport's cloud: stack, monthly cost on every platform and where to host it. Works without a local copy of the code. Without `repo`, lists the connected repositories.",
313
+ inputSchema: {
314
+ repo: z2.string().optional().describe("owner/name or just the name, e.g. acme/portal"),
315
+ reanalyze: z2.boolean().optional().describe("Analyze the latest commit again instead of the last result"),
316
+ scenario: load.scenario,
317
+ geo: load.geo
318
+ }
319
+ },
320
+ async (a) => text(await github.analyze(a))
321
+ );
322
+ }
299
323
  return server2;
300
324
  }
301
325
 
326
+ // src/format.ts
327
+ var runtimeName = (lang) => lang === "typescript" || lang === "javascript" ? "Node.js" : lang === "python" ? "Python" : lang === "csharp" || lang === "fsharp" ? ".NET" : lang;
328
+ var money = (v) => v >= 100 ? `$${Math.round(v).toLocaleString("en-US")}` : `$${v.toFixed(2)}`;
329
+ var range = (r) => Math.abs(r.high - r.low) < 5e-3 ? money(r.low) : `${money(r.low)}\u2013${money(r.high)}`;
330
+ var SCENARIO = {
331
+ team: "Team (up to 50 users, ~1,000 requests a day, 1 GB of data)",
332
+ department: "Department (up to 500 users, ~20,000 requests a day, 10 GB)",
333
+ company: "Company (up to 5,000 users, ~200,000 requests a day, 50 GB)"
334
+ };
335
+ function formatStack(apps, warnings) {
336
+ const out = [];
337
+ for (const a of apps) {
338
+ const p = a.profile;
339
+ const rt = p.runtimes[0];
340
+ out.push(`### ${p.app.name}${a.path ? ` (\`${a.path}\`)` : ""}`);
341
+ out.push(
342
+ `- Kind: ${p.app.kind}; ${rt?.language ?? "unknown"}${rt?.framework ? `, ${rt.framework}` : ""}${rt?.version ? ` (${runtimeName(rt.language)} ${rt.version})` : ""}${p.build.packageManager ? `; ${p.build.packageManager}` : ""}${p.build.port ? `; port ${p.build.port}` : ""}`
343
+ );
344
+ if (p.services.length)
345
+ out.push(
346
+ `- Services: ${p.services.map((s) => `${s.type}${s.engine ? ` (${s.engine})` : ""}`).join(", ")}`
347
+ );
348
+ const secrets = p.env.filter((e) => e.secret).map((e) => e.name);
349
+ const plain = p.env.filter((e) => !e.secret).map((e) => e.name);
350
+ if (secrets.length) out.push(`- Secrets it needs: ${secrets.join(", ")}`);
351
+ if (plain.length) out.push(`- Other settings: ${plain.join(", ")}`);
352
+ for (const w of a.warnings) out.push(`- Note: ${w}`);
353
+ }
354
+ for (const w of warnings) out.push(`- Note: ${w}`);
355
+ return out.join("\n");
356
+ }
357
+ function scenarioLine(r) {
358
+ return `Load: ${SCENARIO[r.scenario] ?? "custom numbers"}. Region: ${r.geo === "us" ? "US East" : "Europe (Frankfurt)"}. Monthly USD.`;
359
+ }
360
+ function asOf(r) {
361
+ const d = Object.entries(r.pricesAsOf).map(([p, day]) => `${p} ${day}`);
362
+ return d.length ? `Prices as of: ${d.join(", ")}.` : "";
363
+ }
364
+ function formatCosts(r) {
365
+ const ok = r.ranking.filter((p) => !p.excluded).sort((a, b) => a.monthlyUsd.low + a.monthlyUsd.high - (b.monthlyUsd.low + b.monthlyUsd.high));
366
+ const out = [scenarioLine(r), "", "| Platform | Per month | Codeport deploys here |", "|---|---|---|"];
367
+ for (const p of ok)
368
+ out.push(`| ${p.name} | ${range(p.monthlyUsd)} | ${p.deployable ? "yes" : "not yet"} |`);
369
+ const ex = r.ranking.filter((p) => p.excluded);
370
+ if (ex.length) out.push("", "Not suitable or not priced:", ...ex.map((p) => `- ${p.name}: ${p.excluded}`));
371
+ const missing = [...new Set(ok.flatMap((p) => p.notIncluded.map((n) => n.item)))];
372
+ if (missing.length)
373
+ out.push("", `Not in these totals (billed by their own providers): ${missing.join(", ")}.`);
374
+ out.push("", asOf(r), "Ask for one platform's breakdown to see every line, its unit price and source.");
375
+ return out.filter((l, i, a) => !(l === "" && a[i - 1] === "")).join("\n");
376
+ }
377
+ function formatBreakdown(p, r) {
378
+ if (p.excluded) return `${p.name}: ${p.excluded}`;
379
+ const out = [
380
+ `## ${p.name}: ${range(p.monthlyUsd)} per month${p.region === "global" ? "" : ` (prices for ${p.region})`}`,
381
+ scenarioLine(r),
382
+ "",
383
+ "| Item | Quantity | Unit price | Cost | Source |",
384
+ "|---|---|---|---|---|"
385
+ ];
386
+ for (const l of p.lines) {
387
+ const q = Math.abs(l.quantity.high - l.quantity.low) < 1e-9 ? fmtQty(l.quantity.low) : `${fmtQty(l.quantity.low)}\u2013${fmtQty(l.quantity.high)}`;
388
+ const unit = l.unitPrice ? `$${l.unitPrice.usd} / ${l.unitPrice.per === 1 ? "" : `${l.unitPrice.per.toLocaleString("en-US")} `}${l.unitPrice.unit}` : "";
389
+ const src = !l.source ? "" : l.source.kind === "aws-price-list" ? `AWS Price List, SKU ${l.source.sku}, ${l.source.publishedAt.slice(0, 10)}` : l.source.kind === "manual" ? `[${new URL(l.source.url).hostname}](${l.source.url}), checked ${l.source.verifiedAt}` : l.source.kind === "azure-retail-prices" ? `Azure Retail Prices, meter ${l.source.meterId}` : `Google Cloud Billing, SKU ${l.source.skuId}`;
390
+ const note = [l.vendor ? `billed by ${l.vendor}` : "", l.note ?? ""].filter(Boolean).join("; ");
391
+ out.push(
392
+ `| ${l.label}${note ? ` (${note})` : ""} | ${l.unitPrice ? q : `${q} ${l.unit}`} | ${unit} | ${range(l.usd)} | ${src} |`
393
+ );
394
+ }
395
+ if (p.notIncluded.length)
396
+ out.push("", "Not included:", ...p.notIncluded.map((n) => `- ${n.item}: ${n.reason}`));
397
+ return out.join("\n");
398
+ }
399
+ var fmtQty = (v) => v >= 1e3 ? Math.round(v).toLocaleString("en-US") : Number(v.toFixed(3)).toString();
400
+ function formatRecommendation(r) {
401
+ const ok = r.ranking.filter((p) => !p.excluded);
402
+ const best = ok[0];
403
+ if (!best)
404
+ return "No platform can run this project as it is: " + r.ranking.map((p) => `${p.name}: ${p.excluded}`).join("; ");
405
+ const out = [scenarioLine(r), ""];
406
+ const dep = ok.find((p) => p.deployable);
407
+ out.push(`**Best fit: ${best.name}** (${range(best.monthlyUsd)} per month, score ${best.score}).`);
408
+ if (!best.deployable && dep)
409
+ out.push(
410
+ `Codeport cannot deploy to ${best.name} yet. The best option it deploys to today is **${dep.name}** (${range(dep.monthlyUsd)} per month).`
411
+ );
412
+ if (!best.deployable && !dep) {
413
+ const why = r.ranking.filter((p) => p.deployable).map((p) => `${p.name}: ${p.excluded ?? "not suitable"}`);
414
+ out.push(`Codeport cannot deploy this project anywhere yet (${why.join("; ")}).`);
415
+ }
416
+ out.push("", "| # | Platform | Per month | Score | For | Against |", "|---|---|---|---|---|---|");
417
+ ok.forEach(
418
+ (p, i) => out.push(
419
+ `| ${i + 1} | ${p.name}${p.deployable ? "" : " (estimate only)"} | ${range(p.monthlyUsd)} | ${p.score} | ${p.pros.join("; ")} | ${p.cons.join("; ")} |`
420
+ )
421
+ );
422
+ const ex = r.ranking.filter((p) => p.excluded);
423
+ if (ex.length) out.push("", "Ruled out:", ...ex.map((p) => `- ${p.name}: ${p.excluded}`));
424
+ out.push("", "Score = 0.45 simplicity + 0.35 cost + 0.2 fit with the stack.", asOf(r));
425
+ return out.join("\n");
426
+ }
427
+
428
+ // src/github-tools.ts
429
+ var NOT_SIGNED_IN = "Not signed in to Codeport. Ask the user for their work email and call auth_start.";
430
+ var GitHubTools = class {
431
+ constructor(api2, store2, opts = {}) {
432
+ this.api = api2;
433
+ this.store = store2;
434
+ this.waitMs = opts.waitMs ?? 1e5;
435
+ this.pollMs = opts.pollMs ?? 4e3;
436
+ this.sleep = opts.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
437
+ }
438
+ waitMs;
439
+ pollMs;
440
+ sleep;
441
+ async run(fn) {
442
+ const c = await this.store.load();
443
+ const token = c && c.apiUrl === this.api.baseUrl ? c.token : null;
444
+ if (!token) return NOT_SIGNED_IN;
445
+ try {
446
+ return await fn(token);
447
+ } catch (e) {
448
+ if (e instanceof ApiError && e.status === 401) {
449
+ await this.store.clear();
450
+ return "The Codeport session has expired. Call auth_start to sign in again.";
451
+ }
452
+ if (e instanceof ApiError && e.status === 503)
453
+ return "Connecting GitHub is not available on this Codeport server yet.";
454
+ if (e instanceof ApiError) return `Codeport could not do that (${e.status}: ${e.message}).`;
455
+ throw e;
456
+ }
457
+ }
458
+ /** The install link and what is already connected. */
459
+ async connect() {
460
+ return this.run(async (token) => {
461
+ const g = await this.api.call(token, "GET", "/v1/github");
462
+ const lines = [];
463
+ if (g.installations.length)
464
+ lines.push(
465
+ `Connected GitHub accounts: ${g.installations.map((i) => i.account).join(", ")}.`,
466
+ ...repoLines(g),
467
+ "",
468
+ "To give Codeport access to more repositories or another GitHub account, open:"
469
+ );
470
+ else
471
+ lines.push(
472
+ "GitHub is not connected yet. Ask the user to open this link, choose the repositories Codeport may read (read-only access to code and metadata), and confirm. The link is valid for one hour:"
473
+ );
474
+ lines.push(
475
+ g.installUrl,
476
+ "",
477
+ "After that, use analyze_repository. Codeport analyzes new repositories automatically."
478
+ );
479
+ return lines.join("\n");
480
+ });
481
+ }
482
+ /** Analyzes a connected repository in the cloud and reports its stack and costs. */
483
+ async analyze(args) {
484
+ return this.run(async (token) => {
485
+ const g = await this.api.call(token, "GET", "/v1/github");
486
+ if (!g.repos.length)
487
+ return "No GitHub repositories are connected. Call connect_github to get the link that connects them.";
488
+ if (!args.repo) return ["Which repository? Connected ones:", ...repoLines(g)].join("\n");
489
+ const want = args.repo.toLowerCase().replace(/^https?:\/\/github\.com\//, "").replace(/\.git$/, "");
490
+ const matches = g.repos.filter((r) => {
491
+ const full2 = (r.repo ?? "").replace(/^github:/, "").toLowerCase();
492
+ return full2 === want || full2.split("/")[1] === want || r.name.toLowerCase() === want;
493
+ });
494
+ if (matches.length !== 1)
495
+ return [
496
+ matches.length ? `"${args.repo}" matches several repositories:` : `"${args.repo}" is not connected. Connected:`,
497
+ ...repoLines({ repos: matches.length ? matches : g.repos }),
498
+ "Give the full owner/name, or call connect_github to add a repository."
499
+ ].join("\n");
500
+ const app = matches[0];
501
+ const full = (app.repo ?? app.name).replace(/^github:/, "");
502
+ if (app.status !== "analyzed" || args.reanalyze) {
503
+ const { run } = await this.api.call(token, "POST", `/v1/apps/${app.appId}/runs`, {
504
+ trigger: "mcp"
505
+ });
506
+ const done = await this.wait(token, run.id);
507
+ if (!done)
508
+ return `Codeport is analyzing ${full} in the cloud; it usually takes a minute or two. Call analyze_repository again shortly.`;
509
+ if (done.status === "failed")
510
+ return `The analysis of ${full} failed: ${done.error ?? "unknown error"}`;
511
+ }
512
+ const geo = args.geo ?? "eu";
513
+ const report = await this.api.call(token, "GET", `/v1/apps/${app.appId}/report?geo=${geo}`);
514
+ if (!report.estimates || !report.profiles.length)
515
+ return `${full} has no finished analysis yet. Call analyze_repository with reanalyze: true.`;
516
+ const commit = report.analysis?.commitSha ? ` at commit ${report.analysis.commitSha.slice(0, 7)}` : "";
517
+ return [
518
+ `Analysis of ${full}${commit} (in Codeport's cloud; the code was read, nothing from it was run).`,
519
+ "",
520
+ "## Stack",
521
+ formatStack(
522
+ report.profiles.map((p) => ({ path: p.path, profile: p.profile, warnings: [] })),
523
+ []
524
+ ),
525
+ "",
526
+ formatRecommendation(report.estimates[args.scenario ?? "team"])
527
+ ].join("\n");
528
+ });
529
+ }
530
+ async wait(token, runId) {
531
+ const deadline = Date.now() + this.waitMs;
532
+ for (; ; ) {
533
+ const { run } = await this.api.call(token, "GET", `/v1/runs/${runId}`);
534
+ if (run.status === "succeeded" || run.status === "failed") return run;
535
+ if (Date.now() + this.pollMs > deadline) return null;
536
+ await this.sleep(this.pollMs);
537
+ }
538
+ }
539
+ };
540
+ function repoLines(g) {
541
+ return g.repos.map(
542
+ (r) => `- ${(r.repo ?? r.name).replace(/^github:/, "")}${r.status === "analyzed" ? "" : " (not analyzed yet)"}`
543
+ );
544
+ }
545
+
302
546
  // src/project-tools.ts
303
547
  import path6 from "node:path";
304
548
  import { stat as stat2 } from "node:fs/promises";
@@ -2248,108 +2492,6 @@ async function analyzeDirectory(dir) {
2248
2492
  return analyzeFiles(await fromDirectory(dir), path4.basename(path4.resolve(dir)));
2249
2493
  }
2250
2494
 
2251
- // src/format.ts
2252
- var runtimeName = (lang) => lang === "typescript" || lang === "javascript" ? "Node.js" : lang === "python" ? "Python" : lang === "csharp" || lang === "fsharp" ? ".NET" : lang;
2253
- var money = (v) => v >= 100 ? `$${Math.round(v).toLocaleString("en-US")}` : `$${v.toFixed(2)}`;
2254
- var range = (r) => Math.abs(r.high - r.low) < 5e-3 ? money(r.low) : `${money(r.low)}\u2013${money(r.high)}`;
2255
- var SCENARIO = {
2256
- team: "Team (up to 50 users, ~1,000 requests a day, 1 GB of data)",
2257
- department: "Department (up to 500 users, ~20,000 requests a day, 10 GB)",
2258
- company: "Company (up to 5,000 users, ~200,000 requests a day, 50 GB)"
2259
- };
2260
- function formatStack(apps, warnings) {
2261
- const out = [];
2262
- for (const a of apps) {
2263
- const p = a.profile;
2264
- const rt = p.runtimes[0];
2265
- out.push(`### ${p.app.name}${a.path ? ` (\`${a.path}\`)` : ""}`);
2266
- out.push(
2267
- `- Kind: ${p.app.kind}; ${rt?.language ?? "unknown"}${rt?.framework ? `, ${rt.framework}` : ""}${rt?.version ? ` (${runtimeName(rt.language)} ${rt.version})` : ""}${p.build.packageManager ? `; ${p.build.packageManager}` : ""}${p.build.port ? `; port ${p.build.port}` : ""}`
2268
- );
2269
- if (p.services.length)
2270
- out.push(
2271
- `- Services: ${p.services.map((s) => `${s.type}${s.engine ? ` (${s.engine})` : ""}`).join(", ")}`
2272
- );
2273
- const secrets = p.env.filter((e) => e.secret).map((e) => e.name);
2274
- const plain = p.env.filter((e) => !e.secret).map((e) => e.name);
2275
- if (secrets.length) out.push(`- Secrets it needs: ${secrets.join(", ")}`);
2276
- if (plain.length) out.push(`- Other settings: ${plain.join(", ")}`);
2277
- for (const w of a.warnings) out.push(`- Note: ${w}`);
2278
- }
2279
- for (const w of warnings) out.push(`- Note: ${w}`);
2280
- return out.join("\n");
2281
- }
2282
- function scenarioLine(r) {
2283
- return `Load: ${SCENARIO[r.scenario] ?? "custom numbers"}. Region: ${r.geo === "us" ? "US East" : "Europe (Frankfurt)"}. Monthly USD.`;
2284
- }
2285
- function asOf(r) {
2286
- const d = Object.entries(r.pricesAsOf).map(([p, day]) => `${p} ${day}`);
2287
- return d.length ? `Prices as of: ${d.join(", ")}.` : "";
2288
- }
2289
- function formatCosts(r) {
2290
- const ok = r.ranking.filter((p) => !p.excluded).sort((a, b) => a.monthlyUsd.low + a.monthlyUsd.high - (b.monthlyUsd.low + b.monthlyUsd.high));
2291
- const out = [scenarioLine(r), "", "| Platform | Per month | Codeport deploys here |", "|---|---|---|"];
2292
- for (const p of ok)
2293
- out.push(`| ${p.name} | ${range(p.monthlyUsd)} | ${p.deployable ? "yes" : "not yet"} |`);
2294
- const ex = r.ranking.filter((p) => p.excluded);
2295
- if (ex.length) out.push("", "Not suitable or not priced:", ...ex.map((p) => `- ${p.name}: ${p.excluded}`));
2296
- const missing = [...new Set(ok.flatMap((p) => p.notIncluded.map((n) => n.item)))];
2297
- if (missing.length)
2298
- out.push("", `Not in these totals (billed by their own providers): ${missing.join(", ")}.`);
2299
- out.push("", asOf(r), "Ask for one platform's breakdown to see every line, its unit price and source.");
2300
- return out.filter((l, i, a) => !(l === "" && a[i - 1] === "")).join("\n");
2301
- }
2302
- function formatBreakdown(p, r) {
2303
- if (p.excluded) return `${p.name}: ${p.excluded}`;
2304
- const out = [
2305
- `## ${p.name}: ${range(p.monthlyUsd)} per month${p.region === "global" ? "" : ` (prices for ${p.region})`}`,
2306
- scenarioLine(r),
2307
- "",
2308
- "| Item | Quantity | Unit price | Cost | Source |",
2309
- "|---|---|---|---|---|"
2310
- ];
2311
- for (const l of p.lines) {
2312
- const q = Math.abs(l.quantity.high - l.quantity.low) < 1e-9 ? fmtQty(l.quantity.low) : `${fmtQty(l.quantity.low)}\u2013${fmtQty(l.quantity.high)}`;
2313
- const unit = l.unitPrice ? `$${l.unitPrice.usd} / ${l.unitPrice.per === 1 ? "" : `${l.unitPrice.per.toLocaleString("en-US")} `}${l.unitPrice.unit}` : "";
2314
- const src = !l.source ? "" : l.source.kind === "aws-price-list" ? `AWS Price List, SKU ${l.source.sku}, ${l.source.publishedAt.slice(0, 10)}` : l.source.kind === "manual" ? `[${new URL(l.source.url).hostname}](${l.source.url}), checked ${l.source.verifiedAt}` : l.source.kind === "azure-retail-prices" ? `Azure Retail Prices, meter ${l.source.meterId}` : `Google Cloud Billing, SKU ${l.source.skuId}`;
2315
- const note = [l.vendor ? `billed by ${l.vendor}` : "", l.note ?? ""].filter(Boolean).join("; ");
2316
- out.push(
2317
- `| ${l.label}${note ? ` (${note})` : ""} | ${l.unitPrice ? q : `${q} ${l.unit}`} | ${unit} | ${range(l.usd)} | ${src} |`
2318
- );
2319
- }
2320
- if (p.notIncluded.length)
2321
- out.push("", "Not included:", ...p.notIncluded.map((n) => `- ${n.item}: ${n.reason}`));
2322
- return out.join("\n");
2323
- }
2324
- var fmtQty = (v) => v >= 1e3 ? Math.round(v).toLocaleString("en-US") : Number(v.toFixed(3)).toString();
2325
- function formatRecommendation(r) {
2326
- const ok = r.ranking.filter((p) => !p.excluded);
2327
- const best = ok[0];
2328
- if (!best)
2329
- return "No platform can run this project as it is: " + r.ranking.map((p) => `${p.name}: ${p.excluded}`).join("; ");
2330
- const out = [scenarioLine(r), ""];
2331
- const dep = ok.find((p) => p.deployable);
2332
- out.push(`**Best fit: ${best.name}** (${range(best.monthlyUsd)} per month, score ${best.score}).`);
2333
- if (!best.deployable && dep)
2334
- out.push(
2335
- `Codeport cannot deploy to ${best.name} yet. The best option it deploys to today is **${dep.name}** (${range(dep.monthlyUsd)} per month).`
2336
- );
2337
- if (!best.deployable && !dep) {
2338
- const why = r.ranking.filter((p) => p.deployable).map((p) => `${p.name}: ${p.excluded ?? "not suitable"}`);
2339
- out.push(`Codeport cannot deploy this project anywhere yet (${why.join("; ")}).`);
2340
- }
2341
- out.push("", "| # | Platform | Per month | Score | For | Against |", "|---|---|---|---|---|---|");
2342
- ok.forEach(
2343
- (p, i) => out.push(
2344
- `| ${i + 1} | ${p.name}${p.deployable ? "" : " (estimate only)"} | ${range(p.monthlyUsd)} | ${p.score} | ${p.pros.join("; ")} | ${p.cons.join("; ")} |`
2345
- )
2346
- );
2347
- const ex = r.ranking.filter((p) => p.excluded);
2348
- if (ex.length) out.push("", "Ruled out:", ...ex.map((p) => `- ${p.name}: ${p.excluded}`));
2349
- out.push("", "Score = 0.45 simplicity + 0.35 cost + 0.2 fit with the stack.", asOf(r));
2350
- return out.join("\n");
2351
- }
2352
-
2353
2495
  // src/projects.ts
2354
2496
  import { mkdir as mkdir2, readFile as readFile3, writeFile as writeFile2 } from "node:fs/promises";
2355
2497
  import { homedir as homedir2 } from "node:os";
@@ -2398,7 +2540,7 @@ async function repoOf(dir) {
2398
2540
  }
2399
2541
 
2400
2542
  // src/project-tools.ts
2401
- var NOT_SIGNED_IN = "Not signed in to Codeport. Ask the user for their work email and call auth_start.";
2543
+ var NOT_SIGNED_IN2 = "Not signed in to Codeport. Ask the user for their work email and call auth_start.";
2402
2544
  var ProjectTools = class {
2403
2545
  constructor(api2, store2, projects = new ProjectMap(), cwd = () => process.cwd()) {
2404
2546
  this.api = api2;
@@ -2433,7 +2575,7 @@ var ProjectTools = class {
2433
2575
  }
2434
2576
  async run(fn) {
2435
2577
  const token = await this.token();
2436
- if (!token) return NOT_SIGNED_IN;
2578
+ if (!token) return NOT_SIGNED_IN2;
2437
2579
  try {
2438
2580
  return await fn(token);
2439
2581
  } catch (e) {
@@ -2529,14 +2671,14 @@ var usd = (r) => {
2529
2671
  };
2530
2672
 
2531
2673
  // src/version.ts
2532
- var VERSION = "0.3.1";
2674
+ var VERSION = "0.4.0";
2533
2675
 
2534
2676
  // src/index.ts
2535
2677
  var apiUrl = process.env.CODEPORT_API_URL ?? "https://api.codeport.diy";
2536
2678
  var api = new CodeportApi(apiUrl);
2537
2679
  var store = await defaultStore();
2538
2680
  var flow = new AuthFlow(api, store);
2539
- var server = createServer(flow, new ProjectTools(api, store), VERSION);
2681
+ var server = createServer(flow, new ProjectTools(api, store), VERSION, new GitHubTools(api, store));
2540
2682
  await server.connect(new StdioServerTransport());
2541
2683
  /*! Bundled license information:
2542
2684
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeport",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "Codeport MCP server: analyze your project's stack, estimate hosting cost and pick where to host it",
5
5
  "type": "module",
6
6
  "bin": {