@rushstack/mcp-server
Advanced tools
| /** | ||
| * API for use by MCP plugins. | ||
| * @packageDocumentation | ||
| */ | ||
| import { CallToolResultSchema } from '@modelcontextprotocol/sdk/types'; | ||
| import type * as zodModule from 'zod'; | ||
| /** | ||
| * @public | ||
| */ | ||
| export declare type CallToolResult = zodModule.infer<typeof CallToolResultSchema>; | ||
| export { CallToolResultSchema } | ||
| /** | ||
| * Each plugin gets its own session. | ||
| * | ||
| * @public | ||
| */ | ||
| export declare interface IRegisterToolOptions { | ||
| toolName: string; | ||
| description?: string; | ||
| } | ||
| /** | ||
| * MCP plugins should implement this interface. | ||
| * @public | ||
| */ | ||
| export declare interface IRushMcpPlugin { | ||
| onInitializeAsync(): Promise<void>; | ||
| } | ||
| /** | ||
| * MCP plugins should implement this interface. | ||
| * @public | ||
| */ | ||
| export declare interface IRushMcpTool<TSchema extends zodModule.ZodObject<zodModule.ZodRawShape> = zodModule.ZodObject<zodModule.ZodRawShape>> { | ||
| readonly schema: TSchema; | ||
| executeAsync(input: zodModule.infer<TSchema>): Promise<CallToolResult>; | ||
| } | ||
| /** | ||
| * The plugin's entry point should return this function as its default export. | ||
| * @public | ||
| */ | ||
| export declare type RushMcpPluginFactory<TConfigFile = {}> = (session: RushMcpPluginSession, configFile: TConfigFile | undefined) => IRushMcpPlugin; | ||
| /** | ||
| * Each plugin gets its own session. | ||
| * | ||
| * @public | ||
| */ | ||
| export declare abstract class RushMcpPluginSession { | ||
| readonly zod: typeof zodModule; | ||
| abstract registerTool(options: IRegisterToolOptions, tool: IRushMcpTool): void; | ||
| } | ||
| export { zodModule } | ||
| export { } |
| // This file is read by tools that parse documentation comments conforming to the TSDoc standard. | ||
| // It should be published with your NPM package. It should not be tracked by Git. | ||
| { | ||
| "tsdocVersion": "0.12", | ||
| "toolPackages": [ | ||
| { | ||
| "packageName": "@microsoft/api-extractor", | ||
| "packageVersion": "7.52.8" | ||
| } | ||
| ] | ||
| } |
| import type { RushMcpPluginSession } from './RushMcpPluginSession'; | ||
| /** | ||
| * MCP plugins should implement this interface. | ||
| * @public | ||
| */ | ||
| export interface IRushMcpPlugin { | ||
| onInitializeAsync(): Promise<void>; | ||
| } | ||
| /** | ||
| * The plugin's entry point should return this function as its default export. | ||
| * @public | ||
| */ | ||
| export type RushMcpPluginFactory<TConfigFile = {}> = (session: RushMcpPluginSession, configFile: TConfigFile | undefined) => IRushMcpPlugin; | ||
| //# sourceMappingURL=IRushMcpPlugin.d.ts.map |
| {"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"} |
| "use strict"; | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
| // See LICENSE in the project root for license information. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| //# sourceMappingURL=IRushMcpPlugin.js.map |
| {"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"]} |
| import type * as zod from 'zod'; | ||
| import type { CallToolResult } from './zodTypes'; | ||
| /** | ||
| * MCP plugins should implement this interface. | ||
| * @public | ||
| */ | ||
| export interface IRushMcpTool<TSchema extends zod.ZodObject<zod.ZodRawShape> = zod.ZodObject<zod.ZodRawShape>> { | ||
| readonly schema: TSchema; | ||
| executeAsync(input: zod.infer<TSchema>): Promise<CallToolResult>; | ||
| } | ||
| //# sourceMappingURL=IRushMcpTool.d.ts.map |
| {"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"} |
| "use strict"; | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
| // See LICENSE in the project root for license information. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| //# sourceMappingURL=IRushMcpTool.js.map |
| {"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"]} |
| import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp'; | ||
| /** | ||
| * Configuration for @rushstack/mcp-server in a monorepo. | ||
| * Corresponds to the contents of common/config/rush-mcp/rush-mcp.json | ||
| */ | ||
| export interface IJsonRushMcpConfig { | ||
| /** | ||
| * The list of plugins that @rushstack/mcp-server should load when processing this monorepo. | ||
| */ | ||
| mcpPlugins: IJsonRushMcpPlugin[]; | ||
| } | ||
| /** | ||
| * Describes a single MCP plugin entry. | ||
| */ | ||
| export interface IJsonRushMcpPlugin { | ||
| /** | ||
| * The name of an NPM package that appears in the package.json "dependencies" for the autoinstaller. | ||
| */ | ||
| packageName: string; | ||
| /** | ||
| * The name of a Rush autoinstaller with this package as its dependency. | ||
| * @rushstack/mcp-server will ensure this folder is installed before loading the plugin. | ||
| */ | ||
| autoinstaller: string; | ||
| /** | ||
| * The name of the plugin. This is used to identify the plugin in the MCP server. | ||
| */ | ||
| pluginName: string; | ||
| } | ||
| /** | ||
| * Manifest file for a Rush MCP plugin. | ||
| * Every plugin package must contain a "rush-mcp-plugin.json" manifest in the top-level folder. | ||
| */ | ||
| export interface IJsonRushMcpPluginManifest { | ||
| /** | ||
| * 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. | ||
| */ | ||
| pluginName: string; | ||
| /** | ||
| * 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`. | ||
| */ | ||
| configFileSchema?: string; | ||
| /** | ||
| * The module path to the plugin's entry point. | ||
| * Its default export must be a class implementing the MCP plugin interface. | ||
| */ | ||
| entryPoint: string; | ||
| } | ||
| export declare class RushMcpPluginLoader { | ||
| private static readonly _rushMcpJsonSchema; | ||
| private static readonly _rushMcpPluginSchemaObject; | ||
| private readonly _rushWorkspacePath; | ||
| private readonly _mcpServer; | ||
| constructor(rushWorkspacePath: string, mcpServer: McpServer); | ||
| loadAsync(): Promise<void>; | ||
| } | ||
| //# sourceMappingURL=RushMcpPluginLoader.d.ts.map |
| {"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"} |
| "use strict"; | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
| // See LICENSE in the project root for license information. | ||
| var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
| if (k2 === undefined) k2 = k; | ||
| var desc = Object.getOwnPropertyDescriptor(m, k); | ||
| if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
| desc = { enumerable: true, get: function() { return m[k]; } }; | ||
| } | ||
| Object.defineProperty(o, k2, desc); | ||
| }) : (function(o, m, k, k2) { | ||
| if (k2 === undefined) k2 = k; | ||
| o[k2] = m[k]; | ||
| })); | ||
| var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
| Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
| }) : function(o, v) { | ||
| o["default"] = v; | ||
| }); | ||
| var __importStar = (this && this.__importStar) || (function () { | ||
| var ownKeys = function(o) { | ||
| ownKeys = Object.getOwnPropertyNames || function (o) { | ||
| var ar = []; | ||
| for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
| return ar; | ||
| }; | ||
| return ownKeys(o); | ||
| }; | ||
| return function (mod) { | ||
| if (mod && mod.__esModule) return mod; | ||
| var result = {}; | ||
| if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
| __setModuleDefault(result, mod); | ||
| return result; | ||
| }; | ||
| })(); | ||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||
| return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.RushMcpPluginLoader = void 0; | ||
| const path = __importStar(require("path")); | ||
| const node_core_library_1 = require("@rushstack/node-core-library"); | ||
| const Autoinstaller_1 = require("@rushstack/rush-sdk/lib/logic/Autoinstaller"); | ||
| const RushGlobalFolder_1 = require("@rushstack/rush-sdk/lib/api/RushGlobalFolder"); | ||
| const RushConfiguration_1 = require("@rushstack/rush-sdk/lib/api/RushConfiguration"); | ||
| const RushMcpPluginSession_1 = require("./RushMcpPluginSession"); | ||
| const rush_mcp_schema_json_1 = __importDefault(require("../schemas/rush-mcp.schema.json")); | ||
| const rush_mcp_plugin_schema_json_1 = __importDefault(require("../schemas/rush-mcp-plugin.schema.json")); | ||
| class RushMcpPluginLoader { | ||
| constructor(rushWorkspacePath, mcpServer) { | ||
| this._rushWorkspacePath = rushWorkspacePath; | ||
| this._mcpServer = mcpServer; | ||
| } | ||
| async loadAsync() { | ||
| const rushMcpFilePath = path.join(this._rushWorkspacePath, 'common/config/rush-mcp/rush-mcp.json'); | ||
| if (!(await node_core_library_1.FileSystem.existsAsync(rushMcpFilePath))) { | ||
| return; | ||
| } | ||
| const rushConfiguration = RushConfiguration_1.RushConfiguration.loadFromDefaultLocation({ | ||
| startingFolder: this._rushWorkspacePath | ||
| }); | ||
| const jsonRushMcpConfig = await node_core_library_1.JsonFile.loadAndValidateAsync(rushMcpFilePath, RushMcpPluginLoader._rushMcpJsonSchema); | ||
| if (jsonRushMcpConfig.mcpPlugins.length === 0) { | ||
| return; | ||
| } | ||
| const rushGlobalFolder = new RushGlobalFolder_1.RushGlobalFolder(); | ||
| for (const jsonMcpPlugin of jsonRushMcpConfig.mcpPlugins) { | ||
| // Ensure the autoinstaller is installed | ||
| const autoinstaller = new Autoinstaller_1.Autoinstaller({ | ||
| autoinstallerName: jsonMcpPlugin.autoinstaller, | ||
| rushConfiguration, | ||
| rushGlobalFolder, | ||
| restrictConsoleOutput: false | ||
| }); | ||
| await autoinstaller.prepareAsync(); | ||
| // Load the manifest | ||
| // Suppose the autoinstaller is "my-autoinstaller" and the package is "rush-mcp-example-plugin". | ||
| // Then the folder will be: | ||
| // "/path/to/my-repo/common/autoinstallers/my-autoinstaller/node_modules/rush-mcp-example-plugin" | ||
| const installedPluginPackageFolder = await node_core_library_1.Import.resolvePackageAsync({ | ||
| baseFolderPath: autoinstaller.folderFullPath, | ||
| packageName: jsonMcpPlugin.packageName | ||
| }); | ||
| const manifestFilePath = path.join(installedPluginPackageFolder, 'rush-mcp-plugin.json'); | ||
| if (!(await node_core_library_1.FileSystem.existsAsync(manifestFilePath))) { | ||
| throw new Error('The "rush-mcp-plugin.json" manifest file was not found under ' + installedPluginPackageFolder); | ||
| } | ||
| const jsonManifest = await node_core_library_1.JsonFile.loadAndValidateAsync(manifestFilePath, RushMcpPluginLoader._rushMcpPluginSchemaObject); | ||
| let rushMcpPluginOptions = {}; | ||
| if (jsonManifest.configFileSchema) { | ||
| const mcpPluginSchemaFilePath = path.resolve(installedPluginPackageFolder, jsonManifest.configFileSchema); | ||
| const mcpPluginSchema = await node_core_library_1.JsonSchema.fromFile(mcpPluginSchemaFilePath); | ||
| const rushMcpPluginOptionsFilePath = path.resolve(this._rushWorkspacePath, `common/config/rush-mcp/${jsonMcpPlugin.pluginName}.json`); | ||
| // Example: /path/to/my-repo/common/config/rush-mcp/rush-mcp-example-plugin.json | ||
| rushMcpPluginOptions = await node_core_library_1.JsonFile.loadAndValidateAsync(rushMcpPluginOptionsFilePath, mcpPluginSchema); | ||
| } | ||
| const fullEntryPointPath = path.join(installedPluginPackageFolder, jsonManifest.entryPoint); | ||
| let pluginFactory; | ||
| try { | ||
| const entryPointModule = require(fullEntryPointPath); | ||
| if (entryPointModule.default === undefined) { | ||
| throw new Error('The commonJS "default" export is missing'); | ||
| } | ||
| pluginFactory = entryPointModule.default; | ||
| } | ||
| catch (e) { | ||
| throw new Error(`Unable to load plugin entry point at ${fullEntryPointPath}: ` + e.toString()); | ||
| } | ||
| const session = new RushMcpPluginSession_1.RushMcpPluginSessionInternal(this._mcpServer); | ||
| let plugin; | ||
| try { | ||
| plugin = pluginFactory(session, rushMcpPluginOptions); | ||
| } | ||
| catch (e) { | ||
| throw new Error(`Error invoking entry point for plugin ${jsonManifest.pluginName}:` + e.toString()); | ||
| } | ||
| try { | ||
| await plugin.onInitializeAsync(); | ||
| } | ||
| catch (e) { | ||
| throw new Error(`Error occurred in onInitializeAsync() for plugin ${jsonManifest.pluginName}:` + e.toString()); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| exports.RushMcpPluginLoader = RushMcpPluginLoader; | ||
| RushMcpPluginLoader._rushMcpJsonSchema = node_core_library_1.JsonSchema.fromLoadedObject(rush_mcp_schema_json_1.default); | ||
| RushMcpPluginLoader._rushMcpPluginSchemaObject = node_core_library_1.JsonSchema.fromLoadedObject(rush_mcp_plugin_schema_json_1.default); | ||
| //# sourceMappingURL=RushMcpPluginLoader.js.map |
| {"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"]} |
| import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp'; | ||
| import type { IRushMcpTool } from './IRushMcpTool'; | ||
| import type { zodModule } from './zodTypes'; | ||
| /** | ||
| * Each plugin gets its own session. | ||
| * | ||
| * @public | ||
| */ | ||
| export interface IRegisterToolOptions { | ||
| toolName: string; | ||
| description?: string; | ||
| } | ||
| /** | ||
| * Each plugin gets its own session. | ||
| * | ||
| * @public | ||
| */ | ||
| export declare abstract class RushMcpPluginSession { | ||
| readonly zod: typeof zodModule; | ||
| abstract registerTool(options: IRegisterToolOptions, tool: IRushMcpTool): void; | ||
| } | ||
| export declare class RushMcpPluginSessionInternal extends RushMcpPluginSession { | ||
| private readonly _mcpServer; | ||
| constructor(mcpServer: McpServer); | ||
| registerTool(options: IRegisterToolOptions, tool: IRushMcpTool): void; | ||
| } | ||
| //# sourceMappingURL=RushMcpPluginSession.d.ts.map |
| {"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"} |
| "use strict"; | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
| // See LICENSE in the project root for license information. | ||
| var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
| if (k2 === undefined) k2 = k; | ||
| var desc = Object.getOwnPropertyDescriptor(m, k); | ||
| if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
| desc = { enumerable: true, get: function() { return m[k]; } }; | ||
| } | ||
| Object.defineProperty(o, k2, desc); | ||
| }) : (function(o, m, k, k2) { | ||
| if (k2 === undefined) k2 = k; | ||
| o[k2] = m[k]; | ||
| })); | ||
| var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
| Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
| }) : function(o, v) { | ||
| o["default"] = v; | ||
| }); | ||
| var __importStar = (this && this.__importStar) || (function () { | ||
| var ownKeys = function(o) { | ||
| ownKeys = Object.getOwnPropertyNames || function (o) { | ||
| var ar = []; | ||
| for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
| return ar; | ||
| }; | ||
| return ownKeys(o); | ||
| }; | ||
| return function (mod) { | ||
| if (mod && mod.__esModule) return mod; | ||
| var result = {}; | ||
| if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
| __setModuleDefault(result, mod); | ||
| return result; | ||
| }; | ||
| })(); | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.RushMcpPluginSessionInternal = exports.RushMcpPluginSession = void 0; | ||
| const zod = __importStar(require("zod")); | ||
| /** | ||
| * Each plugin gets its own session. | ||
| * | ||
| * @public | ||
| */ | ||
| class RushMcpPluginSession { | ||
| constructor() { | ||
| this.zod = zod; | ||
| } | ||
| } | ||
| exports.RushMcpPluginSession = RushMcpPluginSession; | ||
| class RushMcpPluginSessionInternal extends RushMcpPluginSession { | ||
| constructor(mcpServer) { | ||
| super(); | ||
| this._mcpServer = mcpServer; | ||
| } | ||
| registerTool(options, tool) { | ||
| if (options.description) { | ||
| this._mcpServer.tool(options.toolName, options.description, tool.schema.shape, tool.executeAsync.bind(tool)); | ||
| } | ||
| else { | ||
| this._mcpServer.tool(options.toolName, tool.schema.shape, tool.executeAsync.bind(tool)); | ||
| } | ||
| } | ||
| } | ||
| exports.RushMcpPluginSessionInternal = RushMcpPluginSessionInternal; | ||
| //# sourceMappingURL=RushMcpPluginSession.js.map |
| {"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"]} |
| import type * as zod from 'zod'; | ||
| export type { zod as zodModule }; | ||
| import { CallToolResultSchema } from '@modelcontextprotocol/sdk/types'; | ||
| export { CallToolResultSchema }; | ||
| /** | ||
| * @public | ||
| */ | ||
| export type CallToolResult = zod.infer<typeof CallToolResultSchema>; | ||
| //# sourceMappingURL=zodTypes.d.ts.map |
| {"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"} |
| "use strict"; | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
| // See LICENSE in the project root for license information. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.CallToolResultSchema = void 0; | ||
| const types_1 = require("@modelcontextprotocol/sdk/types"); | ||
| Object.defineProperty(exports, "CallToolResultSchema", { enumerable: true, get: function () { return types_1.CallToolResultSchema; } }); | ||
| //# sourceMappingURL=zodTypes.js.map |
| {"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"]} |
| { | ||
| "$schema": "http://json-schema.org/draft-07/schema#", | ||
| "title": "Rush MCP Plugin Manifest", | ||
| "type": "object", | ||
| "properties": { | ||
| "pluginName": { | ||
| "type": "string", | ||
| "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." | ||
| }, | ||
| "configFileSchema": { | ||
| "type": "string", | ||
| "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`." | ||
| }, | ||
| "entryPoint": { | ||
| "type": "string", | ||
| "description": "The module path to the plugin's entry point. Its default export must be a class implementing the MCP plugin interface." | ||
| } | ||
| }, | ||
| "required": ["pluginName", "entryPoint"], | ||
| "additionalProperties": false | ||
| } |
| { | ||
| "$schema": "http://json-schema.org/draft-07/schema#", | ||
| "title": "rush-mcp.json Configuration Schema", | ||
| "type": "object", | ||
| "properties": { | ||
| "mcpPlugins": { | ||
| "type": "array", | ||
| "description": "The list of plugins that `@rushstack/mcp-server` should load when processing this monorepo.", | ||
| "items": { | ||
| "type": "object", | ||
| "properties": { | ||
| "packageName": { | ||
| "type": "string", | ||
| "description": "The name of an NPM package that appears in the package.json \"dependencies\" for the autoinstaller." | ||
| }, | ||
| "autoinstaller": { | ||
| "type": "string", | ||
| "description": "The name of a Rush autoinstaller with this package as its dependency." | ||
| }, | ||
| "pluginName": { | ||
| "type": "string", | ||
| "description": "The name of the plugin. This is used to identify the plugin in the MCP server." | ||
| } | ||
| }, | ||
| "required": ["packageName", "autoinstaller"], | ||
| "additionalProperties": false | ||
| } | ||
| } | ||
| }, | ||
| "required": ["mcpPlugins"], | ||
| "additionalProperties": false | ||
| } |
+12
-0
@@ -5,2 +5,14 @@ { | ||
| { | ||
| "version": "0.2.0", | ||
| "tag": "@rushstack/mcp-server_v0.2.0", | ||
| "date": "Fri, 06 Jun 2025 00:11:09 GMT", | ||
| "comments": { | ||
| "minor": [ | ||
| { | ||
| "comment": "Introduce a plugin system for custom MCP tools" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "version": "0.1.8", | ||
@@ -7,0 +19,0 @@ "tag": "@rushstack/mcp-server_v0.1.8", |
+8
-1
| # Change Log - @rushstack/mcp-server | ||
| This log was last generated on Thu, 29 May 2025 15:10:58 GMT and should not be manually modified. | ||
| This log was last generated on Fri, 06 Jun 2025 00:11:09 GMT and should not be manually modified. | ||
| ## 0.2.0 | ||
| Fri, 06 Jun 2025 00:11:09 GMT | ||
| ### Minor changes | ||
| - Introduce a plugin system for custom MCP tools | ||
| ## 0.1.8 | ||
@@ -6,0 +13,0 @@ Thu, 29 May 2025 15:10:58 GMT |
+8
-2
@@ -1,3 +0,9 @@ | ||
| export { log } from './utilities/log'; | ||
| export * from './tools'; | ||
| /** | ||
| * API for use by MCP plugins. | ||
| * @packageDocumentation | ||
| */ | ||
| export * from './pluginFramework/IRushMcpPlugin'; | ||
| export * from './pluginFramework/IRushMcpTool'; | ||
| export { type IRegisterToolOptions, RushMcpPluginSession } from './pluginFramework/RushMcpPluginSession'; | ||
| export * from './pluginFramework/zodTypes'; | ||
| //# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,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"} | ||
| {"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"} |
+10
-4
@@ -19,6 +19,12 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.log = void 0; | ||
| var log_1 = require("./utilities/log"); | ||
| Object.defineProperty(exports, "log", { enumerable: true, get: function () { return log_1.log; } }); | ||
| __exportStar(require("./tools"), exports); | ||
| exports.RushMcpPluginSession = void 0; | ||
| /** | ||
| * API for use by MCP plugins. | ||
| * @packageDocumentation | ||
| */ | ||
| __exportStar(require("./pluginFramework/IRushMcpPlugin"), exports); | ||
| __exportStar(require("./pluginFramework/IRushMcpTool"), exports); | ||
| var RushMcpPluginSession_1 = require("./pluginFramework/RushMcpPluginSession"); | ||
| Object.defineProperty(exports, "RushMcpPluginSession", { enumerable: true, get: function () { return RushMcpPluginSession_1.RushMcpPluginSession; } }); | ||
| __exportStar(require("./pluginFramework/zodTypes"), exports); | ||
| //# sourceMappingURL=index.js.map |
+1
-1
@@ -1,1 +0,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"]} | ||
| {"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"]} |
+2
-0
@@ -5,3 +5,5 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; | ||
| private _tools; | ||
| private _pluginLoader; | ||
| constructor(rushWorkspacePath: string); | ||
| startAsync(): Promise<void>; | ||
| private _initializeTools; | ||
@@ -8,0 +10,0 @@ private _registerTools; |
@@ -1,1 +0,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"} | ||
| {"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"} |
+5
-0
@@ -8,2 +8,3 @@ "use strict"; | ||
| const tools_1 = require("./tools"); | ||
| const RushMcpPluginLoader_1 = require("./pluginFramework/RushMcpPluginLoader"); | ||
| class RushMCPServer extends mcp_js_1.McpServer { | ||
@@ -17,4 +18,8 @@ constructor(rushWorkspacePath) { | ||
| this._rushWorkspacePath = rushWorkspacePath; | ||
| this._pluginLoader = new RushMcpPluginLoader_1.RushMcpPluginLoader(this._rushWorkspacePath, this); | ||
| } | ||
| async startAsync() { | ||
| this._initializeTools(); | ||
| this._registerTools(); | ||
| await this._pluginLoader.loadAsync(); | ||
| } | ||
@@ -21,0 +26,0 @@ _initializeTools() { |
@@ -1,1 +0,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"]} | ||
| {"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"]} |
+1
-0
@@ -14,2 +14,3 @@ "use strict"; | ||
| const server = new server_1.RushMCPServer(rushWorkspacePath); | ||
| await server.startAsync(); | ||
| const transport = new stdio_js_1.StdioServerTransport(); | ||
@@ -16,0 +17,0 @@ await server.connect(transport); |
+1
-1
@@ -1,1 +0,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,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 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"]} | ||
| {"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"]} |
+5
-3
| { | ||
| "name": "@rushstack/mcp-server", | ||
| "version": "0.1.8", | ||
| "version": "0.2.0", | ||
| "description": "A Model Context Protocol server implementation for Rush", | ||
@@ -12,2 +12,4 @@ "keywords": [ | ||
| ], | ||
| "main": "lib/index.js", | ||
| "typings": "dist/mcp-server.d.ts", | ||
| "repository": { | ||
@@ -32,4 +34,4 @@ "type": "git", | ||
| "@rushstack/terminal": "0.15.3", | ||
| "@rushstack/rush-sdk": "5.153.2", | ||
| "@rushstack/ts-command-line": "5.0.1" | ||
| "@rushstack/ts-command-line": "5.0.1", | ||
| "@rushstack/rush-sdk": "5.153.2" | ||
| }, | ||
@@ -36,0 +38,0 @@ "devDependencies": { |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
142250
37.75%87
38.1%1436
48.96%2
100%