@hasna/cloud 0.1.28 → 0.1.29
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.js +6 -1
- package/dist/mcp-helpers.d.ts +7 -2
- package/dist/mcp-helpers.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10975,7 +10975,7 @@ init_zod();
|
|
|
10975
10975
|
init_config();
|
|
10976
10976
|
init_dotfile();
|
|
10977
10977
|
init_adapter();
|
|
10978
|
-
function registerCloudTools(server, serviceName) {
|
|
10978
|
+
function registerCloudTools(server, serviceName, opts = {}) {
|
|
10979
10979
|
server.tool(`${serviceName}_cloud_status`, "Show cloud configuration and connection health", {}, async () => {
|
|
10980
10980
|
const config = getCloudConfig();
|
|
10981
10981
|
const lines = [
|
|
@@ -11010,6 +11010,11 @@ function registerCloudTools(server, serviceName) {
|
|
|
11010
11010
|
}
|
|
11011
11011
|
const local = new SqliteAdapter(getDbPath(serviceName));
|
|
11012
11012
|
const cloud = new PgAdapterAsync(getConnectionString(serviceName));
|
|
11013
|
+
if (opts.migrations?.length) {
|
|
11014
|
+
for (const sql of opts.migrations) {
|
|
11015
|
+
await cloud.run(sql);
|
|
11016
|
+
}
|
|
11017
|
+
}
|
|
11013
11018
|
const tableList = tablesStr ? tablesStr.split(",").map((t) => t.trim()) : listSqliteTables(local);
|
|
11014
11019
|
const results = await syncPush(local, cloud, { tables: tableList });
|
|
11015
11020
|
local.close();
|
package/dist/mcp-helpers.d.ts
CHANGED
|
@@ -3,14 +3,19 @@ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
3
3
|
* Register cloud-related MCP tools onto an existing MCP server.
|
|
4
4
|
* Services call this to embed cloud sync/feedback tools into their own MCP server.
|
|
5
5
|
*
|
|
6
|
+
* @param migrations - Optional list of SQL statements to run against PG before pushing.
|
|
7
|
+
* Use this to ensure the cloud schema exists (CREATE TABLE IF NOT EXISTS ...).
|
|
8
|
+
*
|
|
6
9
|
* @example
|
|
7
10
|
* ```ts
|
|
8
11
|
* import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
9
12
|
* import { registerCloudTools } from "@hasna/cloud";
|
|
10
13
|
*
|
|
11
14
|
* const server = new McpServer({ name: "my-service", version: "0.1.0" });
|
|
12
|
-
* registerCloudTools(server, "my-service");
|
|
15
|
+
* registerCloudTools(server, "my-service", { migrations: PG_MIGRATIONS });
|
|
13
16
|
* ```
|
|
14
17
|
*/
|
|
15
|
-
export declare function registerCloudTools(server: McpServer, serviceName: string
|
|
18
|
+
export declare function registerCloudTools(server: McpServer, serviceName: string, opts?: {
|
|
19
|
+
migrations?: string[];
|
|
20
|
+
}): void;
|
|
16
21
|
//# sourceMappingURL=mcp-helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-helpers.d.ts","sourceRoot":"","sources":["../src/mcp-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAYzE
|
|
1
|
+
{"version":3,"file":"mcp-helpers.d.ts","sourceRoot":"","sources":["../src/mcp-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAYzE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,SAAS,EACjB,WAAW,EAAE,MAAM,EACnB,IAAI,GAAE;IAAE,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;CAAO,GACnC,IAAI,CA2JN"}
|
package/package.json
CHANGED