@shell-shock/plugin-mcp 0.1.1

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/index.cjs ADDED
@@ -0,0 +1,79 @@
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
+ const require_components_mcp_command = require('./components/mcp-command.cjs');
3
+ const require_generator = require('./generator.cjs');
4
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
5
+ let _shell_shock_core_helpers_power_plant = require("@shell-shock/core/helpers/power-plant");
6
+ let _stryke_path_join = require("@stryke/path/join");
7
+ let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
8
+ let defu = require("defu");
9
+
10
+ //#region src/index.tsx
11
+ /**
12
+ * A Shell Shock plugin that generates an MCP server command from the resolved command tree.
13
+ */
14
+ const plugin = (options = {}) => {
15
+ return {
16
+ name: "shell-shock/mcp",
17
+ config() {
18
+ this.debug("Providing default configuration for the Shell Shock `mcp` plugin.");
19
+ const commandName = (0, _stryke_type_checks_is_set_string.isSetString)(options.command) ? options.command : null;
20
+ const commandConfig = typeof options.command === "object" && options.command ? options.command : {};
21
+ return { mcp: (0, defu.defu)({ command: { name: commandName ?? commandConfig.name ?? "mcp" } }, {
22
+ ...options,
23
+ command: commandConfig
24
+ }) };
25
+ },
26
+ async configResolved() {
27
+ const _self$ = this;
28
+ this.debug("Adding the CLI mcp command to the application context.");
29
+ this.inputs ??= [];
30
+ if (this.inputs.some((input) => input.id === this.config.mcp.command.name)) {
31
+ this.info("The `mcp` command already exists in the commands list. If you would like the mcp command to be managed by the `@shell-shock/plugin-mcp` package, please remove or rename the command.");
32
+ return;
33
+ }
34
+ const { entry: commandEntry, ...commandOverrides } = this.config.mcp.command;
35
+ const mcpCommand = {
36
+ ...commandOverrides,
37
+ id: this.config.mcp.command.name,
38
+ name: this.config.mcp.command.name,
39
+ path: this.config.mcp.command.name,
40
+ segments: [this.config.mcp.command.name],
41
+ title: "Model Context Protocol (MCP) Server",
42
+ icon: "🔌",
43
+ alias: [],
44
+ tags: ["AI"],
45
+ description: "Start a Model Context Protocol (MCP) stdio server for this application.",
46
+ entry: {
47
+ file: (0, _stryke_path_join.joinPaths)(this.entryPath, "mcp", "index.ts"),
48
+ input: { file: (0, _stryke_path_join.joinPaths)(this.entryPath, "mcp", "command.ts") },
49
+ ...commandEntry ?? {}
50
+ },
51
+ virtual: false
52
+ };
53
+ this.inputs.push(mcpCommand);
54
+ await (0, _shell_shock_core_helpers_power_plant.executeCommandGenerator)(this, require_generator.default, { template: (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_mcp_command.McpCommandModule, {
55
+ get appName() {
56
+ return _self$.config.name;
57
+ },
58
+ get commandName() {
59
+ return _self$.config.mcp.command.name;
60
+ },
61
+ get commands() {
62
+ return Object.values(_self$.commands);
63
+ }
64
+ }) });
65
+ },
66
+ prepare: {
67
+ order: "post",
68
+ async handler() {
69
+ this.debug("Generating the Shell Shock MCP command module via Power Plant from resolved commands.");
70
+ await (0, _shell_shock_core_helpers_power_plant.executeCommandGenerator)(this, require_generator.default);
71
+ }
72
+ }
73
+ };
74
+ };
75
+
76
+ //#endregion
77
+ exports.default = plugin;
78
+ exports.plugin = plugin;
79
+ exports.mcpGenerator = require_generator.default;
@@ -0,0 +1,12 @@
1
+ import mcpGenerator from "./generator.cjs";
2
+ import { McpPluginContext, McpPluginOptions, McpPluginResolvedConfig, McpPluginUserConfig } from "./types/plugin.cjs";
3
+ import "./types/index.cjs";
4
+ import { Plugin } from "powerlines";
5
+ //#region src/index.d.ts
6
+ /**
7
+ * A Shell Shock plugin that generates an MCP server command from the resolved command tree.
8
+ */
9
+ declare const plugin: <TContext extends McpPluginContext = McpPluginContext>(options?: McpPluginOptions) => Plugin<TContext>;
10
+ //#endregion
11
+ export { type McpPluginContext, type McpPluginOptions, type McpPluginResolvedConfig, type McpPluginUserConfig, plugin as default, plugin, mcpGenerator };
12
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;;;cAkCa,SAAU,iBAAiB,mBAAmB,kBACzD,UAAS,qBACR,OAAO"}
@@ -0,0 +1,12 @@
1
+ import mcpGenerator from "./generator.mjs";
2
+ import { McpPluginContext, McpPluginOptions, McpPluginResolvedConfig, McpPluginUserConfig } from "./types/plugin.mjs";
3
+ import "./types/index.mjs";
4
+ import { Plugin } from "powerlines";
5
+ //#region src/index.d.ts
6
+ /**
7
+ * A Shell Shock plugin that generates an MCP server command from the resolved command tree.
8
+ */
9
+ declare const plugin: <TContext extends McpPluginContext = McpPluginContext>(options?: McpPluginOptions) => Plugin<TContext>;
10
+ //#endregion
11
+ export { type McpPluginContext, type McpPluginOptions, type McpPluginResolvedConfig, type McpPluginUserConfig, plugin as default, plugin, mcpGenerator };
12
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":""}
package/dist/index.mjs ADDED
@@ -0,0 +1,77 @@
1
+ import { McpCommandModule } from "./components/mcp-command.mjs";
2
+ import mcpGenerator from "./generator.mjs";
3
+ import { createComponent } from "@alloy-js/core/jsx-runtime";
4
+ import { executeCommandGenerator } from "@shell-shock/core/helpers/power-plant";
5
+ import { joinPaths } from "@stryke/path/join";
6
+ import { isSetString } from "@stryke/type-checks/is-set-string";
7
+ import { defu } from "defu";
8
+
9
+ //#region src/index.tsx
10
+ /**
11
+ * A Shell Shock plugin that generates an MCP server command from the resolved command tree.
12
+ */
13
+ const plugin = (options = {}) => {
14
+ return {
15
+ name: "shell-shock/mcp",
16
+ config() {
17
+ this.debug("Providing default configuration for the Shell Shock `mcp` plugin.");
18
+ const commandName = isSetString(options.command) ? options.command : null;
19
+ const commandConfig = typeof options.command === "object" && options.command ? options.command : {};
20
+ return { mcp: defu({ command: { name: commandName ?? commandConfig.name ?? "mcp" } }, {
21
+ ...options,
22
+ command: commandConfig
23
+ }) };
24
+ },
25
+ async configResolved() {
26
+ const _self$ = this;
27
+ this.debug("Adding the CLI mcp command to the application context.");
28
+ this.inputs ??= [];
29
+ if (this.inputs.some((input) => input.id === this.config.mcp.command.name)) {
30
+ this.info("The `mcp` command already exists in the commands list. If you would like the mcp command to be managed by the `@shell-shock/plugin-mcp` package, please remove or rename the command.");
31
+ return;
32
+ }
33
+ const { entry: commandEntry, ...commandOverrides } = this.config.mcp.command;
34
+ const mcpCommand = {
35
+ ...commandOverrides,
36
+ id: this.config.mcp.command.name,
37
+ name: this.config.mcp.command.name,
38
+ path: this.config.mcp.command.name,
39
+ segments: [this.config.mcp.command.name],
40
+ title: "Model Context Protocol (MCP) Server",
41
+ icon: "🔌",
42
+ alias: [],
43
+ tags: ["AI"],
44
+ description: "Start a Model Context Protocol (MCP) stdio server for this application.",
45
+ entry: {
46
+ file: joinPaths(this.entryPath, "mcp", "index.ts"),
47
+ input: { file: joinPaths(this.entryPath, "mcp", "command.ts") },
48
+ ...commandEntry ?? {}
49
+ },
50
+ virtual: false
51
+ };
52
+ this.inputs.push(mcpCommand);
53
+ await executeCommandGenerator(this, mcpGenerator, { template: createComponent(McpCommandModule, {
54
+ get appName() {
55
+ return _self$.config.name;
56
+ },
57
+ get commandName() {
58
+ return _self$.config.mcp.command.name;
59
+ },
60
+ get commands() {
61
+ return Object.values(_self$.commands);
62
+ }
63
+ }) });
64
+ },
65
+ prepare: {
66
+ order: "post",
67
+ async handler() {
68
+ this.debug("Generating the Shell Shock MCP command module via Power Plant from resolved commands.");
69
+ await executeCommandGenerator(this, mcpGenerator);
70
+ }
71
+ }
72
+ };
73
+ };
74
+
75
+ //#endregion
76
+ export { plugin as default, plugin, mcpGenerator };
77
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":[],"mappings":""}
@@ -0,0 +1 @@
1
+ require('./plugin.cjs');
@@ -0,0 +1,2 @@
1
+ import { McpPluginContext, McpPluginOptions, McpPluginResolvedConfig, McpPluginUserConfig } from "./plugin.cjs";
2
+ export { McpPluginContext, McpPluginOptions, McpPluginResolvedConfig, McpPluginUserConfig };
@@ -0,0 +1,2 @@
1
+ import { McpPluginContext, McpPluginOptions, McpPluginResolvedConfig, McpPluginUserConfig } from "./plugin.mjs";
2
+ export { McpPluginContext, McpPluginOptions, McpPluginResolvedConfig, McpPluginUserConfig };
@@ -0,0 +1,3 @@
1
+ import "./plugin.mjs";
2
+
3
+ export { };
File without changes
@@ -0,0 +1,21 @@
1
+ import { CommandConfig, Context, ResolvedConfig, UserConfig } from "@shell-shock/core";
2
+ import { RequiredKeys } from "@stryke/types/base";
3
+ //#region src/types/plugin.d.ts
4
+ interface McpPluginOptions {
5
+ /**
6
+ * The command name used to expose the MCP server.
7
+ */
8
+ command?: Partial<CommandConfig> | string;
9
+ }
10
+ type McpPluginUserConfig = UserConfig & {
11
+ mcp: McpPluginOptions;
12
+ };
13
+ type McpPluginResolvedConfig = ResolvedConfig & {
14
+ mcp: {
15
+ command: RequiredKeys<Partial<CommandConfig>, "name">;
16
+ };
17
+ };
18
+ type McpPluginContext<TResolvedConfig extends McpPluginResolvedConfig = McpPluginResolvedConfig> = Context<TResolvedConfig>;
19
+ //#endregion
20
+ export { McpPluginContext, McpPluginOptions, McpPluginResolvedConfig, McpPluginUserConfig };
21
+ //# sourceMappingURL=plugin.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;UA0BiB;;;;EAIf,UAAU,QAAQ;;KAGR,sBAAsB;EAChC,KAAK;;KAGK,0BAA0B;EACpC;IACE,SAAS,aAAa,QAAQ;;;KAItB,iBACV,wBAAwB,0BAA0B,2BAChD,QAAQ"}
@@ -0,0 +1,21 @@
1
+ import { CommandConfig, Context, ResolvedConfig, UserConfig } from "@shell-shock/core";
2
+ import { RequiredKeys } from "@stryke/types/base";
3
+ //#region src/types/plugin.d.ts
4
+ interface McpPluginOptions {
5
+ /**
6
+ * The command name used to expose the MCP server.
7
+ */
8
+ command?: Partial<CommandConfig> | string;
9
+ }
10
+ type McpPluginUserConfig = UserConfig & {
11
+ mcp: McpPluginOptions;
12
+ };
13
+ type McpPluginResolvedConfig = ResolvedConfig & {
14
+ mcp: {
15
+ command: RequiredKeys<Partial<CommandConfig>, "name">;
16
+ };
17
+ };
18
+ type McpPluginContext<TResolvedConfig extends McpPluginResolvedConfig = McpPluginResolvedConfig> = Context<TResolvedConfig>;
19
+ //#endregion
20
+ export { McpPluginContext, McpPluginOptions, McpPluginResolvedConfig, McpPluginUserConfig };
21
+ //# sourceMappingURL=plugin.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":""}
@@ -0,0 +1 @@
1
+ export { };
package/package.json ADDED
@@ -0,0 +1,144 @@
1
+ {
2
+ "name": "@shell-shock/plugin-mcp",
3
+ "version": "0.1.1",
4
+ "private": false,
5
+ "description": "A package containing a Shell Shock plugin to expose CLI commands through an MCP server.",
6
+ "keywords": [
7
+ "shell-shock",
8
+ "shell-shock-plugin",
9
+ "mcp",
10
+ "powerlines",
11
+ "storm-software"
12
+ ],
13
+ "homepage": "https://stormsoftware.com",
14
+ "bugs": {
15
+ "url": "https://stormsoftware.com/support",
16
+ "email": "support@stormsoftware.com"
17
+ },
18
+ "repository": {
19
+ "type": "github",
20
+ "url": "https://github.com/storm-software/shell-shock.git",
21
+ "directory": "packages/plugin-mcp"
22
+ },
23
+ "funding": {
24
+ "type": "github",
25
+ "url": "https://github.com/sponsors/storm-software"
26
+ },
27
+ "license": "Apache-2.0",
28
+ "author": {
29
+ "name": "Storm Software",
30
+ "email": "contact@stormsoftware.com",
31
+ "url": "https://stormsoftware.com"
32
+ },
33
+ "maintainers": [
34
+ {
35
+ "name": "Storm Software",
36
+ "email": "contact@stormsoftware.com",
37
+ "url": "https://stormsoftware.com"
38
+ }
39
+ ],
40
+ "contributors": [
41
+ {
42
+ "name": "Storm Software",
43
+ "email": "contact@stormsoftware.com",
44
+ "url": "https://stormsoftware.com"
45
+ }
46
+ ],
47
+ "type": "module",
48
+ "exports": {
49
+ ".": {
50
+ "require": {
51
+ "types": "./dist/index.d.cts",
52
+ "default": "./dist/index.cjs"
53
+ },
54
+ "import": {
55
+ "types": "./dist/index.d.mts",
56
+ "default": "./dist/index.mjs"
57
+ },
58
+ "default": {
59
+ "types": "./dist/index.d.mts",
60
+ "default": "./dist/index.mjs"
61
+ }
62
+ },
63
+ "./components/mcp-command": {
64
+ "require": {
65
+ "types": "./dist/components/mcp-command.d.cts",
66
+ "default": "./dist/components/mcp-command.cjs"
67
+ },
68
+ "import": {
69
+ "types": "./dist/components/mcp-command.d.mts",
70
+ "default": "./dist/components/mcp-command.mjs"
71
+ },
72
+ "default": {
73
+ "types": "./dist/components/mcp-command.d.mts",
74
+ "default": "./dist/components/mcp-command.mjs"
75
+ }
76
+ },
77
+ "./generator": {
78
+ "require": {
79
+ "types": "./dist/generator.d.cts",
80
+ "default": "./dist/generator.cjs"
81
+ },
82
+ "import": {
83
+ "types": "./dist/generator.d.mts",
84
+ "default": "./dist/generator.mjs"
85
+ },
86
+ "default": {
87
+ "types": "./dist/generator.d.mts",
88
+ "default": "./dist/generator.mjs"
89
+ }
90
+ },
91
+ "./package.json": "./package.json",
92
+ "./types": {
93
+ "require": {
94
+ "types": "./dist/types/index.d.cts",
95
+ "default": "./dist/types/index.cjs"
96
+ },
97
+ "import": {
98
+ "types": "./dist/types/index.d.mts",
99
+ "default": "./dist/types/index.mjs"
100
+ },
101
+ "default": {
102
+ "types": "./dist/types/index.d.mts",
103
+ "default": "./dist/types/index.mjs"
104
+ }
105
+ },
106
+ "./types/plugin": {
107
+ "require": {
108
+ "types": "./dist/types/plugin.d.cts",
109
+ "default": "./dist/types/plugin.cjs"
110
+ },
111
+ "import": {
112
+ "types": "./dist/types/plugin.d.mts",
113
+ "default": "./dist/types/plugin.mjs"
114
+ },
115
+ "default": {
116
+ "types": "./dist/types/plugin.d.mts",
117
+ "default": "./dist/types/plugin.mjs"
118
+ }
119
+ }
120
+ },
121
+ "main": "./dist/index.cjs",
122
+ "module": "./dist/index.mjs",
123
+ "types": "./dist/index.d.cts",
124
+ "typings": "dist/index.d.mts",
125
+ "files": ["dist"],
126
+ "dependencies": {
127
+ "@alloy-js/core": "^0.24.1",
128
+ "@alloy-js/typescript": "^0.24.0",
129
+ "@modelcontextprotocol/server": "^2.0.0",
130
+ "@power-plant/alloy-js": "^0.0.87",
131
+ "@power-plant/core": "^0.0.90",
132
+ "@powerlines/plugin-alloy": "^0.26.308",
133
+ "@powerlines/plugin-plugin": "^0.12.623",
134
+ "@shell-shock/core": "0.17.23",
135
+ "@stryke/path": "^0.29.35",
136
+ "@stryke/type-checks": "^0.6.41",
137
+ "defu": "^6.1.7",
138
+ "powerlines": "^0.47.210",
139
+ "zod": "^4.4.3"
140
+ },
141
+ "devDependencies": { "@types/node": "^25.9.5" },
142
+ "publishConfig": { "access": "public" },
143
+ "gitHead": "3227e8ed7b3e816987d4d4f270dfdfceb963c022"
144
+ }