@casys/mcp-avl 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/mcp-avl.mjs CHANGED
@@ -8739,6 +8739,10 @@ async function serveFetch(options, handler) {
8739
8739
  return { finished: new Promise((resolve2) => server.once("close", () => resolve2())) };
8740
8740
  }
8741
8741
 
8742
+ // src/qualification.ts
8743
+ var STATIC_MARGIN_MIN_PCT = 4;
8744
+ var STATIC_MARGIN_MAX_PCT = 22;
8745
+
8742
8746
  // src/avl-runner.ts
8743
8747
  var GRAVITY_MS2 = 9.80665;
8744
8748
  var DEFAULT_AIR_DENSITY_KG_M3 = 1.225;
@@ -8992,9 +8996,9 @@ function evaluateStabilityQualification(metrics) {
8992
8996
  const checks = [
8993
8997
  {
8994
8998
  name: "staticMargin",
8995
- passed: metrics.staticMarginPct >= 4 && metrics.staticMarginPct <= 22,
8999
+ passed: metrics.staticMarginPct >= STATIC_MARGIN_MIN_PCT && metrics.staticMarginPct <= STATIC_MARGIN_MAX_PCT,
8996
9000
  value: round(metrics.staticMarginPct, 3),
8997
- requirement: "4% <= staticMarginPct <= 22%"
9001
+ requirement: `${STATIC_MARGIN_MIN_PCT}% <= staticMarginPct <= ${STATIC_MARGIN_MAX_PCT}%`
8998
9002
  },
8999
9003
  {
9000
9004
  name: "pitchStability",
@@ -54823,7 +54827,7 @@ var McpApp = class {
54823
54827
  continue;
54824
54828
  }
54825
54829
  const resourceUri = `ui://${config2.prefix}/${viewerName}`;
54826
- const readFile4 = config2.readFile;
54830
+ const readFile5 = config2.readFile;
54827
54831
  const currentDistPath = distPath;
54828
54832
  this.registerResource({
54829
54833
  uri: resourceUri,
@@ -54831,7 +54835,7 @@ var McpApp = class {
54831
54835
  description: `MCP App: ${viewerName}`,
54832
54836
  mimeType: MCP_APP_MIME_TYPE
54833
54837
  }, async () => {
54834
- const html = await Promise.resolve(readFile4(currentDistPath));
54838
+ const html = await Promise.resolve(readFile5(currentDistPath));
54835
54839
  const content = {
54836
54840
  uri: resourceUri,
54837
54841
  mimeType: MCP_APP_MIME_TYPE,
@@ -56623,8 +56627,101 @@ import { link, mkdir as mkdir4, open as open2, readdir as readdir2, readFile as
56623
56627
  import { join as join2, resolve } from "node:path";
56624
56628
  var encoder3 = new TextEncoder();
56625
56629
 
56630
+ // src/viewer.ts
56631
+ import { readFile as readFile4 } from "node:fs/promises";
56632
+ import { statSync } from "node:fs";
56633
+ import { fileURLToPath } from "node:url";
56634
+
56635
+ // src/widgets.ts
56636
+ var STABILITY_VERDICT_WIDGET = {
56637
+ key: "stability-verdict",
56638
+ uri: "ui://mcp-avl/stability-verdict",
56639
+ kind: "stat",
56640
+ title: "Stability verdict",
56641
+ description: "PASS or FAIL of the stability qualification with its headline numbers.",
56642
+ supportedWidths: [280, 380, 520]
56643
+ };
56644
+ var STABILITY_DERIVATIVES_WIDGET = {
56645
+ key: "stability-derivatives",
56646
+ uri: "ui://mcp-avl/stability-derivatives",
56647
+ kind: "table",
56648
+ title: "Stability derivatives",
56649
+ description: "Stability derivatives, neutral point and trim, one column per configuration.",
56650
+ supportedWidths: [340, 480, 680]
56651
+ };
56652
+ var STABILITY_GATES_WIDGET = {
56653
+ key: "stability-gates",
56654
+ uri: "ui://mcp-avl/stability-gates",
56655
+ kind: "table",
56656
+ title: "Qualification gates",
56657
+ description: "Each qualification gate with its pass or fail, one column per configuration.",
56658
+ supportedWidths: [320, 460, 640]
56659
+ };
56660
+ var STATIC_MARGIN_WIDGET = {
56661
+ key: "static-margin",
56662
+ uri: "ui://mcp-avl/static-margin",
56663
+ kind: "chart",
56664
+ title: "Static margin",
56665
+ description: "Static margin of each configuration against the qualification window.",
56666
+ supportedWidths: [320, 440, 640]
56667
+ };
56668
+ var AVL_WIDGETS = [
56669
+ STABILITY_VERDICT_WIDGET,
56670
+ STABILITY_DERIVATIVES_WIDGET,
56671
+ STABILITY_GATES_WIDGET,
56672
+ STATIC_MARGIN_WIDGET
56673
+ ];
56674
+ var AVL_DEFAULT_WIDGET = STABILITY_VERDICT_WIDGET;
56675
+ function avlWidgetByKey(key) {
56676
+ return AVL_WIDGETS.find((widget) => widget.key === key);
56677
+ }
56678
+ function avlDeclaredViews(available) {
56679
+ return AVL_WIDGETS.filter((widget) => available === void 0 || available.includes(widget.key)).map((widget) => ({
56680
+ name: widget.key,
56681
+ resourceUri: widget.uri,
56682
+ title: widget.title,
56683
+ supportedWidths: widget.supportedWidths
56684
+ }));
56685
+ }
56686
+
56687
+ // src/viewer.ts
56688
+ var DENO_RELATIVE = `./ui/dist/${AVL_WIDGETS[0].key}/index.html`;
56689
+ function isRemote(path) {
56690
+ return path.startsWith("https://") || path.startsWith("http://");
56691
+ }
56692
+ function isFile(path) {
56693
+ try {
56694
+ return statSync(path).isFile();
56695
+ } catch {
56696
+ return false;
56697
+ }
56698
+ }
56699
+ function viewerModuleUrl(moduleUrl = import.meta.url) {
56700
+ const denoLayout = isRemote(moduleUrl) || isFile(fileURLToPath(new URL(DENO_RELATIVE, moduleUrl)));
56701
+ return denoLayout ? new URL("../server.ts", moduleUrl).href : moduleUrl;
56702
+ }
56703
+ function registerAvlWidgets(app, moduleUrl = viewerModuleUrl()) {
56704
+ return app.registerViewers({
56705
+ prefix: "mcp-avl",
56706
+ viewers: AVL_WIDGETS.map((widget) => widget.key),
56707
+ moduleUrl,
56708
+ exists: (path) => isRemote(path) || isFile(path),
56709
+ readFile: async (path) => {
56710
+ if (!isRemote(path)) return await readFile4(path, "utf8");
56711
+ const response = await fetch(path);
56712
+ if (!response.ok) {
56713
+ throw new Error(
56714
+ `Unable to fetch AVL widget from ${path}: HTTP ${response.status}.`
56715
+ );
56716
+ }
56717
+ return await response.text();
56718
+ },
56719
+ humanName: (name) => `AVL ${avlWidgetByKey(name)?.title.toLowerCase() ?? name}`
56720
+ });
56721
+ }
56722
+
56626
56723
  // src/server.ts
56627
- var MCP_AVL_VERSION = "0.1.0";
56724
+ var MCP_AVL_VERSION = "0.2.0";
56628
56725
  var AVL_STABILITY_INPUT_SCHEMA = {
56629
56726
  type: "object",
56630
56727
  properties: {
@@ -56846,11 +56943,17 @@ function createMcpAvlServer(options = {}) {
56846
56943
  "(or Level-2 snippets `run_stability`, `check_valkyrie_stability` via `list_snippets` / `run_snippet`)."
56847
56944
  ].join(" ")
56848
56945
  });
56946
+ const registeredWidgets = registerAvlWidgets(app, options.viewerModuleUrl).registered.filter((key) => AVL_WIDGETS.some((widget) => widget.key === key));
56947
+ const hasDefaultWidget = registeredWidgets.includes(AVL_DEFAULT_WIDGET.key);
56948
+ const declaredViews = avlDeclaredViews(registeredWidgets);
56949
+ const snippetViewsMeta = declaredViews.length > 0 ? { "io.mcpview/views": declaredViews } : {};
56950
+ const viewerMeta = hasDefaultWidget ? { _meta: { ui: { resourceUri: AVL_DEFAULT_WIDGET.uri } } } : {};
56849
56951
  app.registerTool(
56850
56952
  {
56851
56953
  name: "avl_run_stability",
56852
56954
  description: "Run a real 3D MIT AVL (Athena Vortex Lattice) stability and trim analysis for a parametric swept delta wing + twin canted V-tail aircraft with optional ventral Stage 2 pod lifting surface, returning CLa, Cma, Cnb, Clb, Xnp, MAC, static margin %, trim alpha/elevon, CDind, Oswald e, and qualification verdict.",
56853
56955
  inputSchema: AVL_STABILITY_INPUT_SCHEMA,
56956
+ ...viewerMeta,
56854
56957
  annotations: {
56855
56958
  readOnlyHint: true,
56856
56959
  destructiveHint: false,
@@ -56879,6 +56982,7 @@ function createMcpAvlServer(options = {}) {
56879
56982
  name: "avl_check_valkyrie_stability",
56880
56983
  description: "Run real MIT AVL 3D vortex-lattice stability qualification for BOTH coupled Valkyrie-RTB (Booster + Stage 2 Pod) and post-release Booster-alone (RTB) configurations, verifying static margin (4%..22%), Cma < -0.15, Cnb > 0.03, Clb < -0.01, and |trimElevonDeg| <= 15 deg.",
56881
56984
  inputSchema: VALKYRIE_STABILITY_INPUT_SCHEMA,
56985
+ ...viewerMeta,
56882
56986
  annotations: {
56883
56987
  readOnlyHint: true,
56884
56988
  destructiveHint: false,
@@ -56903,6 +57007,7 @@ function createMcpAvlServer(options = {}) {
56903
57007
  }
56904
57008
  );
56905
57009
  registerSnippetProvider(app, {
57010
+ ...hasDefaultWidget ? { runResourceUri: AVL_DEFAULT_WIDGET.uri } : {},
56906
57011
  runAnnotations: {
56907
57012
  readOnlyHint: true,
56908
57013
  destructiveHint: false,
@@ -56925,6 +57030,7 @@ function createMcpAvlServer(options = {}) {
56925
57030
  content: [{ type: "text", text: JSON.stringify(value) }],
56926
57031
  structuredContent: { value },
56927
57032
  _meta: {
57033
+ ...snippetViewsMeta,
56928
57034
  "io.casys/provenance": "verified-solver",
56929
57035
  "io.casys/case-sha256": value.caseSha256
56930
57036
  }
@@ -56949,6 +57055,7 @@ function createMcpAvlServer(options = {}) {
56949
57055
  content: [{ type: "text", text: JSON.stringify(value) }],
56950
57056
  structuredContent: { value },
56951
57057
  _meta: {
57058
+ ...snippetViewsMeta,
56952
57059
  "io.casys/provenance": "verified-solver",
56953
57060
  "io.casys/case-sha256": value.caseSha256
56954
57061
  }
@@ -56961,7 +57068,7 @@ function createMcpAvlServer(options = {}) {
56961
57068
  ]
56962
57069
  });
56963
57070
  void detectAvlVersion(runnerOptionsFrom(options));
56964
- return { app };
57071
+ return { app, registeredWidgets, hasDefaultWidget };
56965
57072
  }
56966
57073
 
56967
57074
  // server.ts
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@casys/mcp-avl",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "MIT AVL 3D vortex-lattice stability & trim MCP server (MCP tools + @mcpview Code Mode snippets)",
5
5
  "type": "module",
6
6
  "bin": { "mcp-avl": "mcp-avl.mjs" },
7
- "files": ["mcp-avl.mjs","LICENSE","README.md"],
7
+ "files": ["mcp-avl.mjs","LICENSE","README.md","ui-dist/stability-derivatives/index.html","ui-dist/stability-gates/index.html","ui-dist/stability-verdict/index.html","ui-dist/static-margin/index.html","THIRD_PARTY_NOTICES.txt"],
8
8
  "engines": { "node": ">=20.0.0" },
9
9
  "license": "MIT",
10
10
  "repository": { "type": "git", "url": "git+https://github.com/superWorldSavior/mcp-avl.git" },