@artyfacts/claude 1.3.18 → 1.3.20

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/cli.js CHANGED
@@ -876,8 +876,17 @@ function addMcpServer(options) {
876
876
  } else {
877
877
  const error = result.stderr || result.stdout || `Exit code ${result.status}`;
878
878
  if (error.includes("already exists")) {
879
- console.log(`[MCP] Server ${name} already configured - treating as success`);
880
- return { success: true, alreadyExists: true };
879
+ console.log(`[MCP] Server ${name} exists - removing old config...`);
880
+ (0, import_child_process2.spawnSync)("claude", ["mcp", "remove", name], { encoding: "utf-8" });
881
+ const retryResult = (0, import_child_process2.spawnSync)("claude", cliArgs, {
882
+ encoding: "utf-8",
883
+ stdio: ["pipe", "pipe", "pipe"]
884
+ });
885
+ if (retryResult.status === 0) {
886
+ return { success: true, replaced: true };
887
+ } else {
888
+ return { success: false, error: retryResult.stderr || retryResult.stdout || "Failed after removing old config" };
889
+ }
881
890
  }
882
891
  return { success: false, error };
883
892
  }
@@ -912,11 +921,11 @@ var McpHandler = class {
912
921
  console.log(`[MCP] Triggering ${platform} OAuth via Claude...`);
913
922
  const oauthProcess = (0, import_child_process2.spawnSync)("claude", [
914
923
  "-p",
915
- `Please list the available tools from the ${platform} MCP server. Just list them briefly.`,
924
+ `Please authenticate with the ${platform} MCP server. If there's an authenticate tool, call it. Otherwise list what tools are available.`,
916
925
  "--allowedTools",
917
926
  `mcp__${serverName}__*`,
918
927
  "--permission-mode",
919
- "default"
928
+ "bypassPermissions"
920
929
  ], {
921
930
  encoding: "utf-8",
922
931
  stdio: "inherit",
package/dist/cli.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  getCredentials,
8
8
  loadCredentials,
9
9
  promptForApiKey
10
- } from "./chunk-SKROECYN.mjs";
10
+ } from "./chunk-KXV4I4WJ.mjs";
11
11
 
12
12
  // src/cli.ts
13
13
  import { Command } from "commander";
package/dist/index.js CHANGED
@@ -6069,8 +6069,17 @@ function addMcpServer(options) {
6069
6069
  } else {
6070
6070
  const error = result.stderr || result.stdout || `Exit code ${result.status}`;
6071
6071
  if (error.includes("already exists")) {
6072
- console.log(`[MCP] Server ${name} already configured - treating as success`);
6073
- return { success: true, alreadyExists: true };
6072
+ console.log(`[MCP] Server ${name} exists - removing old config...`);
6073
+ (0, import_child_process2.spawnSync)("claude", ["mcp", "remove", name], { encoding: "utf-8" });
6074
+ const retryResult = (0, import_child_process2.spawnSync)("claude", cliArgs, {
6075
+ encoding: "utf-8",
6076
+ stdio: ["pipe", "pipe", "pipe"]
6077
+ });
6078
+ if (retryResult.status === 0) {
6079
+ return { success: true, replaced: true };
6080
+ } else {
6081
+ return { success: false, error: retryResult.stderr || retryResult.stdout || "Failed after removing old config" };
6082
+ }
6074
6083
  }
6075
6084
  return { success: false, error };
6076
6085
  }
@@ -6105,11 +6114,11 @@ var McpHandler = class {
6105
6114
  console.log(`[MCP] Triggering ${platform} OAuth via Claude...`);
6106
6115
  const oauthProcess = (0, import_child_process2.spawnSync)("claude", [
6107
6116
  "-p",
6108
- `Please list the available tools from the ${platform} MCP server. Just list them briefly.`,
6117
+ `Please authenticate with the ${platform} MCP server. If there's an authenticate tool, call it. Otherwise list what tools are available.`,
6109
6118
  "--allowedTools",
6110
6119
  `mcp__${serverName}__*`,
6111
6120
  "--permission-mode",
6112
- "default"
6121
+ "bypassPermissions"
6113
6122
  ], {
6114
6123
  encoding: "utf-8",
6115
6124
  stdio: "inherit",
package/dist/index.mjs CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  promptForApiKey,
15
15
  runDeviceAuth,
16
16
  saveCredentials
17
- } from "./chunk-SKROECYN.mjs";
17
+ } from "./chunk-KXV4I4WJ.mjs";
18
18
 
19
19
  // node_modules/@anthropic-ai/sdk/internal/tslib.mjs
20
20
  function __classPrivateFieldSet(receiver, state, value, kind, f) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artyfacts/claude",
3
- "version": "1.3.18",
3
+ "version": "1.3.20",
4
4
  "description": "Claude adapter for Artyfacts - Execute tasks using Claude Code CLI",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
package/src/mcp.ts CHANGED
@@ -101,7 +101,7 @@ function addMcpServer(options: {
101
101
  args?: string[];
102
102
  env?: Record<string, string>;
103
103
  scope?: 'local' | 'user' | 'project';
104
- }): { success: boolean; error?: string; alreadyExists?: boolean } {
104
+ }): { success: boolean; error?: string; replaced?: boolean } {
105
105
  const { name, transport, url, command, args = [], env = {}, scope = 'user' } = options;
106
106
 
107
107
  const cliArgs = ['mcp', 'add', '-s', scope, '-t', transport];
@@ -136,10 +136,22 @@ function addMcpServer(options: {
136
136
  } else {
137
137
  const error = result.stderr || result.stdout || `Exit code ${result.status}`;
138
138
 
139
- // "Already exists" is not an error - the server is configured
139
+ // "Already exists" - remove and retry to ensure fresh config
140
140
  if (error.includes('already exists')) {
141
- console.log(`[MCP] Server ${name} already configured - treating as success`);
142
- return { success: true, alreadyExists: true };
141
+ console.log(`[MCP] Server ${name} exists - removing old config...`);
142
+ spawnSync('claude', ['mcp', 'remove', name], { encoding: 'utf-8' });
143
+
144
+ // Retry the add
145
+ const retryResult = spawnSync('claude', cliArgs, {
146
+ encoding: 'utf-8',
147
+ stdio: ['pipe', 'pipe', 'pipe'],
148
+ });
149
+
150
+ if (retryResult.status === 0) {
151
+ return { success: true, replaced: true };
152
+ } else {
153
+ return { success: false, error: retryResult.stderr || retryResult.stdout || 'Failed after removing old config' };
154
+ }
143
155
  }
144
156
 
145
157
  return { success: false, error };
@@ -186,13 +198,13 @@ export class McpHandler {
186
198
 
187
199
  console.log(`[MCP] Added ${serverName} → ${oauthServer.url}`);
188
200
 
189
- // Trigger OAuth by asking Claude to use the MCP - this opens browser!
201
+ // Trigger OAuth by asking Claude to authenticate with the MCP
190
202
  console.log(`[MCP] Triggering ${platform} OAuth via Claude...`);
191
203
  const oauthProcess = spawnSync('claude', [
192
204
  '-p',
193
- `Please list the available tools from the ${platform} MCP server. Just list them briefly.`,
205
+ `Please authenticate with the ${platform} MCP server. If there's an authenticate tool, call it. Otherwise list what tools are available.`,
194
206
  '--allowedTools', `mcp__${serverName}__*`,
195
- '--permission-mode', 'default',
207
+ '--permission-mode', 'bypassPermissions',
196
208
  ], {
197
209
  encoding: 'utf-8',
198
210
  stdio: 'inherit', // Show output and allow browser interaction