md4ai 0.7.6 → 0.7.7
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/index.bundled.js +50 -14
- package/package.json +1 -1
package/dist/index.bundled.js
CHANGED
|
@@ -1232,7 +1232,7 @@ var CURRENT_VERSION;
|
|
|
1232
1232
|
var init_check_update = __esm({
|
|
1233
1233
|
"dist/check-update.js"() {
|
|
1234
1234
|
"use strict";
|
|
1235
|
-
CURRENT_VERSION = true ? "0.7.
|
|
1235
|
+
CURRENT_VERSION = true ? "0.7.7" : "0.0.0-dev";
|
|
1236
1236
|
}
|
|
1237
1237
|
});
|
|
1238
1238
|
|
|
@@ -1563,15 +1563,24 @@ function findProcessesForConfig(config, processes) {
|
|
|
1563
1563
|
return [];
|
|
1564
1564
|
const packageName = config.args ? extractPackageName(config.args) : null;
|
|
1565
1565
|
const matches = [];
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1566
|
+
const searchTerms = [];
|
|
1567
|
+
if (packageName)
|
|
1568
|
+
searchTerms.push(packageName);
|
|
1569
|
+
if (config.command === "node" && config.args?.[0]) {
|
|
1570
|
+
searchTerms.push(config.args[0]);
|
|
1571
|
+
}
|
|
1572
|
+
if (config.name) {
|
|
1573
|
+
searchTerms.push(`mcp-server-${config.name}`);
|
|
1574
|
+
searchTerms.push(`${config.name}-mcp`);
|
|
1575
|
+
}
|
|
1576
|
+
if ((config.command === "uvx" || config.command === "pipx") && config.args) {
|
|
1577
|
+
for (const arg of config.args) {
|
|
1578
|
+
if (!arg.startsWith("-") && arg !== "run")
|
|
1579
|
+
searchTerms.push(arg);
|
|
1574
1580
|
}
|
|
1581
|
+
}
|
|
1582
|
+
for (const proc of processes) {
|
|
1583
|
+
const matched = searchTerms.some((term) => proc.args.includes(term));
|
|
1575
1584
|
if (matched) {
|
|
1576
1585
|
matches.push({
|
|
1577
1586
|
pid: proc.pid,
|
|
@@ -1623,16 +1632,37 @@ function detectTty() {
|
|
|
1623
1632
|
}
|
|
1624
1633
|
function checkEnvVars(config) {
|
|
1625
1634
|
const required = config.env ? Object.keys(config.env) : [];
|
|
1626
|
-
const missing = required.filter((key) =>
|
|
1635
|
+
const missing = required.filter((key) => {
|
|
1636
|
+
const configValue = config.env?.[key];
|
|
1637
|
+
const hasConfigValue = configValue && !configValue.startsWith("${");
|
|
1638
|
+
return !hasConfigValue && !process.env[key];
|
|
1639
|
+
});
|
|
1627
1640
|
return { required, missing };
|
|
1628
1641
|
}
|
|
1629
|
-
function
|
|
1642
|
+
async function checkHttpServer(url) {
|
|
1643
|
+
try {
|
|
1644
|
+
const controller = new AbortController();
|
|
1645
|
+
const timeout = setTimeout(() => controller.abort(), 3e3);
|
|
1646
|
+
const res = await fetch(url, {
|
|
1647
|
+
method: "HEAD",
|
|
1648
|
+
signal: controller.signal
|
|
1649
|
+
});
|
|
1650
|
+
clearTimeout(timeout);
|
|
1651
|
+
return "reachable";
|
|
1652
|
+
} catch {
|
|
1653
|
+
return "unreachable";
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
function buildRows(configs, httpResults) {
|
|
1630
1657
|
const processes = getProcessTable();
|
|
1631
1658
|
const rows = [];
|
|
1632
1659
|
for (const config of configs) {
|
|
1633
1660
|
const { required, missing } = checkEnvVars(config);
|
|
1634
1661
|
const packageName = config.args ? extractPackageName(config.args) : null;
|
|
1635
1662
|
if (config.type === "http") {
|
|
1663
|
+
const reachability = httpResults.get(config.name) ?? "unknown";
|
|
1664
|
+
const status = reachability === "reachable" ? "running" : "stopped";
|
|
1665
|
+
const detail = reachability === "reachable" ? "HTTP \u2014 remote service reachable" : reachability === "unreachable" ? "HTTP \u2014 remote service unreachable" : "HTTP \u2014 could not verify";
|
|
1636
1666
|
rows.push({
|
|
1637
1667
|
server_name: config.name,
|
|
1638
1668
|
config_source: config.source,
|
|
@@ -1640,14 +1670,14 @@ function buildRows(configs) {
|
|
|
1640
1670
|
command: null,
|
|
1641
1671
|
package_name: null,
|
|
1642
1672
|
http_url: config.url ?? null,
|
|
1643
|
-
status
|
|
1673
|
+
status,
|
|
1644
1674
|
pid: null,
|
|
1645
1675
|
session_tty: null,
|
|
1646
1676
|
uptime_seconds: null,
|
|
1647
1677
|
memory_mb: null,
|
|
1648
1678
|
env_vars_required: required.length ? required : null,
|
|
1649
1679
|
env_vars_missing: missing.length ? missing : null,
|
|
1650
|
-
error_detail:
|
|
1680
|
+
error_detail: detail
|
|
1651
1681
|
});
|
|
1652
1682
|
continue;
|
|
1653
1683
|
}
|
|
@@ -1788,7 +1818,13 @@ async function mcpWatchCommand() {
|
|
|
1788
1818
|
await supabase.from("mcp_watchers").delete().eq("device_id", deviceId).lt("last_heartbeat", staleThreshold);
|
|
1789
1819
|
async function cycle() {
|
|
1790
1820
|
const configs = await readAllMcpConfigs();
|
|
1791
|
-
const
|
|
1821
|
+
const httpConfigs = configs.filter((c) => c.type === "http" && c.url);
|
|
1822
|
+
const httpResults = /* @__PURE__ */ new Map();
|
|
1823
|
+
await Promise.all(httpConfigs.map(async (c) => {
|
|
1824
|
+
const result = await checkHttpServer(c.url);
|
|
1825
|
+
httpResults.set(c.name, result);
|
|
1826
|
+
}));
|
|
1827
|
+
const rows = buildRows(configs, httpResults);
|
|
1792
1828
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1793
1829
|
await supabase.from("mcp_server_status").delete().eq("device_id", deviceId);
|
|
1794
1830
|
if (rows.length > 0) {
|