mcpcac 0.0.1 → 0.0.2

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.d.ts CHANGED
@@ -63,7 +63,12 @@ export interface CachedMcpTools {
63
63
  }
64
64
  export interface AddMcpCommandsOptions {
65
65
  cli: CAC;
66
- commandPrefix: string;
66
+ /**
67
+ * Prefix for all MCP tool commands.
68
+ * Set to empty string '' for no prefix (e.g., 'notion-search' instead of 'mcp notion-search').
69
+ * @default 'mcp'
70
+ */
71
+ commandPrefix?: string;
67
72
  /**
68
73
  * Name used when connecting to the MCP server.
69
74
  * @default 'mcp-cli-client'
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAC/E,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAGvC,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,YAAY,CAAC;AAGhE,YAAY,EAAE,SAAS,EAAE,CAAC;AAC1B,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhE,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,KAAK,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,CAAC,CAAC;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,GAAG,CAAC;IACT,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,SA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ACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IAErC;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,KAAK,SAAS,GAAG,IAAI,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IAEvF;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,EAAE,cAAc,CAAC;IAEvB;;OAEG;IACH,SAAS,EAAE,MAAM,cAAc,GAAG,SAAS,CAAC;IAE5C;;OAEG;IACH,SAAS,EAAE,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,KAAK,IAAI,CAAC;CACxD;AAkHD;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqMlF"}
package/dist/index.js CHANGED
@@ -145,7 +145,7 @@ function normalizeUrl(mcpUrl) {
145
145
  * After successful auth, the operation is automatically retried.
146
146
  */
147
147
  export async function addMcpCommands(options) {
148
- const { cli, commandPrefix, clientName = "mcp-cli-client", getMcpUrl, getMcpTransport, oauth, loadCache, saveCache, } = options;
148
+ const { cli, commandPrefix = "mcp", clientName = "mcp-cli-client", getMcpUrl, getMcpTransport, oauth, loadCache, saveCache, } = options;
149
149
  // Helper to get transport - supports both old and new API
150
150
  const getTransport = async (sessionId) => {
151
151
  // New API: getMcpUrl + oauth
@@ -242,7 +242,7 @@ export async function addMcpCommands(options) {
242
242
  // Register CLI commands for each tool
243
243
  for (const tool of tools) {
244
244
  const inputSchema = tool.inputSchema;
245
- const cmdName = `${commandPrefix} ${tool.name}`;
245
+ const cmdName = commandPrefix ? `${commandPrefix} ${tool.name}` : tool.name;
246
246
  const description = tool.description || `Run MCP tool ${tool.name}`;
247
247
  const cmd = cli.command(cmdName, description);
248
248
  if (inputSchema?.properties) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcpcac",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Dynamically generate CLI commands from MCP server tools",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/index.ts CHANGED
@@ -74,7 +74,12 @@ const CACHE_TTL_MS = 60 * 60 * 1000; // 1 hour
74
74
 
75
75
  export interface AddMcpCommandsOptions {
76
76
  cli: CAC;
77
- commandPrefix: string;
77
+ /**
78
+ * Prefix for all MCP tool commands.
79
+ * Set to empty string '' for no prefix (e.g., 'notion-search' instead of 'mcp notion-search').
80
+ * @default 'mcp'
81
+ */
82
+ commandPrefix?: string;
78
83
  /**
79
84
  * Name used when connecting to the MCP server.
80
85
  * @default 'mcp-cli-client'
@@ -248,7 +253,7 @@ function normalizeUrl(mcpUrl: string): URL {
248
253
  export async function addMcpCommands(options: AddMcpCommandsOptions): Promise<void> {
249
254
  const {
250
255
  cli,
251
- commandPrefix,
256
+ commandPrefix = "mcp",
252
257
  clientName = "mcp-cli-client",
253
258
  getMcpUrl,
254
259
  getMcpTransport,
@@ -366,7 +371,7 @@ export async function addMcpCommands(options: AddMcpCommandsOptions): Promise<vo
366
371
  // Register CLI commands for each tool
367
372
  for (const tool of tools) {
368
373
  const inputSchema = tool.inputSchema as InputSchema | undefined;
369
- const cmdName = `${commandPrefix} ${tool.name}`;
374
+ const cmdName = commandPrefix ? `${commandPrefix} ${tool.name}` : tool.name;
370
375
  const description = tool.description || `Run MCP tool ${tool.name}`;
371
376
 
372
377
  const cmd = cli.command(cmdName, description);