@hubspot/cli 8.0.11-experimental.1 → 8.0.12-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/api/migrate.js +3 -3
- package/bin/cli.js +3 -0
- package/commands/account/link.d.ts +4 -0
- package/commands/account/link.js +88 -0
- package/commands/account/unlink.d.ts +4 -0
- package/commands/account/unlink.js +69 -0
- package/commands/account.js +4 -0
- package/commands/app/migrate.js +4 -4
- package/commands/getStarted.js +2 -2
- package/commands/project/add.js +3 -3
- package/commands/project/appInstallStatus.d.ts +4 -0
- package/commands/project/appInstallStatus.js +132 -0
- package/commands/project/create.js +18 -7
- package/commands/project/delete.js +2 -2
- package/commands/project/deploy.js +4 -3
- package/commands/project/dev/index.js +5 -4
- package/commands/project/info.js +2 -2
- package/commands/project/lint.js +2 -1
- package/commands/project/migrate.js +5 -5
- package/commands/project/profile/add.js +2 -2
- package/commands/project/profile/delete.js +2 -2
- package/commands/project/upload.d.ts +2 -0
- package/commands/project/upload.js +38 -6
- package/commands/project/validate.js +2 -2
- package/commands/project/watch.js +2 -2
- package/commands/project.js +8 -3
- package/commands/testAccount/create.js +4 -4
- package/lang/en.d.ts +95 -0
- package/lang/en.js +108 -8
- package/lib/app/migrate.js +8 -0
- package/lib/doctor/Doctor.js +2 -2
- package/lib/getStartedV2Actions.js +2 -2
- package/lib/link/accountTableUtils.d.ts +10 -0
- package/lib/link/accountTableUtils.js +39 -0
- package/lib/link/index.d.ts +14 -0
- package/lib/link/index.js +154 -0
- package/lib/link/linkUtils.d.ts +4 -0
- package/lib/link/linkUtils.js +24 -0
- package/lib/link/prompts.d.ts +7 -0
- package/lib/link/prompts.js +126 -0
- package/lib/link/renderLinkedAccountsTable.d.ts +2 -0
- package/lib/link/renderLinkedAccountsTable.js +14 -0
- package/lib/projects/ProjectLogsManager.js +6 -3
- package/lib/projects/create/index.js +2 -2
- package/lib/projects/create/legacy.js +2 -2
- package/lib/projects/create/v2.js +2 -2
- package/lib/projects/delete.js +2 -2
- package/lib/projects/deploy.d.ts +1 -1
- package/lib/projects/deploy.js +2 -2
- package/lib/projects/preview.d.ts +7 -0
- package/lib/projects/preview.js +71 -0
- package/lib/projects/uieLinting.d.ts +8 -3
- package/lib/projects/uieLinting.js +48 -27
- package/lib/projects/upload.d.ts +1 -0
- package/lib/projects/upload.js +8 -7
- package/lib/prompts/projectsLogsPrompt.js +3 -0
- package/lib/prompts/promptUtils.js +1 -0
- package/lib/theme/cmsDevServerProcess.js +1 -1
- package/mcp-server/Tool.d.ts +15 -0
- package/mcp-server/Tool.js +53 -0
- package/mcp-server/server.js +39 -3
- package/mcp-server/tools/cms/HsCreateFunctionTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsCreateFunctionTool.js +8 -6
- package/mcp-server/tools/cms/HsCreateModuleTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsCreateModuleTool.js +8 -6
- package/mcp-server/tools/cms/HsCreateTemplateTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsCreateTemplateTool.js +8 -6
- package/mcp-server/tools/cms/HsFunctionLogsTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsFunctionLogsTool.js +8 -6
- package/mcp-server/tools/cms/HsListFunctionsTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsListFunctionsTool.js +8 -6
- package/mcp-server/tools/cms/HsListTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsListTool.js +8 -6
- package/mcp-server/tools/index.d.ts +3 -2
- package/mcp-server/tools/index.js +22 -22
- package/mcp-server/tools/project/AddFeatureToProjectTool.d.ts +6 -4
- package/mcp-server/tools/project/AddFeatureToProjectTool.js +8 -6
- package/mcp-server/tools/project/CreateProjectTool.d.ts +6 -4
- package/mcp-server/tools/project/CreateProjectTool.js +9 -7
- package/mcp-server/tools/project/CreateTestAccountTool.d.ts +4 -2
- package/mcp-server/tools/project/CreateTestAccountTool.js +20 -8
- package/mcp-server/tools/project/DeployProjectTool.d.ts +4 -2
- package/mcp-server/tools/project/DeployProjectTool.js +4 -6
- package/mcp-server/tools/project/DocFetchTool.d.ts +4 -2
- package/mcp-server/tools/project/DocFetchTool.js +8 -6
- package/mcp-server/tools/project/DocsSearchTool.d.ts +9 -3
- package/mcp-server/tools/project/DocsSearchTool.js +32 -9
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +4 -2
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +8 -6
- package/mcp-server/tools/project/GetApplicationInfoTool.d.ts +4 -2
- package/mcp-server/tools/project/GetApplicationInfoTool.js +8 -6
- package/mcp-server/tools/project/GetBuildLogsTool.d.ts +4 -2
- package/mcp-server/tools/project/GetBuildLogsTool.js +8 -6
- package/mcp-server/tools/project/GetBuildStatusTool.d.ts +4 -2
- package/mcp-server/tools/project/GetBuildStatusTool.js +8 -6
- package/mcp-server/tools/project/GetConfigValuesTool.d.ts +4 -2
- package/mcp-server/tools/project/GetConfigValuesTool.js +12 -7
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +4 -2
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +4 -6
- package/mcp-server/tools/project/UploadProjectTools.d.ts +4 -2
- package/mcp-server/tools/project/UploadProjectTools.js +9 -7
- package/mcp-server/tools/project/ValidateProjectTool.d.ts +4 -2
- package/mcp-server/tools/project/ValidateProjectTool.js +8 -6
- package/mcp-server/tools/project/constants.d.ts +2 -2
- package/mcp-server/types.d.ts +0 -7
- package/mcp-server/types.js +1 -13
- package/mcp-server/utils/logger.d.ts +10 -0
- package/mcp-server/utils/logger.js +29 -0
- package/mcp-server/utils/toolUsageTracking.js +0 -2
- package/package.json +10 -10
- package/types/Link.d.ts +27 -0
- package/types/Link.js +1 -0
- package/types/Prompts.d.ts +1 -0
- package/lib/projects/platformVersion.d.ts +0 -9
- package/lib/projects/platformVersion.js +0 -39
package/mcp-server/server.js
CHANGED
|
@@ -1,13 +1,49 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
3
3
|
import { registerProjectTools, registerCmsTools } from './tools/index.js';
|
|
4
|
+
import { McpLogger } from './utils/logger.js';
|
|
5
|
+
const instructions = `
|
|
6
|
+
This server exposes the HubSpot CLI (\`hs\`) for local development of HubSpot
|
|
7
|
+
projects, apps, and CMS assets. Prefer these tools over running \`hs\`,
|
|
8
|
+
\`npx hs\`, or HubSpot HTTP APIs directly via shell — they handle config
|
|
9
|
+
loading, auth, platform-version flags, and structured output for you.
|
|
10
|
+
|
|
11
|
+
WHEN TO USE THIS SERVER
|
|
12
|
+
- The user is working in a HubSpot project directory (has an hsproject.json
|
|
13
|
+
or *-hsmeta.json files), or wants to scaffold one.
|
|
14
|
+
- The user asks about HubSpot apps, CMS modules/templates/serverless
|
|
15
|
+
functions, project builds, deploys, or developer test accounts.
|
|
16
|
+
- The user asks a HubSpot platform/API question — answer it from the docs
|
|
17
|
+
via \`search-docs\` + \`fetch-doc\` rather than from prior knowledge.
|
|
18
|
+
|
|
19
|
+
REQUIRED WORKFLOWS
|
|
20
|
+
1. Documentation lookup: always call \`search-docs\` first, then
|
|
21
|
+
\`fetch-doc\` on the most relevant result(s) before planning, writing
|
|
22
|
+
code, or answering platform/API questions. Do not answer from memory.
|
|
23
|
+
2. Editing \`*-hsmeta.json\`: call \`get-feature-config-schema\` for that
|
|
24
|
+
feature type first to learn the allowed fields and values.
|
|
25
|
+
3. Debugging a failed build: start with \`get-build-status\` to surface
|
|
26
|
+
error messages, and only reach for \`get-build-logs\` for deeper
|
|
27
|
+
troubleshooting or warnings.
|
|
28
|
+
4. Reading serverless function logs: call \`list-cms-serverless-functions\`
|
|
29
|
+
first to discover the endpoint path, then
|
|
30
|
+
\`get-cms-serverless-function-logs\`.
|
|
31
|
+
5. App analytics: call \`get-apps-info\` to discover \`appId\` values
|
|
32
|
+
before \`get-api-usage-patterns-by-app-id\`.
|
|
33
|
+
|
|
34
|
+
OUTPUT
|
|
35
|
+
Tool results contain the relevant \`hs\` stdout/stderr or structured data.
|
|
36
|
+
Surface error text from results to the user verbatim when troubleshooting,
|
|
37
|
+
rather than paraphrasing.
|
|
38
|
+
`.trim();
|
|
4
39
|
const server = new McpServer({
|
|
5
40
|
name: 'HubSpot CLI MCP Server',
|
|
6
41
|
version: '0.0.1',
|
|
7
42
|
description: 'Helps perform tasks for local development of HubSpot projects.',
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
|
|
43
|
+
}, { capabilities: { logging: {} }, instructions });
|
|
44
|
+
const logger = new McpLogger(server);
|
|
45
|
+
registerProjectTools(server, logger);
|
|
46
|
+
registerCmsTools(server, logger);
|
|
11
47
|
// Start receiving messages on stdin and sending messages on stdout
|
|
12
48
|
const transport = new StdioServerTransport();
|
|
13
49
|
server.connect(transport);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { TextContentResponse
|
|
1
|
+
import { TextContentResponse } from '../../types.js';
|
|
2
|
+
import { Tool } from '../../Tool.js';
|
|
2
3
|
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
|
+
import { McpLogger } from '../../utils/logger.js';
|
|
3
5
|
import { z } from 'zod';
|
|
4
6
|
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
7
|
absoluteCurrentWorkingDirectory: z.ZodString;
|
|
@@ -17,7 +19,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
|
|
|
17
19
|
}, z.core.$strip>;
|
|
18
20
|
export type HsCreateFunctionInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
19
21
|
export declare class HsCreateFunctionTool extends Tool<HsCreateFunctionInputSchema> {
|
|
20
|
-
constructor(mcpServer: McpServer);
|
|
22
|
+
constructor(mcpServer: McpServer, logger: McpLogger);
|
|
21
23
|
handler({ dest, functionsFolder, filename, endpointMethod, endpointPath, absoluteCurrentWorkingDirectory, }: HsCreateFunctionInputSchema): Promise<TextContentResponse>;
|
|
22
24
|
register(): RegisteredTool;
|
|
23
25
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { Tool } from '../../
|
|
1
|
+
import { Tool } from '../../Tool.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
|
|
4
4
|
import { runCommandInDir } from '../../utils/command.js';
|
|
5
5
|
import { formatTextContents, formatTextContent } from '../../utils/content.js';
|
|
6
|
-
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
7
6
|
import { addFlag } from '../../utils/command.js';
|
|
8
7
|
import { HTTP_METHODS } from '../../../types/Cms.js';
|
|
9
8
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
@@ -35,12 +34,11 @@ const inputSchema = {
|
|
|
35
34
|
const inputSchemaZodObject = z.object({ ...inputSchema });
|
|
36
35
|
const toolName = 'create-cms-function';
|
|
37
36
|
export class HsCreateFunctionTool extends Tool {
|
|
38
|
-
constructor(mcpServer) {
|
|
39
|
-
super(mcpServer);
|
|
37
|
+
constructor(mcpServer, logger) {
|
|
38
|
+
super(mcpServer, logger, toolName);
|
|
40
39
|
}
|
|
41
40
|
async handler({ dest, functionsFolder, filename, endpointMethod, endpointPath, absoluteCurrentWorkingDirectory, }) {
|
|
42
41
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
43
|
-
await trackToolUsage(toolName);
|
|
44
42
|
const content = [];
|
|
45
43
|
// Require functions folder
|
|
46
44
|
if (!functionsFolder) {
|
|
@@ -86,6 +84,10 @@ export class HsCreateFunctionTool extends Tool {
|
|
|
86
84
|
return formatTextContents(stdout, stderr);
|
|
87
85
|
}
|
|
88
86
|
catch (error) {
|
|
87
|
+
this.logger.debug(toolName, {
|
|
88
|
+
message: 'Handler caught error',
|
|
89
|
+
error: error instanceof Error ? error.message : String(error),
|
|
90
|
+
});
|
|
89
91
|
return formatTextContents(getErrorMessage(error));
|
|
90
92
|
}
|
|
91
93
|
}
|
|
@@ -100,6 +102,6 @@ export class HsCreateFunctionTool extends Tool {
|
|
|
100
102
|
idempotentHint: false,
|
|
101
103
|
openWorldHint: false,
|
|
102
104
|
},
|
|
103
|
-
}, this.
|
|
105
|
+
}, input => this.wrappedHandler(input));
|
|
104
106
|
}
|
|
105
107
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { TextContentResponse
|
|
1
|
+
import { TextContentResponse } from '../../types.js';
|
|
2
|
+
import { Tool } from '../../Tool.js';
|
|
2
3
|
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
|
+
import { McpLogger } from '../../utils/logger.js';
|
|
3
5
|
import { z } from 'zod';
|
|
4
6
|
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
7
|
absoluteCurrentWorkingDirectory: z.ZodString;
|
|
@@ -13,7 +15,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
|
|
|
13
15
|
}, z.core.$strip>;
|
|
14
16
|
export type HsCreateModuleInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
15
17
|
export declare class HsCreateModuleTool extends Tool<HsCreateModuleInputSchema> {
|
|
16
|
-
constructor(mcpServer: McpServer);
|
|
18
|
+
constructor(mcpServer: McpServer, logger: McpLogger);
|
|
17
19
|
handler({ userSuppliedName, dest, moduleLabel, reactType, contentTypes, global, availableForNewContent, absoluteCurrentWorkingDirectory, }: HsCreateModuleInputSchema): Promise<TextContentResponse>;
|
|
18
20
|
register(): RegisteredTool;
|
|
19
21
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { Tool } from '../../
|
|
1
|
+
import { Tool } from '../../Tool.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
|
|
4
4
|
import { runCommandInDir } from '../../utils/command.js';
|
|
5
5
|
import { formatTextContents, formatTextContent } from '../../utils/content.js';
|
|
6
|
-
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
7
6
|
import { addFlag } from '../../utils/command.js';
|
|
8
7
|
import { CONTENT_TYPES } from '../../../types/Cms.js';
|
|
9
8
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
@@ -51,12 +50,11 @@ const inputSchema = {
|
|
|
51
50
|
const inputSchemaZodObject = z.object({ ...inputSchema });
|
|
52
51
|
const toolName = 'create-cms-module';
|
|
53
52
|
export class HsCreateModuleTool extends Tool {
|
|
54
|
-
constructor(mcpServer) {
|
|
55
|
-
super(mcpServer);
|
|
53
|
+
constructor(mcpServer, logger) {
|
|
54
|
+
super(mcpServer, logger, toolName);
|
|
56
55
|
}
|
|
57
56
|
async handler({ userSuppliedName, dest, moduleLabel, reactType, contentTypes, global, availableForNewContent, absoluteCurrentWorkingDirectory, }) {
|
|
58
57
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
59
|
-
await trackToolUsage(toolName);
|
|
60
58
|
const content = [];
|
|
61
59
|
// Always require a name
|
|
62
60
|
if (!userSuppliedName) {
|
|
@@ -108,6 +106,10 @@ export class HsCreateModuleTool extends Tool {
|
|
|
108
106
|
return formatTextContents(stdout, stderr);
|
|
109
107
|
}
|
|
110
108
|
catch (error) {
|
|
109
|
+
this.logger.debug(toolName, {
|
|
110
|
+
message: 'Handler caught error',
|
|
111
|
+
error: error instanceof Error ? error.message : String(error),
|
|
112
|
+
});
|
|
111
113
|
return formatTextContents(getErrorMessage(error));
|
|
112
114
|
}
|
|
113
115
|
}
|
|
@@ -122,6 +124,6 @@ export class HsCreateModuleTool extends Tool {
|
|
|
122
124
|
idempotentHint: false,
|
|
123
125
|
openWorldHint: false,
|
|
124
126
|
},
|
|
125
|
-
}, this.
|
|
127
|
+
}, input => this.wrappedHandler(input));
|
|
126
128
|
}
|
|
127
129
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { TextContentResponse
|
|
1
|
+
import { TextContentResponse } from '../../types.js';
|
|
2
|
+
import { Tool } from '../../Tool.js';
|
|
2
3
|
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
|
+
import { McpLogger } from '../../utils/logger.js';
|
|
3
5
|
import { z } from 'zod';
|
|
4
6
|
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
7
|
absoluteCurrentWorkingDirectory: z.ZodString;
|
|
@@ -18,7 +20,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
|
|
|
18
20
|
}, z.core.$strip>;
|
|
19
21
|
export type HsCreateTemplateInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
20
22
|
export declare class HsCreateTemplateTool extends Tool<HsCreateTemplateInputSchema> {
|
|
21
|
-
constructor(mcpServer: McpServer);
|
|
23
|
+
constructor(mcpServer: McpServer, logger: McpLogger);
|
|
22
24
|
handler({ userSuppliedName, dest, templateType, absoluteCurrentWorkingDirectory, }: HsCreateTemplateInputSchema): Promise<TextContentResponse>;
|
|
23
25
|
register(): RegisteredTool;
|
|
24
26
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { Tool } from '../../
|
|
1
|
+
import { Tool } from '../../Tool.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
|
|
4
4
|
import { runCommandInDir } from '../../utils/command.js';
|
|
5
5
|
import { formatTextContents, formatTextContent } from '../../utils/content.js';
|
|
6
|
-
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
7
6
|
import { addFlag } from '../../utils/command.js';
|
|
8
7
|
import { TEMPLATE_TYPES } from '../../../types/Cms.js';
|
|
9
8
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
@@ -27,12 +26,11 @@ const inputSchema = {
|
|
|
27
26
|
const inputSchemaZodObject = z.object({ ...inputSchema });
|
|
28
27
|
const toolName = 'create-cms-template';
|
|
29
28
|
export class HsCreateTemplateTool extends Tool {
|
|
30
|
-
constructor(mcpServer) {
|
|
31
|
-
super(mcpServer);
|
|
29
|
+
constructor(mcpServer, logger) {
|
|
30
|
+
super(mcpServer, logger, toolName);
|
|
32
31
|
}
|
|
33
32
|
async handler({ userSuppliedName, dest, templateType, absoluteCurrentWorkingDirectory, }) {
|
|
34
33
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
35
|
-
await trackToolUsage(toolName);
|
|
36
34
|
const content = [];
|
|
37
35
|
// Always require a name
|
|
38
36
|
if (!userSuppliedName) {
|
|
@@ -65,6 +63,10 @@ export class HsCreateTemplateTool extends Tool {
|
|
|
65
63
|
return formatTextContents(stdout, stderr);
|
|
66
64
|
}
|
|
67
65
|
catch (error) {
|
|
66
|
+
this.logger.debug(toolName, {
|
|
67
|
+
message: 'Handler caught error',
|
|
68
|
+
error: error instanceof Error ? error.message : String(error),
|
|
69
|
+
});
|
|
68
70
|
return formatTextContents(getErrorMessage(error));
|
|
69
71
|
}
|
|
70
72
|
}
|
|
@@ -79,6 +81,6 @@ export class HsCreateTemplateTool extends Tool {
|
|
|
79
81
|
idempotentHint: false,
|
|
80
82
|
openWorldHint: false,
|
|
81
83
|
},
|
|
82
|
-
}, this.
|
|
84
|
+
}, input => this.wrappedHandler(input));
|
|
83
85
|
}
|
|
84
86
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { TextContentResponse
|
|
1
|
+
import { TextContentResponse } from '../../types.js';
|
|
2
|
+
import { Tool } from '../../Tool.js';
|
|
2
3
|
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
|
+
import { McpLogger } from '../../utils/logger.js';
|
|
3
5
|
import { z } from 'zod';
|
|
4
6
|
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
7
|
absoluteCurrentWorkingDirectory: z.ZodString;
|
|
@@ -11,7 +13,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
|
|
|
11
13
|
}, z.core.$strip>;
|
|
12
14
|
export type HsFunctionLogsInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
13
15
|
export declare class HsFunctionLogsTool extends Tool<HsFunctionLogsInputSchema> {
|
|
14
|
-
constructor(mcpServer: McpServer);
|
|
16
|
+
constructor(mcpServer: McpServer, logger: McpLogger);
|
|
15
17
|
handler({ endpoint, account, latest, compact, limit, absoluteCurrentWorkingDirectory, }: HsFunctionLogsInputSchema): Promise<TextContentResponse>;
|
|
16
18
|
register(): RegisteredTool;
|
|
17
19
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Tool } from '../../
|
|
1
|
+
import { Tool } from '../../Tool.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { addFlag } from '../../utils/command.js';
|
|
4
4
|
import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
|
|
5
5
|
import { runCommandInDir } from '../../utils/command.js';
|
|
6
6
|
import { formatTextContents } from '../../utils/content.js';
|
|
7
|
-
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
8
7
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
9
8
|
import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
|
|
10
9
|
const inputSchema = {
|
|
@@ -30,12 +29,11 @@ const inputSchema = {
|
|
|
30
29
|
const inputSchemaZodObject = z.object({ ...inputSchema });
|
|
31
30
|
const toolName = 'get-cms-serverless-function-logs';
|
|
32
31
|
export class HsFunctionLogsTool extends Tool {
|
|
33
|
-
constructor(mcpServer) {
|
|
34
|
-
super(mcpServer);
|
|
32
|
+
constructor(mcpServer, logger) {
|
|
33
|
+
super(mcpServer, logger, toolName);
|
|
35
34
|
}
|
|
36
35
|
async handler({ endpoint, account, latest, compact, limit, absoluteCurrentWorkingDirectory, }) {
|
|
37
36
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
38
|
-
await trackToolUsage(toolName);
|
|
39
37
|
// Ensure endpoint doesn't start with '/'
|
|
40
38
|
const normalizedEndpoint = endpoint.startsWith('/')
|
|
41
39
|
? endpoint.slice(1)
|
|
@@ -58,6 +56,10 @@ export class HsFunctionLogsTool extends Tool {
|
|
|
58
56
|
return formatTextContents(stdout, stderr);
|
|
59
57
|
}
|
|
60
58
|
catch (error) {
|
|
59
|
+
this.logger.debug(toolName, {
|
|
60
|
+
message: 'Handler caught error',
|
|
61
|
+
error: error instanceof Error ? error.message : String(error),
|
|
62
|
+
});
|
|
61
63
|
return formatTextContents(`Error executing hs logs command: ${getErrorMessage(error)}`);
|
|
62
64
|
}
|
|
63
65
|
}
|
|
@@ -70,6 +72,6 @@ export class HsFunctionLogsTool extends Tool {
|
|
|
70
72
|
readOnlyHint: true,
|
|
71
73
|
openWorldHint: true,
|
|
72
74
|
},
|
|
73
|
-
}, this.
|
|
75
|
+
}, input => this.wrappedHandler(input));
|
|
74
76
|
}
|
|
75
77
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { TextContentResponse
|
|
1
|
+
import { TextContentResponse } from '../../types.js';
|
|
2
|
+
import { Tool } from '../../Tool.js';
|
|
2
3
|
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
|
+
import { McpLogger } from '../../utils/logger.js';
|
|
3
5
|
import { z } from 'zod';
|
|
4
6
|
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
7
|
absoluteCurrentWorkingDirectory: z.ZodString;
|
|
@@ -8,7 +10,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
|
|
|
8
10
|
}, z.core.$strip>;
|
|
9
11
|
export type HsListFunctionsInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
10
12
|
export declare class HsListFunctionsTool extends Tool<HsListFunctionsInputSchema> {
|
|
11
|
-
constructor(mcpServer: McpServer);
|
|
13
|
+
constructor(mcpServer: McpServer, logger: McpLogger);
|
|
12
14
|
handler({ account, json, absoluteCurrentWorkingDirectory, }: HsListFunctionsInputSchema): Promise<TextContentResponse>;
|
|
13
15
|
register(): RegisteredTool;
|
|
14
16
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Tool } from '../../
|
|
1
|
+
import { Tool } from '../../Tool.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { addFlag } from '../../utils/command.js';
|
|
4
4
|
import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
|
|
5
5
|
import { runCommandInDir } from '../../utils/command.js';
|
|
6
6
|
import { formatTextContents } from '../../utils/content.js';
|
|
7
|
-
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
8
7
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
9
8
|
import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
|
|
10
9
|
const inputSchema = {
|
|
@@ -22,12 +21,11 @@ const inputSchema = {
|
|
|
22
21
|
const inputSchemaZodObject = z.object({ ...inputSchema });
|
|
23
22
|
const toolName = 'list-cms-serverless-functions';
|
|
24
23
|
export class HsListFunctionsTool extends Tool {
|
|
25
|
-
constructor(mcpServer) {
|
|
26
|
-
super(mcpServer);
|
|
24
|
+
constructor(mcpServer, logger) {
|
|
25
|
+
super(mcpServer, logger, toolName);
|
|
27
26
|
}
|
|
28
27
|
async handler({ account, json, absoluteCurrentWorkingDirectory, }) {
|
|
29
28
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
30
|
-
await trackToolUsage(toolName);
|
|
31
29
|
let command = 'hs function list';
|
|
32
30
|
if (json) {
|
|
33
31
|
command += ' --json';
|
|
@@ -40,6 +38,10 @@ export class HsListFunctionsTool extends Tool {
|
|
|
40
38
|
return formatTextContents(stdout, stderr);
|
|
41
39
|
}
|
|
42
40
|
catch (error) {
|
|
41
|
+
this.logger.debug(toolName, {
|
|
42
|
+
message: 'Handler caught error',
|
|
43
|
+
error: error instanceof Error ? error.message : String(error),
|
|
44
|
+
});
|
|
43
45
|
return {
|
|
44
46
|
content: [
|
|
45
47
|
{
|
|
@@ -59,6 +61,6 @@ export class HsListFunctionsTool extends Tool {
|
|
|
59
61
|
readOnlyHint: true,
|
|
60
62
|
openWorldHint: true,
|
|
61
63
|
},
|
|
62
|
-
}, this.
|
|
64
|
+
}, input => this.wrappedHandler(input));
|
|
63
65
|
}
|
|
64
66
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { TextContentResponse
|
|
1
|
+
import { TextContentResponse } from '../../types.js';
|
|
2
|
+
import { Tool } from '../../Tool.js';
|
|
2
3
|
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
|
+
import { McpLogger } from '../../utils/logger.js';
|
|
3
5
|
import { z } from 'zod';
|
|
4
6
|
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
7
|
absoluteCurrentWorkingDirectory: z.ZodString;
|
|
@@ -8,7 +10,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
|
|
|
8
10
|
}, z.core.$strip>;
|
|
9
11
|
export type HsListInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
10
12
|
export declare class HsListTool extends Tool<HsListInputSchema> {
|
|
11
|
-
constructor(mcpServer: McpServer);
|
|
13
|
+
constructor(mcpServer: McpServer, logger: McpLogger);
|
|
12
14
|
handler({ path, account, absoluteCurrentWorkingDirectory, }: HsListInputSchema): Promise<TextContentResponse>;
|
|
13
15
|
register(): RegisteredTool;
|
|
14
16
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Tool } from '../../
|
|
1
|
+
import { Tool } from '../../Tool.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { addFlag } from '../../utils/command.js';
|
|
4
4
|
import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
|
|
5
5
|
import { runCommandInDir } from '../../utils/command.js';
|
|
6
6
|
import { formatTextContents } from '../../utils/content.js';
|
|
7
|
-
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
8
7
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
9
8
|
import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
|
|
10
9
|
const inputSchema = {
|
|
@@ -22,12 +21,11 @@ const inputSchema = {
|
|
|
22
21
|
const inputSchemaZodObject = z.object({ ...inputSchema });
|
|
23
22
|
const toolName = 'list-cms-remote-contents';
|
|
24
23
|
export class HsListTool extends Tool {
|
|
25
|
-
constructor(mcpServer) {
|
|
26
|
-
super(mcpServer);
|
|
24
|
+
constructor(mcpServer, logger) {
|
|
25
|
+
super(mcpServer, logger, toolName);
|
|
27
26
|
}
|
|
28
27
|
async handler({ path, account, absoluteCurrentWorkingDirectory, }) {
|
|
29
28
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
30
|
-
await trackToolUsage(toolName);
|
|
31
29
|
let command = 'hs list';
|
|
32
30
|
if (path) {
|
|
33
31
|
command += ` ${path}`;
|
|
@@ -40,6 +38,10 @@ export class HsListTool extends Tool {
|
|
|
40
38
|
return formatTextContents(stdout, stderr);
|
|
41
39
|
}
|
|
42
40
|
catch (error) {
|
|
41
|
+
this.logger.debug(toolName, {
|
|
42
|
+
message: 'Handler caught error',
|
|
43
|
+
error: error instanceof Error ? error.message : String(error),
|
|
44
|
+
});
|
|
43
45
|
return {
|
|
44
46
|
content: [
|
|
45
47
|
{
|
|
@@ -59,6 +61,6 @@ export class HsListTool extends Tool {
|
|
|
59
61
|
readOnlyHint: true,
|
|
60
62
|
openWorldHint: true,
|
|
61
63
|
},
|
|
62
|
-
}, this.
|
|
64
|
+
}, input => this.wrappedHandler(input));
|
|
63
65
|
}
|
|
64
66
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
2
|
+
import { McpLogger } from '../utils/logger.js';
|
|
3
|
+
export declare function registerProjectTools(mcpServer: McpServer, logger: McpLogger): RegisteredTool[];
|
|
4
|
+
export declare function registerCmsTools(mcpServer: McpServer, logger: McpLogger): RegisteredTool[];
|
|
@@ -18,31 +18,31 @@ import { HsCreateFunctionTool } from './cms/HsCreateFunctionTool.js';
|
|
|
18
18
|
import { HsListFunctionsTool } from './cms/HsListFunctionsTool.js';
|
|
19
19
|
import { HsFunctionLogsTool } from './cms/HsFunctionLogsTool.js';
|
|
20
20
|
import { CreateTestAccountTool } from './project/CreateTestAccountTool.js';
|
|
21
|
-
export function registerProjectTools(mcpServer) {
|
|
21
|
+
export function registerProjectTools(mcpServer, logger) {
|
|
22
22
|
return [
|
|
23
|
-
new UploadProjectTools(mcpServer).register(),
|
|
24
|
-
new CreateProjectTool(mcpServer).register(),
|
|
25
|
-
new GuidedWalkthroughTool(mcpServer).register(),
|
|
26
|
-
new CreateTestAccountTool(mcpServer).register(),
|
|
27
|
-
new DeployProjectTool(mcpServer).register(),
|
|
28
|
-
new AddFeatureToProjectTool(mcpServer).register(),
|
|
29
|
-
new ValidateProjectTool(mcpServer).register(),
|
|
30
|
-
new GetConfigValuesTool(mcpServer).register(),
|
|
31
|
-
new DocsSearchTool(mcpServer).register(),
|
|
32
|
-
new DocFetchTool(mcpServer).register(),
|
|
33
|
-
new GetApiUsagePatternsByAppIdTool(mcpServer).register(),
|
|
34
|
-
new GetApplicationInfoTool(mcpServer).register(),
|
|
35
|
-
new GetBuildLogsTool(mcpServer).register(),
|
|
36
|
-
new GetBuildStatusTool(mcpServer).register(),
|
|
23
|
+
new UploadProjectTools(mcpServer, logger).register(),
|
|
24
|
+
new CreateProjectTool(mcpServer, logger).register(),
|
|
25
|
+
new GuidedWalkthroughTool(mcpServer, logger).register(),
|
|
26
|
+
new CreateTestAccountTool(mcpServer, logger).register(),
|
|
27
|
+
new DeployProjectTool(mcpServer, logger).register(),
|
|
28
|
+
new AddFeatureToProjectTool(mcpServer, logger).register(),
|
|
29
|
+
new ValidateProjectTool(mcpServer, logger).register(),
|
|
30
|
+
new GetConfigValuesTool(mcpServer, logger).register(),
|
|
31
|
+
new DocsSearchTool(mcpServer, logger).register(),
|
|
32
|
+
new DocFetchTool(mcpServer, logger).register(),
|
|
33
|
+
new GetApiUsagePatternsByAppIdTool(mcpServer, logger).register(),
|
|
34
|
+
new GetApplicationInfoTool(mcpServer, logger).register(),
|
|
35
|
+
new GetBuildLogsTool(mcpServer, logger).register(),
|
|
36
|
+
new GetBuildStatusTool(mcpServer, logger).register(),
|
|
37
37
|
];
|
|
38
38
|
}
|
|
39
|
-
export function registerCmsTools(mcpServer) {
|
|
39
|
+
export function registerCmsTools(mcpServer, logger) {
|
|
40
40
|
return [
|
|
41
|
-
new HsListTool(mcpServer).register(),
|
|
42
|
-
new HsCreateModuleTool(mcpServer).register(),
|
|
43
|
-
new HsCreateTemplateTool(mcpServer).register(),
|
|
44
|
-
new HsCreateFunctionTool(mcpServer).register(),
|
|
45
|
-
new HsListFunctionsTool(mcpServer).register(),
|
|
46
|
-
new HsFunctionLogsTool(mcpServer).register(),
|
|
41
|
+
new HsListTool(mcpServer, logger).register(),
|
|
42
|
+
new HsCreateModuleTool(mcpServer, logger).register(),
|
|
43
|
+
new HsCreateTemplateTool(mcpServer, logger).register(),
|
|
44
|
+
new HsCreateFunctionTool(mcpServer, logger).register(),
|
|
45
|
+
new HsListFunctionsTool(mcpServer, logger).register(),
|
|
46
|
+
new HsFunctionLogsTool(mcpServer, logger).register(),
|
|
47
47
|
];
|
|
48
48
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { TextContentResponse
|
|
1
|
+
import { TextContentResponse } from '../../types.js';
|
|
2
|
+
import { Tool } from '../../Tool.js';
|
|
2
3
|
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
|
+
import { McpLogger } from '../../utils/logger.js';
|
|
3
5
|
import { z } from 'zod';
|
|
4
6
|
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
7
|
absoluteProjectPath: z.ZodString;
|
|
@@ -20,16 +22,16 @@ declare const inputSchemaZodObject: z.ZodObject<{
|
|
|
20
22
|
"workflow-action-tool": "workflow-action-tool";
|
|
21
23
|
page: "page";
|
|
22
24
|
webhooks: "webhooks";
|
|
23
|
-
"workflow-action": "workflow-action";
|
|
24
25
|
"app-function": "app-function";
|
|
25
|
-
"app-function-endpoint": "app-function-endpoint";
|
|
26
26
|
"app-object": "app-object";
|
|
27
27
|
scim: "scim";
|
|
28
|
+
"workflow-action": "workflow-action";
|
|
29
|
+
"app-function-endpoint": "app-function-endpoint";
|
|
28
30
|
}>>>;
|
|
29
31
|
}, z.core.$strip>;
|
|
30
32
|
export type AddFeatureInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
31
33
|
export declare class AddFeatureToProjectTool extends Tool<AddFeatureInputSchema> {
|
|
32
|
-
constructor(mcpServer: McpServer);
|
|
34
|
+
constructor(mcpServer: McpServer, logger: McpLogger);
|
|
33
35
|
handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, distribution, auth, features, addApp, }: AddFeatureInputSchema): Promise<TextContentResponse>;
|
|
34
36
|
register(): RegisteredTool;
|
|
35
37
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { Tool } from '../../
|
|
1
|
+
import { Tool } from '../../Tool.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { APP_AUTH_TYPES, APP_DISTRIBUTION_TYPES, } from '../../../lib/constants.js';
|
|
4
4
|
import { addFlag } from '../../utils/command.js';
|
|
5
5
|
import { absoluteCurrentWorkingDirectory, absoluteProjectPath, features, } from './constants.js';
|
|
6
6
|
import { runCommandInDir } from '../../utils/command.js';
|
|
7
7
|
import { formatTextContents, formatTextContent } from '../../utils/content.js';
|
|
8
|
-
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
9
8
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
10
9
|
import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
|
|
11
10
|
const inputSchema = {
|
|
@@ -30,13 +29,12 @@ const inputSchemaZodObject = z.object({
|
|
|
30
29
|
});
|
|
31
30
|
const toolName = 'add-feature-to-project';
|
|
32
31
|
export class AddFeatureToProjectTool extends Tool {
|
|
33
|
-
constructor(mcpServer) {
|
|
34
|
-
super(mcpServer);
|
|
32
|
+
constructor(mcpServer, logger) {
|
|
33
|
+
super(mcpServer, logger, toolName);
|
|
35
34
|
}
|
|
36
35
|
async handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, distribution, auth, features, addApp, }) {
|
|
37
36
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
38
37
|
try {
|
|
39
|
-
await trackToolUsage(toolName);
|
|
40
38
|
let command = `hs project add`;
|
|
41
39
|
const content = [];
|
|
42
40
|
if (distribution) {
|
|
@@ -62,6 +60,10 @@ export class AddFeatureToProjectTool extends Tool {
|
|
|
62
60
|
return formatTextContents(stdout, stderr);
|
|
63
61
|
}
|
|
64
62
|
catch (error) {
|
|
63
|
+
this.logger.debug(toolName, {
|
|
64
|
+
message: 'Handler caught error',
|
|
65
|
+
error: error instanceof Error ? error.message : String(error),
|
|
66
|
+
});
|
|
65
67
|
return formatTextContents(getErrorMessage(error));
|
|
66
68
|
}
|
|
67
69
|
}
|
|
@@ -77,6 +79,6 @@ export class AddFeatureToProjectTool extends Tool {
|
|
|
77
79
|
idempotentHint: false,
|
|
78
80
|
openWorldHint: false,
|
|
79
81
|
},
|
|
80
|
-
}, this.
|
|
82
|
+
}, input => this.wrappedHandler(input));
|
|
81
83
|
}
|
|
82
84
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { TextContentResponse
|
|
1
|
+
import { TextContentResponse } from '../../types.js';
|
|
2
|
+
import { Tool } from '../../Tool.js';
|
|
2
3
|
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
|
+
import { McpLogger } from '../../utils/logger.js';
|
|
3
5
|
import { z } from 'zod';
|
|
4
6
|
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
7
|
absoluteCurrentWorkingDirectory: z.ZodString;
|
|
@@ -24,16 +26,16 @@ declare const inputSchemaZodObject: z.ZodObject<{
|
|
|
24
26
|
"workflow-action-tool": "workflow-action-tool";
|
|
25
27
|
page: "page";
|
|
26
28
|
webhooks: "webhooks";
|
|
27
|
-
"workflow-action": "workflow-action";
|
|
28
29
|
"app-function": "app-function";
|
|
29
|
-
"app-function-endpoint": "app-function-endpoint";
|
|
30
30
|
"app-object": "app-object";
|
|
31
31
|
scim: "scim";
|
|
32
|
+
"workflow-action": "workflow-action";
|
|
33
|
+
"app-function-endpoint": "app-function-endpoint";
|
|
32
34
|
}>>>;
|
|
33
35
|
}, z.core.$strip>;
|
|
34
36
|
export type CreateProjectInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
35
37
|
export declare class CreateProjectTool extends Tool<CreateProjectInputSchema> {
|
|
36
|
-
constructor(mcpServer: McpServer);
|
|
38
|
+
constructor(mcpServer: McpServer, logger: McpLogger);
|
|
37
39
|
handler({ name, destination, projectBase, distribution, auth, features, absoluteCurrentWorkingDirectory, }: CreateProjectInputSchema): Promise<TextContentResponse>;
|
|
38
40
|
register(): RegisteredTool;
|
|
39
41
|
}
|