@hubspot/cli 7.7.9-experimental.0 → 7.7.11-experimental.0
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/commands/mcp/setup.d.ts +2 -1
- package/commands/mcp/setup.js +77 -6
- package/lang/en.d.ts +7 -0
- package/lang/en.js +7 -0
- package/lib/middleware/configMiddleware.js +2 -0
- package/package.json +1 -1
package/commands/mcp/setup.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ArgumentsCamelCase, Argv } from 'yargs';
|
|
2
2
|
interface MCPSetupArgs {
|
|
3
3
|
targets?: string[];
|
|
4
|
+
addDocsSearch?: boolean;
|
|
4
5
|
}
|
|
5
|
-
declare function handler(
|
|
6
|
+
declare function handler(args: ArgumentsCamelCase<MCPSetupArgs>): Promise<void>;
|
|
6
7
|
declare const _default: {
|
|
7
8
|
command: string[];
|
|
8
9
|
describe: undefined;
|
package/commands/mcp/setup.js
CHANGED
|
@@ -20,27 +20,33 @@ const describe = undefined; // Leave hidden for now
|
|
|
20
20
|
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
21
21
|
const claudeCode = 'claude-code';
|
|
22
22
|
const claudeDesktop = 'claude-desktop';
|
|
23
|
+
const windsurf = 'windsurf';
|
|
23
24
|
const cursor = 'cursor';
|
|
24
25
|
const mcpServerName = 'hubspot-cli-mcp';
|
|
25
26
|
const supportedTools = [
|
|
26
27
|
{ name: en_1.commands.mcp.setup.claudeCode, value: claudeCode },
|
|
27
28
|
// { name: commands.mcp.setup.claudeDesktop, value: claudeDesktop },
|
|
28
29
|
{ name: en_1.commands.mcp.setup.cursor, value: cursor },
|
|
30
|
+
{ name: en_1.commands.mcp.setup.windsurf, value: windsurf },
|
|
29
31
|
];
|
|
30
32
|
const hsCommand = 'hs';
|
|
31
33
|
const mcpCommandArgs = ['mcp', 'start'];
|
|
32
34
|
function setupBuilder(yargs) {
|
|
33
|
-
yargs
|
|
35
|
+
yargs
|
|
36
|
+
.option('targets', {
|
|
34
37
|
describe: en_1.commands.mcp.setup.args.targets,
|
|
35
38
|
type: 'array',
|
|
36
39
|
choices: [...supportedTools.map(tool => tool.value)],
|
|
40
|
+
})
|
|
41
|
+
.option('add-docs-search', {
|
|
42
|
+
type: 'boolean',
|
|
37
43
|
});
|
|
38
44
|
return yargs;
|
|
39
45
|
}
|
|
40
46
|
const builder = (0, yargsUtils_1.makeYargsBuilder)(setupBuilder, command, describe, {
|
|
41
47
|
useGlobalOptions: true,
|
|
42
48
|
});
|
|
43
|
-
async function handler(
|
|
49
|
+
async function handler(args) {
|
|
44
50
|
try {
|
|
45
51
|
await import('@modelcontextprotocol/sdk/server/mcp.js');
|
|
46
52
|
}
|
|
@@ -48,7 +54,22 @@ async function handler(argv) {
|
|
|
48
54
|
logger_1.uiLogger.error(en_1.commands.mcp.setup.errors.needsNode20);
|
|
49
55
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
50
56
|
}
|
|
51
|
-
await addMcpServerToConfig(
|
|
57
|
+
await addMcpServerToConfig(args.targets);
|
|
58
|
+
if (args.addDocsSearch) {
|
|
59
|
+
logger_1.uiLogger.info(en_1.commands.mcp.setup.installingDocSearch);
|
|
60
|
+
await new Promise(() => {
|
|
61
|
+
const childProcess = (0, child_process_1.spawn)(`npx`, ['mint-mcp', 'add', 'hubspot-migration'], {
|
|
62
|
+
stdio: 'inherit',
|
|
63
|
+
});
|
|
64
|
+
childProcess.on('exit', code => {
|
|
65
|
+
if (code !== 0) {
|
|
66
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
67
|
+
}
|
|
68
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
52
73
|
}
|
|
53
74
|
async function addMcpServerToConfig(targets) {
|
|
54
75
|
try {
|
|
@@ -80,6 +101,9 @@ async function addMcpServerToConfig(targets) {
|
|
|
80
101
|
if (derivedTargets.includes(cursor)) {
|
|
81
102
|
await runSetupFunction(setupCursor);
|
|
82
103
|
}
|
|
104
|
+
if (derivedTargets.includes(windsurf)) {
|
|
105
|
+
await runSetupFunction(setupWindsurf);
|
|
106
|
+
}
|
|
83
107
|
logger_1.uiLogger.info(en_1.commands.mcp.setup.success(derivedTargets));
|
|
84
108
|
}
|
|
85
109
|
catch (error) {
|
|
@@ -95,7 +119,7 @@ async function runSetupFunction(func) {
|
|
|
95
119
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
96
120
|
}
|
|
97
121
|
}
|
|
98
|
-
|
|
122
|
+
function setupClaudeDesktop() {
|
|
99
123
|
try {
|
|
100
124
|
const configPath = getClaudeDesktopConfigPath();
|
|
101
125
|
SpinniesManager_1.default.add('claudeDesktop', {
|
|
@@ -196,7 +220,7 @@ async function setupClaudeCode() {
|
|
|
196
220
|
return false;
|
|
197
221
|
}
|
|
198
222
|
}
|
|
199
|
-
|
|
223
|
+
function setupCursor() {
|
|
200
224
|
try {
|
|
201
225
|
SpinniesManager_1.default.add('cursor', {
|
|
202
226
|
text: en_1.commands.mcp.setup.spinners.configuringCursor,
|
|
@@ -237,7 +261,7 @@ async function setupCursor() {
|
|
|
237
261
|
}
|
|
238
262
|
catch (error) {
|
|
239
263
|
SpinniesManager_1.default.fail('cursor', {
|
|
240
|
-
text: en_1.commands.mcp.setup.spinners.
|
|
264
|
+
text: en_1.commands.mcp.setup.spinners.failedToConfigureCursor,
|
|
241
265
|
});
|
|
242
266
|
(0, errorHandlers_1.logError)(error);
|
|
243
267
|
return false;
|
|
@@ -254,4 +278,51 @@ function getClaudeDesktopConfigPath() {
|
|
|
254
278
|
return path_1.default.join(homeDir, '.config', 'claude', 'claude_desktop_config.json');
|
|
255
279
|
}
|
|
256
280
|
}
|
|
281
|
+
function setupWindsurf() {
|
|
282
|
+
try {
|
|
283
|
+
SpinniesManager_1.default.add('cursor', {
|
|
284
|
+
text: en_1.commands.mcp.setup.spinners.configuringWindsurf,
|
|
285
|
+
});
|
|
286
|
+
const windsurf = path_1.default.join(os_1.default.homedir(), '.codeium', 'windsurf', 'mcp_config.json');
|
|
287
|
+
if (!fs_1.default.existsSync(windsurf)) {
|
|
288
|
+
SpinniesManager_1.default.succeed('cursor', {
|
|
289
|
+
text: en_1.commands.mcp.setup.spinners.noWindsurfFile(windsurf),
|
|
290
|
+
});
|
|
291
|
+
return false;
|
|
292
|
+
}
|
|
293
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
294
|
+
let config = {};
|
|
295
|
+
// Read existing config
|
|
296
|
+
try {
|
|
297
|
+
const configContent = fs_1.default.readFileSync(windsurf, 'utf8');
|
|
298
|
+
config = JSON.parse(configContent);
|
|
299
|
+
}
|
|
300
|
+
catch (error) {
|
|
301
|
+
(0, errorHandlers_1.logError)(error);
|
|
302
|
+
return false;
|
|
303
|
+
}
|
|
304
|
+
// Initialize mcpServers if it doesn't exist
|
|
305
|
+
if (!config.mcpServers) {
|
|
306
|
+
config.mcpServers = {};
|
|
307
|
+
}
|
|
308
|
+
// Add or update HubSpot CLI MCP server
|
|
309
|
+
config.mcpServers[mcpServerName] = {
|
|
310
|
+
command: hsCommand,
|
|
311
|
+
args: mcpCommandArgs,
|
|
312
|
+
};
|
|
313
|
+
// Write the updated config
|
|
314
|
+
fs_1.default.writeFileSync(windsurf, JSON.stringify(config, null, 2));
|
|
315
|
+
SpinniesManager_1.default.succeed('cursor', {
|
|
316
|
+
text: en_1.commands.mcp.setup.spinners.configuredWindsurf,
|
|
317
|
+
});
|
|
318
|
+
return true;
|
|
319
|
+
}
|
|
320
|
+
catch (error) {
|
|
321
|
+
SpinniesManager_1.default.fail('cursor', {
|
|
322
|
+
text: en_1.commands.mcp.setup.spinners.failedToConfigureWindsurf,
|
|
323
|
+
});
|
|
324
|
+
(0, errorHandlers_1.logError)(error);
|
|
325
|
+
return false;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
257
328
|
exports.default = { command, describe, builder, handler };
|
package/lang/en.d.ts
CHANGED
|
@@ -766,11 +766,14 @@ Global configuration replaces hubspot.config.yml, and you will be prompted to mi
|
|
|
766
766
|
};
|
|
767
767
|
readonly mcp: {
|
|
768
768
|
readonly setup: {
|
|
769
|
+
readonly installingDocSearch: "Adding the docs-search mcp server, please follow the prompt";
|
|
769
770
|
readonly claudeCode: "Claude Code";
|
|
770
771
|
readonly claudeDesktop: "Claude Desktop";
|
|
771
772
|
readonly cursor: "Cursor";
|
|
773
|
+
readonly windsurf: "Windsurf";
|
|
772
774
|
readonly args: {
|
|
773
775
|
readonly targets: "Target applications to configure";
|
|
776
|
+
readonly docsSearch: "Should the docs search mcp server be installed";
|
|
774
777
|
};
|
|
775
778
|
readonly success: (derivedTargets: string[]) => string;
|
|
776
779
|
readonly errors: {
|
|
@@ -790,6 +793,10 @@ Global configuration replaces hubspot.config.yml, and you will be prompted to mi
|
|
|
790
793
|
readonly failedToConfigureCursor: "Failed to configure Cursor";
|
|
791
794
|
readonly configuredCursor: "Configured Cursor";
|
|
792
795
|
readonly alreadyInstalled: "HubSpot CLI mcp server already installed, reinstalling";
|
|
796
|
+
readonly configuringWindsurf: "Configuring Cursor...";
|
|
797
|
+
readonly noWindsurfFile: (configFile: string) => string;
|
|
798
|
+
readonly failedToConfigureWindsurf: "Failed to configure Cursor";
|
|
799
|
+
readonly configuredWindsurf: "Configured Windsurf";
|
|
793
800
|
};
|
|
794
801
|
readonly prompts: {
|
|
795
802
|
readonly targets: "[--targets] Which tools would you like to add the HubSpot CLI MCP server to?";
|
package/lang/en.js
CHANGED
|
@@ -778,11 +778,14 @@ exports.commands = {
|
|
|
778
778
|
},
|
|
779
779
|
mcp: {
|
|
780
780
|
setup: {
|
|
781
|
+
installingDocSearch: 'Adding the docs-search mcp server, please follow the prompt',
|
|
781
782
|
claudeCode: 'Claude Code',
|
|
782
783
|
claudeDesktop: 'Claude Desktop',
|
|
783
784
|
cursor: 'Cursor',
|
|
785
|
+
windsurf: 'Windsurf',
|
|
784
786
|
args: {
|
|
785
787
|
targets: 'Target applications to configure',
|
|
788
|
+
docsSearch: 'Should the docs search mcp server be installed',
|
|
786
789
|
},
|
|
787
790
|
success: (derivedTargets) => `You can now use the HubSpot CLI tools in ${derivedTargets.join(', ')}. ${chalk_1.default.bold('You may need to restart these tools to apply the changes')}.`,
|
|
788
791
|
errors: {
|
|
@@ -802,6 +805,10 @@ exports.commands = {
|
|
|
802
805
|
failedToConfigureCursor: 'Failed to configure Cursor',
|
|
803
806
|
configuredCursor: 'Configured Cursor',
|
|
804
807
|
alreadyInstalled: 'HubSpot CLI mcp server already installed, reinstalling',
|
|
808
|
+
configuringWindsurf: 'Configuring Cursor...',
|
|
809
|
+
noWindsurfFile: (configFile) => `No ${configFile} file found - skipping Windsurf configuration`,
|
|
810
|
+
failedToConfigureWindsurf: 'Failed to configure Cursor',
|
|
811
|
+
configuredWindsurf: 'Configured Windsurf',
|
|
805
812
|
},
|
|
806
813
|
prompts: {
|
|
807
814
|
targets: '[--targets] Which tools would you like to add the HubSpot CLI MCP server to?',
|
|
@@ -40,6 +40,7 @@ async function injectAccountIdMiddleware(argv) {
|
|
|
40
40
|
const SKIP_CONFIG_VALIDATION = {
|
|
41
41
|
init: { target: true },
|
|
42
42
|
auth: { target: true },
|
|
43
|
+
mcp: { target: true },
|
|
43
44
|
};
|
|
44
45
|
async function loadConfigMiddleware(argv) {
|
|
45
46
|
// Skip this when no command is provided
|
|
@@ -105,6 +106,7 @@ const configSubCommands = {
|
|
|
105
106
|
const SKIP_ACCOUNT_VALIDATION = {
|
|
106
107
|
init: { target: true },
|
|
107
108
|
auth: { target: true },
|
|
109
|
+
mcp: { target: true },
|
|
108
110
|
account: accountsSubCommands,
|
|
109
111
|
accounts: accountsSubCommands,
|
|
110
112
|
sandbox: sandboxesSubCommands,
|
package/package.json
CHANGED