@hubspot/cli 7.7.7-experimental.0 → 7.7.9-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 +1 -2
- package/commands/mcp/setup.js +67 -56
- package/commands/mcp/start.d.ts +1 -2
- package/commands/mcp/start.js +25 -26
- package/commands/mcp.d.ts +3 -10
- package/commands/mcp.js +16 -11
- package/lang/en.d.ts +44 -0
- package/lang/en.js +44 -0
- package/mcp-server/tools/index.js +5 -5
- package/mcp-server/tools/project/AddFeatureToProject.d.ts +27 -4
- package/mcp-server/tools/project/AddFeatureToProject.js +91 -83
- package/mcp-server/tools/project/CreateProjectTool.d.ts +33 -4
- package/mcp-server/tools/project/CreateProjectTool.js +107 -102
- package/mcp-server/tools/project/DeployProject.d.ts +18 -4
- package/mcp-server/tools/project/DeployProject.js +42 -35
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +15 -4
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +41 -24
- package/mcp-server/tools/project/UploadProjectTools.d.ts +15 -3
- package/mcp-server/tools/project/UploadProjectTools.js +27 -14
- package/mcp-server/types.d.ts +9 -3
- package/mcp-server/types.js +11 -1
- package/package.json +1 -1
|
@@ -7,94 +7,102 @@ const constants_1 = require("../../../lib/constants");
|
|
|
7
7
|
const command_1 = require("../../utils/command");
|
|
8
8
|
const constants_2 = require("./constants");
|
|
9
9
|
const project_1 = require("../../utils/project");
|
|
10
|
+
const inputSchema = {
|
|
11
|
+
absoluteProjectPath: constants_2.absoluteProjectPath,
|
|
12
|
+
addApp: zod_1.z
|
|
13
|
+
.boolean()
|
|
14
|
+
.describe('Should an app be added? If there is no app in the project, and app must be added to add a feature'),
|
|
15
|
+
distribution: zod_1.z
|
|
16
|
+
.optional(zod_1.z.union([
|
|
17
|
+
zod_1.z.literal(constants_1.APP_DISTRIBUTION_TYPES.MARKETPLACE),
|
|
18
|
+
zod_1.z.literal(constants_1.APP_DISTRIBUTION_TYPES.PRIVATE),
|
|
19
|
+
]))
|
|
20
|
+
.describe('Private is used if you do not wish to distribute your application on the HubSpot marketplace. If not specified by the user, do not choose for them. This cannot be changed after a project is uploaded.'),
|
|
21
|
+
auth: zod_1.z
|
|
22
|
+
.optional(zod_1.z.union([
|
|
23
|
+
zod_1.z.literal(constants_1.APP_AUTH_TYPES.STATIC),
|
|
24
|
+
zod_1.z.literal(constants_1.APP_AUTH_TYPES.OAUTH),
|
|
25
|
+
]))
|
|
26
|
+
.describe('Static uses a static non changing authentication token, and is only available for private distribution. If not specified by the user, do not choose for them. This cannot be changed after a project is uploaded.'),
|
|
27
|
+
features: zod_1.z
|
|
28
|
+
.array(zod_1.z
|
|
29
|
+
.union([
|
|
30
|
+
zod_1.z.literal('card'),
|
|
31
|
+
zod_1.z.literal('settings'),
|
|
32
|
+
zod_1.z.literal('app-function'),
|
|
33
|
+
zod_1.z.literal('webhooks'),
|
|
34
|
+
])
|
|
35
|
+
.describe('The features to include in the project, multiple options can be selected'))
|
|
36
|
+
.optional(),
|
|
37
|
+
};
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
39
|
+
const inputSchemaZodObject = zod_1.z.object({
|
|
40
|
+
...inputSchema,
|
|
41
|
+
});
|
|
10
42
|
class AddFeatureToProject extends types_1.Tool {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
auth: zod_1.z
|
|
27
|
-
.optional(zod_1.z.union([
|
|
28
|
-
zod_1.z.literal(constants_1.APP_AUTH_TYPES.STATIC),
|
|
29
|
-
zod_1.z.literal(constants_1.APP_AUTH_TYPES.OAUTH),
|
|
30
|
-
]))
|
|
31
|
-
.describe('Static uses a static non changing authentication token, and is only available for private distribution. If not specified by the user, do not choose for them. This cannot be changed after a project is uploaded.')
|
|
32
|
-
.optional(),
|
|
33
|
-
features: zod_1.z
|
|
34
|
-
.array(zod_1.z
|
|
35
|
-
.union([
|
|
36
|
-
zod_1.z.literal('card'),
|
|
37
|
-
zod_1.z.literal('settings'),
|
|
38
|
-
zod_1.z.literal('app-function'),
|
|
39
|
-
zod_1.z.literal('webhooks'),
|
|
40
|
-
])
|
|
41
|
-
.describe('The features to include in the project, multiple options can be selected'))
|
|
42
|
-
.optional(),
|
|
43
|
-
},
|
|
44
|
-
}, async ({ absoluteProjectPath, distribution, auth, features, addApp }) => {
|
|
45
|
-
try {
|
|
46
|
-
let command = `hs project add`;
|
|
47
|
-
const content = [];
|
|
48
|
-
if (distribution) {
|
|
49
|
-
command = (0, command_1.addFlag)(command, 'distribution', distribution);
|
|
50
|
-
}
|
|
51
|
-
else if (addApp) {
|
|
52
|
-
content.push({
|
|
53
|
-
type: 'text',
|
|
54
|
-
text: `Ask the user how they would you like to distribute the application? Options are ${constants_1.APP_DISTRIBUTION_TYPES.MARKETPLACE} and ${constants_1.APP_DISTRIBUTION_TYPES.PRIVATE}`,
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
if (auth) {
|
|
58
|
-
command = (0, command_1.addFlag)(command, 'auth', auth);
|
|
59
|
-
}
|
|
60
|
-
else if (addApp) {
|
|
61
|
-
content.push({
|
|
62
|
-
type: 'text',
|
|
63
|
-
text: `Ask the user which auth type they would like to use? Options are ${constants_1.APP_AUTH_TYPES.STATIC} and ${constants_1.APP_AUTH_TYPES.OAUTH}`,
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
if (content.length > 0) {
|
|
67
|
-
return {
|
|
68
|
-
content,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
// If features isn't provided, pass an empty array to bypass the prompt
|
|
72
|
-
command = (0, command_1.addFlag)(command, 'features', features || []);
|
|
73
|
-
const { stdout, stderr } = await (0, project_1.runCommandInDir)(absoluteProjectPath, command);
|
|
74
|
-
return {
|
|
75
|
-
content: [
|
|
76
|
-
{
|
|
77
|
-
type: 'text',
|
|
78
|
-
text: stdout,
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
type: 'text',
|
|
82
|
-
text: stderr,
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
};
|
|
43
|
+
constructor(mcpServer) {
|
|
44
|
+
super(mcpServer);
|
|
45
|
+
}
|
|
46
|
+
async handler({ absoluteProjectPath, distribution, auth, features, addApp, }) {
|
|
47
|
+
try {
|
|
48
|
+
let command = `hs project add`;
|
|
49
|
+
const content = [];
|
|
50
|
+
if (distribution) {
|
|
51
|
+
command = (0, command_1.addFlag)(command, 'distribution', distribution);
|
|
52
|
+
}
|
|
53
|
+
else if (addApp) {
|
|
54
|
+
content.push({
|
|
55
|
+
type: 'text',
|
|
56
|
+
text: `Ask the user how they would you like to distribute the application? Options are ${constants_1.APP_DISTRIBUTION_TYPES.MARKETPLACE} and ${constants_1.APP_DISTRIBUTION_TYPES.PRIVATE}`,
|
|
57
|
+
});
|
|
86
58
|
}
|
|
87
|
-
|
|
59
|
+
if (auth) {
|
|
60
|
+
command = (0, command_1.addFlag)(command, 'auth', auth);
|
|
61
|
+
}
|
|
62
|
+
else if (addApp) {
|
|
63
|
+
content.push({
|
|
64
|
+
type: 'text',
|
|
65
|
+
text: `Ask the user which auth type they would like to use? Options are ${constants_1.APP_AUTH_TYPES.STATIC} and ${constants_1.APP_AUTH_TYPES.OAUTH}`,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
if (content.length > 0) {
|
|
88
69
|
return {
|
|
89
|
-
content
|
|
90
|
-
{
|
|
91
|
-
type: 'text',
|
|
92
|
-
text: error instanceof Error ? error.message : `${error}`,
|
|
93
|
-
},
|
|
94
|
-
],
|
|
70
|
+
content,
|
|
95
71
|
};
|
|
96
72
|
}
|
|
97
|
-
|
|
73
|
+
// If features isn't provided, pass an empty array to bypass the prompt
|
|
74
|
+
command = (0, command_1.addFlag)(command, 'features', features || []);
|
|
75
|
+
const { stdout, stderr } = await (0, project_1.runCommandInDir)(absoluteProjectPath, command);
|
|
76
|
+
return {
|
|
77
|
+
content: [
|
|
78
|
+
{
|
|
79
|
+
type: 'text',
|
|
80
|
+
text: stdout,
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
type: 'text',
|
|
84
|
+
text: stderr,
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
return {
|
|
91
|
+
content: [
|
|
92
|
+
{
|
|
93
|
+
type: 'text',
|
|
94
|
+
text: error instanceof Error ? error.message : `${error}`,
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
register() {
|
|
101
|
+
return this.mcpServer.registerTool('add-feature-to-hubspot-project', {
|
|
102
|
+
title: 'Add feature to HubSpot Project',
|
|
103
|
+
description: 'Adds a feature to an existing HubSpot project',
|
|
104
|
+
inputSchema,
|
|
105
|
+
}, this.handler);
|
|
98
106
|
}
|
|
99
107
|
}
|
|
100
108
|
exports.AddFeatureToProject = AddFeatureToProject;
|
|
@@ -1,6 +1,35 @@
|
|
|
1
|
-
import { Tool } from '../../types';
|
|
1
|
+
import { TextContentResponse, Tool } from '../../types';
|
|
2
2
|
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
|
+
absoluteCurrentWorkingDirectory: z.ZodString;
|
|
6
|
+
name: z.ZodString;
|
|
7
|
+
destination: z.ZodString;
|
|
8
|
+
projectBase: z.ZodUnion<[z.ZodLiteral<"empty">, z.ZodLiteral<"app">]>;
|
|
9
|
+
distribution: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"marketplace">, z.ZodLiteral<"private">]>>;
|
|
10
|
+
auth: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"static">, z.ZodLiteral<"oauth">]>>>;
|
|
11
|
+
features: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodLiteral<"card">, z.ZodLiteral<"settings">, z.ZodLiteral<"app-function">, z.ZodLiteral<"webhooks">]>, "many">>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
name: string;
|
|
14
|
+
projectBase: "app" | "empty";
|
|
15
|
+
absoluteCurrentWorkingDirectory: string;
|
|
16
|
+
destination: string;
|
|
17
|
+
auth?: "oauth" | "static" | undefined;
|
|
18
|
+
distribution?: "marketplace" | "private" | undefined;
|
|
19
|
+
features?: ("card" | "settings" | "app-function" | "webhooks")[] | undefined;
|
|
20
|
+
}, {
|
|
21
|
+
name: string;
|
|
22
|
+
projectBase: "app" | "empty";
|
|
23
|
+
absoluteCurrentWorkingDirectory: string;
|
|
24
|
+
destination: string;
|
|
25
|
+
auth?: "oauth" | "static" | undefined;
|
|
26
|
+
distribution?: "marketplace" | "private" | undefined;
|
|
27
|
+
features?: ("card" | "settings" | "app-function" | "webhooks")[] | undefined;
|
|
28
|
+
}>;
|
|
29
|
+
export type CreateProjectInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
30
|
+
export declare class CreateProjectTool extends Tool<CreateProjectInputSchema> {
|
|
31
|
+
constructor(mcpServer: McpServer);
|
|
32
|
+
handler({ name, destination, projectBase, distribution, auth, features, absoluteCurrentWorkingDirectory, }: CreateProjectInputSchema): Promise<TextContentResponse>;
|
|
33
|
+
register(): RegisteredTool;
|
|
6
34
|
}
|
|
35
|
+
export {};
|
|
@@ -8,112 +8,117 @@ const command_1 = require("../../utils/command");
|
|
|
8
8
|
const v3_1 = require("../../../lib/projects/create/v3");
|
|
9
9
|
const constants_2 = require("./constants");
|
|
10
10
|
const project_1 = require("../../utils/project");
|
|
11
|
+
const inputSchema = {
|
|
12
|
+
absoluteCurrentWorkingDirectory: constants_2.absoluteCurrentWorkingDirectory,
|
|
13
|
+
name: zod_1.z
|
|
14
|
+
.string()
|
|
15
|
+
.describe('The name of the project to be created. This name is how your project will appear in HubSpot.'),
|
|
16
|
+
destination: zod_1.z
|
|
17
|
+
.string()
|
|
18
|
+
.describe('Relative path to the directory the project will be created in. It is not recommended to use the current directory unless it is an empty directory'),
|
|
19
|
+
projectBase: zod_1.z
|
|
20
|
+
.union([zod_1.z.literal(v3_1.EMPTY_PROJECT), zod_1.z.literal(v3_1.PROJECT_WITH_APP)])
|
|
21
|
+
.describe('Empty will create and empty project, and app will create a project with an app inside of it.'),
|
|
22
|
+
distribution: zod_1.z
|
|
23
|
+
.optional(zod_1.z.union([
|
|
24
|
+
zod_1.z.literal(constants_1.APP_DISTRIBUTION_TYPES.MARKETPLACE),
|
|
25
|
+
zod_1.z.literal(constants_1.APP_DISTRIBUTION_TYPES.PRIVATE),
|
|
26
|
+
]))
|
|
27
|
+
.describe('Private is used if you do not wish to distribute your application on the HubSpot marketplace. If not specified by the user, do not choose for them. This cannot be changed after a project is uploaded.'),
|
|
28
|
+
auth: zod_1.z
|
|
29
|
+
.optional(zod_1.z.union([
|
|
30
|
+
zod_1.z.literal(constants_1.APP_AUTH_TYPES.STATIC),
|
|
31
|
+
zod_1.z.literal(constants_1.APP_AUTH_TYPES.OAUTH),
|
|
32
|
+
]))
|
|
33
|
+
.describe('Static uses a static non changing authentication token, and is only available for private distribution. If not specified by the user, do not choose for them. This cannot be changed after a project is uploaded.')
|
|
34
|
+
.optional(),
|
|
35
|
+
features: zod_1.z
|
|
36
|
+
.array(zod_1.z
|
|
37
|
+
.union([
|
|
38
|
+
zod_1.z.literal('card'),
|
|
39
|
+
zod_1.z.literal('settings'),
|
|
40
|
+
zod_1.z.literal('app-function'),
|
|
41
|
+
zod_1.z.literal('webhooks'),
|
|
42
|
+
])
|
|
43
|
+
.describe('The features to include in the project, multiple options can be selected'))
|
|
44
|
+
.optional(),
|
|
45
|
+
};
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
47
|
+
const inputSchemaZodObject = zod_1.z.object({ ...inputSchema });
|
|
11
48
|
class CreateProjectTool extends types_1.Tool {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
49
|
+
constructor(mcpServer) {
|
|
50
|
+
super(mcpServer);
|
|
51
|
+
}
|
|
52
|
+
async handler({ name, destination, projectBase, distribution, auth, features, absoluteCurrentWorkingDirectory, }) {
|
|
53
|
+
let command = (0, command_1.addFlag)('hs project create', 'platform-version', '2025.2');
|
|
54
|
+
const content = [];
|
|
55
|
+
if (name) {
|
|
56
|
+
command = (0, command_1.addFlag)(command, 'name', name);
|
|
57
|
+
}
|
|
58
|
+
if (destination) {
|
|
59
|
+
command = (0, command_1.addFlag)(command, 'dest', destination);
|
|
60
|
+
}
|
|
61
|
+
if (projectBase) {
|
|
62
|
+
command = (0, command_1.addFlag)(command, 'project-base', projectBase);
|
|
63
|
+
}
|
|
64
|
+
if (distribution) {
|
|
65
|
+
command = (0, command_1.addFlag)(command, 'distribution', distribution);
|
|
66
|
+
}
|
|
67
|
+
else if (projectBase === v3_1.PROJECT_WITH_APP) {
|
|
68
|
+
content.push({
|
|
69
|
+
type: 'text',
|
|
70
|
+
text: `Ask the user how they would you like to distribute the application? Options are ${constants_1.APP_DISTRIBUTION_TYPES.MARKETPLACE} and ${constants_1.APP_DISTRIBUTION_TYPES.PRIVATE}`,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
if (auth) {
|
|
74
|
+
command = (0, command_1.addFlag)(command, 'auth', auth);
|
|
75
|
+
}
|
|
76
|
+
else if (projectBase === v3_1.PROJECT_WITH_APP) {
|
|
77
|
+
content.push({
|
|
78
|
+
type: 'text',
|
|
79
|
+
text: `Ask the user which auth type they would like to use? Options are ${constants_1.APP_AUTH_TYPES.STATIC} and ${constants_1.APP_AUTH_TYPES.OAUTH}`,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
if (content.length > 0) {
|
|
83
|
+
return {
|
|
84
|
+
content,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
if (features && features.length) {
|
|
88
|
+
command = (0, command_1.addFlag)(command, 'features', features);
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
const { stdout, stderr } = await (0, project_1.runCommandInDir)(absoluteCurrentWorkingDirectory, command);
|
|
92
|
+
return {
|
|
93
|
+
content: [
|
|
94
|
+
{
|
|
95
|
+
type: 'text',
|
|
96
|
+
text: stdout,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
type: 'text',
|
|
100
|
+
text: stderr,
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
return {
|
|
107
|
+
content: [
|
|
108
|
+
{
|
|
109
|
+
type: 'text',
|
|
110
|
+
text: error instanceof Error ? error.message : `${error}`,
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
register() {
|
|
15
117
|
return this.mcpServer.registerTool('create-hubspot-project', {
|
|
16
118
|
title: 'Create HubSpot Project',
|
|
17
119
|
description: 'Creates a HubSpot project with the provided name and outputs it in the provided destination',
|
|
18
|
-
inputSchema
|
|
19
|
-
|
|
20
|
-
name: zod_1.z
|
|
21
|
-
.string()
|
|
22
|
-
.describe('The name of the project to be created. This name is how your project will appear in HubSpot.'),
|
|
23
|
-
destination: zod_1.z
|
|
24
|
-
.string()
|
|
25
|
-
.describe('Relative path to the directory the project will be created in. It is not recommended to use the current directory unless it is an empty directory'),
|
|
26
|
-
projectBase: zod_1.z
|
|
27
|
-
.union([zod_1.z.literal(v3_1.EMPTY_PROJECT), zod_1.z.literal(v3_1.PROJECT_WITH_APP)])
|
|
28
|
-
.describe('Empty will create and empty project, and app will create a project with an app inside of it.'),
|
|
29
|
-
distribution: zod_1.z
|
|
30
|
-
.optional(zod_1.z.union([
|
|
31
|
-
zod_1.z.literal(constants_1.APP_DISTRIBUTION_TYPES.MARKETPLACE),
|
|
32
|
-
zod_1.z.literal(constants_1.APP_DISTRIBUTION_TYPES.PRIVATE),
|
|
33
|
-
]))
|
|
34
|
-
.describe('Private is used if you do not wish to distribute your application on the HubSpot marketplace. If not specified by the user, do not choose for them. This cannot be changed after a project is uploaded.'),
|
|
35
|
-
auth: zod_1.z
|
|
36
|
-
.optional(zod_1.z.union([
|
|
37
|
-
zod_1.z.literal(constants_1.APP_AUTH_TYPES.STATIC),
|
|
38
|
-
zod_1.z.literal(constants_1.APP_AUTH_TYPES.OAUTH),
|
|
39
|
-
]))
|
|
40
|
-
.describe('Static uses a static non changing authentication token, and is only available for private distribution. If not specified by the user, do not choose for them. This cannot be changed after a project is uploaded.')
|
|
41
|
-
.optional(),
|
|
42
|
-
features: zod_1.z
|
|
43
|
-
.array(zod_1.z
|
|
44
|
-
.union([
|
|
45
|
-
zod_1.z.literal('card'),
|
|
46
|
-
zod_1.z.literal('settings'),
|
|
47
|
-
zod_1.z.literal('app-function'),
|
|
48
|
-
zod_1.z.literal('webhooks'),
|
|
49
|
-
])
|
|
50
|
-
.describe('The features to include in the project, multiple options can be selected'))
|
|
51
|
-
.optional(),
|
|
52
|
-
},
|
|
53
|
-
}, async ({ name, destination, projectBase, distribution, auth, features, absoluteCurrentWorkingDirectory, }) => {
|
|
54
|
-
let command = (0, command_1.addFlag)('hs project create', 'platform-version', '2025.2');
|
|
55
|
-
const content = [];
|
|
56
|
-
if (name) {
|
|
57
|
-
command = (0, command_1.addFlag)(command, 'name', name);
|
|
58
|
-
}
|
|
59
|
-
if (destination) {
|
|
60
|
-
command = (0, command_1.addFlag)(command, 'dest', destination);
|
|
61
|
-
}
|
|
62
|
-
if (projectBase) {
|
|
63
|
-
command = (0, command_1.addFlag)(command, 'project-base', projectBase);
|
|
64
|
-
}
|
|
65
|
-
if (distribution) {
|
|
66
|
-
command = (0, command_1.addFlag)(command, 'distribution', distribution);
|
|
67
|
-
}
|
|
68
|
-
else if (projectBase === v3_1.PROJECT_WITH_APP) {
|
|
69
|
-
content.push({
|
|
70
|
-
type: 'text',
|
|
71
|
-
text: `Ask the user how they would you like to distribute the application? Options are ${constants_1.APP_DISTRIBUTION_TYPES.MARKETPLACE} and ${constants_1.APP_DISTRIBUTION_TYPES.PRIVATE}`,
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
if (auth) {
|
|
75
|
-
command = (0, command_1.addFlag)(command, 'auth', auth);
|
|
76
|
-
}
|
|
77
|
-
else if (projectBase === v3_1.PROJECT_WITH_APP) {
|
|
78
|
-
content.push({
|
|
79
|
-
type: 'text',
|
|
80
|
-
text: `Ask the user which auth type they would like to use? Options are ${constants_1.APP_AUTH_TYPES.STATIC} and ${constants_1.APP_AUTH_TYPES.OAUTH}`,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
if (content.length > 0) {
|
|
84
|
-
return {
|
|
85
|
-
content,
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
if (features && features.length) {
|
|
89
|
-
command = (0, command_1.addFlag)(command, 'features', features);
|
|
90
|
-
}
|
|
91
|
-
try {
|
|
92
|
-
const { stdout, stderr } = await (0, project_1.runCommandInDir)(absoluteCurrentWorkingDirectory, command);
|
|
93
|
-
return {
|
|
94
|
-
content: [
|
|
95
|
-
{
|
|
96
|
-
type: 'text',
|
|
97
|
-
text: stdout,
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
type: 'text',
|
|
101
|
-
text: stderr,
|
|
102
|
-
},
|
|
103
|
-
],
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
catch (error) {
|
|
107
|
-
return {
|
|
108
|
-
content: [
|
|
109
|
-
{
|
|
110
|
-
type: 'text',
|
|
111
|
-
text: error instanceof Error ? error.message : `${error}`,
|
|
112
|
-
},
|
|
113
|
-
],
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
});
|
|
120
|
+
inputSchema,
|
|
121
|
+
}, this.handler);
|
|
117
122
|
}
|
|
118
123
|
}
|
|
119
124
|
exports.CreateProjectTool = CreateProjectTool;
|
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
import { Tool } from '../../types';
|
|
1
|
+
import { TextContentResponse, Tool } from '../../types';
|
|
2
2
|
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
|
+
absoluteProjectPath: z.ZodString;
|
|
6
|
+
buildNumber: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
absoluteProjectPath: string;
|
|
9
|
+
buildNumber?: number | undefined;
|
|
10
|
+
}, {
|
|
11
|
+
absoluteProjectPath: string;
|
|
12
|
+
buildNumber?: number | undefined;
|
|
13
|
+
}>;
|
|
14
|
+
type InputSchemaType = z.infer<typeof inputSchemaZodObject>;
|
|
15
|
+
export declare class DeployProject extends Tool<InputSchemaType> {
|
|
16
|
+
constructor(mcpServer: McpServer);
|
|
17
|
+
handler({ absoluteProjectPath, buildNumber, }: InputSchemaType): Promise<TextContentResponse>;
|
|
18
|
+
register(): RegisteredTool;
|
|
6
19
|
}
|
|
20
|
+
export {};
|
|
@@ -6,45 +6,52 @@ const zod_1 = require("zod");
|
|
|
6
6
|
const command_1 = require("../../utils/command");
|
|
7
7
|
const constants_1 = require("./constants");
|
|
8
8
|
const project_1 = require("../../utils/project");
|
|
9
|
+
const inputSchema = {
|
|
10
|
+
absoluteProjectPath: constants_1.absoluteProjectPath,
|
|
11
|
+
buildNumber: zod_1.z
|
|
12
|
+
.optional(zod_1.z.number())
|
|
13
|
+
.describe('The build number to be deployed. This can be found in the project details page using `hs project open`. If no build number is specified, the most recent build is deployed'),
|
|
14
|
+
};
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16
|
+
const inputSchemaZodObject = zod_1.z.object({
|
|
17
|
+
...inputSchema,
|
|
18
|
+
});
|
|
9
19
|
class DeployProject extends types_1.Tool {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
20
|
+
constructor(mcpServer) {
|
|
21
|
+
super(mcpServer);
|
|
22
|
+
}
|
|
23
|
+
async handler({ absoluteProjectPath, buildNumber, }) {
|
|
24
|
+
let command = `hs project deploy`;
|
|
25
|
+
const content = [];
|
|
26
|
+
if (!buildNumber) {
|
|
27
|
+
const { stdout } = await (0, project_1.runCommandInDir)(absoluteProjectPath, `hs project list-builds --limit 100`);
|
|
28
|
+
content.push({
|
|
29
|
+
type: 'text',
|
|
30
|
+
text: `Ask the user which build number they would like to deploy? Build information: ${stdout}`,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
command = (0, command_1.addFlag)(command, 'build', buildNumber);
|
|
35
|
+
}
|
|
36
|
+
if (content.length) {
|
|
37
|
+
return {
|
|
38
|
+
content,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const { stdout, stderr } = await (0, project_1.runCommandInDir)(absoluteProjectPath, command);
|
|
42
|
+
return {
|
|
43
|
+
content: [
|
|
44
|
+
{ type: 'text', text: stdout },
|
|
45
|
+
{ type: 'text', text: stderr },
|
|
46
|
+
],
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
register() {
|
|
13
50
|
return this.mcpServer.registerTool('deploy-hubspot-project', {
|
|
14
51
|
title: 'Deploy a build of HubSpot Project',
|
|
15
52
|
description: 'Takes a build number and a project name and deploys that build of the project',
|
|
16
|
-
inputSchema
|
|
17
|
-
|
|
18
|
-
buildNumber: zod_1.z
|
|
19
|
-
.optional(zod_1.z.number())
|
|
20
|
-
.describe('The build number to be deployed. This can be found in the project details page using `hs project open`. If no build number is specified, the most recent build is deployed'),
|
|
21
|
-
},
|
|
22
|
-
}, async ({ absoluteProjectPath, buildNumber }) => {
|
|
23
|
-
let command = `hs project deploy`;
|
|
24
|
-
const content = [];
|
|
25
|
-
if (!buildNumber) {
|
|
26
|
-
const { stdout } = await (0, project_1.runCommandInDir)(absoluteProjectPath, `hs project list-builds --limit 100`);
|
|
27
|
-
content.push({
|
|
28
|
-
type: 'text',
|
|
29
|
-
text: `Ask the user which build number they would like to deploy? Build information: ${stdout}`,
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
command = (0, command_1.addFlag)(command, 'build', buildNumber);
|
|
34
|
-
}
|
|
35
|
-
if (content.length) {
|
|
36
|
-
return {
|
|
37
|
-
content,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
const { stdout, stderr } = await (0, project_1.runCommandInDir)(absoluteProjectPath, command);
|
|
41
|
-
return {
|
|
42
|
-
content: [
|
|
43
|
-
{ type: 'text', text: stdout },
|
|
44
|
-
{ type: 'text', text: stderr },
|
|
45
|
-
],
|
|
46
|
-
};
|
|
47
|
-
});
|
|
53
|
+
inputSchema,
|
|
54
|
+
}, this.handler);
|
|
48
55
|
}
|
|
49
56
|
}
|
|
50
57
|
exports.DeployProject = DeployProject;
|
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
import { Tool } from '../../types';
|
|
1
|
+
import { TextContentResponse, Tool } from '../../types';
|
|
2
2
|
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
|
+
command: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"hs init">, z.ZodLiteral<"hs auth">, z.ZodLiteral<"hs project create">, z.ZodLiteral<"hs project upload">]>>;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
command?: "hs auth" | "hs project upload" | "hs project create" | "hs init" | undefined;
|
|
8
|
+
}, {
|
|
9
|
+
command?: "hs auth" | "hs project upload" | "hs project create" | "hs init" | undefined;
|
|
10
|
+
}>;
|
|
11
|
+
type InputSchemaType = z.infer<typeof inputSchemaZodObject>;
|
|
12
|
+
export declare class GuidedWalkthroughTool extends Tool<InputSchemaType> {
|
|
13
|
+
constructor(mcpServer: McpServer);
|
|
14
|
+
handler({ command }: InputSchemaType): Promise<TextContentResponse>;
|
|
15
|
+
register(): RegisteredTool;
|
|
6
16
|
}
|
|
17
|
+
export {};
|
|
@@ -10,10 +10,47 @@ const nextCommands = {
|
|
|
10
10
|
'hs project create': 'hs project upload',
|
|
11
11
|
'hs project upload': 'hs project dev',
|
|
12
12
|
};
|
|
13
|
+
const inputSchema = {
|
|
14
|
+
command: zod_1.z
|
|
15
|
+
.union([
|
|
16
|
+
zod_1.z.literal('hs init'),
|
|
17
|
+
zod_1.z.literal('hs auth'),
|
|
18
|
+
zod_1.z.literal('hs project create'),
|
|
19
|
+
zod_1.z.literal('hs project upload'),
|
|
20
|
+
])
|
|
21
|
+
.describe('The command to learn more about. Start with `hs init`')
|
|
22
|
+
.optional(),
|
|
23
|
+
};
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
25
|
+
const inputSchemaZodObject = zod_1.z.object({
|
|
26
|
+
...inputSchema,
|
|
27
|
+
});
|
|
13
28
|
class GuidedWalkthroughTool extends types_1.Tool {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
29
|
+
constructor(mcpServer) {
|
|
30
|
+
super(mcpServer);
|
|
31
|
+
}
|
|
32
|
+
async handler({ command }) {
|
|
33
|
+
if (command) {
|
|
34
|
+
const { stdout } = await (0, command_1.execAsync)(`${command} --help`);
|
|
35
|
+
return {
|
|
36
|
+
content: [
|
|
37
|
+
{
|
|
38
|
+
type: 'text',
|
|
39
|
+
text: `Display this help output for the user amd wait for them to acknowledge: ${stdout}. ${nextCommands[command] ? `Once they are ready, A good command to look at next is ${nextCommands[command]}` : ''}`,
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
content: [
|
|
46
|
+
{
|
|
47
|
+
type: 'text',
|
|
48
|
+
text: 'Is there another command you would like to learn more about?',
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
register() {
|
|
17
54
|
return this.mcpServer.registerTool('guided-walkthrough-hubspot-cli', {
|
|
18
55
|
title: 'Guided walkthrough of the CLI',
|
|
19
56
|
description: 'Give the user a guided walkthrough of the HubSpot CLI.',
|
|
@@ -28,27 +65,7 @@ class GuidedWalkthroughTool extends types_1.Tool {
|
|
|
28
65
|
.describe('The command to learn more about. Start with `hs init`')
|
|
29
66
|
.optional(),
|
|
30
67
|
},
|
|
31
|
-
},
|
|
32
|
-
if (command) {
|
|
33
|
-
const { stdout } = await (0, command_1.execAsync)(`${command} --help`);
|
|
34
|
-
return {
|
|
35
|
-
content: [
|
|
36
|
-
{
|
|
37
|
-
type: 'text',
|
|
38
|
-
text: `Display this help output for the user amd wait for them to acknowledge: ${stdout}. ${nextCommands[command] ? `Once they are ready, A good command to look at next is ${nextCommands[command]}` : ''}`,
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
return {
|
|
44
|
-
content: [
|
|
45
|
-
{
|
|
46
|
-
type: 'text',
|
|
47
|
-
text: 'Is there another command you would like to learn more about?',
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
};
|
|
51
|
-
});
|
|
68
|
+
}, this.handler);
|
|
52
69
|
}
|
|
53
70
|
}
|
|
54
71
|
exports.GuidedWalkthroughTool = GuidedWalkthroughTool;
|