@hubspot/cli 7.7.17-experimental.0 → 7.7.19-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.js +1 -0
- package/commands/mcp/start.d.ts +4 -1
- package/commands/mcp/start.js +10 -3
- package/lib/mcp/setup.js +8 -3
- package/lib/usageTracking.d.ts +5 -5
- package/lib/usageTracking.js +74 -79
- package/mcp-server/tools/project/UploadProjectTools.js +1 -1
- package/mcp-server/utils/project.js +3 -0
- package/package.json +2 -2
package/commands/mcp/setup.js
CHANGED
package/commands/mcp/start.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { CommonArgs, YargsCommandModule } from '../../types/Yargs';
|
|
2
|
-
|
|
2
|
+
interface McpStartArgs extends CommonArgs {
|
|
3
|
+
aiAgent: string;
|
|
4
|
+
}
|
|
5
|
+
declare const mcpStartCommand: YargsCommandModule<unknown, McpStartArgs>;
|
|
3
6
|
export default mcpStartCommand;
|
package/commands/mcp/start.js
CHANGED
|
@@ -24,9 +24,9 @@ async function handler(args) {
|
|
|
24
24
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
25
25
|
}
|
|
26
26
|
(0, usageTracking_1.trackCommandUsage)('mcp-start', {}, args.derivedAccountId);
|
|
27
|
-
await startMcpServer();
|
|
27
|
+
await startMcpServer(args.aiAgent);
|
|
28
28
|
}
|
|
29
|
-
async function startMcpServer() {
|
|
29
|
+
async function startMcpServer(aiAgent) {
|
|
30
30
|
try {
|
|
31
31
|
const serverPath = path_1.default.join(__dirname, '..', '..', 'mcp-server', 'server.js');
|
|
32
32
|
// Check if server file exists
|
|
@@ -36,11 +36,13 @@ async function startMcpServer() {
|
|
|
36
36
|
}
|
|
37
37
|
logger_1.uiLogger.info(en_1.commands.mcp.start.startingServer);
|
|
38
38
|
logger_1.uiLogger.info(en_1.commands.mcp.start.stopInstructions);
|
|
39
|
+
const args = [serverPath];
|
|
39
40
|
// Start the server using ts-node
|
|
40
|
-
const child = (0, child_process_1.spawn)(
|
|
41
|
+
const child = (0, child_process_1.spawn)(`node`, args, {
|
|
41
42
|
stdio: 'inherit',
|
|
42
43
|
env: {
|
|
43
44
|
...process.env,
|
|
45
|
+
HUBSPOT_MCP_AI_AGENT: aiAgent || 'unknown',
|
|
44
46
|
},
|
|
45
47
|
});
|
|
46
48
|
// Handle server process events
|
|
@@ -63,6 +65,11 @@ async function startMcpServer() {
|
|
|
63
65
|
}
|
|
64
66
|
}
|
|
65
67
|
function startBuilder(yargs) {
|
|
68
|
+
yargs
|
|
69
|
+
.option('ai-agent', {
|
|
70
|
+
type: 'string',
|
|
71
|
+
})
|
|
72
|
+
.demandOption('ai-agent');
|
|
66
73
|
return yargs;
|
|
67
74
|
}
|
|
68
75
|
const builder = (0, yargsUtils_1.makeYargsBuilder)(startBuilder, command, describe, {
|
package/lib/mcp/setup.js
CHANGED
|
@@ -157,7 +157,7 @@ async function setupClaudeCode(mcpCommand = defaultMcpCommand) {
|
|
|
157
157
|
// Run claude mcp add command
|
|
158
158
|
const mcpConfig = JSON.stringify({
|
|
159
159
|
type: 'stdio',
|
|
160
|
-
...mcpCommand,
|
|
160
|
+
...buildCommandWithAgentString(mcpCommand, claudeCode),
|
|
161
161
|
});
|
|
162
162
|
const { stdout } = await (0, command_1.execAsync)('claude mcp list');
|
|
163
163
|
if (stdout.includes(mcpServerName)) {
|
|
@@ -203,7 +203,7 @@ function setupCursor(mcpCommand = defaultMcpCommand) {
|
|
|
203
203
|
configuringMessage: en_1.commands.mcp.setup.spinners.configuringCursor,
|
|
204
204
|
configuredMessage: en_1.commands.mcp.setup.spinners.configuredCursor,
|
|
205
205
|
failedMessage: en_1.commands.mcp.setup.spinners.failedToConfigureCursor,
|
|
206
|
-
mcpCommand,
|
|
206
|
+
mcpCommand: buildCommandWithAgentString(mcpCommand, cursor),
|
|
207
207
|
});
|
|
208
208
|
}
|
|
209
209
|
function setupWindsurf(mcpCommand = defaultMcpCommand) {
|
|
@@ -213,6 +213,11 @@ function setupWindsurf(mcpCommand = defaultMcpCommand) {
|
|
|
213
213
|
configuringMessage: en_1.commands.mcp.setup.spinners.configuringWindsurf,
|
|
214
214
|
configuredMessage: en_1.commands.mcp.setup.spinners.configuredWindsurf,
|
|
215
215
|
failedMessage: en_1.commands.mcp.setup.spinners.failedToConfigureWindsurf,
|
|
216
|
-
mcpCommand,
|
|
216
|
+
mcpCommand: buildCommandWithAgentString(mcpCommand, windsurf),
|
|
217
217
|
});
|
|
218
218
|
}
|
|
219
|
+
function buildCommandWithAgentString(mcpCommand, agent) {
|
|
220
|
+
const mcpCommandCopy = structuredClone(mcpCommand);
|
|
221
|
+
mcpCommandCopy.args.push('--ai-agent', agent);
|
|
222
|
+
return mcpCommandCopy;
|
|
223
|
+
}
|
package/lib/usageTracking.d.ts
CHANGED
|
@@ -13,9 +13,9 @@ type Meta = {
|
|
|
13
13
|
file?: boolean;
|
|
14
14
|
successful?: boolean;
|
|
15
15
|
};
|
|
16
|
-
export declare function trackCommandUsage(command: string, meta?: Meta, accountId?: number):
|
|
17
|
-
export declare function trackHelpUsage(command: string):
|
|
18
|
-
export declare function trackConvertFieldsUsage(command: string):
|
|
19
|
-
export declare function trackAuthAction(command: string, authType: string, step: string, accountId?: number):
|
|
20
|
-
export declare function trackCommandMetadataUsage(command: string, meta?: Meta, accountId?: number):
|
|
16
|
+
export declare function trackCommandUsage(command: string, meta?: Meta, accountId?: number): void;
|
|
17
|
+
export declare function trackHelpUsage(command: string): void;
|
|
18
|
+
export declare function trackConvertFieldsUsage(command: string): void;
|
|
19
|
+
export declare function trackAuthAction(command: string, authType: string, step: string, accountId?: number): void;
|
|
20
|
+
export declare function trackCommandMetadataUsage(command: string, meta?: Meta, accountId?: number): void;
|
|
21
21
|
export {};
|
package/lib/usageTracking.js
CHANGED
|
@@ -33,7 +33,7 @@ function getPlatform() {
|
|
|
33
33
|
return process.platform;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
function trackCommandUsage(command, meta = {}, accountId) {
|
|
37
37
|
if (!(0, config_1.isTrackingAllowed)()) {
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
@@ -46,88 +46,47 @@ async function trackCommandUsage(command, meta = {}, accountId) {
|
|
|
46
46
|
? accountConfig.authType
|
|
47
47
|
: auth_1.API_KEY_AUTH_METHOD.value;
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
command,
|
|
56
|
-
authType,
|
|
57
|
-
...meta,
|
|
58
|
-
};
|
|
59
|
-
try {
|
|
60
|
-
await (0, trackUsage_1.trackUsage)('cli-interaction', EventClass.INTERACTION, usageTrackingEvent, accountId);
|
|
61
|
-
logger_1.logger.debug('Sent usage tracking command event: %o', usageTrackingEvent);
|
|
62
|
-
}
|
|
63
|
-
catch (e) {
|
|
64
|
-
(0, errorHandlers_1.debugError)(e);
|
|
65
|
-
}
|
|
49
|
+
trackCliInteraction({
|
|
50
|
+
action: 'cli-command',
|
|
51
|
+
command,
|
|
52
|
+
authType,
|
|
53
|
+
...meta,
|
|
54
|
+
accountId,
|
|
66
55
|
});
|
|
67
56
|
}
|
|
68
|
-
|
|
57
|
+
function trackHelpUsage(command) {
|
|
69
58
|
if (!(0, config_1.isTrackingAllowed)()) {
|
|
70
59
|
return;
|
|
71
60
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
logger_1.logger.debug('Tracking help usage of "%s" sub-command', command);
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
logger_1.logger.debug('Tracking help usage of main command');
|
|
78
|
-
}
|
|
79
|
-
await (0, trackUsage_1.trackUsage)('cli-interaction', EventClass.INTERACTION, {
|
|
80
|
-
action: 'cli-help',
|
|
81
|
-
os: getPlatform(),
|
|
82
|
-
...getNodeVersionData(),
|
|
83
|
-
version: package_json_1.version,
|
|
84
|
-
command,
|
|
85
|
-
});
|
|
61
|
+
if (command) {
|
|
62
|
+
logger_1.logger.debug('Tracking help usage of "%s" sub-command', command);
|
|
86
63
|
}
|
|
87
|
-
|
|
88
|
-
(
|
|
64
|
+
else {
|
|
65
|
+
logger_1.logger.debug('Tracking help usage of main command');
|
|
89
66
|
}
|
|
67
|
+
trackCliInteraction({
|
|
68
|
+
action: 'cli-help',
|
|
69
|
+
command,
|
|
70
|
+
});
|
|
90
71
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
logger_1.logger.debug('Attempting to track usage of "%s" command', command);
|
|
97
|
-
await (0, trackUsage_1.trackUsage)('cli-interaction', EventClass.INTERACTION, {
|
|
98
|
-
action: 'cli-process-fields',
|
|
99
|
-
os: getPlatform(),
|
|
100
|
-
...getNodeVersionData(),
|
|
101
|
-
version: package_json_1.version,
|
|
102
|
-
command,
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
catch (e) {
|
|
106
|
-
(0, errorHandlers_1.debugError)(e);
|
|
107
|
-
}
|
|
72
|
+
function trackConvertFieldsUsage(command) {
|
|
73
|
+
trackCliInteraction({
|
|
74
|
+
action: 'cli-process-fields',
|
|
75
|
+
command,
|
|
76
|
+
});
|
|
108
77
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
const usageTrackingEvent = {
|
|
78
|
+
function trackAuthAction(command, authType, step, accountId) {
|
|
79
|
+
trackCliInteraction({
|
|
114
80
|
action: 'cli-auth',
|
|
115
|
-
os: getPlatform(),
|
|
116
|
-
...getNodeVersionData(),
|
|
117
|
-
version: package_json_1.version,
|
|
118
81
|
command,
|
|
119
82
|
authType,
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
catch (e) {
|
|
127
|
-
(0, errorHandlers_1.debugError)(e);
|
|
128
|
-
}
|
|
83
|
+
accountId,
|
|
84
|
+
meta: {
|
|
85
|
+
step,
|
|
86
|
+
},
|
|
87
|
+
});
|
|
129
88
|
}
|
|
130
|
-
|
|
89
|
+
function trackCommandMetadataUsage(command, meta = {}, accountId) {
|
|
131
90
|
if (!(0, config_1.isTrackingAllowed)()) {
|
|
132
91
|
return;
|
|
133
92
|
}
|
|
@@ -140,9 +99,21 @@ async function trackCommandMetadataUsage(command, meta = {}, accountId) {
|
|
|
140
99
|
? accountConfig.authType
|
|
141
100
|
: auth_1.API_KEY_AUTH_METHOD.value;
|
|
142
101
|
}
|
|
143
|
-
|
|
102
|
+
trackCliInteraction({
|
|
103
|
+
action: 'cli-command-metadata',
|
|
104
|
+
command,
|
|
105
|
+
authType,
|
|
106
|
+
accountId,
|
|
107
|
+
meta,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function trackCliInteraction({ action, accountId, command, authType, meta = {}, }) {
|
|
111
|
+
try {
|
|
112
|
+
if (!(0, config_1.isTrackingAllowed)()) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
144
115
|
const usageTrackingEvent = {
|
|
145
|
-
action
|
|
116
|
+
action,
|
|
146
117
|
os: getPlatform(),
|
|
147
118
|
...getNodeVersionData(),
|
|
148
119
|
version: package_json_1.version,
|
|
@@ -150,12 +121,36 @@ async function trackCommandMetadataUsage(command, meta = {}, accountId) {
|
|
|
150
121
|
authType,
|
|
151
122
|
...meta,
|
|
152
123
|
};
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
124
|
+
if (process.env.HUBSPOT_MCP_AI_AGENT) {
|
|
125
|
+
setImmediate(async () => {
|
|
126
|
+
try {
|
|
127
|
+
await (0, trackUsage_1.trackUsage)('cli-interaction', EventClass.INTERACTION, {
|
|
128
|
+
...usageTrackingEvent,
|
|
129
|
+
action: 'cli-mcp-server',
|
|
130
|
+
type: process.env.HUBSPOT_MCP_AI_AGENT,
|
|
131
|
+
}, accountId);
|
|
132
|
+
logger_1.logger.debug('Sent AI usage tracking command event: %o', {
|
|
133
|
+
...usageTrackingEvent,
|
|
134
|
+
action: 'cli-mcp-server',
|
|
135
|
+
type: process.env.HUBSPOT_MCP_AI_AGENT,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
(0, errorHandlers_1.debugError)(error);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
156
142
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
143
|
+
setImmediate(async () => {
|
|
144
|
+
try {
|
|
145
|
+
await (0, trackUsage_1.trackUsage)('cli-interaction', EventClass.INTERACTION, usageTrackingEvent, accountId);
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
(0, errorHandlers_1.debugError)(error);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
logger_1.logger.debug('Sent usage tracking command event: %o', usageTrackingEvent);
|
|
152
|
+
}
|
|
153
|
+
catch (e) {
|
|
154
|
+
(0, errorHandlers_1.debugError)(e);
|
|
155
|
+
}
|
|
161
156
|
}
|
|
@@ -21,7 +21,7 @@ class UploadProjectTools extends types_1.Tool {
|
|
|
21
21
|
super(mcpServer);
|
|
22
22
|
}
|
|
23
23
|
async handler({ absoluteProjectPath, }) {
|
|
24
|
-
const { stdout, stderr } = await (0, project_1.runCommandInDir)(absoluteProjectPath, `hs project upload --force-create`);
|
|
24
|
+
const { stdout, stderr } = await (0, project_1.runCommandInDir)(absoluteProjectPath, `hs project upload --force-create --debug`);
|
|
25
25
|
return (0, content_1.formatTextContents)(stdout, stderr);
|
|
26
26
|
}
|
|
27
27
|
register() {
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cli",
|
|
3
|
-
"version": "7.7.
|
|
3
|
+
"version": "7.7.19-experimental.0",
|
|
4
4
|
"description": "The official CLI for developing on HubSpot",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": "https://github.com/HubSpot/hubspot-cli",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@hubspot/local-dev-lib": "3.12.0",
|
|
9
|
-
"@hubspot/project-parsing-lib": "0.5.
|
|
9
|
+
"@hubspot/project-parsing-lib": "0.5.1",
|
|
10
10
|
"@hubspot/serverless-dev-runtime": "7.0.6",
|
|
11
11
|
"@hubspot/theme-preview-dev-server": "0.0.10",
|
|
12
12
|
"@hubspot/ui-extensions-dev-server": "0.9.2",
|