@mcp-ts/sdk 1.3.5 → 1.3.6

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.
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ var fs = require('fs');
5
+ var path = require('path');
6
+
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
17
+ });
18
+ }
19
+ });
20
+ }
21
+ n.default = e;
22
+ return Object.freeze(n);
23
+ }
24
+
25
+ var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
26
+ var path__namespace = /*#__PURE__*/_interopNamespace(path);
27
+
28
+ async function run() {
29
+ const args = process.argv.slice(2);
30
+ const command = args[0];
31
+ if (command === "supabase-init") {
32
+ await initSupabase();
33
+ } else {
34
+ showHelp();
35
+ }
36
+ }
37
+ function showHelp() {
38
+ console.log(`
39
+ \u{1F680} MCP-TS CLI Utility
40
+ Usage: npx mcp-ts <command>
41
+
42
+ Commands:
43
+ supabase-init Initialize Supabase migrations in your project
44
+ `);
45
+ }
46
+ async function initSupabase() {
47
+ console.log("\u{1F680} Initializing Supabase storage for MCP-TS...");
48
+ const pkgRoot = path__namespace.resolve(__dirname, "../..");
49
+ const sourceDir = path__namespace.join(pkgRoot, "supabase", "migrations");
50
+ if (!fs__namespace.existsSync(sourceDir)) {
51
+ console.error(`\u274C Error: Could not find migration files in package at: ${sourceDir}`);
52
+ console.log("Please ensure you are running this from a project where @mcp-ts/sdk is installed.");
53
+ process.exit(1);
54
+ }
55
+ const targetDir = path__namespace.join(process.cwd(), "supabase", "migrations");
56
+ try {
57
+ if (!fs__namespace.existsSync(targetDir)) {
58
+ fs__namespace.mkdirSync(targetDir, { recursive: true });
59
+ console.log(`\u{1F4C1} Created directory: ${targetDir}`);
60
+ }
61
+ const files = fs__namespace.readdirSync(sourceDir);
62
+ let copiedCount = 0;
63
+ for (const file of files) {
64
+ if (file.endsWith(".sql")) {
65
+ const srcPath = path__namespace.join(sourceDir, file);
66
+ const destPath = path__namespace.join(targetDir, file);
67
+ if (fs__namespace.existsSync(destPath)) {
68
+ console.log(`\u23ED\uFE0F Skipping existing migration: ${file}`);
69
+ continue;
70
+ }
71
+ fs__namespace.copyFileSync(srcPath, destPath);
72
+ console.log(`\u2705 Copied: ${file}`);
73
+ copiedCount++;
74
+ }
75
+ }
76
+ if (copiedCount > 0) {
77
+ console.log("\n\u2728 Database migrations successfully initialized!");
78
+ console.log("\nNext steps:");
79
+ console.log("1. Link your Supabase project:");
80
+ console.log(" npx supabase link --project-ref <your-project-id>");
81
+ console.log("\n2. Push the migrations to your remote database:");
82
+ console.log(" npx supabase db push");
83
+ console.log("\n3. Add your Supabase credentials to .env:");
84
+ console.log(" SUPABASE_URL=https://<your-project-id>.supabase.co");
85
+ console.log(" SUPABASE_SERVICE_ROLE_KEY=<your-service-role-key>");
86
+ console.log("\n\u26A0\uFE0F Important: Use the service_role key (not the anon key) for server-side storage.");
87
+ console.log(" The service_role key bypasses RLS policies and is required for mcp-ts to work correctly.");
88
+ console.log(" Find it in: Supabase Dashboard -> Project Settings -> API -> service_role");
89
+ } else if (files.length > 0) {
90
+ console.log("\n\u{1F44D} All migration files are already present in your project.");
91
+ console.log(" Ensure SUPABASE_SERVICE_ROLE_KEY (not SUPABASE_ANON_KEY) is set in your .env");
92
+ } else {
93
+ console.log("\u26A0\uFE0F No migration files found to copy.");
94
+ }
95
+ } catch (error) {
96
+ console.error(`\u274C Error initializing Supabase: ${error.message}`);
97
+ process.exit(1);
98
+ }
99
+ }
100
+ run().catch((err) => {
101
+ console.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AAyB,CAAA;AACrC,MAAA,OAAA,CAAQ,IAAI,6CAA6C,CAAA;AACzD,MAAA,OAAA,CAAQ,IAAI,uDAAuD,CAAA;AACnE,MAAA,OAAA,CAAQ,IAAI,sDAAsD,CAAA;AAClE,MAAA,OAAA,CAAQ,IAAI,iGAAuF,CAAA;AACnG,MAAA,OAAA,CAAQ,IAAI,6FAA6F,CAAA;AACzG,MAAA,OAAA,CAAQ,IAAI,8EAA8E,CAAA;AAAA,IAC9F,CAAA,MAAA,IAAW,KAAA,CAAM,MAAA,GAAS,CAAA,EAAG;AACzB,MAAA,OAAA,CAAQ,IAAI,sEAA+D,CAAA;AAC3E,MAAA,OAAA,CAAQ,IAAI,iFAAiF,CAAA;AAAA,IACjG,CAAA,MAAO;AACH,MAAA,OAAA,CAAQ,IAAI,iDAAuC,CAAA;AAAA,IACvD;AAAA,EAEJ,SAAS,KAAA,EAAY;AACjB,IAAA,OAAA,CAAQ,KAAA,CAAM,CAAA,oCAAA,EAAkC,KAAA,CAAM,OAAO,CAAA,CAAE,CAAA;AAC/D,IAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,EAClB;AACJ;AAEA,GAAA,EAAI,CAAE,MAAM,CAAA,GAAA,KAAO;AACf,EAAA,OAAA,CAAQ,MAAM,GAAG,CAAA;AACjB,EAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAClB,CAAC,CAAA","file":"mcp-ts.js","sourcesContent":["#!/usr/bin/env node\r\nimport * as fs from 'fs';\r\nimport * as path from 'path';\r\n\r\n/**\r\n * MCP-TS CLI Utility\r\n * \r\n * Provides helper commands for users of the @mcp-ts/sdk library.\r\n */\r\nasync function run() {\r\n const args = process.argv.slice(2);\r\n const command = args[0];\r\n\r\n if (command === 'supabase-init') {\r\n await initSupabase();\r\n } else {\r\n showHelp();\r\n }\r\n}\r\n\r\nfunction showHelp() {\r\n console.log(`\r\nšŸš€ MCP-TS CLI Utility\r\nUsage: npx mcp-ts <command>\r\n\r\nCommands:\r\n supabase-init Initialize Supabase migrations in your project\r\n `);\r\n}\r\n\r\nasync function initSupabase() {\r\n console.log('šŸš€ Initializing Supabase storage for MCP-TS...');\r\n\r\n // When running from dist/bin/mcp-ts.js (compiled), __dirname is dist/bin.\r\n // The supabase/ migrations are at the root of the package.\r\n // We need to look up two levels to find 'supabase' folder in the package.\r\n const pkgRoot = path.resolve(__dirname, '../..');\r\n const sourceDir = path.join(pkgRoot, 'supabase', 'migrations');\r\n \r\n if (!fs.existsSync(sourceDir)) {\r\n console.error(`āŒ Error: Could not find migration files in package at: ${sourceDir}`);\r\n console.log('Please ensure you are running this from a project where @mcp-ts/sdk is installed.');\r\n process.exit(1);\r\n }\r\n\r\n const targetDir = path.join(process.cwd(), 'supabase', 'migrations');\r\n\r\n try {\r\n if (!fs.existsSync(targetDir)) {\r\n fs.mkdirSync(targetDir, { recursive: true });\r\n console.log(`šŸ“ Created directory: ${targetDir}`);\r\n }\r\n\r\n const files = fs.readdirSync(sourceDir);\r\n let copiedCount = 0;\r\n\r\n for (const file of files) {\r\n if (file.endsWith('.sql')) {\r\n const srcPath = path.join(sourceDir, file);\r\n const destPath = path.join(targetDir, file);\r\n \r\n if (fs.existsSync(destPath)) {\r\n console.log(`ā­ļø Skipping existing migration: ${file}`);\r\n continue;\r\n }\r\n\r\n fs.copyFileSync(srcPath, destPath);\r\n console.log(`āœ… Copied: ${file}`);\r\n copiedCount++;\r\n }\r\n }\r\n\r\n if (copiedCount > 0) {\r\n console.log('\\n✨ Database migrations successfully initialized!');\r\n console.log('\\nNext steps:');\r\n console.log('1. Link your Supabase project:');\r\n console.log(' npx supabase link --project-ref <your-project-id>');\r\n console.log('\\n2. Push the migrations to your remote database:');\r\n console.log(' npx supabase db push');\r\n console.log('\\n3. Add your Supabase credentials to .env:');\r\n console.log(' SUPABASE_URL=https://<your-project-id>.supabase.co');\r\n console.log(' SUPABASE_SERVICE_ROLE_KEY=<your-service-role-key>');\r\n console.log('\\nāš ļø Important: Use the service_role key (not the anon key) for server-side storage.');\r\n console.log(' The service_role key bypasses RLS policies and is required for mcp-ts to work correctly.');\r\n console.log(' Find it in: Supabase Dashboard -> Project Settings -> API -> service_role');\r\n } else if (files.length > 0) {\r\n console.log('\\nšŸ‘ All migration files are already present in your project.');\r\n console.log(' Ensure SUPABASE_SERVICE_ROLE_KEY (not SUPABASE_ANON_KEY) is set in your .env');\r\n } else {\r\n console.log('āš ļø No migration files found to copy.');\r\n }\r\n\r\n } catch (error: any) {\r\n console.error(`āŒ Error initializing Supabase: ${error.message}`);\r\n process.exit(1);\r\n }\r\n}\r\n\r\nrun().catch(err => {\r\n console.error(err);\r\n process.exit(1);\r\n});\r\n"]}
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env node
2
+ import * as fs from 'fs';
3
+ import * as path from 'path';
4
+
5
+ async function run() {
6
+ const args = process.argv.slice(2);
7
+ const command = args[0];
8
+ if (command === "supabase-init") {
9
+ await initSupabase();
10
+ } else {
11
+ showHelp();
12
+ }
13
+ }
14
+ function showHelp() {
15
+ console.log(`
16
+ \u{1F680} MCP-TS CLI Utility
17
+ Usage: npx mcp-ts <command>
18
+
19
+ Commands:
20
+ supabase-init Initialize Supabase migrations in your project
21
+ `);
22
+ }
23
+ async function initSupabase() {
24
+ console.log("\u{1F680} Initializing Supabase storage for MCP-TS...");
25
+ const pkgRoot = path.resolve(__dirname, "../..");
26
+ const sourceDir = path.join(pkgRoot, "supabase", "migrations");
27
+ if (!fs.existsSync(sourceDir)) {
28
+ console.error(`\u274C Error: Could not find migration files in package at: ${sourceDir}`);
29
+ console.log("Please ensure you are running this from a project where @mcp-ts/sdk is installed.");
30
+ process.exit(1);
31
+ }
32
+ const targetDir = path.join(process.cwd(), "supabase", "migrations");
33
+ try {
34
+ if (!fs.existsSync(targetDir)) {
35
+ fs.mkdirSync(targetDir, { recursive: true });
36
+ console.log(`\u{1F4C1} Created directory: ${targetDir}`);
37
+ }
38
+ const files = fs.readdirSync(sourceDir);
39
+ let copiedCount = 0;
40
+ for (const file of files) {
41
+ if (file.endsWith(".sql")) {
42
+ const srcPath = path.join(sourceDir, file);
43
+ const destPath = path.join(targetDir, file);
44
+ if (fs.existsSync(destPath)) {
45
+ console.log(`\u23ED\uFE0F Skipping existing migration: ${file}`);
46
+ continue;
47
+ }
48
+ fs.copyFileSync(srcPath, destPath);
49
+ console.log(`\u2705 Copied: ${file}`);
50
+ copiedCount++;
51
+ }
52
+ }
53
+ if (copiedCount > 0) {
54
+ console.log("\n\u2728 Database migrations successfully initialized!");
55
+ console.log("\nNext steps:");
56
+ console.log("1. Link your Supabase project:");
57
+ console.log(" npx supabase link --project-ref <your-project-id>");
58
+ console.log("\n2. Push the migrations to your remote database:");
59
+ console.log(" npx supabase db push");
60
+ console.log("\n3. Add your Supabase credentials to .env:");
61
+ console.log(" SUPABASE_URL=https://<your-project-id>.supabase.co");
62
+ console.log(" SUPABASE_SERVICE_ROLE_KEY=<your-service-role-key>");
63
+ console.log("\n\u26A0\uFE0F Important: Use the service_role key (not the anon key) for server-side storage.");
64
+ console.log(" The service_role key bypasses RLS policies and is required for mcp-ts to work correctly.");
65
+ console.log(" Find it in: Supabase Dashboard -> Project Settings -> API -> service_role");
66
+ } else if (files.length > 0) {
67
+ console.log("\n\u{1F44D} All migration files are already present in your project.");
68
+ console.log(" Ensure SUPABASE_SERVICE_ROLE_KEY (not SUPABASE_ANON_KEY) is set in your .env");
69
+ } else {
70
+ console.log("\u26A0\uFE0F No migration files found to copy.");
71
+ }
72
+ } catch (error) {
73
+ console.error(`\u274C Error initializing Supabase: ${error.message}`);
74
+ process.exit(1);
75
+ }
76
+ }
77
+ run().catch((err) => {
78
+ console.error(err);
79
+ process.exit(1);
80
+ });
81
+ //# sourceMappingURL=mcp-ts.mjs.map
82
+ //# sourceMappingURL=mcp-ts.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/bin/mcp-ts.ts"],"names":[],"mappings":";;;;AASA,eAAe,GAAA,GAAM;AACjB,EAAA,MAAM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,OAAA,CAAQ,IAAI,8EAA8E,CAAA;AAAA,IAC9F,CAAA,MAAA,IAAW,KAAA,CAAM,MAAA,GAAS,CAAA,EAAG;AACzB,MAAA,OAAA,CAAQ,IAAI,sEAA+D,CAAA;AAC3E,MAAA,OAAA,CAAQ,IAAI,iFAAiF,CAAA;AAAA,IACjG,CAAA,MAAO;AACH,MAAA,OAAA,CAAQ,IAAI,iDAAuC,CAAA;AAAA,IACvD;AAAA,EAEJ,SAAS,KAAA,EAAY;AACjB,IAAA,OAAA,CAAQ,KAAA,CAAM,CAAA,oCAAA,EAAkC,KAAA,CAAM,OAAO,CAAA,CAAE,CAAA;AAC/D,IAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,EAClB;AACJ;AAEA,GAAA,EAAI,CAAE,MAAM,CAAA,GAAA,KAAO;AACf,EAAA,OAAA,CAAQ,MAAM,GAAG,CAAA;AACjB,EAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAClB,CAAC,CAAA","file":"mcp-ts.mjs","sourcesContent":["#!/usr/bin/env node\r\nimport * as fs from 'fs';\r\nimport * as path from 'path';\r\n\r\n/**\r\n * MCP-TS CLI Utility\r\n * \r\n * Provides helper commands for users of the @mcp-ts/sdk library.\r\n */\r\nasync function run() {\r\n const args = process.argv.slice(2);\r\n const command = args[0];\r\n\r\n if (command === 'supabase-init') {\r\n await initSupabase();\r\n } else {\r\n showHelp();\r\n }\r\n}\r\n\r\nfunction showHelp() {\r\n console.log(`\r\nšŸš€ MCP-TS CLI Utility\r\nUsage: npx mcp-ts <command>\r\n\r\nCommands:\r\n supabase-init Initialize Supabase migrations in your project\r\n `);\r\n}\r\n\r\nasync function initSupabase() {\r\n console.log('šŸš€ Initializing Supabase storage for MCP-TS...');\r\n\r\n // When running from dist/bin/mcp-ts.js (compiled), __dirname is dist/bin.\r\n // The supabase/ migrations are at the root of the package.\r\n // We need to look up two levels to find 'supabase' folder in the package.\r\n const pkgRoot = path.resolve(__dirname, '../..');\r\n const sourceDir = path.join(pkgRoot, 'supabase', 'migrations');\r\n \r\n if (!fs.existsSync(sourceDir)) {\r\n console.error(`āŒ Error: Could not find migration files in package at: ${sourceDir}`);\r\n console.log('Please ensure you are running this from a project where @mcp-ts/sdk is installed.');\r\n process.exit(1);\r\n }\r\n\r\n const targetDir = path.join(process.cwd(), 'supabase', 'migrations');\r\n\r\n try {\r\n if (!fs.existsSync(targetDir)) {\r\n fs.mkdirSync(targetDir, { recursive: true });\r\n console.log(`šŸ“ Created directory: ${targetDir}`);\r\n }\r\n\r\n const files = fs.readdirSync(sourceDir);\r\n let copiedCount = 0;\r\n\r\n for (const file of files) {\r\n if (file.endsWith('.sql')) {\r\n const srcPath = path.join(sourceDir, file);\r\n const destPath = path.join(targetDir, file);\r\n \r\n if (fs.existsSync(destPath)) {\r\n console.log(`ā­ļø Skipping existing migration: ${file}`);\r\n continue;\r\n }\r\n\r\n fs.copyFileSync(srcPath, destPath);\r\n console.log(`āœ… Copied: ${file}`);\r\n copiedCount++;\r\n }\r\n }\r\n\r\n if (copiedCount > 0) {\r\n console.log('\\n✨ Database migrations successfully initialized!');\r\n console.log('\\nNext steps:');\r\n console.log('1. Link your Supabase project:');\r\n console.log(' npx supabase link --project-ref <your-project-id>');\r\n console.log('\\n2. Push the migrations to your remote database:');\r\n console.log(' npx supabase db push');\r\n console.log('\\n3. Add your Supabase credentials to .env:');\r\n console.log(' SUPABASE_URL=https://<your-project-id>.supabase.co');\r\n console.log(' SUPABASE_SERVICE_ROLE_KEY=<your-service-role-key>');\r\n console.log('\\nāš ļø Important: Use the service_role key (not the anon key) for server-side storage.');\r\n console.log(' The service_role key bypasses RLS policies and is required for mcp-ts to work correctly.');\r\n console.log(' Find it in: Supabase Dashboard -> Project Settings -> API -> service_role');\r\n } else if (files.length > 0) {\r\n console.log('\\nšŸ‘ All migration files are already present in your project.');\r\n console.log(' Ensure SUPABASE_SERVICE_ROLE_KEY (not SUPABASE_ANON_KEY) is set in your .env');\r\n } else {\r\n console.log('āš ļø No migration files found to copy.');\r\n }\r\n\r\n } catch (error: any) {\r\n console.error(`āŒ Error initializing Supabase: ${error.message}`);\r\n process.exit(1);\r\n }\r\n}\r\n\r\nrun().catch(err => {\r\n console.error(err);\r\n process.exit(1);\r\n});\r\n"]}