@hanzo/platform-mcp 1.4.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.
Files changed (83) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +534 -0
  3. package/build/http-server.js +286 -0
  4. package/build/index.js +35 -0
  5. package/build/mcp/tools/application/applicationCleanQueues.js +23 -0
  6. package/build/mcp/tools/application/applicationCreate.js +39 -0
  7. package/build/mcp/tools/application/applicationDelete.js +21 -0
  8. package/build/mcp/tools/application/applicationDeploy.js +21 -0
  9. package/build/mcp/tools/application/applicationMarkRunning.js +23 -0
  10. package/build/mcp/tools/application/applicationMove.js +22 -0
  11. package/build/mcp/tools/application/applicationOne.js +26 -0
  12. package/build/mcp/tools/application/applicationReadAppMonitoring.js +26 -0
  13. package/build/mcp/tools/application/applicationReadTraefikConfig.js +26 -0
  14. package/build/mcp/tools/application/applicationRedeploy.js +23 -0
  15. package/build/mcp/tools/application/applicationRefreshToken.js +23 -0
  16. package/build/mcp/tools/application/applicationReload.js +22 -0
  17. package/build/mcp/tools/application/applicationSaveBitbucketProvider.js +49 -0
  18. package/build/mcp/tools/application/applicationSaveBuildType.js +56 -0
  19. package/build/mcp/tools/application/applicationSaveDockerProvider.js +43 -0
  20. package/build/mcp/tools/application/applicationSaveEnvironment.js +33 -0
  21. package/build/mcp/tools/application/applicationSaveGitProvider.js +49 -0
  22. package/build/mcp/tools/application/applicationSaveGiteaProvider.js +43 -0
  23. package/build/mcp/tools/application/applicationSaveGithubProvider.js +51 -0
  24. package/build/mcp/tools/application/applicationSaveGitlabProvider.js +48 -0
  25. package/build/mcp/tools/application/applicationStart.js +21 -0
  26. package/build/mcp/tools/application/applicationStop.js +21 -0
  27. package/build/mcp/tools/application/applicationUpdate.js +319 -0
  28. package/build/mcp/tools/application/applicationUpdateTraefikConfig.js +26 -0
  29. package/build/mcp/tools/application/index.js +24 -0
  30. package/build/mcp/tools/compose/composeCreate.js +31 -0
  31. package/build/mcp/tools/compose/composeDeploy.js +26 -0
  32. package/build/mcp/tools/compose/composeOne.js +24 -0
  33. package/build/mcp/tools/compose/composeReload.js +28 -0
  34. package/build/mcp/tools/compose/composeRemove.js +26 -0
  35. package/build/mcp/tools/compose/composeSaveEnvironment.js +28 -0
  36. package/build/mcp/tools/compose/composeStart.js +26 -0
  37. package/build/mcp/tools/compose/composeStop.js +26 -0
  38. package/build/mcp/tools/compose/composeUpdate.js +34 -0
  39. package/build/mcp/tools/compose/index.js +9 -0
  40. package/build/mcp/tools/index.js +12 -0
  41. package/build/mcp/tools/mysql/index.js +13 -0
  42. package/build/mcp/tools/mysql/mysqlChangeStatus.js +24 -0
  43. package/build/mcp/tools/mysql/mysqlCreate.js +50 -0
  44. package/build/mcp/tools/mysql/mysqlDeploy.js +21 -0
  45. package/build/mcp/tools/mysql/mysqlMove.js +24 -0
  46. package/build/mcp/tools/mysql/mysqlOne.js +23 -0
  47. package/build/mcp/tools/mysql/mysqlRebuild.js +21 -0
  48. package/build/mcp/tools/mysql/mysqlReload.js +22 -0
  49. package/build/mcp/tools/mysql/mysqlRemove.js +21 -0
  50. package/build/mcp/tools/mysql/mysqlSaveEnvironment.js +26 -0
  51. package/build/mcp/tools/mysql/mysqlSaveExternalPort.js +25 -0
  52. package/build/mcp/tools/mysql/mysqlStart.js +21 -0
  53. package/build/mcp/tools/mysql/mysqlStop.js +21 -0
  54. package/build/mcp/tools/mysql/mysqlUpdate.js +103 -0
  55. package/build/mcp/tools/postgres/index.js +13 -0
  56. package/build/mcp/tools/postgres/postgresChangeStatus.js +26 -0
  57. package/build/mcp/tools/postgres/postgresCreate.js +48 -0
  58. package/build/mcp/tools/postgres/postgresDeploy.js +23 -0
  59. package/build/mcp/tools/postgres/postgresMove.js +26 -0
  60. package/build/mcp/tools/postgres/postgresOne.js +26 -0
  61. package/build/mcp/tools/postgres/postgresRebuild.js +23 -0
  62. package/build/mcp/tools/postgres/postgresReload.js +26 -0
  63. package/build/mcp/tools/postgres/postgresRemove.js +23 -0
  64. package/build/mcp/tools/postgres/postgresSaveEnvironment.js +28 -0
  65. package/build/mcp/tools/postgres/postgresSaveExternalPort.js +27 -0
  66. package/build/mcp/tools/postgres/postgresStart.js +23 -0
  67. package/build/mcp/tools/postgres/postgresStop.js +23 -0
  68. package/build/mcp/tools/postgres/postgresUpdate.js +97 -0
  69. package/build/mcp/tools/project/index.js +6 -0
  70. package/build/mcp/tools/project/projectAll.js +68 -0
  71. package/build/mcp/tools/project/projectCreate.js +30 -0
  72. package/build/mcp/tools/project/projectDuplicate.js +54 -0
  73. package/build/mcp/tools/project/projectOne.js +24 -0
  74. package/build/mcp/tools/project/projectRemove.js +21 -0
  75. package/build/mcp/tools/project/projectUpdate.js +39 -0
  76. package/build/mcp/tools/toolFactory.js +60 -0
  77. package/build/server.js +12 -0
  78. package/build/types/platform.js +3 -0
  79. package/build/utils/apiClient.js +126 -0
  80. package/build/utils/clientConfig.js +37 -0
  81. package/build/utils/logger.js +38 -0
  82. package/build/utils/responseFormatter.js +33 -0
  83. package/package.json +63 -0
@@ -0,0 +1,37 @@
1
+ class ConfigManager {
2
+ static instance;
3
+ config = null;
4
+ constructor() { }
5
+ static getInstance() {
6
+ if (!ConfigManager.instance) {
7
+ ConfigManager.instance = new ConfigManager();
8
+ }
9
+ return ConfigManager.instance;
10
+ }
11
+ getConfig() {
12
+ if (!this.config) {
13
+ this.config = this.loadConfig();
14
+ }
15
+ return this.config;
16
+ }
17
+ loadConfig() {
18
+ const platformUrl = process.env.PLATFORM_URL;
19
+ const authToken = process.env.PLATFORM_API_KEY;
20
+ if (!platformUrl) {
21
+ throw new Error("Environment variable PLATFORM_URL is not defined");
22
+ }
23
+ if (!authToken) {
24
+ throw new Error("Environment variable PLATFORM_API_KEY is not defined");
25
+ }
26
+ return {
27
+ platformUrl,
28
+ authToken,
29
+ timeout: parseInt(process.env.PLATFORM_TIMEOUT || "30000", 10),
30
+ retryAttempts: parseInt(process.env.PLATFORM_RETRY_ATTEMPTS || "3", 10),
31
+ retryDelay: parseInt(process.env.PLATFORM_RETRY_DELAY || "1000", 10),
32
+ };
33
+ }
34
+ }
35
+ export function getClientConfig() {
36
+ return ConfigManager.getInstance().getConfig();
37
+ }
@@ -0,0 +1,38 @@
1
+ export var LogLevel;
2
+ (function (LogLevel) {
3
+ LogLevel["ERROR"] = "error";
4
+ LogLevel["WARN"] = "warn";
5
+ LogLevel["INFO"] = "info";
6
+ LogLevel["DEBUG"] = "debug";
7
+ })(LogLevel || (LogLevel = {}));
8
+ class Logger {
9
+ context;
10
+ constructor(context = "MCP-Server") {
11
+ this.context = context;
12
+ }
13
+ log(level, message, meta) {
14
+ const entry = {
15
+ level,
16
+ message,
17
+ timestamp: new Date().toISOString(),
18
+ context: { service: this.context, ...meta },
19
+ };
20
+ // eslint-disable-next-line no-console
21
+ console.error(JSON.stringify(entry));
22
+ }
23
+ error(message, meta) {
24
+ this.log(LogLevel.ERROR, message, meta);
25
+ }
26
+ warn(message, meta) {
27
+ this.log(LogLevel.WARN, message, meta);
28
+ }
29
+ info(message, meta) {
30
+ this.log(LogLevel.INFO, message, meta);
31
+ }
32
+ debug(message, meta) {
33
+ this.log(LogLevel.DEBUG, message, meta);
34
+ }
35
+ }
36
+ export function createLogger(context) {
37
+ return new Logger(context);
38
+ }
@@ -0,0 +1,33 @@
1
+ export class ResponseFormatter {
2
+ static success(message, data) {
3
+ const responseData = {
4
+ success: true,
5
+ message,
6
+ ...(data && typeof data === "object" && data !== null ? { data } : {}),
7
+ };
8
+ return {
9
+ content: [
10
+ {
11
+ type: "text",
12
+ text: JSON.stringify(responseData, null, 2),
13
+ },
14
+ ],
15
+ };
16
+ }
17
+ static error(message, details) {
18
+ const errorData = {
19
+ success: false,
20
+ error: message,
21
+ ...(details && { details }),
22
+ };
23
+ return {
24
+ isError: true,
25
+ content: [
26
+ {
27
+ type: "text",
28
+ text: JSON.stringify(errorData, null, 2),
29
+ },
30
+ ],
31
+ };
32
+ }
33
+ }
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@hanzo/platform-mcp",
3
+ "version": "1.4.0",
4
+ "description": "MCP Server for Hanzo API",
5
+ "main": "build/index.js",
6
+ "bin": {
7
+ "platform-mcp": "build/index.js"
8
+ },
9
+ "files": [
10
+ "build"
11
+ ],
12
+ "scripts": {
13
+ "build": "npm run clean && tsc && chmod 755 build/index.js",
14
+ "dev": "tsc --watch",
15
+ "start:stdio": "node build/index.js",
16
+ "start:http": "node build/index.js --http",
17
+ "start:sse": "node build/index.js --sse",
18
+ "dev:http": "npm run build && npm run start:http",
19
+ "dev:sse": "npm run build && npm run start:sse",
20
+ "lint": "eslint src/**/*.ts",
21
+ "lint:fix": "eslint src/**/*.ts --fix",
22
+ "format": "prettier --write src/**/*.{ts,js,json}",
23
+ "format:check": "prettier --check src/**/*.{ts,js,json}",
24
+ "type-check": "tsc --noEmit",
25
+ "clean": "rm -rf build",
26
+ "precommit": "npm run lint && npm run format:check && npm run type-check",
27
+ "test": "echo \"Error: no test specified\" && exit 1"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/hanzoai/platform.git"
32
+ },
33
+ "keywords": [
34
+ "modelcontextprotocol",
35
+ "mcp",
36
+ "platform"
37
+ ],
38
+ "author": "Henrique Andrade <developer@henriqueandrade.dev>",
39
+ "bugs": {
40
+ "url": "https://github.com/hanzoai/mcp/issues"
41
+ },
42
+ "homepage": "https://github.com/hanzoai/mcp#readme",
43
+ "license": "Apache-2.0",
44
+ "type": "module",
45
+ "dependencies": {
46
+ "@modelcontextprotocol/sdk": "^1.12.0",
47
+ "axios": "^1.9.0",
48
+ "express": "^5.1.0",
49
+ "zod": "^3.25.28"
50
+ },
51
+ "devDependencies": {
52
+ "@types/eslint": "^9.6.1",
53
+ "@types/express": "^5.0.2",
54
+ "@types/node": "^22.15.21",
55
+ "@typescript-eslint/eslint-plugin": "^8.32.1",
56
+ "@typescript-eslint/parser": "^8.32.1",
57
+ "eslint": "^9.27.0",
58
+ "eslint-config-prettier": "^10.1.5",
59
+ "eslint-plugin-prettier": "^5.4.1",
60
+ "prettier": "^3.5.3",
61
+ "typescript": "^5.8.3"
62
+ }
63
+ }