@ductape/mcp 0.1.1 → 0.1.3

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 CHANGED
@@ -9,6 +9,7 @@
9
9
  * publishable_key on every tool call. Per-call publishable_key still overrides
10
10
  * the env var when provided.
11
11
  */
12
+ import { createRequire } from 'module';
12
13
  import { z } from 'zod';
13
14
  import { executeViaProxy, generateExecutablePayload, getAssetSchemas, } from './proxy-client.js';
14
15
  const MODULES = [
@@ -802,6 +803,30 @@ async function loadMcpSdk() {
802
803
  'Or v2 alpha: npm install @modelcontextprotocol/server zod @cfworker/json-schema');
803
804
  process.exit(1);
804
805
  }
806
+ function handleCliFlags() {
807
+ const arg = process.argv[2];
808
+ if (arg === '--version' || arg === '-v') {
809
+ const { version } = createRequire(import.meta.url)('../package.json');
810
+ process.stdout.write(version + '\n');
811
+ return true;
812
+ }
813
+ if (arg === '--help' || arg === '-h') {
814
+ process.stdout.write('ductape-mcp — Ductape MCP server\n\n' +
815
+ 'Usage: ductape-mcp\n\n' +
816
+ 'The server communicates over stdio and is meant to be spawned by an MCP\n' +
817
+ 'client (Cursor, Claude Desktop, Claude Code). Run it directly only to\n' +
818
+ 'verify the binary is working.\n\n' +
819
+ 'Options:\n' +
820
+ ' --version, -v Print version and exit\n' +
821
+ ' --help, -h Print this message and exit\n\n' +
822
+ 'Environment:\n' +
823
+ ' DUCTAPE_PUBLISHABLE_KEY Your workspace publishable key. Set this in\n' +
824
+ ' the MCP client env config to avoid passing\n' +
825
+ ' publishable_key on every tool call.\n');
826
+ return true;
827
+ }
828
+ return false;
829
+ }
805
830
  async function main() {
806
831
  const { McpServer, StdioServerTransport } = await loadMcpSdk();
807
832
  const server = new McpServer({ name: 'ductape-mcp', version: '0.1.0' });
@@ -919,7 +944,9 @@ async function main() {
919
944
  }
920
945
  await server.connect(transport);
921
946
  }
922
- main().catch((err) => {
923
- console.error(err);
924
- process.exit(1);
925
- });
947
+ if (!handleCliFlags()) {
948
+ main().catch((err) => {
949
+ console.error(err);
950
+ process.exit(1);
951
+ });
952
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ductape/mcp",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "MCP server that exposes Ductape SDK operations via the backend proxy",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/index.ts CHANGED
@@ -10,6 +10,7 @@
10
10
  * the env var when provided.
11
11
  */
12
12
 
13
+ import { createRequire } from 'module';
13
14
  import { z } from 'zod';
14
15
  import {
15
16
  executeViaProxy,
@@ -851,6 +852,33 @@ async function loadMcpSdk(): Promise<{
851
852
  process.exit(1);
852
853
  }
853
854
 
855
+ function handleCliFlags(): boolean {
856
+ const arg = process.argv[2];
857
+ if (arg === '--version' || arg === '-v') {
858
+ const { version } = createRequire(import.meta.url)('../package.json') as { version: string };
859
+ process.stdout.write(version + '\n');
860
+ return true;
861
+ }
862
+ if (arg === '--help' || arg === '-h') {
863
+ process.stdout.write(
864
+ 'ductape-mcp — Ductape MCP server\n\n' +
865
+ 'Usage: ductape-mcp\n\n' +
866
+ 'The server communicates over stdio and is meant to be spawned by an MCP\n' +
867
+ 'client (Cursor, Claude Desktop, Claude Code). Run it directly only to\n' +
868
+ 'verify the binary is working.\n\n' +
869
+ 'Options:\n' +
870
+ ' --version, -v Print version and exit\n' +
871
+ ' --help, -h Print this message and exit\n\n' +
872
+ 'Environment:\n' +
873
+ ' DUCTAPE_PUBLISHABLE_KEY Your workspace publishable key. Set this in\n' +
874
+ ' the MCP client env config to avoid passing\n' +
875
+ ' publishable_key on every tool call.\n',
876
+ );
877
+ return true;
878
+ }
879
+ return false;
880
+ }
881
+
854
882
  async function main() {
855
883
  const { McpServer, StdioServerTransport } = await loadMcpSdk();
856
884
  const server = new McpServer({ name: 'ductape-mcp', version: '0.1.0' });
@@ -996,7 +1024,9 @@ async function main() {
996
1024
  await server.connect(transport);
997
1025
  }
998
1026
 
999
- main().catch((err) => {
1000
- console.error(err);
1001
- process.exit(1);
1002
- });
1027
+ if (!handleCliFlags()) {
1028
+ main().catch((err) => {
1029
+ console.error(err);
1030
+ process.exit(1);
1031
+ });
1032
+ }