@webiny/mcp 0.0.0-unstable.f6dc066313
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/Extension.d.ts +2 -0
- package/Extension.js +11 -0
- package/Extension.js.map +1 -0
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/agents/claude.d.ts +15 -0
- package/agents/claude.js +33 -0
- package/agents/claude.js.map +1 -0
- package/agents/cline.d.ts +17 -0
- package/agents/cline.js +29 -0
- package/agents/cline.js.map +1 -0
- package/agents/copilot.d.ts +17 -0
- package/agents/copilot.js +64 -0
- package/agents/copilot.js.map +1 -0
- package/agents/cursor.d.ts +15 -0
- package/agents/cursor.js +33 -0
- package/agents/cursor.js.map +1 -0
- package/agents/instructions.d.ts +7 -0
- package/agents/instructions.js +13 -0
- package/agents/instructions.js.map +1 -0
- package/agents/shared.d.ts +41 -0
- package/agents/shared.js +124 -0
- package/agents/shared.js.map +1 -0
- package/agents/windsurf.d.ts +15 -0
- package/agents/windsurf.js +33 -0
- package/agents/windsurf.js.map +1 -0
- package/cli/ConfigureMcp.d.ts +15 -0
- package/cli/ConfigureMcp.js +57 -0
- package/cli/ConfigureMcp.js.map +1 -0
- package/cli/McpServer.d.ts +12 -0
- package/cli/McpServer.js +239 -0
- package/cli/McpServer.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +3 -0
- package/index.js.map +1 -0
- package/package.json +49 -0
- package/skills/admin-ui-extensions/SKILL.md +267 -0
- package/skills/cli-extensions/SKILL.md +133 -0
- package/skills/content-models/SKILL.md +306 -0
- package/skills/custom-graphql-api/SKILL.md +199 -0
- package/skills/dependency-injection/SKILL.md +252 -0
- package/skills/infrastructure-extensions/SKILL.md +192 -0
- package/skills/lifecycle-events/SKILL.md +203 -0
- package/skills/local-development/SKILL.md +245 -0
- package/skills/project-structure/SKILL.md +156 -0
- package/skills/webiny-sdk/SKILL.md +271 -0
- package/skills/website-builder/SKILL.md +384 -0
package/Extension.d.ts
ADDED
package/Extension.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CliCommand } from "@webiny/cli-core/extensions/index.js";
|
|
3
|
+
export const McpExtension = () => {
|
|
4
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CliCommand, {
|
|
5
|
+
src: import.meta.dirname + "/cli/ConfigureMcp.js"
|
|
6
|
+
}), /*#__PURE__*/React.createElement(CliCommand, {
|
|
7
|
+
src: import.meta.dirname + "/cli/McpServer.js"
|
|
8
|
+
}));
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=Extension.js.map
|
package/Extension.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","CliCommand","McpExtension","createElement","Fragment","src","import","meta","dirname"],"sources":["Extension.tsx"],"sourcesContent":["import React from \"react\";\nimport { CliCommand } from \"@webiny/cli-core/extensions/index.js\";\n\nexport const McpExtension = () => {\n return (\n <>\n <CliCommand src={import.meta.dirname + \"/cli/ConfigureMcp.js\"} />\n <CliCommand src={import.meta.dirname + \"/cli/McpServer.js\"} />\n </>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,sCAAsC;AAEjE,OAAO,MAAMC,YAAY,GAAGA,CAAA,KAAM;EAC9B,oBACIF,KAAA,CAAAG,aAAA,CAAAH,KAAA,CAAAI,QAAA,qBACIJ,KAAA,CAAAG,aAAA,CAACF,UAAU;IAACI,GAAG,EAAEC,MAAM,CAACC,IAAI,CAACC,OAAO,GAAG;EAAuB,CAAE,CAAC,eACjER,KAAA,CAAAG,aAAA,CAACF,UAAU;IAACI,GAAG,EAAEC,MAAM,CAACC,IAAI,CAACC,OAAO,GAAG;EAAoB,CAAE,CAC/D,CAAC;AAEX,CAAC","ignoreList":[]}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Webiny
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# @webiny/mcp
|
|
2
|
+
|
|
3
|
+
> [!NOTE]
|
|
4
|
+
> This package is part of the [Webiny](https://www.webiny.com) monorepo.
|
|
5
|
+
> Itβs **included in every Webiny project by default** and is not meant to be used as a standalone package.
|
|
6
|
+
|
|
7
|
+
π **Documentation:** [https://www.webiny.com/docs](https://www.webiny.com/docs)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
_This README file is automatically generated during the publish process._
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent adapter: Claude Code
|
|
3
|
+
*
|
|
4
|
+
* MCP config : .mcp.json (project-level, checked into git)
|
|
5
|
+
* Hint file : CLAUDE.md (Claude Code reads this automatically each session)
|
|
6
|
+
*
|
|
7
|
+
* Docs: https://docs.anthropic.com/en/docs/claude-code/mcp
|
|
8
|
+
*/
|
|
9
|
+
import type { Ui } from "@webiny/cli-core/exports/cli/index.js";
|
|
10
|
+
interface InitParams {
|
|
11
|
+
ui: Ui.Interface;
|
|
12
|
+
cwd: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function init({ ui, cwd }: InitParams): Promise<void>;
|
|
15
|
+
export {};
|
package/agents/claude.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent adapter: Claude Code
|
|
3
|
+
*
|
|
4
|
+
* MCP config : .mcp.json (project-level, checked into git)
|
|
5
|
+
* Hint file : CLAUDE.md (Claude Code reads this automatically each session)
|
|
6
|
+
*
|
|
7
|
+
* Docs: https://docs.anthropic.com/en/docs/claude-code/mcp
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { join } from "path";
|
|
11
|
+
import { writeMcpConfig, writeHintFile, webinyHintBlock, printDone } from "./shared.js";
|
|
12
|
+
export async function init({
|
|
13
|
+
ui,
|
|
14
|
+
cwd
|
|
15
|
+
}) {
|
|
16
|
+
ui.info("Setting up for Claude Code...");
|
|
17
|
+
writeMcpConfig({
|
|
18
|
+
ui,
|
|
19
|
+
configPath: join(cwd, ".mcp.json")
|
|
20
|
+
});
|
|
21
|
+
writeHintFile({
|
|
22
|
+
ui,
|
|
23
|
+
hintPath: join(cwd, "CLAUDE.md"),
|
|
24
|
+
content: webinyHintBlock({
|
|
25
|
+
heading: "## Webiny"
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
printDone({
|
|
29
|
+
ui
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=claude.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["join","writeMcpConfig","writeHintFile","webinyHintBlock","printDone","init","ui","cwd","info","configPath","hintPath","content","heading"],"sources":["claude.ts"],"sourcesContent":["/**\n * Agent adapter: Claude Code\n *\n * MCP config : .mcp.json (project-level, checked into git)\n * Hint file : CLAUDE.md (Claude Code reads this automatically each session)\n *\n * Docs: https://docs.anthropic.com/en/docs/claude-code/mcp\n */\n\nimport { join } from \"path\";\nimport type { Ui } from \"@webiny/cli-core/exports/cli/index.js\";\nimport { writeMcpConfig, writeHintFile, webinyHintBlock, printDone } from \"./shared.js\";\n\ninterface InitParams {\n ui: Ui.Interface;\n cwd: string;\n}\n\nexport async function init({ ui, cwd }: InitParams): Promise<void> {\n ui.info(\"Setting up for Claude Code...\");\n\n writeMcpConfig({\n ui,\n configPath: join(cwd, \".mcp.json\")\n });\n\n writeHintFile({\n ui,\n hintPath: join(cwd, \"CLAUDE.md\"),\n content: webinyHintBlock({ heading: \"## Webiny\" })\n });\n\n printDone({ ui });\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,QAAQ,MAAM;AAE3B,SAASC,cAAc,EAAEC,aAAa,EAAEC,eAAe,EAAEC,SAAS;AAOlE,OAAO,eAAeC,IAAIA,CAAC;EAAEC,EAAE;EAAEC;AAAgB,CAAC,EAAiB;EAC/DD,EAAE,CAACE,IAAI,CAAC,+BAA+B,CAAC;EAExCP,cAAc,CAAC;IACXK,EAAE;IACFG,UAAU,EAAET,IAAI,CAACO,GAAG,EAAE,WAAW;EACrC,CAAC,CAAC;EAEFL,aAAa,CAAC;IACVI,EAAE;IACFI,QAAQ,EAAEV,IAAI,CAACO,GAAG,EAAE,WAAW,CAAC;IAChCI,OAAO,EAAER,eAAe,CAAC;MAAES,OAAO,EAAE;IAAY,CAAC;EACrD,CAAC,CAAC;EAEFR,SAAS,CAAC;IAAEE;EAAG,CAAC,CAAC;AACrB","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent adapter: Cline
|
|
3
|
+
*
|
|
4
|
+
* MCP config : .vscode/cline_mcp_settings.json (project-level)
|
|
5
|
+
*
|
|
6
|
+
* Cline reads instructions from its system prompt in settings,
|
|
7
|
+
* so we only write the MCP config file.
|
|
8
|
+
*
|
|
9
|
+
* Docs: https://docs.cline.bot/mcp-servers/configuring-mcp-servers
|
|
10
|
+
*/
|
|
11
|
+
import type { Ui } from "@webiny/cli-core/exports/cli/index.js";
|
|
12
|
+
interface InitParams {
|
|
13
|
+
ui: Ui.Interface;
|
|
14
|
+
cwd: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function init({ ui, cwd }: InitParams): Promise<void>;
|
|
17
|
+
export {};
|
package/agents/cline.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent adapter: Cline
|
|
3
|
+
*
|
|
4
|
+
* MCP config : .vscode/cline_mcp_settings.json (project-level)
|
|
5
|
+
*
|
|
6
|
+
* Cline reads instructions from its system prompt in settings,
|
|
7
|
+
* so we only write the MCP config file.
|
|
8
|
+
*
|
|
9
|
+
* Docs: https://docs.cline.bot/mcp-servers/configuring-mcp-servers
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { join } from "path";
|
|
13
|
+
import { writeMcpConfig, printDone } from "./shared.js";
|
|
14
|
+
export async function init({
|
|
15
|
+
ui,
|
|
16
|
+
cwd
|
|
17
|
+
}) {
|
|
18
|
+
ui.info("Setting up for Cline...");
|
|
19
|
+
writeMcpConfig({
|
|
20
|
+
ui,
|
|
21
|
+
configPath: join(cwd, ".vscode", "cline_mcp_settings.json")
|
|
22
|
+
});
|
|
23
|
+
printDone({
|
|
24
|
+
ui,
|
|
25
|
+
extra: "Add Webiny instructions to Cline's system prompt in settings manually."
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=cline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["join","writeMcpConfig","printDone","init","ui","cwd","info","configPath","extra"],"sources":["cline.ts"],"sourcesContent":["/**\n * Agent adapter: Cline\n *\n * MCP config : .vscode/cline_mcp_settings.json (project-level)\n *\n * Cline reads instructions from its system prompt in settings,\n * so we only write the MCP config file.\n *\n * Docs: https://docs.cline.bot/mcp-servers/configuring-mcp-servers\n */\n\nimport { join } from \"path\";\nimport type { Ui } from \"@webiny/cli-core/exports/cli/index.js\";\nimport { writeMcpConfig, printDone } from \"./shared.js\";\n\ninterface InitParams {\n ui: Ui.Interface;\n cwd: string;\n}\n\nexport async function init({ ui, cwd }: InitParams): Promise<void> {\n ui.info(\"Setting up for Cline...\");\n\n writeMcpConfig({\n ui,\n configPath: join(cwd, \".vscode\", \"cline_mcp_settings.json\")\n });\n\n printDone({\n ui,\n extra: \"Add Webiny instructions to Cline's system prompt in settings manually.\"\n });\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,QAAQ,MAAM;AAE3B,SAASC,cAAc,EAAEC,SAAS;AAOlC,OAAO,eAAeC,IAAIA,CAAC;EAAEC,EAAE;EAAEC;AAAgB,CAAC,EAAiB;EAC/DD,EAAE,CAACE,IAAI,CAAC,yBAAyB,CAAC;EAElCL,cAAc,CAAC;IACXG,EAAE;IACFG,UAAU,EAAEP,IAAI,CAACK,GAAG,EAAE,SAAS,EAAE,yBAAyB;EAC9D,CAAC,CAAC;EAEFH,SAAS,CAAC;IACNE,EAAE;IACFI,KAAK,EAAE;EACX,CAAC,CAAC;AACN","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent adapter: GitHub Copilot / VS Code
|
|
3
|
+
*
|
|
4
|
+
* MCP config : .vscode/mcp.json (project-level)
|
|
5
|
+
* Hint file : .github/copilot-instructions.md
|
|
6
|
+
*
|
|
7
|
+
* Note: VS Code uses "servers" as the top-level key, not "mcpServers".
|
|
8
|
+
*
|
|
9
|
+
* Docs: https://code.visualstudio.com/docs/copilot/chat/mcp-servers
|
|
10
|
+
*/
|
|
11
|
+
import type { Ui } from "@webiny/cli-core/exports/cli/index.js";
|
|
12
|
+
interface InitParams {
|
|
13
|
+
ui: Ui.Interface;
|
|
14
|
+
cwd: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function init({ ui, cwd }: InitParams): Promise<void>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent adapter: GitHub Copilot / VS Code
|
|
3
|
+
*
|
|
4
|
+
* MCP config : .vscode/mcp.json (project-level)
|
|
5
|
+
* Hint file : .github/copilot-instructions.md
|
|
6
|
+
*
|
|
7
|
+
* Note: VS Code uses "servers" as the top-level key, not "mcpServers".
|
|
8
|
+
*
|
|
9
|
+
* Docs: https://code.visualstudio.com/docs/copilot/chat/mcp-servers
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { join, dirname } from "path";
|
|
13
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
|
|
14
|
+
import { writeHintFile, webinyHintBlock, printDone } from "./shared.js";
|
|
15
|
+
function writeCopilotMcpConfig(ui, configPath) {
|
|
16
|
+
const dir = dirname(configPath);
|
|
17
|
+
if (!existsSync(dir)) {
|
|
18
|
+
mkdirSync(dir, {
|
|
19
|
+
recursive: true
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
const entry = {
|
|
23
|
+
command: "npx",
|
|
24
|
+
args: ["webiny", "mcp-server"]
|
|
25
|
+
};
|
|
26
|
+
let config = {
|
|
27
|
+
servers: {}
|
|
28
|
+
};
|
|
29
|
+
if (existsSync(configPath)) {
|
|
30
|
+
try {
|
|
31
|
+
config = JSON.parse(readFileSync(configPath, "utf8"));
|
|
32
|
+
config.servers ??= {};
|
|
33
|
+
} catch {
|
|
34
|
+
ui.warning(`Could not parse %s β will overwrite.`, configPath);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (config.servers.webiny) {
|
|
38
|
+
ui.info(`${configPath} already has a %s entry β skipping.`, "webiny");
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
config.servers.webiny = entry;
|
|
42
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
|
|
43
|
+
ui.success(`Registered Webiny MCP server in %s`, configPath);
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
export async function init({
|
|
47
|
+
ui,
|
|
48
|
+
cwd
|
|
49
|
+
}) {
|
|
50
|
+
ui.info("Setting up for GitHub Copilot (VS Code)...");
|
|
51
|
+
writeCopilotMcpConfig(ui, join(cwd, ".vscode", "mcp.json"));
|
|
52
|
+
writeHintFile({
|
|
53
|
+
ui,
|
|
54
|
+
hintPath: join(cwd, ".github", "copilot-instructions.md"),
|
|
55
|
+
content: webinyHintBlock({
|
|
56
|
+
heading: "## Webiny"
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
printDone({
|
|
60
|
+
ui
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=copilot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["join","dirname","readFileSync","writeFileSync","existsSync","mkdirSync","writeHintFile","webinyHintBlock","printDone","writeCopilotMcpConfig","ui","configPath","dir","recursive","entry","command","args","config","servers","JSON","parse","warning","webiny","info","stringify","success","init","cwd","hintPath","content","heading"],"sources":["copilot.ts"],"sourcesContent":["/**\n * Agent adapter: GitHub Copilot / VS Code\n *\n * MCP config : .vscode/mcp.json (project-level)\n * Hint file : .github/copilot-instructions.md\n *\n * Note: VS Code uses \"servers\" as the top-level key, not \"mcpServers\".\n *\n * Docs: https://code.visualstudio.com/docs/copilot/chat/mcp-servers\n */\n\nimport { join, dirname } from \"path\";\nimport { readFileSync, writeFileSync, existsSync, mkdirSync } from \"fs\";\nimport type { Ui } from \"@webiny/cli-core/exports/cli/index.js\";\nimport { writeHintFile, webinyHintBlock, printDone } from \"./shared.js\";\n\ninterface InitParams {\n ui: Ui.Interface;\n cwd: string;\n}\n\nfunction writeCopilotMcpConfig(ui: Ui.Interface, configPath: string): boolean {\n const dir = dirname(configPath);\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n\n const entry = { command: \"npx\", args: [\"webiny\", \"mcp-server\"] };\n let config: { servers: Record<string, unknown> } = { servers: {} };\n\n if (existsSync(configPath)) {\n try {\n config = JSON.parse(readFileSync(configPath, \"utf8\"));\n config.servers ??= {};\n } catch {\n ui.warning(`Could not parse %s β will overwrite.`, configPath);\n }\n }\n\n if (config.servers.webiny) {\n ui.info(`${configPath} already has a %s entry β skipping.`, \"webiny\");\n return false;\n }\n\n config.servers.webiny = entry;\n writeFileSync(configPath, JSON.stringify(config, null, 2) + \"\\n\");\n ui.success(`Registered Webiny MCP server in %s`, configPath);\n return true;\n}\n\nexport async function init({ ui, cwd }: InitParams): Promise<void> {\n ui.info(\"Setting up for GitHub Copilot (VS Code)...\");\n\n writeCopilotMcpConfig(ui, join(cwd, \".vscode\", \"mcp.json\"));\n\n writeHintFile({\n ui,\n hintPath: join(cwd, \".github\", \"copilot-instructions.md\"),\n content: webinyHintBlock({ heading: \"## Webiny\" })\n });\n\n printDone({ ui });\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,EAAEC,OAAO,QAAQ,MAAM;AACpC,SAASC,YAAY,EAAEC,aAAa,EAAEC,UAAU,EAAEC,SAAS,QAAQ,IAAI;AAEvE,SAASC,aAAa,EAAEC,eAAe,EAAEC,SAAS;AAOlD,SAASC,qBAAqBA,CAACC,EAAgB,EAAEC,UAAkB,EAAW;EAC1E,MAAMC,GAAG,GAAGX,OAAO,CAACU,UAAU,CAAC;EAC/B,IAAI,CAACP,UAAU,CAACQ,GAAG,CAAC,EAAE;IACl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,CAAC;IACzDE,OAAO,EAAEtB,eAAe,CAAC;MAAEuB,OAAO,EAAE;IAAY,CAAC;EACrD,CAAC,CAAC;EAEFtB,SAAS,CAAC;IAAEE;EAAG,CAAC,CAAC;AACrB","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent adapter: Cursor
|
|
3
|
+
*
|
|
4
|
+
* MCP config : .cursor/mcp.json (project-level)
|
|
5
|
+
* Hint file : .cursor/rules/webiny.mdc
|
|
6
|
+
*
|
|
7
|
+
* Docs: https://docs.cursor.com/context/model-context-protocol
|
|
8
|
+
*/
|
|
9
|
+
import type { Ui } from "@webiny/cli-core/exports/cli/index.js";
|
|
10
|
+
interface InitParams {
|
|
11
|
+
ui: Ui.Interface;
|
|
12
|
+
cwd: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function init({ ui, cwd }: InitParams): Promise<void>;
|
|
15
|
+
export {};
|
package/agents/cursor.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent adapter: Cursor
|
|
3
|
+
*
|
|
4
|
+
* MCP config : .cursor/mcp.json (project-level)
|
|
5
|
+
* Hint file : .cursor/rules/webiny.mdc
|
|
6
|
+
*
|
|
7
|
+
* Docs: https://docs.cursor.com/context/model-context-protocol
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { join } from "path";
|
|
11
|
+
import { writeMcpConfig, writeHintFile, webinyHintBlock, printDone } from "./shared.js";
|
|
12
|
+
export async function init({
|
|
13
|
+
ui,
|
|
14
|
+
cwd
|
|
15
|
+
}) {
|
|
16
|
+
ui.info("Setting up for Cursor...");
|
|
17
|
+
writeMcpConfig({
|
|
18
|
+
ui,
|
|
19
|
+
configPath: join(cwd, ".cursor", "mcp.json")
|
|
20
|
+
});
|
|
21
|
+
writeHintFile({
|
|
22
|
+
ui,
|
|
23
|
+
hintPath: join(cwd, ".cursor", "rules", "webiny.mdc"),
|
|
24
|
+
content: webinyHintBlock({
|
|
25
|
+
heading: "# Webiny"
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
printDone({
|
|
29
|
+
ui
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=cursor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["join","writeMcpConfig","writeHintFile","webinyHintBlock","printDone","init","ui","cwd","info","configPath","hintPath","content","heading"],"sources":["cursor.ts"],"sourcesContent":["/**\n * Agent adapter: Cursor\n *\n * MCP config : .cursor/mcp.json (project-level)\n * Hint file : .cursor/rules/webiny.mdc\n *\n * Docs: https://docs.cursor.com/context/model-context-protocol\n */\n\nimport { join } from \"path\";\nimport type { Ui } from \"@webiny/cli-core/exports/cli/index.js\";\nimport { writeMcpConfig, writeHintFile, webinyHintBlock, printDone } from \"./shared.js\";\n\ninterface InitParams {\n ui: Ui.Interface;\n cwd: string;\n}\n\nexport async function init({ ui, cwd }: InitParams): Promise<void> {\n ui.info(\"Setting up for Cursor...\");\n\n writeMcpConfig({\n ui,\n configPath: join(cwd, \".cursor\", \"mcp.json\")\n });\n\n writeHintFile({\n ui,\n hintPath: join(cwd, \".cursor\", \"rules\", \"webiny.mdc\"),\n content: webinyHintBlock({ heading: \"# Webiny\" })\n });\n\n printDone({ ui });\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,QAAQ,MAAM;AAE3B,SAASC,cAAc,EAAEC,aAAa,EAAEC,eAAe,EAAEC,SAAS;AAOlE,OAAO,eAAeC,IAAIA,CAAC;EAAEC,EAAE;EAAEC;AAAgB,CAAC,EAAiB;EAC/DD,EAAE,CAACE,IAAI,CAAC,0BAA0B,CAAC;EAEnCP,cAAc,CAAC;IACXK,EAAE;IACFG,UAAU,EAAET,IAAI,CAACO,GAAG,EAAE,SAAS,EAAE,UAAU;EAC/C,CAAC,CAAC;EAEFL,aAAa,CAAC;IACVI,EAAE;IACFI,QAAQ,EAAEV,IAAI,CAACO,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,CAAC;IACrDI,OAAO,EAAER,eAAe,CAAC;MAAES,OAAO,EAAE;IAAW,CAAC;EACpD,CAAC,CAAC;EAEFR,SAAS,CAAC;IAAEE;EAAG,CAAC,CAAC;AACrB","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* --instructions / --manual
|
|
3
|
+
*
|
|
4
|
+
* Prints a clear, copy-paste-friendly guide for wiring up the Webiny MCP
|
|
5
|
+
* server in any agent not covered by the built-in adapters.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export function printInstructions() {
|
|
9
|
+
const lines = ["", "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ", "β Webiny MCP Server β Manual Setup Guide β", "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ", "", "The Webiny MCP server works with any agent that supports the Model", "Context Protocol (MCP) over stdio transport.", "", "ββ Step 1: Register the MCP server βββββββββββββββββββββββββββββββ", "", "Most agents accept a JSON config file. Add the following entry:", "", ' "webiny": {', ' "command": "npx",', ' "args": ["webiny", "mcp-server"]', " }", "", "Where this config lives depends on your agent:", "", " Agent Config file", " βββββββββββββββββ ββββββββββββββββββββββββββββββββββββββ", " Claude Code .mcp.json (project root)", " Cursor .cursor/mcp.json (project root)", " Windsurf .windsurf/mcp.json (project root)", " Copilot/VS Code .vscode/mcp.json (note: uses 'servers', not 'mcpServers')", " Cline .vscode/cline_mcp_settings.json", " Zed ~/.config/zed/settings.json (under 'context_servers')", " Claude Desktop ~/Library/Application Support/Claude/claude_desktop_config.json", " or %APPDATA%\\Claude\\claude_desktop_config.json (Windows)", "", "Full example (the most common shape):", "", " {", ' "mcpServers": {', ' "webiny": {', ' "command": "npx",', ' "args": ["webiny", "mcp-server"]', " }", " }", " }", "", "ββ Step 2: Tell your agent about the MCP tools βββββββββββββββββββ", "", "Add the following to your agent's instruction / rules file so it", "knows to reach for the Webiny tools automatically:", "", " ## Webiny", " This project uses the Webiny framework.", " A `webiny` MCP server is available.", " When helping with Webiny-related tasks:", " 1. Call `list_webiny_skills` to see available skills.", " 2. Call `get_webiny_skill` with the relevant topic before writing code.", "", "Where this instruction file lives:", "", " Agent Instruction file", " βββββββββββββββββ ββββββββββββββββββββββββββββββββββββββ", " Claude Code CLAUDE.md (project root)", " Cursor .cursor/rules/*.mdc", " Windsurf .windsurf/rules/*.md", " Copilot/VS Code .github/copilot-instructions.md", " Cline system prompt in settings", " Zed system prompt in settings", "", "ββ Step 3: Verify the server starts ββββββββββββββββββββββββββββββ", "", "Test it with the MCP Inspector before relying on it in your agent:", "", " npx @modelcontextprotocol/inspector npx webiny mcp-server", "", "Connect, click 'List Tools', and confirm you see:", " β’ list_webiny_skills", " β’ get_webiny_skill", "", "ββ Need a built-in adapter for your agent? βββββββββββββββββββββββ", "", "Open an issue or PR at: https://github.com/webiny/webiny-js", "The adapter just needs to write the right config file β see", "mcp/agents/claude.ts as a reference (~20 lines).", ""];
|
|
10
|
+
process.stdout.write(lines.join("\n") + "\n");
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=instructions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["printInstructions","lines","process","stdout","write","join"],"sources":["instructions.ts"],"sourcesContent":["/**\n * --instructions / --manual\n *\n * Prints a clear, copy-paste-friendly guide for wiring up the Webiny MCP\n * server in any agent not covered by the built-in adapters.\n */\n\nexport function printInstructions(): void {\n const lines = [\n \"\",\n \"ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ\",\n \"β Webiny MCP Server β Manual Setup Guide β\",\n \"ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ\",\n \"\",\n \"The Webiny MCP server works with any agent that supports the Model\",\n \"Context Protocol (MCP) over stdio transport.\",\n \"\",\n \"ββ Step 1: Register the MCP server βββββββββββββββββββββββββββββββ\",\n \"\",\n \"Most agents accept a JSON config file. Add the following entry:\",\n \"\",\n ' \"webiny\": {',\n ' \"command\": \"npx\",',\n ' \"args\": [\"webiny\", \"mcp-server\"]',\n \" }\",\n \"\",\n \"Where this config lives depends on your agent:\",\n \"\",\n \" Agent Config file\",\n \" βββββββββββββββββ ββββββββββββββββββββββββββββββββββββββ\",\n \" Claude Code .mcp.json (project root)\",\n \" Cursor .cursor/mcp.json (project root)\",\n \" Windsurf .windsurf/mcp.json (project root)\",\n \" Copilot/VS Code .vscode/mcp.json (note: uses 'servers', not 'mcpServers')\",\n \" Cline .vscode/cline_mcp_settings.json\",\n \" Zed ~/.config/zed/settings.json (under 'context_servers')\",\n \" Claude Desktop ~/Library/Application Support/Claude/claude_desktop_config.json\",\n \" or %APPDATA%\\\\Claude\\\\claude_desktop_config.json (Windows)\",\n \"\",\n \"Full example (the most common shape):\",\n \"\",\n \" {\",\n ' \"mcpServers\": {',\n ' \"webiny\": {',\n ' \"command\": \"npx\",',\n ' \"args\": [\"webiny\", \"mcp-server\"]',\n \" }\",\n \" }\",\n \" }\",\n \"\",\n \"ββ Step 2: Tell your agent about the MCP tools βββββββββββββββββββ\",\n \"\",\n \"Add the following to your agent's instruction / rules file so it\",\n \"knows to reach for the Webiny tools automatically:\",\n \"\",\n \" ## Webiny\",\n \" This project uses the Webiny framework.\",\n \" A `webiny` MCP server is available.\",\n \" When helping with Webiny-related tasks:\",\n \" 1. Call `list_webiny_skills` to see available skills.\",\n \" 2. Call `get_webiny_skill` with the relevant topic before writing code.\",\n \"\",\n \"Where this instruction file lives:\",\n \"\",\n \" Agent Instruction file\",\n \" βββββββββββββββββ ββββββββββββββββββββββββββββββββββββββ\",\n \" Claude Code CLAUDE.md (project root)\",\n \" Cursor .cursor/rules/*.mdc\",\n \" Windsurf .windsurf/rules/*.md\",\n \" Copilot/VS Code .github/copilot-instructions.md\",\n \" Cline system prompt in settings\",\n \" Zed system prompt in settings\",\n \"\",\n \"ββ Step 3: Verify the server starts ββββββββββββββββββββββββββββββ\",\n \"\",\n \"Test it with the MCP Inspector before relying on it in your agent:\",\n \"\",\n \" npx @modelcontextprotocol/inspector npx webiny mcp-server\",\n \"\",\n \"Connect, click 'List Tools', and confirm you see:\",\n \" β’ list_webiny_skills\",\n \" β’ get_webiny_skill\",\n \"\",\n \"ββ Need a built-in adapter for your agent? βββββββββββββββββββββββ\",\n \"\",\n \"Open an issue or PR at: https://github.com/webiny/webiny-js\",\n \"The adapter just needs to write the right config file β see\",\n \"mcp/agents/claude.ts as a reference (~20 lines).\",\n \"\"\n ];\n\n process.stdout.write(lines.join(\"\\n\") + \"\\n\");\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,SAASA,iBAAiBA,CAAA,EAAS;EACtC,MAAMC,KAAK,GAAG,CACV,EAAE,EACF,sEAAsE,EACtE,qEAAqE,EACrE,sEAAsE,EACtE,EAAE,EACF,oEAAoE,EACpE,8CAA8C,EAC9C,EAAE,EACF,oEAAoE,EACpE,EAAE,EACF,iEAAiE,EACjE,EAAE,EACF,eAAe,EACf,uBAAuB,EACvB,sCAAsC,EACtC,KAAK,EACL,EAAE,EACF,gDAAgD,EAChD,EAAE,EACF,kCAAkC,EAClC,6DAA6D,EAC7D,8DAA8D,EAC9D,8DAA8D,EAC9D,8DAA8D,EAC9D,wFAAwF,EACxF,sDAAsD,EACtD,6EAA6E,EAC7E,sFAAsF,EACtF,kFAAkF,EAClF,EAAE,EACF,uCAAuC,EACvC,EAAE,EACF,KAAK,EACL,qBAAqB,EACrB,mBAAmB,EACnB,2BAA2B,EAC3B,0CAA0C,EAC1C,SAAS,EACT,OAAO,EACP,KAAK,EACL,EAAE,EACF,oEAAoE,EACpE,EAAE,EACF,kEAAkE,EAClE,oDAAoD,EACpD,EAAE,EACF,aAAa,EACb,2CAA2C,EAC3C,uCAAuC,EACvC,2CAA2C,EAC3C,yDAAyD,EACzD,2EAA2E,EAC3E,EAAE,EACF,oCAAoC,EACpC,EAAE,EACF,uCAAuC,EACvC,6DAA6D,EAC7D,8DAA8D,EAC9D,0CAA0C,EAC1C,2CAA2C,EAC3C,sDAAsD,EACtD,gDAAgD,EAChD,gDAAgD,EAChD,EAAE,EACF,oEAAoE,EACpE,EAAE,EACF,oEAAoE,EACpE,EAAE,EACF,6DAA6D,EAC7D,EAAE,EACF,mDAAmD,EACnD,wBAAwB,EACxB,sBAAsB,EACtB,EAAE,EACF,oEAAoE,EACpE,EAAE,EACF,6DAA6D,EAC7D,6DAA6D,EAC7D,kDAAkD,EAClD,EAAE,CACL;EAEDC,OAAO,CAACC,MAAM,CAACC,KAAK,CAACH,KAAK,CAACI,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AACjD","ignoreList":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared helpers for agent adapters.
|
|
3
|
+
*/
|
|
4
|
+
import type { Ui } from "@webiny/cli-core/exports/cli/index.js";
|
|
5
|
+
interface WriteMcpConfigParams {
|
|
6
|
+
ui: Ui.Interface;
|
|
7
|
+
configPath: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Write (or patch) an MCP server registration into a JSON config file.
|
|
11
|
+
*
|
|
12
|
+
* All agents use the same JSON shape β only the file path differs:
|
|
13
|
+
* {
|
|
14
|
+
* "mcpServers": {
|
|
15
|
+
* "webiny": { "command": "npx", "args": ["webiny", "mcp-server"] }
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
*/
|
|
19
|
+
export declare function writeMcpConfig({ ui, configPath }: WriteMcpConfigParams): boolean;
|
|
20
|
+
interface WriteHintFileParams {
|
|
21
|
+
ui: Ui.Interface;
|
|
22
|
+
hintPath: string;
|
|
23
|
+
content: string;
|
|
24
|
+
marker?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Append Webiny instructions to a markdown hint file (CLAUDE.md,
|
|
28
|
+
* copilot-instructions.md, etc.) if not already present.
|
|
29
|
+
*/
|
|
30
|
+
export declare function writeHintFile({ ui, hintPath, content, marker }: WriteHintFileParams): boolean;
|
|
31
|
+
interface WebinyHintBlockParams {
|
|
32
|
+
heading?: string;
|
|
33
|
+
prefix?: string;
|
|
34
|
+
}
|
|
35
|
+
export declare function webinyHintBlock({ heading, prefix }?: WebinyHintBlockParams): string;
|
|
36
|
+
interface PrintDoneParams {
|
|
37
|
+
ui: Ui.Interface;
|
|
38
|
+
extra?: string;
|
|
39
|
+
}
|
|
40
|
+
export declare function printDone({ ui, extra }: PrintDoneParams): void;
|
|
41
|
+
export {};
|
package/agents/shared.js
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared helpers for agent adapters.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
|
|
6
|
+
import { dirname } from "path";
|
|
7
|
+
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
// MCP config helpers
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Write (or patch) an MCP server registration into a JSON config file.
|
|
14
|
+
*
|
|
15
|
+
* All agents use the same JSON shape β only the file path differs:
|
|
16
|
+
* {
|
|
17
|
+
* "mcpServers": {
|
|
18
|
+
* "webiny": { "command": "npx", "args": ["webiny", "mcp-server"] }
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
*/
|
|
22
|
+
export function writeMcpConfig({
|
|
23
|
+
ui,
|
|
24
|
+
configPath
|
|
25
|
+
}) {
|
|
26
|
+
ensureDir(configPath);
|
|
27
|
+
const entry = {
|
|
28
|
+
command: "npx",
|
|
29
|
+
args: ["webiny", "mcp-server", "--additional-skills=./my-skills"]
|
|
30
|
+
};
|
|
31
|
+
let config = {
|
|
32
|
+
mcpServers: {}
|
|
33
|
+
};
|
|
34
|
+
if (existsSync(configPath)) {
|
|
35
|
+
try {
|
|
36
|
+
config = JSON.parse(readFileSync(configPath, "utf8"));
|
|
37
|
+
config.mcpServers ??= {};
|
|
38
|
+
} catch {
|
|
39
|
+
ui.warning(`Could not parse %s β will overwrite.`, configPath);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (config.mcpServers.webiny) {
|
|
43
|
+
ui.info(`%s already has a %s entry β skipping.`, configPath, "webiny");
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
config.mcpServers.webiny = entry;
|
|
47
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
|
|
48
|
+
ui.success(`Registered Webiny MCP server in %s`, configPath);
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
// Hint file helpers
|
|
54
|
+
// ---------------------------------------------------------------------------
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Append Webiny instructions to a markdown hint file (CLAUDE.md,
|
|
58
|
+
* copilot-instructions.md, etc.) if not already present.
|
|
59
|
+
*/
|
|
60
|
+
export function writeHintFile({
|
|
61
|
+
ui,
|
|
62
|
+
hintPath,
|
|
63
|
+
content,
|
|
64
|
+
marker = "list_webiny_skills"
|
|
65
|
+
}) {
|
|
66
|
+
ensureDir(hintPath);
|
|
67
|
+
if (existsSync(hintPath)) {
|
|
68
|
+
const existing = readFileSync(hintPath, "utf8");
|
|
69
|
+
if (existing.includes(marker)) {
|
|
70
|
+
ui.info(`%s already contains Webiny instructions β skipping.`, hintPath);
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
writeFileSync(hintPath, existing.trimEnd() + "\n\n" + content.trim() + "\n");
|
|
74
|
+
} else {
|
|
75
|
+
writeFileSync(hintPath, content.trim() + "\n");
|
|
76
|
+
}
|
|
77
|
+
ui.success(`Wrote Webiny instructions to ${hintPath}`);
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// ---------------------------------------------------------------------------
|
|
82
|
+
// Common hint block (same concept across all agents, slightly different wrapping)
|
|
83
|
+
// ---------------------------------------------------------------------------
|
|
84
|
+
|
|
85
|
+
export function webinyHintBlock({
|
|
86
|
+
heading = "## Webiny",
|
|
87
|
+
prefix = ""
|
|
88
|
+
} = {}) {
|
|
89
|
+
return [heading, "", `${prefix}This project uses the Webiny framework.`, `${prefix}A \`webiny\` MCP server is available.`, `${prefix}When helping with Webiny-related tasks:`, `${prefix}1. Call \`list_webiny_skills\` to see available skills.`, `${prefix}2. Call \`get_webiny_skill\` with the relevant topic before writing code.`, ""].join("\n");
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// ---------------------------------------------------------------------------
|
|
93
|
+
// Done message
|
|
94
|
+
// ---------------------------------------------------------------------------
|
|
95
|
+
|
|
96
|
+
export function printDone({
|
|
97
|
+
ui,
|
|
98
|
+
extra
|
|
99
|
+
}) {
|
|
100
|
+
ui.emptyLine();
|
|
101
|
+
if (extra) {
|
|
102
|
+
ui.warning(extra);
|
|
103
|
+
}
|
|
104
|
+
ui.info("Restart your agent/editor session if it is already running.");
|
|
105
|
+
ui.emptyLine();
|
|
106
|
+
ui.info("To test the MCP server directly:");
|
|
107
|
+
ui.info(" %s", "npx @modelcontextprotocol/inspector npx webiny mcp-server");
|
|
108
|
+
ui.emptyLine();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// ---------------------------------------------------------------------------
|
|
112
|
+
// Internal
|
|
113
|
+
// ---------------------------------------------------------------------------
|
|
114
|
+
|
|
115
|
+
function ensureDir(filePath) {
|
|
116
|
+
const dir = dirname(filePath);
|
|
117
|
+
if (!existsSync(dir)) {
|
|
118
|
+
mkdirSync(dir, {
|
|
119
|
+
recursive: true
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["readFileSync","writeFileSync","existsSync","mkdirSync","dirname","writeMcpConfig","ui","configPath","ensureDir","entry","command","args","config","mcpServers","JSON","parse","warning","webiny","info","stringify","success","writeHintFile","hintPath","content","marker","existing","includes","trimEnd","trim","webinyHintBlock","heading","prefix","join","printDone","extra","emptyLine","filePath","dir","recursive"],"sources":["shared.ts"],"sourcesContent":["/**\n * Shared helpers for agent adapters.\n */\n\nimport { readFileSync, writeFileSync, existsSync, mkdirSync } from \"fs\";\nimport { dirname } from \"path\";\nimport type { Ui } from \"@webiny/cli-core/exports/cli/index.js\";\n\n// ---------------------------------------------------------------------------\n// MCP config helpers\n// ---------------------------------------------------------------------------\n\ninterface WriteMcpConfigParams {\n ui: Ui.Interface;\n configPath: string;\n}\n\n/**\n * Write (or patch) an MCP server registration into a JSON config file.\n *\n * All agents use the same JSON shape β only the file path differs:\n * {\n * \"mcpServers\": {\n * \"webiny\": { \"command\": \"npx\", \"args\": [\"webiny\", \"mcp-server\"] }\n * }\n * }\n */\nexport function writeMcpConfig({ ui, configPath }: WriteMcpConfigParams): boolean {\n ensureDir(configPath);\n\n const entry = {\n command: \"npx\",\n args: [\"webiny\", \"mcp-server\", \"--additional-skills=./my-skills\"]\n };\n let config: { mcpServers: Record<string, unknown> } = { mcpServers: {} };\n\n if (existsSync(configPath)) {\n try {\n config = JSON.parse(readFileSync(configPath, \"utf8\"));\n config.mcpServers ??= {};\n } catch {\n ui.warning(`Could not parse %s β will overwrite.`, configPath);\n }\n }\n\n if (config.mcpServers.webiny) {\n ui.info(`%s already has a %s entry β skipping.`, configPath, \"webiny\");\n return false;\n }\n\n config.mcpServers.webiny = entry;\n writeFileSync(configPath, JSON.stringify(config, null, 2) + \"\\n\");\n ui.success(`Registered Webiny MCP server in %s`, configPath);\n return true;\n}\n\n// ---------------------------------------------------------------------------\n// Hint file helpers\n// ---------------------------------------------------------------------------\n\ninterface WriteHintFileParams {\n ui: Ui.Interface;\n hintPath: string;\n content: string;\n marker?: string;\n}\n\n/**\n * Append Webiny instructions to a markdown hint file (CLAUDE.md,\n * copilot-instructions.md, etc.) if not already present.\n */\nexport function writeHintFile({\n ui,\n hintPath,\n content,\n marker = \"list_webiny_skills\"\n}: WriteHintFileParams): boolean {\n ensureDir(hintPath);\n\n if (existsSync(hintPath)) {\n const existing = readFileSync(hintPath, \"utf8\");\n if (existing.includes(marker)) {\n ui.info(`%s already contains Webiny instructions β skipping.`, hintPath);\n return false;\n }\n writeFileSync(hintPath, existing.trimEnd() + \"\\n\\n\" + content.trim() + \"\\n\");\n } else {\n writeFileSync(hintPath, content.trim() + \"\\n\");\n }\n\n ui.success(`Wrote Webiny instructions to ${hintPath}`);\n return true;\n}\n\n// ---------------------------------------------------------------------------\n// Common hint block (same concept across all agents, slightly different wrapping)\n// ---------------------------------------------------------------------------\n\ninterface WebinyHintBlockParams {\n heading?: string;\n prefix?: string;\n}\n\nexport function webinyHintBlock({\n heading = \"## Webiny\",\n prefix = \"\"\n}: WebinyHintBlockParams = {}): string {\n return [\n heading,\n \"\",\n `${prefix}This project uses the Webiny framework.`,\n `${prefix}A \\`webiny\\` MCP server is available.`,\n `${prefix}When helping with Webiny-related tasks:`,\n `${prefix}1. Call \\`list_webiny_skills\\` to see available skills.`,\n `${prefix}2. Call \\`get_webiny_skill\\` with the relevant topic before writing code.`,\n \"\"\n ].join(\"\\n\");\n}\n\n// ---------------------------------------------------------------------------\n// Done message\n// ---------------------------------------------------------------------------\n\ninterface PrintDoneParams {\n ui: Ui.Interface;\n extra?: string;\n}\n\nexport function printDone({ ui, extra }: PrintDoneParams): void {\n ui.emptyLine();\n if (extra) {\n ui.warning(extra);\n }\n ui.info(\"Restart your agent/editor session if it is already running.\");\n ui.emptyLine();\n ui.info(\"To test the MCP server directly:\");\n ui.info(\" %s\", \"npx @modelcontextprotocol/inspector npx webiny mcp-server\");\n ui.emptyLine();\n}\n\n// ---------------------------------------------------------------------------\n// Internal\n// ---------------------------------------------------------------------------\n\nfunction ensureDir(filePath: string): void {\n const dir = dirname(filePath);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,KAAK,EAAE;IACP5B,EAAE,CAACU,OAAO,CAACkB,KAAK,CAAC;EACrB;EACA5B,EAAE,CAACY,IAAI,CAAC,6DAA6D,CAAC;EACtEZ,EAAE,CAAC6B,SAAS,CAAC,CAAC;EACd7B,EAAE,CAACY,IAAI,CAAC,kCAAkC,CAAC;EAC3CZ,EAAE,CAACY,IAAI,CAAC,MAAM,EAAE,2DAA2D,CAAC;EAC5EZ,EAAE,CAAC6B,SAAS,CAAC,CAAC;AAClB;;AAEA;AACA;AACA;;AAEA,SAAS3B,SAASA,CAAC4B,QAAgB,EAAQ;EACvC,MAAMC,GAAG,GAAGjC,OAAO,CAACgC,QAAQ,CAAC;EAC7B,IAAI,CAAClC,UAAU,CAACmC,GAAG,CAAC,EAAE;IAClBlC,SAAS,CAACkC,GAAG,EAAE;MAAEC,SAAS,EAAE;IAAK,CAAC,CAAC;EACvC;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent adapter: Windsurf (Codeium)
|
|
3
|
+
*
|
|
4
|
+
* MCP config : .windsurf/mcp.json (project-level)
|
|
5
|
+
* Hint file : .windsurf/rules/webiny.md
|
|
6
|
+
*
|
|
7
|
+
* Docs: https://docs.codeium.com/windsurf/mcp
|
|
8
|
+
*/
|
|
9
|
+
import type { Ui } from "@webiny/cli-core/exports/cli/index.js";
|
|
10
|
+
interface InitParams {
|
|
11
|
+
ui: Ui.Interface;
|
|
12
|
+
cwd: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function init({ ui, cwd }: InitParams): Promise<void>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent adapter: Windsurf (Codeium)
|
|
3
|
+
*
|
|
4
|
+
* MCP config : .windsurf/mcp.json (project-level)
|
|
5
|
+
* Hint file : .windsurf/rules/webiny.md
|
|
6
|
+
*
|
|
7
|
+
* Docs: https://docs.codeium.com/windsurf/mcp
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { join } from "path";
|
|
11
|
+
import { writeMcpConfig, writeHintFile, webinyHintBlock, printDone } from "./shared.js";
|
|
12
|
+
export async function init({
|
|
13
|
+
ui,
|
|
14
|
+
cwd
|
|
15
|
+
}) {
|
|
16
|
+
ui.info("Setting up for Windsurf...");
|
|
17
|
+
writeMcpConfig({
|
|
18
|
+
ui,
|
|
19
|
+
configPath: join(cwd, ".windsurf", "mcp.json")
|
|
20
|
+
});
|
|
21
|
+
writeHintFile({
|
|
22
|
+
ui,
|
|
23
|
+
hintPath: join(cwd, ".windsurf", "rules", "webiny.md"),
|
|
24
|
+
content: webinyHintBlock({
|
|
25
|
+
heading: "## Webiny"
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
printDone({
|
|
29
|
+
ui
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=windsurf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["join","writeMcpConfig","writeHintFile","webinyHintBlock","printDone","init","ui","cwd","info","configPath","hintPath","content","heading"],"sources":["windsurf.ts"],"sourcesContent":["/**\n * Agent adapter: Windsurf (Codeium)\n *\n * MCP config : .windsurf/mcp.json (project-level)\n * Hint file : .windsurf/rules/webiny.md\n *\n * Docs: https://docs.codeium.com/windsurf/mcp\n */\n\nimport { join } from \"path\";\nimport type { Ui } from \"@webiny/cli-core/exports/cli/index.js\";\nimport { writeMcpConfig, writeHintFile, webinyHintBlock, printDone } from \"./shared.js\";\n\ninterface InitParams {\n ui: Ui.Interface;\n cwd: string;\n}\n\nexport async function init({ ui, cwd }: InitParams): Promise<void> {\n ui.info(\"Setting up for Windsurf...\");\n\n writeMcpConfig({\n ui,\n configPath: join(cwd, \".windsurf\", \"mcp.json\")\n });\n\n writeHintFile({\n ui,\n hintPath: join(cwd, \".windsurf\", \"rules\", \"webiny.md\"),\n content: webinyHintBlock({ heading: \"## Webiny\" })\n });\n\n printDone({ ui });\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,QAAQ,MAAM;AAE3B,SAASC,cAAc,EAAEC,aAAa,EAAEC,eAAe,EAAEC,SAAS;AAOlE,OAAO,eAAeC,IAAIA,CAAC;EAAEC,EAAE;EAAEC;AAAgB,CAAC,EAAiB;EAC/DD,EAAE,CAACE,IAAI,CAAC,4BAA4B,CAAC;EAErCP,cAAc,CAAC;IACXK,EAAE;IACFG,UAAU,EAAET,IAAI,CAACO,GAAG,EAAE,WAAW,EAAE,UAAU;EACjD,CAAC,CAAC;EAEFL,aAAa,CAAC;IACVI,EAAE;IACFI,QAAQ,EAAEV,IAAI,CAACO,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,CAAC;IACtDI,OAAO,EAAER,eAAe,CAAC;MAAES,OAAO,EAAE;IAAY,CAAC;EACrD,CAAC,CAAC;EAEFR,SAAS,CAAC;IAAEE;EAAG,CAAC,CAAC;AACrB","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CliCommandFactory } from "@webiny/cli-core/exports/cli/command.js";
|
|
2
|
+
import { Ui } from "@webiny/cli-core/exports/cli/index.js";
|
|
3
|
+
export interface IInitAgentParams {
|
|
4
|
+
agent: string;
|
|
5
|
+
instructions: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare class ConfigureMcp implements CliCommandFactory.Interface<IInitAgentParams> {
|
|
8
|
+
private ui;
|
|
9
|
+
constructor(ui: Ui.Interface);
|
|
10
|
+
execute(): CliCommandFactory.CommandDefinition<IInitAgentParams>;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: typeof ConfigureMcp & {
|
|
13
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/cli-core/abstractions/features/CliCommand.js").ICliCommand<any>>;
|
|
14
|
+
};
|
|
15
|
+
export default _default;
|