@hasna/cloud 0.1.36 → 0.1.38
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/mcp/bin.d.ts +3 -0
- package/dist/mcp/bin.d.ts.map +1 -0
- package/dist/mcp/bin.js +27778 -1
- package/dist/mcp/http.d.ts.map +1 -1
- package/dist/mcp/index.d.ts +1 -0
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +34 -13
- package/package.json +2 -2
package/dist/mcp/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/mcp/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAEpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAC1C,eAAO,MAAM,gBAAgB,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/mcp/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAEpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAC1C,eAAO,MAAM,gBAAgB,UAAU,CAAC;AAuBxC,wBAAgB,WAAW,CAAC,IAAI,GAAE,MAAM,EAAiB,GAAG,OAAO,CAElE;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAO5D;AAED,wBAAgB,UAAU,CAAC,IAAI,GAAE,MAAM,EAAiB,GAAG,OAAO,CAEjE;AAED,wBAAgB,aAAa,CAAC,IAAI,GAAE,MAAM,EAAiB,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAgB7F;AAUD,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,SAAS,GAAE,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAe,GAC5D,OAAO,CAAC,IAAI,CAAC,CAUf;AAED,wBAAgB,aAAa,CAAC,IAAI,GAAE,MAAyB,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAE/F;AAED,wBAAsB,kBAAkB,CAAC,OAAO,GAAE;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IACjD,IAAI,CAAC,EAAE,MAAM,CAAC;CACV,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC,CAuC7D;AAED,wBAAsB,gBAAgB,CAAC,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAIrF"}
|
package/dist/mcp/index.d.ts
CHANGED
package/dist/mcp/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAcpE,wBAAgB,WAAW,IAAI,SAAS,CAwVvC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAcpE,wBAAgB,WAAW,IAAI,SAAS,CAwVvC;AAED,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAW1C"}
|
package/dist/mcp/index.js
CHANGED
|
@@ -27413,17 +27413,33 @@ class StreamableHTTPServerTransport {
|
|
|
27413
27413
|
// src/mcp/http.ts
|
|
27414
27414
|
var DEFAULT_MCP_HTTP_PORT = 8852;
|
|
27415
27415
|
var MCP_SERVICE_NAME = "cloud";
|
|
27416
|
+
var MIN_PORT = 0;
|
|
27417
|
+
var MAX_PORT = 65535;
|
|
27418
|
+
function invalidPortMessage(source, value) {
|
|
27419
|
+
return `Invalid ${source} "${value}". Expected an integer between ${MIN_PORT} and ${MAX_PORT}.`;
|
|
27420
|
+
}
|
|
27421
|
+
function validatePort(port, source) {
|
|
27422
|
+
if (!Number.isInteger(port) || port < MIN_PORT || port > MAX_PORT) {
|
|
27423
|
+
throw new Error(invalidPortMessage(source, String(port)));
|
|
27424
|
+
}
|
|
27425
|
+
return port;
|
|
27426
|
+
}
|
|
27427
|
+
function parsePortValue(value, source) {
|
|
27428
|
+
const trimmed = value.trim();
|
|
27429
|
+
if (!/^\d+$/.test(trimmed)) {
|
|
27430
|
+
throw new Error(invalidPortMessage(source, value));
|
|
27431
|
+
}
|
|
27432
|
+
return validatePort(Number(trimmed), source);
|
|
27433
|
+
}
|
|
27416
27434
|
function isStdioMode(argv = process.argv) {
|
|
27417
27435
|
return argv.includes("--stdio") || process.env.MCP_STDIO === "1";
|
|
27418
27436
|
}
|
|
27419
27437
|
function resolveMcpHttpPort(explicit) {
|
|
27420
|
-
if (explicit != null
|
|
27421
|
-
return explicit;
|
|
27438
|
+
if (explicit != null)
|
|
27439
|
+
return validatePort(explicit, "--port");
|
|
27422
27440
|
const env = process.env.MCP_HTTP_PORT;
|
|
27423
|
-
if (env) {
|
|
27424
|
-
|
|
27425
|
-
if (!Number.isNaN(parsed))
|
|
27426
|
-
return parsed;
|
|
27441
|
+
if (env && env.trim() !== "") {
|
|
27442
|
+
return parsePortValue(env, "MCP_HTTP_PORT");
|
|
27427
27443
|
}
|
|
27428
27444
|
return DEFAULT_MCP_HTTP_PORT;
|
|
27429
27445
|
}
|
|
@@ -27433,9 +27449,17 @@ function isHttpMode(argv = process.argv) {
|
|
|
27433
27449
|
function parseHttpArgv(argv = process.argv) {
|
|
27434
27450
|
const http = isHttpMode(argv);
|
|
27435
27451
|
let port;
|
|
27452
|
+
const portEqualsArg = argv.find((arg) => arg.startsWith("--port="));
|
|
27453
|
+
if (portEqualsArg) {
|
|
27454
|
+
port = parsePortValue(portEqualsArg.slice("--port=".length), "--port");
|
|
27455
|
+
}
|
|
27436
27456
|
const portIdx = argv.indexOf("--port");
|
|
27437
|
-
if (portIdx !== -1
|
|
27438
|
-
|
|
27457
|
+
if (portIdx !== -1) {
|
|
27458
|
+
const value = argv[portIdx + 1];
|
|
27459
|
+
if (value === undefined) {
|
|
27460
|
+
throw new Error(invalidPortMessage("--port", ""));
|
|
27461
|
+
}
|
|
27462
|
+
port = parsePortValue(value, "--port");
|
|
27439
27463
|
}
|
|
27440
27464
|
return { http, port };
|
|
27441
27465
|
}
|
|
@@ -27777,19 +27801,16 @@ Done. ${results.length} services, ${totalApplied} migrations applied.`);
|
|
|
27777
27801
|
return server;
|
|
27778
27802
|
}
|
|
27779
27803
|
async function main() {
|
|
27780
|
-
const { port } = parseHttpArgv();
|
|
27781
27804
|
if (isStdioMode()) {
|
|
27782
27805
|
const server = buildServer();
|
|
27783
27806
|
const transport = new StdioServerTransport;
|
|
27784
27807
|
await server.connect(transport);
|
|
27785
27808
|
return;
|
|
27786
27809
|
}
|
|
27810
|
+
const { port } = parseHttpArgv();
|
|
27787
27811
|
await runMcpHttpServer({ port: resolveMcpHttpPort(port) });
|
|
27788
27812
|
}
|
|
27789
|
-
main().catch((err) => {
|
|
27790
|
-
console.error("cloud-mcp failed to start:", err);
|
|
27791
|
-
process.exit(1);
|
|
27792
|
-
});
|
|
27793
27813
|
export {
|
|
27814
|
+
main,
|
|
27794
27815
|
buildServer
|
|
27795
27816
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/cloud",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.38",
|
|
4
4
|
"description": "Shared cloud infrastructure — database adapter (SQLite + PostgreSQL), sync engine, feedback system, unified dotfile config",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"LICENSE"
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
|
-
"build": "bun build src/index.ts --outdir dist --target node && bun build src/cli/index.ts --outdir dist/cli --target node && bun build src/mcp/index.ts --outdir dist/mcp --target node &&
|
|
24
|
+
"build": "bun build src/index.ts --outdir dist --target node && bun build src/cli/index.ts --outdir dist/cli --target node && bun build src/mcp/index.ts --outdir dist/mcp --target node && bun build src/mcp/bin.ts --outfile dist/mcp/bin.js --target node && chmod +x dist/mcp/bin.js && bun build src/scheduled-sync.ts --outdir dist --target node && bun run build:types",
|
|
25
25
|
"build:types": "tsc --emitDeclarationOnly --declaration --outDir dist",
|
|
26
26
|
"test": "bun test",
|
|
27
27
|
"prepublishOnly": "bun run build",
|