@restforgejs/mcp-server 1.2.3 → 1.2.4
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/dist/server.js +52 -7
- package/dist/server.js.map +1 -1
- package/dist/tools/codegen/create-kafka-consumer.d.ts +2 -0
- package/dist/tools/codegen/create-kafka-consumer.js +140 -0
- package/dist/tools/codegen/create-kafka-consumer.js.map +1 -0
- package/dist/tools/codegen/create-processor.d.ts +2 -0
- package/dist/tools/codegen/create-processor.js +157 -0
- package/dist/tools/codegen/create-processor.js.map +1 -0
- package/dist/tools/codegen/generate-test.d.ts +2 -0
- package/dist/tools/codegen/generate-test.js +149 -0
- package/dist/tools/codegen/generate-test.js.map +1 -0
- package/dist/tools/codegen/index.js +6 -0
- package/dist/tools/codegen/index.js.map +1 -1
- package/dist/tools/codegen/migrate-payload.js +3 -0
- package/dist/tools/codegen/migrate-payload.js.map +1 -1
- package/dist/tools/data/index.d.ts +2 -0
- package/dist/tools/data/index.js +7 -0
- package/dist/tools/data/index.js.map +1 -0
- package/dist/tools/data/pull.d.ts +2 -0
- package/dist/tools/data/pull.js +202 -0
- package/dist/tools/data/pull.js.map +1 -0
- package/dist/tools/data/push.d.ts +2 -0
- package/dist/tools/data/push.js +190 -0
- package/dist/tools/data/push.js.map +1 -0
- package/dist/tools/key/generate.d.ts +2 -0
- package/dist/tools/key/generate.js +130 -0
- package/dist/tools/key/generate.js.map +1 -0
- package/dist/tools/key/index.d.ts +2 -0
- package/dist/tools/key/index.js +9 -0
- package/dist/tools/key/index.js.map +1 -0
- package/dist/tools/key/list.d.ts +2 -0
- package/dist/tools/key/list.js +126 -0
- package/dist/tools/key/list.js.map +1 -0
- package/dist/tools/key/revoke.d.ts +2 -0
- package/dist/tools/key/revoke.js +117 -0
- package/dist/tools/key/revoke.js.map +1 -0
- package/dist/tools/project/delete.d.ts +2 -0
- package/dist/tools/project/delete.js +116 -0
- package/dist/tools/project/delete.js.map +1 -0
- package/dist/tools/project/index.d.ts +2 -0
- package/dist/tools/project/index.js +7 -0
- package/dist/tools/project/index.js.map +1 -0
- package/dist/tools/project/list.d.ts +2 -0
- package/dist/tools/project/list.js +107 -0
- package/dist/tools/project/list.js.map +1 -0
- package/dist/tools/setup/clear-default-config.d.ts +2 -0
- package/dist/tools/setup/clear-default-config.js +104 -0
- package/dist/tools/setup/clear-default-config.js.map +1 -0
- package/dist/tools/setup/get-default-config.d.ts +2 -0
- package/dist/tools/setup/get-default-config.js +104 -0
- package/dist/tools/setup/get-default-config.js.map +1 -0
- package/dist/tools/setup/index.js +8 -0
- package/dist/tools/setup/index.js.map +1 -1
- package/dist/tools/setup/init-config.js +3 -5
- package/dist/tools/setup/init-config.js.map +1 -1
- package/dist/tools/setup/list-configs.d.ts +2 -0
- package/dist/tools/setup/list-configs.js +104 -0
- package/dist/tools/setup/list-configs.js.map +1 -0
- package/dist/tools/setup/set-default-config.d.ts +2 -0
- package/dist/tools/setup/set-default-config.js +109 -0
- package/dist/tools/setup/set-default-config.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { access } from 'node:fs/promises';
|
|
3
|
+
import { resolve, join } from 'node:path';
|
|
4
|
+
import { execProcess } from '../../lib/exec.js';
|
|
5
|
+
export function registerSetupGetDefaultConfig(server) {
|
|
6
|
+
server.registerTool('setup_get_default_config', {
|
|
7
|
+
title: 'Get Default Config',
|
|
8
|
+
description: `Show the active default config file for the current working directory, by wrapping restforge config get-default.
|
|
9
|
+
|
|
10
|
+
USE WHEN:
|
|
11
|
+
- The user asks which config is the default, e.g. "config default-nya apa", "show default config", "lihat default config aktif"
|
|
12
|
+
|
|
13
|
+
DO NOT USE FOR:
|
|
14
|
+
- Setting the default -> use 'setup_set_default_config'
|
|
15
|
+
- Clearing the default -> use 'setup_clear_default_config'
|
|
16
|
+
- Listing all .env files -> use 'setup_list_configs'
|
|
17
|
+
|
|
18
|
+
This tool runs: npx restforge config get-default in the given cwd (outputs JSON).
|
|
19
|
+
|
|
20
|
+
Preconditions:
|
|
21
|
+
- The project must have @restforgejs/platform installed in node_modules.
|
|
22
|
+
|
|
23
|
+
PRESENTATION GUIDANCE:
|
|
24
|
+
- Match the user's language. Never mention internal tool names; describe the action.
|
|
25
|
+
- Tell the user which file is the default (or that none is set). Keep it concise.
|
|
26
|
+
- When a precondition is not met, frame it as a question or next-step suggestion rather than an error.`,
|
|
27
|
+
inputSchema: {
|
|
28
|
+
cwd: z.string().min(1).describe('Absolute path of the project folder (must have @restforgejs/platform installed)'),
|
|
29
|
+
},
|
|
30
|
+
annotations: {
|
|
31
|
+
title: 'Get Default Config',
|
|
32
|
+
readOnlyHint: true,
|
|
33
|
+
idempotentHint: true,
|
|
34
|
+
},
|
|
35
|
+
}, async ({ cwd }) => {
|
|
36
|
+
const projectCwd = resolve(cwd);
|
|
37
|
+
try {
|
|
38
|
+
await access(join(projectCwd, 'node_modules', '@restforgejs', 'platform'));
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return {
|
|
42
|
+
content: [
|
|
43
|
+
{
|
|
44
|
+
type: 'text',
|
|
45
|
+
text: `Precondition not met: the RESTForge package is not installed in this project.
|
|
46
|
+
|
|
47
|
+
Project path: ${projectCwd}
|
|
48
|
+
Expected location: node_modules/@restforgejs/platform
|
|
49
|
+
|
|
50
|
+
For the assistant:
|
|
51
|
+
- The user needs to install the RESTForge package first, then retry. Do not mention internal tool names.`,
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
isError: false,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const result = await execProcess('npx', ['restforge', 'config', 'get-default'], { cwd: projectCwd, timeout: 30_000 });
|
|
58
|
+
if (!result.success) {
|
|
59
|
+
return {
|
|
60
|
+
content: [
|
|
61
|
+
{
|
|
62
|
+
type: 'text',
|
|
63
|
+
text: `Failed to get the default config.
|
|
64
|
+
|
|
65
|
+
Project path: ${projectCwd}
|
|
66
|
+
Command: ${result.command}
|
|
67
|
+
Exit code: ${result.exitCode}
|
|
68
|
+
|
|
69
|
+
--- CLI output ---
|
|
70
|
+
stdout:
|
|
71
|
+
${result.stdout}
|
|
72
|
+
|
|
73
|
+
stderr:
|
|
74
|
+
${result.stderr}
|
|
75
|
+
--- end CLI output ---
|
|
76
|
+
|
|
77
|
+
For the assistant:
|
|
78
|
+
- Tell the user the default config could not be read; summarise the likely cause. Do not paste raw output unless asked. Do not mention internal tool names.`,
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
isError: true,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
content: [
|
|
86
|
+
{
|
|
87
|
+
type: 'text',
|
|
88
|
+
text: `Default config retrieved.
|
|
89
|
+
|
|
90
|
+
Project path: ${projectCwd}
|
|
91
|
+
Command: ${result.command}
|
|
92
|
+
|
|
93
|
+
--- CLI output ---
|
|
94
|
+
${result.stdout}
|
|
95
|
+
--- end CLI output ---
|
|
96
|
+
|
|
97
|
+
For the assistant:
|
|
98
|
+
- Read the JSON and tell the user which file is the active default for this directory, or that none is set. Keep it concise. Do not mention internal tool names.`,
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=get-default-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-default-config.js","sourceRoot":"","sources":["../../../src/tools/setup/get-default-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,UAAU,6BAA6B,CAAC,MAAiB;IAC7D,MAAM,CAAC,YAAY,CACj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AAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;;gBAEF,UAAU;WACf,MAAM,CAAC,OAAO;;;EAGvB,MAAM,CAAC,MAAM;;;;iKAIkJ;iBACtJ;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -7,6 +7,10 @@ import { registerSetupUpdateEnv } from './update-env.js';
|
|
|
7
7
|
import { registerSetupValidateConfig } from './validate-config.js';
|
|
8
8
|
import { registerSetupGetConfigSchema } from './get-config-schema.js';
|
|
9
9
|
import { registerSetupGetInitTemplate } from './get-init-template.js';
|
|
10
|
+
import { registerSetupSetDefaultConfig } from './set-default-config.js';
|
|
11
|
+
import { registerSetupGetDefaultConfig } from './get-default-config.js';
|
|
12
|
+
import { registerSetupClearDefaultConfig } from './clear-default-config.js';
|
|
13
|
+
import { registerSetupListConfigs } from './list-configs.js';
|
|
10
14
|
export function registerSetupTools(server) {
|
|
11
15
|
registerSetupCreateFolder(server);
|
|
12
16
|
registerSetupInstallPackage(server);
|
|
@@ -17,5 +21,9 @@ export function registerSetupTools(server) {
|
|
|
17
21
|
registerSetupValidateConfig(server);
|
|
18
22
|
registerSetupGetConfigSchema(server);
|
|
19
23
|
registerSetupGetInitTemplate(server);
|
|
24
|
+
registerSetupSetDefaultConfig(server);
|
|
25
|
+
registerSetupGetDefaultConfig(server);
|
|
26
|
+
registerSetupClearDefaultConfig(server);
|
|
27
|
+
registerSetupListConfigs(server);
|
|
20
28
|
}
|
|
21
29
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/setup/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,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M,CAAC,CAAC;IAChC,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC9B,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC7B,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC/B,2BAA2B,CAAC,MAAM,CAAC,CAAC;IACpC,4BAA4B,CAAC,MAAM,CAAC,CAAC;IACrC,4BAA4B,CAAC,MAAM,CAAC,CAAC;IACrC,6BAA6B,CAAC,MAAM,CAAC,CAAC;IACtC,6BAA6B,CAAC,MAAM,CAAC,CAAC;IACtC,+BAA+B,CAAC,MAAM,CAAC,CAAC;IACxC,wBAAwB,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -5,11 +5,11 @@ import { execProcess } from '../../lib/exec.js';
|
|
|
5
5
|
export function registerSetupInitConfig(server) {
|
|
6
6
|
server.registerTool('setup_init_config', {
|
|
7
7
|
title: 'Init RESTForge Config',
|
|
8
|
-
description: `Generate skeleton config
|
|
8
|
+
description: `Generate a skeleton config file in the project folder via restforge.
|
|
9
9
|
|
|
10
10
|
USE WHEN:
|
|
11
11
|
- The project has @restforgejs/platform installed in node_modules
|
|
12
|
-
- The config/
|
|
12
|
+
- The config/ folder does not exist yet, or you want to reset it to the default template
|
|
13
13
|
- Starting RESTForge project configuration from scratch
|
|
14
14
|
|
|
15
15
|
DO NOT USE FOR:
|
|
@@ -17,7 +17,7 @@ DO NOT USE FOR:
|
|
|
17
17
|
- Filling in credentials in db-connection.env -> use 'setup_write_env'
|
|
18
18
|
|
|
19
19
|
This tool runs: npx restforge init in the given cwd.
|
|
20
|
-
Output: config/db-connection.env (empty template)
|
|
20
|
+
Output: config/db-connection.env (empty template).
|
|
21
21
|
|
|
22
22
|
PRESENTATION GUIDANCE:
|
|
23
23
|
- Match the user's language. If the user writes in Indonesian, respond in Indonesian.
|
|
@@ -101,8 +101,6 @@ For the assistant:
|
|
|
101
101
|
Project path: ${projectCwd}
|
|
102
102
|
Files created:
|
|
103
103
|
- config/db-connection.env (empty template, awaiting credentials)
|
|
104
|
-
- payload/samples.json
|
|
105
|
-
- payload/query/samples-datatables.sql
|
|
106
104
|
|
|
107
105
|
--- CLI output ---
|
|
108
106
|
${result.stdout}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-config.js","sourceRoot":"","sources":["../../../src/tools/setup/init-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,UAAU,uBAAuB,CAAC,MAAiB;IACvD,MAAM,CAAC,YAAY,CACjB,mBAAmB,EACnB;QACE,KAAK,EAAE,uBAAuB;QAC9B,WAAW,EAAE;;;;;;;;;;;;;;;;;;uGAkBoF;QACjG,WAAW,EAAE;YACX,GAAG,EAAE,CAAC;iBACH,MAAM,EAAE;iBACR,GAAG,CAAC,CAAC,CAAC;iBACN,QAAQ,CAAC,qCAAqC,CAAC;SACnD;QACD,WAAW,EAAE;YACX,KAAK,EAAE,aAAa;YACpB,YAAY,EAAE,KAAK;YACnB,cAAc,EAAE,KAAK;SACtB;KACF,EACD,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;QAChB,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAEhC,6EAA6E;QAC7E,oEAAoE;QACpE,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC;QAC7E,CAAC;QAAC,MAAM,CAAC;YACP,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE;;gBAEJ,UAAU;;;;;;gKAMsI;qBACnJ;iBACF;gBACD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,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { access } from 'node:fs/promises';
|
|
3
|
+
import { resolve, join } from 'node:path';
|
|
4
|
+
import { execProcess } from '../../lib/exec.js';
|
|
5
|
+
export function registerSetupListConfigs(server) {
|
|
6
|
+
server.registerTool('setup_list_configs', {
|
|
7
|
+
title: 'List Config Files',
|
|
8
|
+
description: `List the .env config files available in the working directory and the config/ folder, by wrapping restforge config list.
|
|
9
|
+
|
|
10
|
+
USE WHEN:
|
|
11
|
+
- The user asks which config files exist, e.g. "config apa saja yang ada", "list .env files", "daftar config", "lihat file config"
|
|
12
|
+
- Before choosing a config to set as default or to pass to a command
|
|
13
|
+
|
|
14
|
+
DO NOT USE FOR:
|
|
15
|
+
- Showing/setting the DEFAULT config -> use 'setup_get_default_config' / 'setup_set_default_config'
|
|
16
|
+
- Reading the values inside a config -> use 'setup_read_env'
|
|
17
|
+
|
|
18
|
+
This tool runs: npx restforge config list in the given cwd (outputs JSON).
|
|
19
|
+
|
|
20
|
+
Preconditions:
|
|
21
|
+
- The project must have @restforgejs/platform installed in node_modules.
|
|
22
|
+
|
|
23
|
+
PRESENTATION GUIDANCE:
|
|
24
|
+
- Match the user's language. Never mention internal tool names; describe the action.
|
|
25
|
+
- Summarise the available .env files and where they are. Keep it concise.
|
|
26
|
+
- When a precondition is not met, frame it as a question or next-step suggestion rather than an error.`,
|
|
27
|
+
inputSchema: {
|
|
28
|
+
cwd: z.string().min(1).describe('Absolute path of the project folder (must have @restforgejs/platform installed)'),
|
|
29
|
+
},
|
|
30
|
+
annotations: {
|
|
31
|
+
title: 'List Config Files',
|
|
32
|
+
readOnlyHint: true,
|
|
33
|
+
idempotentHint: true,
|
|
34
|
+
},
|
|
35
|
+
}, async ({ cwd }) => {
|
|
36
|
+
const projectCwd = resolve(cwd);
|
|
37
|
+
try {
|
|
38
|
+
await access(join(projectCwd, 'node_modules', '@restforgejs', 'platform'));
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return {
|
|
42
|
+
content: [
|
|
43
|
+
{
|
|
44
|
+
type: 'text',
|
|
45
|
+
text: `Precondition not met: the RESTForge package is not installed in this project.
|
|
46
|
+
|
|
47
|
+
Project path: ${projectCwd}
|
|
48
|
+
Expected location: node_modules/@restforgejs/platform
|
|
49
|
+
|
|
50
|
+
For the assistant:
|
|
51
|
+
- The user needs to install the RESTForge package first, then retry. Do not mention internal tool names.`,
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
isError: false,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const result = await execProcess('npx', ['restforge', 'config', 'list'], { cwd: projectCwd, timeout: 30_000 });
|
|
58
|
+
if (!result.success) {
|
|
59
|
+
return {
|
|
60
|
+
content: [
|
|
61
|
+
{
|
|
62
|
+
type: 'text',
|
|
63
|
+
text: `Failed to list config files.
|
|
64
|
+
|
|
65
|
+
Project path: ${projectCwd}
|
|
66
|
+
Command: ${result.command}
|
|
67
|
+
Exit code: ${result.exitCode}
|
|
68
|
+
|
|
69
|
+
--- CLI output ---
|
|
70
|
+
stdout:
|
|
71
|
+
${result.stdout}
|
|
72
|
+
|
|
73
|
+
stderr:
|
|
74
|
+
${result.stderr}
|
|
75
|
+
--- end CLI output ---
|
|
76
|
+
|
|
77
|
+
For the assistant:
|
|
78
|
+
- Tell the user the config files could not be listed; summarise the likely cause. Do not paste raw output unless asked. Do not mention internal tool names.`,
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
isError: true,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
content: [
|
|
86
|
+
{
|
|
87
|
+
type: 'text',
|
|
88
|
+
text: `Config files listed.
|
|
89
|
+
|
|
90
|
+
Project path: ${projectCwd}
|
|
91
|
+
Command: ${result.command}
|
|
92
|
+
|
|
93
|
+
--- CLI output ---
|
|
94
|
+
${result.stdout}
|
|
95
|
+
--- end CLI output ---
|
|
96
|
+
|
|
97
|
+
For the assistant:
|
|
98
|
+
- Read the JSON and tell the user which .env files are available (in cwd and config/). Keep it concise. Do not mention internal tool names.`,
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=list-configs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-configs.js","sourceRoot":"","sources":["../../../src/tools/setup/list-configs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,UAAU,wBAAwB,CAAC,MAAiB;IACxD,MAAM,CAAC,YAAY,CACjB,oBAAoB,EACpB;QACE,KAAK,EAAE,mBAAmB;QAC1B,WAAW,EAAE;;;;;;;;;;;;;;;;;;uGAkBoF;QACjG,WAAW,EAAE;YACX,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,iFAAiF,CAAC;SACnH;QACD,WAAW,EAAE;YACX,KAAK,EAAE,mBAAmB;YAC1B,YAAY,EAAE,IAAI;YAClB,cAAc,EAAE,IAAI;SACrB;KACF,EACD,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;QAChB,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC;QAC7E,CAAC;QAAC,MAAM,CAAC;YACP,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE;;gBAEJ,UAAU;;;;yGAI+E;qBAC5F;iBACF;gBACD,OAAO,EAAE,KAAK;aACf,CAAC;QACJ,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;QAE/G,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE;;gBAEJ,UAAU;WACf,MAAM,CAAC,OAAO;aACZ,MAAM,CAAC,QAAQ;;;;EAI1B,MAAM,CAAC,MAAM;;;EAGb,MAAM,CAAC,MAAM;;;;4JAI6I;qBAC/I;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;;gBAEF,UAAU;WACf,MAAM,CAAC,OAAO;;;EAGvB,MAAM,CAAC,MAAM;;;;4IAI6H;iBACjI;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { access } from 'node:fs/promises';
|
|
3
|
+
import { resolve, join } from 'node:path';
|
|
4
|
+
import { execProcess } from '../../lib/exec.js';
|
|
5
|
+
export function registerSetupSetDefaultConfig(server) {
|
|
6
|
+
server.registerTool('setup_set_default_config', {
|
|
7
|
+
title: 'Set Default Config',
|
|
8
|
+
description: `Set a config file as the default for the current working directory (stored in .restforge/defaults.json), by wrapping restforge config set-default. Other commands then fall back to this config when --config is not given.
|
|
9
|
+
|
|
10
|
+
USE WHEN:
|
|
11
|
+
- The user wants to pin/set a default config for a project, e.g. "set default config", "jadikan db.env sebagai default", "pakai config ini sebagai default"
|
|
12
|
+
- To avoid passing --config on every command
|
|
13
|
+
|
|
14
|
+
DO NOT USE FOR:
|
|
15
|
+
- Showing the current default -> use 'setup_get_default_config'
|
|
16
|
+
- Removing the default -> use 'setup_clear_default_config'
|
|
17
|
+
- Writing credentials into the .env -> use 'setup_write_env'
|
|
18
|
+
|
|
19
|
+
This tool runs: npx restforge config set-default --config=<config> in the given cwd. The config is looked up as: cwd -> config/ folder -> with +.env extension.
|
|
20
|
+
|
|
21
|
+
Preconditions:
|
|
22
|
+
- The project must have @restforgejs/platform installed in node_modules.
|
|
23
|
+
|
|
24
|
+
PRESENTATION GUIDANCE:
|
|
25
|
+
- Match the user's language. Never mention internal tool names; describe the action (e.g. "set the default config").
|
|
26
|
+
- Confirm which file is now the default. Keep the reply concise.
|
|
27
|
+
- When a precondition is not met, frame it as a question or next-step suggestion rather than an error.`,
|
|
28
|
+
inputSchema: {
|
|
29
|
+
cwd: z.string().min(1).describe('Absolute path of the project folder (must have @restforgejs/platform installed)'),
|
|
30
|
+
config: z.string().min(1).describe('Config file to set as default. REQUIRED. Looked up: cwd -> config/ -> +.env.'),
|
|
31
|
+
},
|
|
32
|
+
annotations: {
|
|
33
|
+
title: 'Set Default Config',
|
|
34
|
+
readOnlyHint: false,
|
|
35
|
+
idempotentHint: true,
|
|
36
|
+
destructiveHint: false,
|
|
37
|
+
},
|
|
38
|
+
}, async ({ cwd, config }) => {
|
|
39
|
+
const projectCwd = resolve(cwd);
|
|
40
|
+
try {
|
|
41
|
+
await access(join(projectCwd, 'node_modules', '@restforgejs', 'platform'));
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return {
|
|
45
|
+
content: [
|
|
46
|
+
{
|
|
47
|
+
type: 'text',
|
|
48
|
+
text: `Precondition not met: the RESTForge package is not installed in this project.
|
|
49
|
+
|
|
50
|
+
Project path: ${projectCwd}
|
|
51
|
+
Expected location: node_modules/@restforgejs/platform
|
|
52
|
+
|
|
53
|
+
For the assistant:
|
|
54
|
+
- The user needs to install the RESTForge package first, then retry. Do not mention internal tool names.`,
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
isError: false,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const result = await execProcess('npx', ['restforge', 'config', 'set-default', `--config=${config}`], { cwd: projectCwd, timeout: 30_000 });
|
|
61
|
+
if (!result.success) {
|
|
62
|
+
return {
|
|
63
|
+
content: [
|
|
64
|
+
{
|
|
65
|
+
type: 'text',
|
|
66
|
+
text: `Failed to set the default config.
|
|
67
|
+
|
|
68
|
+
Project path: ${projectCwd}
|
|
69
|
+
Config: ${config}
|
|
70
|
+
Command: ${result.command}
|
|
71
|
+
Exit code: ${result.exitCode}
|
|
72
|
+
|
|
73
|
+
--- CLI output ---
|
|
74
|
+
stdout:
|
|
75
|
+
${result.stdout}
|
|
76
|
+
|
|
77
|
+
stderr:
|
|
78
|
+
${result.stderr}
|
|
79
|
+
--- end CLI output ---
|
|
80
|
+
|
|
81
|
+
For the assistant:
|
|
82
|
+
- Tell the user the default config was not set; summarise the likely cause (e.g. the config file was not found in cwd or config/). Do not paste raw output unless asked. Do not mention internal tool names.`,
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
isError: true,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
content: [
|
|
90
|
+
{
|
|
91
|
+
type: 'text',
|
|
92
|
+
text: `Default config set.
|
|
93
|
+
|
|
94
|
+
Project path: ${projectCwd}
|
|
95
|
+
Config: ${config}
|
|
96
|
+
Command: ${result.command}
|
|
97
|
+
|
|
98
|
+
--- CLI output ---
|
|
99
|
+
${result.stdout}
|
|
100
|
+
--- end CLI output ---
|
|
101
|
+
|
|
102
|
+
For the assistant:
|
|
103
|
+
- Confirm the named file is now the default config for this working directory (stored in .restforge/defaults.json). Other commands will use it when no config is specified. Keep the reply concise. Do not mention internal tool names.`,
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=set-default-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-default-config.js","sourceRoot":"","sources":["../../../src/tools/setup/set-default-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,UAAU,6BAA6B,CAAC,MAAiB;IAC7D,MAAM,CAAC,YAAY,CACjB,0BAA0B,EAC1B;QACE,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EAAE;;;;;;;;;;;;;;;;;;;uGAmBoF;QACjG,WAAW,EAAE;YACX,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,iFAAiF,CAAC;YAClH,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,8EAA8E,CAAC;SACnH;QACD,WAAW,EAAE;YACX,KAAK,EAAE,oBAAoB;YAC3B,YAAY,EAAE,KAAK;YACnB,cAAc,EAAE,IAAI;YACpB,eAAe,EAAE,KAAK;SACvB;KACF,EACD,KAAK,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE;QACxB,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC;QAC7E,CAAC;QAAC,MAAM,CAAC;YACP,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE;;gBAEJ,UAAU;;;;yGAI+E;qBAC5F;iBACF;gBACD,OAAO,EAAE,KAAK;aACf,CAAC;QACJ,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,MAAM,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;QAE5I,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE;;gBAEJ,UAAU;UAChB,MAAM;WACL,MAAM,CAAC,OAAO;aACZ,MAAM,CAAC,QAAQ;;;;EAI1B,MAAM,CAAC,MAAM;;;EAGb,MAAM,CAAC,MAAM;;;;6MAI8L;qBAChM;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;;gBAEF,UAAU;UAChB,MAAM;WACL,MAAM,CAAC,OAAO;;;EAGvB,MAAM,CAAC,MAAM;;;;wOAIyN;iBAC7N;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@restforgejs/mcp-server",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "RESTForge MCP Server — Model Context Protocol server that exposes RESTForge Platform commands to AI agents (Claude Desktop, Cursor, Claude CLI, and other MCP clients). Orchestrates project setup, code generation, and runtime launch via natural language. A thin orchestrator for the RESTForge Platform CLI, not a generic MCP framework or API testing tool.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|