@rushstack/mcp-server 0.1.7 → 0.2.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 (43) hide show
  1. package/CHANGELOG.json +24 -0
  2. package/CHANGELOG.md +15 -1
  3. package/README.md +32 -0
  4. package/dist/mcp-server.d.ts +61 -0
  5. package/dist/tsdoc-metadata.json +11 -0
  6. package/lib/index.d.ts +8 -2
  7. package/lib/index.d.ts.map +1 -1
  8. package/lib/index.js +10 -4
  9. package/lib/index.js.map +1 -1
  10. package/lib/pluginFramework/IRushMcpPlugin.d.ts +14 -0
  11. package/lib/pluginFramework/IRushMcpPlugin.d.ts.map +1 -0
  12. package/lib/pluginFramework/IRushMcpPlugin.js +5 -0
  13. package/lib/pluginFramework/IRushMcpPlugin.js.map +1 -0
  14. package/lib/pluginFramework/IRushMcpTool.d.ts +11 -0
  15. package/lib/pluginFramework/IRushMcpTool.d.ts.map +1 -0
  16. package/lib/pluginFramework/IRushMcpTool.js +5 -0
  17. package/lib/pluginFramework/IRushMcpTool.js.map +1 -0
  18. package/lib/pluginFramework/RushMcpPluginLoader.d.ts +60 -0
  19. package/lib/pluginFramework/RushMcpPluginLoader.d.ts.map +1 -0
  20. package/lib/pluginFramework/RushMcpPluginLoader.js +130 -0
  21. package/lib/pluginFramework/RushMcpPluginLoader.js.map +1 -0
  22. package/lib/pluginFramework/RushMcpPluginSession.d.ts +27 -0
  23. package/lib/pluginFramework/RushMcpPluginSession.d.ts.map +1 -0
  24. package/lib/pluginFramework/RushMcpPluginSession.js +66 -0
  25. package/lib/pluginFramework/RushMcpPluginSession.js.map +1 -0
  26. package/lib/pluginFramework/zodTypes.d.ts +9 -0
  27. package/lib/pluginFramework/zodTypes.d.ts.map +1 -0
  28. package/lib/pluginFramework/zodTypes.js +8 -0
  29. package/lib/pluginFramework/zodTypes.js.map +1 -0
  30. package/lib/rush-doc-fragment.mock.json +18 -0
  31. package/lib/schemas/rush-mcp-plugin.schema.json +21 -0
  32. package/lib/schemas/rush-mcp.schema.json +32 -0
  33. package/lib/server.d.ts +2 -0
  34. package/lib/server.d.ts.map +1 -1
  35. package/lib/server.js +5 -0
  36. package/lib/server.js.map +1 -1
  37. package/lib/start.js +2 -1
  38. package/lib/start.js.map +1 -1
  39. package/lib/utilities/log.d.ts +2 -2
  40. package/lib/utilities/log.d.ts.map +1 -1
  41. package/lib/utilities/log.js +2 -3
  42. package/lib/utilities/log.js.map +1 -1
  43. package/package.json +14 -5
package/CHANGELOG.json CHANGED
@@ -1,6 +1,30 @@
1
1
  {
2
2
  "name": "@rushstack/mcp-server",
3
3
  "entries": [
4
+ {
5
+ "version": "0.2.0",
6
+ "tag": "@rushstack/mcp-server_v0.2.0",
7
+ "date": "Fri, 06 Jun 2025 00:11:09 GMT",
8
+ "comments": {
9
+ "minor": [
10
+ {
11
+ "comment": "Introduce a plugin system for custom MCP tools"
12
+ }
13
+ ]
14
+ }
15
+ },
16
+ {
17
+ "version": "0.1.8",
18
+ "tag": "@rushstack/mcp-server_v0.1.8",
19
+ "date": "Thu, 29 May 2025 15:10:58 GMT",
20
+ "comments": {
21
+ "patch": [
22
+ {
23
+ "comment": "Update the rush mcp server README.md document"
24
+ }
25
+ ]
26
+ }
27
+ },
4
28
  {
5
29
  "version": "0.1.7",
6
30
  "tag": "@rushstack/mcp-server_v0.1.7",
package/CHANGELOG.md CHANGED
@@ -1,6 +1,20 @@
1
1
  # Change Log - @rushstack/mcp-server
2
2
 
3
- This log was last generated on Tue, 13 May 2025 02:09:20 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 06 Jun 2025 00:11:09 GMT and should not be manually modified.
4
+
5
+ ## 0.2.0
6
+ Fri, 06 Jun 2025 00:11:09 GMT
7
+
8
+ ### Minor changes
9
+
10
+ - Introduce a plugin system for custom MCP tools
11
+
12
+ ## 0.1.8
13
+ Thu, 29 May 2025 15:10:58 GMT
14
+
15
+ ### Patches
16
+
17
+ - Update the rush mcp server README.md document
4
18
 
5
19
  ## 0.1.7
6
20
  Tue, 13 May 2025 02:09:20 GMT
package/README.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # @rushstack/mcp-server
2
2
 
3
+ With the rapid advancement of LLMs, AI applications like Trae, Cursor, Cline, Windsurf, and others have been thriving. However, due to the large scale of monorepos and the context limitations of LLMs, it’s difficult for these models to fully understand your monorepo. This is where @rushstack/mcp-server comes in — by providing a suite of MCP tools, it enables LLMs to better comprehend your monorepo and assist you more effectively with daily development tasks in a Rush-based monorepo environment.
4
+
3
5
  ## Usage
4
6
 
7
+ 1. To get the best results, copy the [.cursor](https://github.com/microsoft/rushstack/tree/main/.cursor) directory into the root of your project.
8
+
9
+ 2. Configure `@rushstack/mcp-server` in your AI application
10
+
11
+ ```
12
+ {
13
+ "mcpServers": {
14
+ "rush": {
15
+ "command": "npx",
16
+ "args": ["-y", "@rushstack/mcp-server", "your-project-path"]
17
+ }
18
+ }
19
+ }
20
+ ```
21
+
22
+ 3. Congratulations 🎉 You’ve completed the setup — Rush MCP is now ready to use!
23
+
24
+ ## Available Tools
25
+
26
+ - `rush_docs`: Retrieves relevant documentation sections based on your queries
27
+ - `rush_workspace_details`: Retrieve detailed workspace information
28
+ - `rush_project_details`: Get detailed information about a specific project
29
+ - `rush_command_validator`: Validate whether commands are compliant and follow best practices
30
+ - `rush_migrate_project`: Migrate a project from one directory to another or into a different subspace
31
+ - `rush_pnpm_lock_file_conflict_resolver`: Resolve pnpm-lock.yaml conflicts
32
+
5
33
  ## Links
34
+
35
+ - [CHANGELOG.md](
36
+ https://github.com/microsoft/rushstack/blob/main/apps/rush-mcp-server/CHANGELOG.md) - Find
37
+ out what's new in the latest version
@@ -0,0 +1,61 @@
1
+ /**
2
+ * API for use by MCP plugins.
3
+ * @packageDocumentation
4
+ */
5
+
6
+ import { CallToolResultSchema } from '@modelcontextprotocol/sdk/types';
7
+ import type * as zodModule from 'zod';
8
+
9
+ /**
10
+ * @public
11
+ */
12
+ export declare type CallToolResult = zodModule.infer<typeof CallToolResultSchema>;
13
+
14
+ export { CallToolResultSchema }
15
+
16
+ /**
17
+ * Each plugin gets its own session.
18
+ *
19
+ * @public
20
+ */
21
+ export declare interface IRegisterToolOptions {
22
+ toolName: string;
23
+ description?: string;
24
+ }
25
+
26
+ /**
27
+ * MCP plugins should implement this interface.
28
+ * @public
29
+ */
30
+ export declare interface IRushMcpPlugin {
31
+ onInitializeAsync(): Promise<void>;
32
+ }
33
+
34
+ /**
35
+ * MCP plugins should implement this interface.
36
+ * @public
37
+ */
38
+ export declare interface IRushMcpTool<TSchema extends zodModule.ZodObject<zodModule.ZodRawShape> = zodModule.ZodObject<zodModule.ZodRawShape>> {
39
+ readonly schema: TSchema;
40
+ executeAsync(input: zodModule.infer<TSchema>): Promise<CallToolResult>;
41
+ }
42
+
43
+ /**
44
+ * The plugin's entry point should return this function as its default export.
45
+ * @public
46
+ */
47
+ export declare type RushMcpPluginFactory<TConfigFile = {}> = (session: RushMcpPluginSession, configFile: TConfigFile | undefined) => IRushMcpPlugin;
48
+
49
+ /**
50
+ * Each plugin gets its own session.
51
+ *
52
+ * @public
53
+ */
54
+ export declare abstract class RushMcpPluginSession {
55
+ readonly zod: typeof zodModule;
56
+ abstract registerTool(options: IRegisterToolOptions, tool: IRushMcpTool): void;
57
+ }
58
+
59
+ export { zodModule }
60
+
61
+ export { }
@@ -0,0 +1,11 @@
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "7.52.8"
9
+ }
10
+ ]
11
+ }
package/lib/index.d.ts CHANGED
@@ -1,3 +1,9 @@
1
- export { log } from './utilities/log';
2
- export * from './tools';
1
+ /**
2
+ * API for use by MCP plugins.
3
+ * @packageDocumentation
4
+ */
5
+ export * from './pluginFramework/IRushMcpPlugin';
6
+ export * from './pluginFramework/IRushMcpTool';
7
+ export { type IRegisterToolOptions, RushMcpPluginSession } from './pluginFramework/RushMcpPluginSession';
8
+ export * from './pluginFramework/zodTypes';
3
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA;;;GAGG;AAEH,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,OAAO,EAAE,KAAK,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AACzG,cAAc,4BAA4B,CAAC"}
package/lib/index.js CHANGED
@@ -16,8 +16,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
17
17
  };
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.log = void 0;
20
- var log_1 = require("./utilities/log");
21
- Object.defineProperty(exports, "log", { enumerable: true, get: function () { return log_1.log; } });
22
- __exportStar(require("./tools"), exports);
19
+ exports.RushMcpPluginSession = void 0;
20
+ /**
21
+ * API for use by MCP plugins.
22
+ * @packageDocumentation
23
+ */
24
+ __exportStar(require("./pluginFramework/IRushMcpPlugin"), exports);
25
+ __exportStar(require("./pluginFramework/IRushMcpTool"), exports);
26
+ var RushMcpPluginSession_1 = require("./pluginFramework/RushMcpPluginSession");
27
+ Object.defineProperty(exports, "RushMcpPluginSession", { enumerable: true, get: function () { return RushMcpPluginSession_1.RushMcpPluginSession; } });
28
+ __exportStar(require("./pluginFramework/zodTypes"), exports);
23
29
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;AAE3D,uCAAsC;AAA7B,0FAAA,GAAG,OAAA;AACZ,0CAAwB","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nexport { log } from './utilities/log';\nexport * from './tools';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;AAE3D;;;GAGG;AAEH,mEAAiD;AACjD,iEAA+C;AAC/C,+EAAyG;AAArE,4HAAA,oBAAoB,OAAA;AACxD,6DAA2C","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n/**\n * API for use by MCP plugins.\n * @packageDocumentation\n */\n\nexport * from './pluginFramework/IRushMcpPlugin';\nexport * from './pluginFramework/IRushMcpTool';\nexport { type IRegisterToolOptions, RushMcpPluginSession } from './pluginFramework/RushMcpPluginSession';\nexport * from './pluginFramework/zodTypes';\n"]}
@@ -0,0 +1,14 @@
1
+ import type { RushMcpPluginSession } from './RushMcpPluginSession';
2
+ /**
3
+ * MCP plugins should implement this interface.
4
+ * @public
5
+ */
6
+ export interface IRushMcpPlugin {
7
+ onInitializeAsync(): Promise<void>;
8
+ }
9
+ /**
10
+ * The plugin's entry point should return this function as its default export.
11
+ * @public
12
+ */
13
+ export type RushMcpPluginFactory<TConfigFile = {}> = (session: RushMcpPluginSession, configFile: TConfigFile | undefined) => IRushMcpPlugin;
14
+ //# sourceMappingURL=IRushMcpPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IRushMcpPlugin.d.ts","sourceRoot":"","sources":["../../src/pluginFramework/IRushMcpPlugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEnE;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAED;;;GAGG;AAEH,MAAM,MAAM,oBAAoB,CAAC,WAAW,GAAG,EAAE,IAAI,CACnD,OAAO,EAAE,oBAAoB,EAC7B,UAAU,EAAE,WAAW,GAAG,SAAS,KAChC,cAAc,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ //# sourceMappingURL=IRushMcpPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IRushMcpPlugin.js","sourceRoot":"","sources":["../../src/pluginFramework/IRushMcpPlugin.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type { RushMcpPluginSession } from './RushMcpPluginSession';\n\n/**\n * MCP plugins should implement this interface.\n * @public\n */\nexport interface IRushMcpPlugin {\n onInitializeAsync(): Promise<void>;\n}\n\n/**\n * The plugin's entry point should return this function as its default export.\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type RushMcpPluginFactory<TConfigFile = {}> = (\n session: RushMcpPluginSession,\n configFile: TConfigFile | undefined\n) => IRushMcpPlugin;\n"]}
@@ -0,0 +1,11 @@
1
+ import type * as zod from 'zod';
2
+ import type { CallToolResult } from './zodTypes';
3
+ /**
4
+ * MCP plugins should implement this interface.
5
+ * @public
6
+ */
7
+ export interface IRushMcpTool<TSchema extends zod.ZodObject<zod.ZodRawShape> = zod.ZodObject<zod.ZodRawShape>> {
8
+ readonly schema: TSchema;
9
+ executeAsync(input: zod.infer<TSchema>): Promise<CallToolResult>;
10
+ }
11
+ //# sourceMappingURL=IRushMcpTool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IRushMcpTool.d.ts","sourceRoot":"","sources":["../../src/pluginFramework/IRushMcpTool.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,GAAG,MAAM,KAAK,CAAC;AAEhC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD;;;GAGG;AACH,MAAM,WAAW,YAAY,CAC3B,OAAO,SAAS,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC;IAE/E,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAClE"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ //# sourceMappingURL=IRushMcpTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IRushMcpTool.js","sourceRoot":"","sources":["../../src/pluginFramework/IRushMcpTool.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type * as zod from 'zod';\n\nimport type { CallToolResult } from './zodTypes';\n\n/**\n * MCP plugins should implement this interface.\n * @public\n */\nexport interface IRushMcpTool<\n TSchema extends zod.ZodObject<zod.ZodRawShape> = zod.ZodObject<zod.ZodRawShape>\n> {\n readonly schema: TSchema;\n executeAsync(input: zod.infer<TSchema>): Promise<CallToolResult>;\n}\n"]}
@@ -0,0 +1,60 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp';
2
+ /**
3
+ * Configuration for @rushstack/mcp-server in a monorepo.
4
+ * Corresponds to the contents of common/config/rush-mcp/rush-mcp.json
5
+ */
6
+ export interface IJsonRushMcpConfig {
7
+ /**
8
+ * The list of plugins that @rushstack/mcp-server should load when processing this monorepo.
9
+ */
10
+ mcpPlugins: IJsonRushMcpPlugin[];
11
+ }
12
+ /**
13
+ * Describes a single MCP plugin entry.
14
+ */
15
+ export interface IJsonRushMcpPlugin {
16
+ /**
17
+ * The name of an NPM package that appears in the package.json "dependencies" for the autoinstaller.
18
+ */
19
+ packageName: string;
20
+ /**
21
+ * The name of a Rush autoinstaller with this package as its dependency.
22
+ * @rushstack/mcp-server will ensure this folder is installed before loading the plugin.
23
+ */
24
+ autoinstaller: string;
25
+ /**
26
+ * The name of the plugin. This is used to identify the plugin in the MCP server.
27
+ */
28
+ pluginName: string;
29
+ }
30
+ /**
31
+ * Manifest file for a Rush MCP plugin.
32
+ * Every plugin package must contain a "rush-mcp-plugin.json" manifest in the top-level folder.
33
+ */
34
+ export interface IJsonRushMcpPluginManifest {
35
+ /**
36
+ * A name that uniquely identifies your plugin.
37
+ * Generally this should match the NPM package name; two plugins with the same pluginName cannot be loaded together.
38
+ */
39
+ pluginName: string;
40
+ /**
41
+ * Optional. Indicates that your plugin accepts a config file.
42
+ * The MCP server will load this schema file and provide it to the plugin.
43
+ * Path is typically `<rush-repo>/common/config/rush-mcp/<plugin-name>.json`.
44
+ */
45
+ configFileSchema?: string;
46
+ /**
47
+ * The module path to the plugin's entry point.
48
+ * Its default export must be a class implementing the MCP plugin interface.
49
+ */
50
+ entryPoint: string;
51
+ }
52
+ export declare class RushMcpPluginLoader {
53
+ private static readonly _rushMcpJsonSchema;
54
+ private static readonly _rushMcpPluginSchemaObject;
55
+ private readonly _rushWorkspacePath;
56
+ private readonly _mcpServer;
57
+ constructor(rushWorkspacePath: string, mcpServer: McpServer);
58
+ loadAsync(): Promise<void>;
59
+ }
60
+ //# sourceMappingURL=RushMcpPluginLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RushMcpPluginLoader.d.ts","sourceRoot":"","sources":["../../src/pluginFramework/RushMcpPluginLoader.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAQtE;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,UAAU,EAAE,kBAAkB,EAAE,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CACa;IACvD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,0BAA0B,CACO;IAEzD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAS;IAC5C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAY;gBAEpB,iBAAiB,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS;IAKrD,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;CAyGxC"}
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
16
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
17
+ }) : function(o, v) {
18
+ o["default"] = v;
19
+ });
20
+ var __importStar = (this && this.__importStar) || (function () {
21
+ var ownKeys = function(o) {
22
+ ownKeys = Object.getOwnPropertyNames || function (o) {
23
+ var ar = [];
24
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
25
+ return ar;
26
+ };
27
+ return ownKeys(o);
28
+ };
29
+ return function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ })();
37
+ var __importDefault = (this && this.__importDefault) || function (mod) {
38
+ return (mod && mod.__esModule) ? mod : { "default": mod };
39
+ };
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ exports.RushMcpPluginLoader = void 0;
42
+ const path = __importStar(require("path"));
43
+ const node_core_library_1 = require("@rushstack/node-core-library");
44
+ const Autoinstaller_1 = require("@rushstack/rush-sdk/lib/logic/Autoinstaller");
45
+ const RushGlobalFolder_1 = require("@rushstack/rush-sdk/lib/api/RushGlobalFolder");
46
+ const RushConfiguration_1 = require("@rushstack/rush-sdk/lib/api/RushConfiguration");
47
+ const RushMcpPluginSession_1 = require("./RushMcpPluginSession");
48
+ const rush_mcp_schema_json_1 = __importDefault(require("../schemas/rush-mcp.schema.json"));
49
+ const rush_mcp_plugin_schema_json_1 = __importDefault(require("../schemas/rush-mcp-plugin.schema.json"));
50
+ class RushMcpPluginLoader {
51
+ constructor(rushWorkspacePath, mcpServer) {
52
+ this._rushWorkspacePath = rushWorkspacePath;
53
+ this._mcpServer = mcpServer;
54
+ }
55
+ async loadAsync() {
56
+ const rushMcpFilePath = path.join(this._rushWorkspacePath, 'common/config/rush-mcp/rush-mcp.json');
57
+ if (!(await node_core_library_1.FileSystem.existsAsync(rushMcpFilePath))) {
58
+ return;
59
+ }
60
+ const rushConfiguration = RushConfiguration_1.RushConfiguration.loadFromDefaultLocation({
61
+ startingFolder: this._rushWorkspacePath
62
+ });
63
+ const jsonRushMcpConfig = await node_core_library_1.JsonFile.loadAndValidateAsync(rushMcpFilePath, RushMcpPluginLoader._rushMcpJsonSchema);
64
+ if (jsonRushMcpConfig.mcpPlugins.length === 0) {
65
+ return;
66
+ }
67
+ const rushGlobalFolder = new RushGlobalFolder_1.RushGlobalFolder();
68
+ for (const jsonMcpPlugin of jsonRushMcpConfig.mcpPlugins) {
69
+ // Ensure the autoinstaller is installed
70
+ const autoinstaller = new Autoinstaller_1.Autoinstaller({
71
+ autoinstallerName: jsonMcpPlugin.autoinstaller,
72
+ rushConfiguration,
73
+ rushGlobalFolder,
74
+ restrictConsoleOutput: false
75
+ });
76
+ await autoinstaller.prepareAsync();
77
+ // Load the manifest
78
+ // Suppose the autoinstaller is "my-autoinstaller" and the package is "rush-mcp-example-plugin".
79
+ // Then the folder will be:
80
+ // "/path/to/my-repo/common/autoinstallers/my-autoinstaller/node_modules/rush-mcp-example-plugin"
81
+ const installedPluginPackageFolder = await node_core_library_1.Import.resolvePackageAsync({
82
+ baseFolderPath: autoinstaller.folderFullPath,
83
+ packageName: jsonMcpPlugin.packageName
84
+ });
85
+ const manifestFilePath = path.join(installedPluginPackageFolder, 'rush-mcp-plugin.json');
86
+ if (!(await node_core_library_1.FileSystem.existsAsync(manifestFilePath))) {
87
+ throw new Error('The "rush-mcp-plugin.json" manifest file was not found under ' + installedPluginPackageFolder);
88
+ }
89
+ const jsonManifest = await node_core_library_1.JsonFile.loadAndValidateAsync(manifestFilePath, RushMcpPluginLoader._rushMcpPluginSchemaObject);
90
+ let rushMcpPluginOptions = {};
91
+ if (jsonManifest.configFileSchema) {
92
+ const mcpPluginSchemaFilePath = path.resolve(installedPluginPackageFolder, jsonManifest.configFileSchema);
93
+ const mcpPluginSchema = await node_core_library_1.JsonSchema.fromFile(mcpPluginSchemaFilePath);
94
+ const rushMcpPluginOptionsFilePath = path.resolve(this._rushWorkspacePath, `common/config/rush-mcp/${jsonMcpPlugin.pluginName}.json`);
95
+ // Example: /path/to/my-repo/common/config/rush-mcp/rush-mcp-example-plugin.json
96
+ rushMcpPluginOptions = await node_core_library_1.JsonFile.loadAndValidateAsync(rushMcpPluginOptionsFilePath, mcpPluginSchema);
97
+ }
98
+ const fullEntryPointPath = path.join(installedPluginPackageFolder, jsonManifest.entryPoint);
99
+ let pluginFactory;
100
+ try {
101
+ const entryPointModule = require(fullEntryPointPath);
102
+ if (entryPointModule.default === undefined) {
103
+ throw new Error('The commonJS "default" export is missing');
104
+ }
105
+ pluginFactory = entryPointModule.default;
106
+ }
107
+ catch (e) {
108
+ throw new Error(`Unable to load plugin entry point at ${fullEntryPointPath}: ` + e.toString());
109
+ }
110
+ const session = new RushMcpPluginSession_1.RushMcpPluginSessionInternal(this._mcpServer);
111
+ let plugin;
112
+ try {
113
+ plugin = pluginFactory(session, rushMcpPluginOptions);
114
+ }
115
+ catch (e) {
116
+ throw new Error(`Error invoking entry point for plugin ${jsonManifest.pluginName}:` + e.toString());
117
+ }
118
+ try {
119
+ await plugin.onInitializeAsync();
120
+ }
121
+ catch (e) {
122
+ throw new Error(`Error occurred in onInitializeAsync() for plugin ${jsonManifest.pluginName}:` + e.toString());
123
+ }
124
+ }
125
+ }
126
+ }
127
+ exports.RushMcpPluginLoader = RushMcpPluginLoader;
128
+ RushMcpPluginLoader._rushMcpJsonSchema = node_core_library_1.JsonSchema.fromLoadedObject(rush_mcp_schema_json_1.default);
129
+ RushMcpPluginLoader._rushMcpPluginSchemaObject = node_core_library_1.JsonSchema.fromLoadedObject(rush_mcp_plugin_schema_json_1.default);
130
+ //# sourceMappingURL=RushMcpPluginLoader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RushMcpPluginLoader.js","sourceRoot":"","sources":["../../src/pluginFramework/RushMcpPluginLoader.ts"],"names":[],"mappings":"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","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'path';\nimport { FileSystem, Import, JsonFile, type JsonObject, JsonSchema } from '@rushstack/node-core-library';\nimport { Autoinstaller } from '@rushstack/rush-sdk/lib/logic/Autoinstaller';\nimport { RushGlobalFolder } from '@rushstack/rush-sdk/lib/api/RushGlobalFolder';\nimport { RushConfiguration } from '@rushstack/rush-sdk/lib/api/RushConfiguration';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp';\n\nimport type { IRushMcpPlugin, RushMcpPluginFactory } from './IRushMcpPlugin';\nimport { RushMcpPluginSessionInternal } from './RushMcpPluginSession';\n\nimport rushMcpJsonSchemaObject from '../schemas/rush-mcp.schema.json';\nimport rushMcpPluginSchemaObject from '../schemas/rush-mcp-plugin.schema.json';\n\n/**\n * Configuration for @rushstack/mcp-server in a monorepo.\n * Corresponds to the contents of common/config/rush-mcp/rush-mcp.json\n */\nexport interface IJsonRushMcpConfig {\n /**\n * The list of plugins that @rushstack/mcp-server should load when processing this monorepo.\n */\n mcpPlugins: IJsonRushMcpPlugin[];\n}\n\n/**\n * Describes a single MCP plugin entry.\n */\nexport interface IJsonRushMcpPlugin {\n /**\n * The name of an NPM package that appears in the package.json \"dependencies\" for the autoinstaller.\n */\n packageName: string;\n\n /**\n * The name of a Rush autoinstaller with this package as its dependency.\n * @rushstack/mcp-server will ensure this folder is installed before loading the plugin.\n */\n autoinstaller: string;\n\n /**\n * The name of the plugin. This is used to identify the plugin in the MCP server.\n */\n pluginName: string;\n}\n\n/**\n * Manifest file for a Rush MCP plugin.\n * Every plugin package must contain a \"rush-mcp-plugin.json\" manifest in the top-level folder.\n */\nexport interface IJsonRushMcpPluginManifest {\n /**\n * A name that uniquely identifies your plugin.\n * Generally this should match the NPM package name; two plugins with the same pluginName cannot be loaded together.\n */\n pluginName: string;\n\n /**\n * Optional. Indicates that your plugin accepts a config file.\n * The MCP server will load this schema file and provide it to the plugin.\n * Path is typically `<rush-repo>/common/config/rush-mcp/<plugin-name>.json`.\n */\n configFileSchema?: string;\n\n /**\n * The module path to the plugin's entry point.\n * Its default export must be a class implementing the MCP plugin interface.\n */\n entryPoint: string;\n}\n\nexport class RushMcpPluginLoader {\n private static readonly _rushMcpJsonSchema: JsonSchema =\n JsonSchema.fromLoadedObject(rushMcpJsonSchemaObject);\n private static readonly _rushMcpPluginSchemaObject: JsonSchema =\n JsonSchema.fromLoadedObject(rushMcpPluginSchemaObject);\n\n private readonly _rushWorkspacePath: string;\n private readonly _mcpServer: McpServer;\n\n public constructor(rushWorkspacePath: string, mcpServer: McpServer) {\n this._rushWorkspacePath = rushWorkspacePath;\n this._mcpServer = mcpServer;\n }\n\n public async loadAsync(): Promise<void> {\n const rushMcpFilePath: string = path.join(\n this._rushWorkspacePath,\n 'common/config/rush-mcp/rush-mcp.json'\n );\n\n if (!(await FileSystem.existsAsync(rushMcpFilePath))) {\n return;\n }\n\n const rushConfiguration: RushConfiguration = RushConfiguration.loadFromDefaultLocation({\n startingFolder: this._rushWorkspacePath\n });\n\n const jsonRushMcpConfig: IJsonRushMcpConfig = await JsonFile.loadAndValidateAsync(\n rushMcpFilePath,\n RushMcpPluginLoader._rushMcpJsonSchema\n );\n\n if (jsonRushMcpConfig.mcpPlugins.length === 0) {\n return;\n }\n\n const rushGlobalFolder: RushGlobalFolder = new RushGlobalFolder();\n\n for (const jsonMcpPlugin of jsonRushMcpConfig.mcpPlugins) {\n // Ensure the autoinstaller is installed\n const autoinstaller: Autoinstaller = new Autoinstaller({\n autoinstallerName: jsonMcpPlugin.autoinstaller,\n rushConfiguration,\n rushGlobalFolder,\n restrictConsoleOutput: false\n });\n await autoinstaller.prepareAsync();\n\n // Load the manifest\n\n // Suppose the autoinstaller is \"my-autoinstaller\" and the package is \"rush-mcp-example-plugin\".\n // Then the folder will be:\n // \"/path/to/my-repo/common/autoinstallers/my-autoinstaller/node_modules/rush-mcp-example-plugin\"\n const installedPluginPackageFolder: string = await Import.resolvePackageAsync({\n baseFolderPath: autoinstaller.folderFullPath,\n packageName: jsonMcpPlugin.packageName\n });\n\n const manifestFilePath: string = path.join(installedPluginPackageFolder, 'rush-mcp-plugin.json');\n if (!(await FileSystem.existsAsync(manifestFilePath))) {\n throw new Error(\n 'The \"rush-mcp-plugin.json\" manifest file was not found under ' + installedPluginPackageFolder\n );\n }\n\n const jsonManifest: IJsonRushMcpPluginManifest = await JsonFile.loadAndValidateAsync(\n manifestFilePath,\n RushMcpPluginLoader._rushMcpPluginSchemaObject\n );\n\n let rushMcpPluginOptions: JsonObject = {};\n if (jsonManifest.configFileSchema) {\n const mcpPluginSchemaFilePath: string = path.resolve(\n installedPluginPackageFolder,\n jsonManifest.configFileSchema\n );\n const mcpPluginSchema: JsonSchema = await JsonSchema.fromFile(mcpPluginSchemaFilePath);\n const rushMcpPluginOptionsFilePath: string = path.resolve(\n this._rushWorkspacePath,\n `common/config/rush-mcp/${jsonMcpPlugin.pluginName}.json`\n );\n // Example: /path/to/my-repo/common/config/rush-mcp/rush-mcp-example-plugin.json\n rushMcpPluginOptions = await JsonFile.loadAndValidateAsync(\n rushMcpPluginOptionsFilePath,\n mcpPluginSchema\n );\n }\n\n const fullEntryPointPath: string = path.join(installedPluginPackageFolder, jsonManifest.entryPoint);\n let pluginFactory: RushMcpPluginFactory;\n try {\n const entryPointModule: { default?: RushMcpPluginFactory } = require(fullEntryPointPath);\n if (entryPointModule.default === undefined) {\n throw new Error('The commonJS \"default\" export is missing');\n }\n pluginFactory = entryPointModule.default;\n } catch (e) {\n throw new Error(`Unable to load plugin entry point at ${fullEntryPointPath}: ` + e.toString());\n }\n\n const session: RushMcpPluginSessionInternal = new RushMcpPluginSessionInternal(this._mcpServer);\n\n let plugin: IRushMcpPlugin;\n try {\n plugin = pluginFactory(session, rushMcpPluginOptions);\n } catch (e) {\n throw new Error(`Error invoking entry point for plugin ${jsonManifest.pluginName}:` + e.toString());\n }\n\n try {\n await plugin.onInitializeAsync();\n } catch (e) {\n throw new Error(\n `Error occurred in onInitializeAsync() for plugin ${jsonManifest.pluginName}:` + e.toString()\n );\n }\n }\n }\n}\n"]}
@@ -0,0 +1,27 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp';
2
+ import type { IRushMcpTool } from './IRushMcpTool';
3
+ import type { zodModule } from './zodTypes';
4
+ /**
5
+ * Each plugin gets its own session.
6
+ *
7
+ * @public
8
+ */
9
+ export interface IRegisterToolOptions {
10
+ toolName: string;
11
+ description?: string;
12
+ }
13
+ /**
14
+ * Each plugin gets its own session.
15
+ *
16
+ * @public
17
+ */
18
+ export declare abstract class RushMcpPluginSession {
19
+ readonly zod: typeof zodModule;
20
+ abstract registerTool(options: IRegisterToolOptions, tool: IRushMcpTool): void;
21
+ }
22
+ export declare class RushMcpPluginSessionInternal extends RushMcpPluginSession {
23
+ private readonly _mcpServer;
24
+ constructor(mcpServer: McpServer);
25
+ registerTool(options: IRegisterToolOptions, tool: IRushMcpTool): void;
26
+ }
27
+ //# sourceMappingURL=RushMcpPluginSession.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RushMcpPluginSession.d.ts","sourceRoot":"","sources":["../../src/pluginFramework/RushMcpPluginSession.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAEtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,8BAAsB,oBAAoB;IACxC,SAAgB,GAAG,EAAE,OAAO,SAAS,CAAO;aAC5B,YAAY,CAAC,OAAO,EAAE,oBAAoB,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI;CACtF;AAED,qBAAa,4BAA6B,SAAQ,oBAAoB;IACpE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAY;gBAEpB,SAAS,EAAE,SAAS;IAKvB,YAAY,CAAC,OAAO,EAAE,oBAAoB,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI;CAYtF"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
16
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
17
+ }) : function(o, v) {
18
+ o["default"] = v;
19
+ });
20
+ var __importStar = (this && this.__importStar) || (function () {
21
+ var ownKeys = function(o) {
22
+ ownKeys = Object.getOwnPropertyNames || function (o) {
23
+ var ar = [];
24
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
25
+ return ar;
26
+ };
27
+ return ownKeys(o);
28
+ };
29
+ return function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ })();
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ exports.RushMcpPluginSessionInternal = exports.RushMcpPluginSession = void 0;
39
+ const zod = __importStar(require("zod"));
40
+ /**
41
+ * Each plugin gets its own session.
42
+ *
43
+ * @public
44
+ */
45
+ class RushMcpPluginSession {
46
+ constructor() {
47
+ this.zod = zod;
48
+ }
49
+ }
50
+ exports.RushMcpPluginSession = RushMcpPluginSession;
51
+ class RushMcpPluginSessionInternal extends RushMcpPluginSession {
52
+ constructor(mcpServer) {
53
+ super();
54
+ this._mcpServer = mcpServer;
55
+ }
56
+ registerTool(options, tool) {
57
+ if (options.description) {
58
+ this._mcpServer.tool(options.toolName, options.description, tool.schema.shape, tool.executeAsync.bind(tool));
59
+ }
60
+ else {
61
+ this._mcpServer.tool(options.toolName, tool.schema.shape, tool.executeAsync.bind(tool));
62
+ }
63
+ }
64
+ }
65
+ exports.RushMcpPluginSessionInternal = RushMcpPluginSessionInternal;
66
+ //# sourceMappingURL=RushMcpPluginSession.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RushMcpPluginSession.js","sourceRoot":"","sources":["../../src/pluginFramework/RushMcpPluginSession.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,yCAA2B;AAgB3B;;;;GAIG;AACH,MAAsB,oBAAoB;IAA1C;QACkB,QAAG,GAAqB,GAAG,CAAC;IAE9C,CAAC;CAAA;AAHD,oDAGC;AAED,MAAa,4BAA6B,SAAQ,oBAAoB;IAGpE,YAAmB,SAAoB;QACrC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC9B,CAAC;IAEe,YAAY,CAAC,OAA6B,EAAE,IAAkB;QAC5E,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;YACxB,IAAI,CAAC,UAAU,CAAC,IAAI,CAClB,OAAO,CAAC,QAAQ,EAChB,OAAO,CAAC,WAAW,EACnB,IAAI,CAAC,MAAM,CAAC,KAAK,EACjB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAC7B,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1F,CAAC;IACH,CAAC;CACF;AApBD,oEAoBC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as zod from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp';\n\nimport type { IRushMcpTool } from './IRushMcpTool';\nimport type { zodModule } from './zodTypes';\n\n/**\n * Each plugin gets its own session.\n *\n * @public\n */\nexport interface IRegisterToolOptions {\n toolName: string;\n description?: string;\n}\n\n/**\n * Each plugin gets its own session.\n *\n * @public\n */\nexport abstract class RushMcpPluginSession {\n public readonly zod: typeof zodModule = zod;\n public abstract registerTool(options: IRegisterToolOptions, tool: IRushMcpTool): void;\n}\n\nexport class RushMcpPluginSessionInternal extends RushMcpPluginSession {\n private readonly _mcpServer: McpServer;\n\n public constructor(mcpServer: McpServer) {\n super();\n this._mcpServer = mcpServer;\n }\n\n public override registerTool(options: IRegisterToolOptions, tool: IRushMcpTool): void {\n if (options.description) {\n this._mcpServer.tool(\n options.toolName,\n options.description,\n tool.schema.shape,\n tool.executeAsync.bind(tool)\n );\n } else {\n this._mcpServer.tool(options.toolName, tool.schema.shape, tool.executeAsync.bind(tool));\n }\n }\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import type * as zod from 'zod';
2
+ export type { zod as zodModule };
3
+ import { CallToolResultSchema } from '@modelcontextprotocol/sdk/types';
4
+ export { CallToolResultSchema };
5
+ /**
6
+ * @public
7
+ */
8
+ export type CallToolResult = zod.infer<typeof CallToolResultSchema>;
9
+ //# sourceMappingURL=zodTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zodTypes.d.ts","sourceRoot":"","sources":["../../src/pluginFramework/zodTypes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,GAAG,MAAM,KAAK,CAAC;AAChC,YAAY,EAAE,GAAG,IAAI,SAAS,EAAE,CAAC;AAEjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAEhC;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.CallToolResultSchema = void 0;
6
+ const types_1 = require("@modelcontextprotocol/sdk/types");
7
+ Object.defineProperty(exports, "CallToolResultSchema", { enumerable: true, get: function () { return types_1.CallToolResultSchema; } });
8
+ //# sourceMappingURL=zodTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zodTypes.js","sourceRoot":"","sources":["../../src/pluginFramework/zodTypes.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAK3D,2DAAuE;AAE9D,qGAFA,4BAAoB,OAEA","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type * as zod from 'zod';\nexport type { zod as zodModule };\n\nimport { CallToolResultSchema } from '@modelcontextprotocol/sdk/types';\n\nexport { CallToolResultSchema };\n\n/**\n * @public\n */\nexport type CallToolResult = zod.infer<typeof CallToolResultSchema>;\n"]}
@@ -0,0 +1,18 @@
1
+ [
2
+ {
3
+ "text": "---\ntitle: rush install-autoinstaller\n---\n\n```\nusage: rush install-autoinstaller [-h] --name AUTOINSTALLER_NAME\n\nUse this command to install dependencies for an autoinstaller folder.\n\nOptional arguments:\n -h, --help Show this help message and exit.\n --name AUTOINSTALLER_NAME\n The name of the autoinstaller, which must be one of\n the folders under common/autoinstallers.\n```\n\n## See also\n\n- [rush update-autoinstaller](../commands/rush_update-autoinstaller.md)\n- [rush init-autoinstaller](../commands/rush_init-autoinstaller.md)",
4
+ "score": 0.7231232
5
+ },
6
+ {
7
+ "text": "---\ntitle: rush install-autoinstaller\n---\n\n```\n用法:rush install-autoinstaller [-h] --name AUTOINSTALLER_NAME\n\n使用该指令给一个项目安装依赖。\n\n可选参数:\n -h, --help 展示帮助信息并退出\n --name AUTOINSTALLER_NAME\n 指定自动安装的包名,它必须是 common/autoinstallers\n 下的一个文件夹。\n```\n\n## See also\n\n- [rush update-autoinstaller](../commands/rush_update-autoinstaller.md)\n- [rush init-autoinstaller](../commands/rush_init-autoinstaller.md)",
8
+ "score": 0.7132133
9
+ },
10
+ {
11
+ "text": "---\ntitle: rush update-autoinstaller\n---\n\n```\nusage: rush update-autoinstaller [-h] --name AUTOINSTALLER_NAME\n\nUse this command to regenerate the shrinkwrap file for an autoinstaller\nfolder.\n\nOptional arguments:\n -h, --help Show this help message and exit.\n --name AUTOINSTALLER_NAME\n The name of the autoinstaller, which must be one of\n the folders under common/autoinstallers.\n```\n\n## See also\n\n- [rush install-autoinstaller](../commands/rush_install-autoinstaller.md)\n- [rush init-autoinstaller](../commands/rush_init-autoinstaller.md)",
12
+ "score": 0.6632131
13
+ },
14
+ {
15
+ "text": "---\ntitle: rush update-autoinstaller\n---\n\n```\nusage: rush update-autoinstaller [-h] --name AUTOINSTALLER_NAME\n\nUse this command to regenerate the shrinkwrap file for an autoinstaller\nfolder.\n\nOptional arguments:\n -h, --help Show this help message and exit.\n --name AUTOINSTALLER_NAME\n The name of the autoinstaller, which must be one of\n the folders under common/autoinstallers.\n```\n\n## See also\n\n- [rush install-autoinstaller](../commands/rush_install-autoinstaller.md)\n- [rush init-autoinstaller](../commands/rush_init-autoinstaller.md)",
16
+ "score": 0.6528328
17
+ }
18
+ ]
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "Rush MCP Plugin Manifest",
4
+ "type": "object",
5
+ "properties": {
6
+ "pluginName": {
7
+ "type": "string",
8
+ "description": "A name that uniquely identifies your plugin. Generally this should match the NPM package name; two plugins with the same pluginName cannot be loaded together."
9
+ },
10
+ "configFileSchema": {
11
+ "type": "string",
12
+ "description": "Optional. Indicates that your plugin accepts a config file. The MCP server will load this schema file and provide it to the plugin. Path is typically `<rush-repo>/common/config/rush-mcp/<plugin-name>.json`."
13
+ },
14
+ "entryPoint": {
15
+ "type": "string",
16
+ "description": "The module path to the plugin's entry point. Its default export must be a class implementing the MCP plugin interface."
17
+ }
18
+ },
19
+ "required": ["pluginName", "entryPoint"],
20
+ "additionalProperties": false
21
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "rush-mcp.json Configuration Schema",
4
+ "type": "object",
5
+ "properties": {
6
+ "mcpPlugins": {
7
+ "type": "array",
8
+ "description": "The list of plugins that `@rushstack/mcp-server` should load when processing this monorepo.",
9
+ "items": {
10
+ "type": "object",
11
+ "properties": {
12
+ "packageName": {
13
+ "type": "string",
14
+ "description": "The name of an NPM package that appears in the package.json \"dependencies\" for the autoinstaller."
15
+ },
16
+ "autoinstaller": {
17
+ "type": "string",
18
+ "description": "The name of a Rush autoinstaller with this package as its dependency."
19
+ },
20
+ "pluginName": {
21
+ "type": "string",
22
+ "description": "The name of the plugin. This is used to identify the plugin in the MCP server."
23
+ }
24
+ },
25
+ "required": ["packageName", "autoinstaller"],
26
+ "additionalProperties": false
27
+ }
28
+ }
29
+ },
30
+ "required": ["mcpPlugins"],
31
+ "additionalProperties": false
32
+ }
package/lib/server.d.ts CHANGED
@@ -2,7 +2,9 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  export declare class RushMCPServer extends McpServer {
3
3
  private _rushWorkspacePath;
4
4
  private _tools;
5
+ private _pluginLoader;
5
6
  constructor(rushWorkspacePath: string);
7
+ startAsync(): Promise<void>;
6
8
  private _initializeTools;
7
9
  private _registerTools;
8
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAWpE,qBAAa,aAAc,SAAQ,SAAS;IAC1C,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,MAAM,CAAkB;gBAEb,iBAAiB,EAAE,MAAM;IAY5C,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,cAAc;CAOvB"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAYpE,qBAAa,aAAc,SAAQ,SAAS;IAC1C,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,aAAa,CAAsB;gBAExB,iBAAiB,EAAE,MAAM;IAU/B,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAOxC,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,cAAc;CAOvB"}
package/lib/server.js CHANGED
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.RushMCPServer = void 0;
6
6
  const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
7
7
  const tools_1 = require("./tools");
8
+ const RushMcpPluginLoader_1 = require("./pluginFramework/RushMcpPluginLoader");
8
9
  class RushMCPServer extends mcp_js_1.McpServer {
9
10
  constructor(rushWorkspacePath) {
10
11
  super({
@@ -13,8 +14,12 @@ class RushMCPServer extends mcp_js_1.McpServer {
13
14
  });
14
15
  this._tools = [];
15
16
  this._rushWorkspacePath = rushWorkspacePath;
17
+ this._pluginLoader = new RushMcpPluginLoader_1.RushMcpPluginLoader(this._rushWorkspacePath, this);
18
+ }
19
+ async startAsync() {
16
20
  this._initializeTools();
17
21
  this._registerTools();
22
+ await this._pluginLoader.loadAsync();
18
23
  }
19
24
  _initializeTools() {
20
25
  this._tools.push(new tools_1.RushConflictResolverTool());
package/lib/server.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,oEAAoE;AACpE,mCAQiB;AAEjB,MAAa,aAAc,SAAQ,kBAAS;IAI1C,YAAmB,iBAAyB;QAC1C,KAAK,CAAC;YACJ,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,OAAO;SACjB,CAAC,CAAC;QANG,WAAM,GAAe,EAAE,CAAC;QAQ9B,IAAI,CAAC,kBAAkB,GAAG,iBAAiB,CAAC;QAE5C,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IAEO,gBAAgB;QACtB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,gCAAwB,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,8BAAsB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC;QACtE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,gCAAwB,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,gCAAwB,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,8BAAsB,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,oBAAY,EAAE,CAAC,CAAC;IACvC,CAAC;IAEO,cAAc;QACpB,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAEvC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;CACF;AAhCD,sCAgCC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport {\n type BaseTool,\n RushConflictResolverTool,\n RushMigrateProjectTool,\n RushCommandValidatorTool,\n RushWorkspaceDetailsTool,\n RushProjectDetailsTool,\n RushDocsTool\n} from './tools';\n\nexport class RushMCPServer extends McpServer {\n private _rushWorkspacePath: string;\n private _tools: BaseTool[] = [];\n\n public constructor(rushWorkspacePath: string) {\n super({\n name: 'rush',\n version: '1.0.0'\n });\n\n this._rushWorkspacePath = rushWorkspacePath;\n\n this._initializeTools();\n this._registerTools();\n }\n\n private _initializeTools(): void {\n this._tools.push(new RushConflictResolverTool());\n this._tools.push(new RushMigrateProjectTool(this._rushWorkspacePath));\n this._tools.push(new RushCommandValidatorTool());\n this._tools.push(new RushWorkspaceDetailsTool());\n this._tools.push(new RushProjectDetailsTool());\n this._tools.push(new RushDocsTool());\n }\n\n private _registerTools(): void {\n process.chdir(this._rushWorkspacePath);\n\n for (const tool of this._tools) {\n tool.register(this);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,oEAAoE;AACpE,mCAQiB;AACjB,+EAA4E;AAE5E,MAAa,aAAc,SAAQ,kBAAS;IAK1C,YAAmB,iBAAyB;QAC1C,KAAK,CAAC;YACJ,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,OAAO;SACjB,CAAC,CAAC;QAPG,WAAM,GAAe,EAAE,CAAC;QAS9B,IAAI,CAAC,kBAAkB,GAAG,iBAAiB,CAAC;QAC5C,IAAI,CAAC,aAAa,GAAG,IAAI,yCAAmB,CAAC,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC;IAC9E,CAAC;IAEM,KAAK,CAAC,UAAU;QACrB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,IAAI,CAAC,cAAc,EAAE,CAAC;QAEtB,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,CAAC;IACvC,CAAC;IAEO,gBAAgB;QACtB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,gCAAwB,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,8BAAsB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC;QACtE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,gCAAwB,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,gCAAwB,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,8BAAsB,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,oBAAY,EAAE,CAAC,CAAC;IACvC,CAAC;IAEO,cAAc;QACpB,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAEvC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;CACF;AAtCD,sCAsCC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport {\n type BaseTool,\n RushConflictResolverTool,\n RushMigrateProjectTool,\n RushCommandValidatorTool,\n RushWorkspaceDetailsTool,\n RushProjectDetailsTool,\n RushDocsTool\n} from './tools';\nimport { RushMcpPluginLoader } from './pluginFramework/RushMcpPluginLoader';\n\nexport class RushMCPServer extends McpServer {\n private _rushWorkspacePath: string;\n private _tools: BaseTool[] = [];\n private _pluginLoader: RushMcpPluginLoader;\n\n public constructor(rushWorkspacePath: string) {\n super({\n name: 'rush',\n version: '1.0.0'\n });\n\n this._rushWorkspacePath = rushWorkspacePath;\n this._pluginLoader = new RushMcpPluginLoader(this._rushWorkspacePath, this);\n }\n\n public async startAsync(): Promise<void> {\n this._initializeTools();\n this._registerTools();\n\n await this._pluginLoader.loadAsync();\n }\n\n private _initializeTools(): void {\n this._tools.push(new RushConflictResolverTool());\n this._tools.push(new RushMigrateProjectTool(this._rushWorkspacePath));\n this._tools.push(new RushCommandValidatorTool());\n this._tools.push(new RushWorkspaceDetailsTool());\n this._tools.push(new RushProjectDetailsTool());\n this._tools.push(new RushDocsTool());\n }\n\n private _registerTools(): void {\n process.chdir(this._rushWorkspacePath);\n\n for (const tool of this._tools) {\n tool.register(this);\n }\n }\n}\n"]}
package/lib/start.js CHANGED
@@ -11,12 +11,13 @@ const main = async () => {
11
11
  throw new Error('Please provide workspace root path as the first argument');
12
12
  }
13
13
  const server = new server_1.RushMCPServer(rushWorkspacePath);
14
+ await server.startAsync();
14
15
  const transport = new stdio_js_1.StdioServerTransport();
15
16
  await server.connect(transport);
16
17
  (0, log_1.log)('Rush MCP Server running on stdio');
17
18
  };
18
19
  main().catch((error) => {
19
- (0, log_1.log)('Fatal error running server:', error);
20
+ (0, log_1.log)('Fatal error running server:', error instanceof Error ? error.message : error);
20
21
  process.exit(1);
21
22
  });
22
23
  //# sourceMappingURL=start.js.map
package/lib/start.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"start.js","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAE3D,wEAAiF;AAEjF,yCAAsC;AACtC,qCAAyC;AAEzC,MAAM,IAAI,GAAG,KAAK,IAAmB,EAAE;IACrC,MAAM,iBAAiB,GAAuB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9D,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC9E,CAAC;IAED,MAAM,MAAM,GAAkB,IAAI,sBAAa,CAAC,iBAAiB,CAAC,CAAC;IACnE,MAAM,SAAS,GAAyB,IAAI,+BAAoB,EAAE,CAAC;IACnE,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,IAAA,SAAG,EAAC,kCAAkC,CAAC,CAAC;AAC1C,CAAC,CAAC;AAEF,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,IAAA,SAAG,EAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;IAC1C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\n\nimport { log } from './utilities/log';\nimport { RushMCPServer } from './server';\n\nconst main = async (): Promise<void> => {\n const rushWorkspacePath: string | undefined = process.argv[2];\n if (!rushWorkspacePath) {\n throw new Error('Please provide workspace root path as the first argument');\n }\n\n const server: RushMCPServer = new RushMCPServer(rushWorkspacePath);\n const transport: StdioServerTransport = new StdioServerTransport();\n await server.connect(transport);\n\n log('Rush MCP Server running on stdio');\n};\n\nmain().catch((error) => {\n log('Fatal error running server:', error);\n process.exit(1);\n});\n"]}
1
+ {"version":3,"file":"start.js","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAE3D,wEAAiF;AAEjF,yCAAsC;AACtC,qCAAyC;AAEzC,MAAM,IAAI,GAAG,KAAK,IAAmB,EAAE;IACrC,MAAM,iBAAiB,GAAuB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9D,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC9E,CAAC;IAED,MAAM,MAAM,GAAkB,IAAI,sBAAa,CAAC,iBAAiB,CAAC,CAAC;IACnE,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;IAC1B,MAAM,SAAS,GAAyB,IAAI,+BAAoB,EAAE,CAAC;IACnE,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,IAAA,SAAG,EAAC,kCAAkC,CAAC,CAAC;AAC1C,CAAC,CAAC;AAEF,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,IAAA,SAAG,EAAC,6BAA6B,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACnF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\n\nimport { log } from './utilities/log';\nimport { RushMCPServer } from './server';\n\nconst main = async (): Promise<void> => {\n const rushWorkspacePath: string | undefined = process.argv[2];\n if (!rushWorkspacePath) {\n throw new Error('Please provide workspace root path as the first argument');\n }\n\n const server: RushMCPServer = new RushMCPServer(rushWorkspacePath);\n await server.startAsync();\n const transport: StdioServerTransport = new StdioServerTransport();\n await server.connect(transport);\n\n log('Rush MCP Server running on stdio');\n};\n\nmain().catch((error) => {\n log('Fatal error running server:', error instanceof Error ? error.message : error);\n process.exit(1);\n});\n"]}
@@ -1,4 +1,4 @@
1
- import { Terminal } from '@rushstack/terminal';
1
+ import { Terminal, type TerminalWriteParameters } from '@rushstack/terminal';
2
2
  export declare const terminal: Terminal;
3
- export declare function log(message?: any, ...optionalParams: any[]): void;
3
+ export declare function log(...messageParts: TerminalWriteParameters): void;
4
4
  //# sourceMappingURL=log.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/utilities/log.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAA2B,MAAM,qBAAqB,CAAC;AAExE,eAAO,MAAM,QAAQ,EAAE,QAA8E,CAAC;AAGtG,wBAAgB,GAAG,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,GAAG,IAAI,CAEjE"}
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/utilities/log.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAA2B,KAAK,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEtG,eAAO,MAAM,QAAQ,EAAE,QAA8E,CAAC;AAEtG,wBAAgB,GAAG,CAAC,GAAG,YAAY,EAAE,uBAAuB,GAAG,IAAI,CAElE"}
@@ -6,8 +6,7 @@ exports.terminal = void 0;
6
6
  exports.log = log;
7
7
  const terminal_1 = require("@rushstack/terminal");
8
8
  exports.terminal = new terminal_1.Terminal(new terminal_1.ConsoleTerminalProvider({ verboseEnabled: true }));
9
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
- function log(message, ...optionalParams) {
11
- exports.terminal.writeErrorLine(message, ...optionalParams);
9
+ function log(...messageParts) {
10
+ exports.terminal.writeErrorLine(...messageParts);
12
11
  }
13
12
  //# sourceMappingURL=log.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/utilities/log.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAO3D,kBAEC;AAPD,kDAAwE;AAE3D,QAAA,QAAQ,GAAa,IAAI,mBAAQ,CAAC,IAAI,kCAAuB,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAEtG,8DAA8D;AAC9D,SAAgB,GAAG,CAAC,OAAa,EAAE,GAAG,cAAqB;IACzD,gBAAQ,CAAC,cAAc,CAAC,OAAO,EAAE,GAAG,cAAc,CAAC,CAAC;AACtD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { Terminal, ConsoleTerminalProvider } from '@rushstack/terminal';\n\nexport const terminal: Terminal = new Terminal(new ConsoleTerminalProvider({ verboseEnabled: true }));\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function log(message?: any, ...optionalParams: any[]): void {\n terminal.writeErrorLine(message, ...optionalParams);\n}\n"]}
1
+ {"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/utilities/log.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAM3D,kBAEC;AAND,kDAAsG;AAEzF,QAAA,QAAQ,GAAa,IAAI,mBAAQ,CAAC,IAAI,kCAAuB,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAEtG,SAAgB,GAAG,CAAC,GAAG,YAAqC;IAC1D,gBAAQ,CAAC,cAAc,CAAC,GAAG,YAAY,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { Terminal, ConsoleTerminalProvider, type TerminalWriteParameters } from '@rushstack/terminal';\n\nexport const terminal: Terminal = new Terminal(new ConsoleTerminalProvider({ verboseEnabled: true }));\n\nexport function log(...messageParts: TerminalWriteParameters): void {\n terminal.writeErrorLine(...messageParts);\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,16 @@
1
1
  {
2
2
  "name": "@rushstack/mcp-server",
3
- "version": "0.1.7",
3
+ "version": "0.2.0",
4
4
  "description": "A Model Context Protocol server implementation for Rush",
5
+ "keywords": [
6
+ "rush",
7
+ "modelcontextprotocol",
8
+ "mcp",
9
+ "monorepo",
10
+ "server"
11
+ ],
12
+ "main": "lib/index.js",
13
+ "typings": "dist/mcp-server.d.ts",
5
14
  "repository": {
6
15
  "type": "git",
7
16
  "url": "https://github.com/microsoft/rushstack.git",
@@ -21,14 +30,14 @@
21
30
  "zod": "~3.24.3",
22
31
  "@rushstack/node-core-library": "5.13.1",
23
32
  "@rushstack/terminal": "0.15.3",
24
- "@rushstack/rush-sdk": "5.153.1",
25
- "@rushstack/ts-command-line": "5.0.1"
33
+ "@rushstack/ts-command-line": "5.0.1",
34
+ "@rushstack/rush-sdk": "5.153.2"
26
35
  },
27
36
  "devDependencies": {
28
37
  "typescript": "~5.8.2",
29
38
  "@types/node": "20.17.19",
30
- "@rushstack/heft": "0.73.6",
31
- "local-node-rig": "1.0.0"
39
+ "local-node-rig": "1.0.0",
40
+ "@rushstack/heft": "0.73.6"
32
41
  },
33
42
  "scripts": {
34
43
  "build": "heft build --clean",