@teambit/cli-mcp-server 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.docs.mdx +48 -1
- package/dist/README.docs.mdx +48 -1
- package/dist/cli-mcp-server.main.runtime.d.ts +2 -0
- package/dist/cli-mcp-server.main.runtime.js +51 -3
- package/dist/cli-mcp-server.main.runtime.js.map +1 -1
- package/dist/mcp-server.cmd.d.ts +1 -0
- package/dist/mcp-server.cmd.js +1 -1
- package/dist/mcp-server.cmd.js.map +1 -1
- package/dist/{preview-1747365602134.js → preview-1747797713732.js} +1 -1
- package/package.json +4 -4
package/README.docs.mdx
CHANGED
|
@@ -32,6 +32,7 @@ bit mcp-server [options]
|
|
|
32
32
|
Options:
|
|
33
33
|
|
|
34
34
|
- `-e, --extended`: Enable the full set of Bit CLI commands as MCP tools
|
|
35
|
+
- `--consumer-project`: For non-Bit workspaces that only consume Bit component packages. Enables only "schema", "show", and "remote-search" tools and automatically adds the "--remote" flag to relevant commands.
|
|
35
36
|
- `--include-only <commands>`: Specify a subset of commands to expose as MCP tools (comma-separated list)
|
|
36
37
|
- `--include-additional <commands>`: Add specific commands to the default set (comma-separated list)
|
|
37
38
|
- `--exclude <commands>`: Prevent specific commands from being exposed (comma-separated list)
|
|
@@ -71,6 +72,21 @@ For extended mode with all commands available:
|
|
|
71
72
|
}
|
|
72
73
|
```
|
|
73
74
|
|
|
75
|
+
For consumer projects that only use Bit component packages:
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"mcp": {
|
|
80
|
+
"servers": {
|
|
81
|
+
"bit-cli": {
|
|
82
|
+
"command": "bit",
|
|
83
|
+
"args": ["mcp-server", "--consumer-project"]
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
74
90
|
### Programmatic Usage
|
|
75
91
|
|
|
76
92
|
```javascript
|
|
@@ -90,7 +106,7 @@ async function example() {
|
|
|
90
106
|
|
|
91
107
|
## Available Tools
|
|
92
108
|
|
|
93
|
-
The Bit CLI MCP Server operates in
|
|
109
|
+
The Bit CLI MCP Server operates in three modes:
|
|
94
110
|
|
|
95
111
|
### Default Mode
|
|
96
112
|
|
|
@@ -121,6 +137,31 @@ In default mode, the server exposes a focused set of essential Bit CLI commands
|
|
|
121
137
|
- `bit_schema`: Retrieve component API schema from workspace or remote scopes
|
|
122
138
|
- `bit_remote_search`: Search for components in remote scopes
|
|
123
139
|
|
|
140
|
+
### Consumer Project Mode (--consumer-project)
|
|
141
|
+
|
|
142
|
+
This mode is designed for non-Bit workspaces that only consume Bit component packages. It exposes a minimal set of tools needed for interacting with remote Bit components:
|
|
143
|
+
|
|
144
|
+
- `bit_schema`: Retrieve component API schema from remote scopes
|
|
145
|
+
- `bit_show`: Display component information
|
|
146
|
+
- `bit_remote_search`: Search for components in remote scopes
|
|
147
|
+
|
|
148
|
+
This mode is perfect for projects that use Bit components as dependencies but don't develop or manage Bit components themselves. It provides access to component documentation, API schemas, and search capabilities without the overhead of full workspace management tools.
|
|
149
|
+
|
|
150
|
+
### Consumer Project Mode (--consumer-project)
|
|
151
|
+
|
|
152
|
+
This mode is designed for applications or projects that are not Bit workspaces but need to consume or work with Bit components as packages. It provides a minimal set of tools focused on component discovery and information:
|
|
153
|
+
|
|
154
|
+
- `bit_schema`: Retrieves component API schema from remote scopes (automatically adds `--remote` flag)
|
|
155
|
+
- `bit_show`: Displays component information from remote scopes (automatically adds `--remote` flag)
|
|
156
|
+
- `bit_remote_search`: Searches for components in remote scopes
|
|
157
|
+
|
|
158
|
+
In this mode:
|
|
159
|
+
|
|
160
|
+
1. You don't need a Bit workspace initialization
|
|
161
|
+
2. The `--remote` flag is automatically added to `show` and `schema` commands
|
|
162
|
+
3. The `cwd` parameter is still required but can be any directory (not necessarily a Bit workspace)
|
|
163
|
+
4. You can still add additional tools with the `--include-additional` flag
|
|
164
|
+
|
|
124
165
|
### Extended Mode (--extended)
|
|
125
166
|
|
|
126
167
|
When started with the `--extended` flag, the server exposes nearly all Bit CLI commands as MCP tools, including:
|
|
@@ -160,6 +201,12 @@ bit mcp-server --include-only "status,show,tag,snap,import,export"
|
|
|
160
201
|
# Add specific tools to the default set
|
|
161
202
|
bit mcp-server --include-additional "build,lint,format"
|
|
162
203
|
|
|
204
|
+
# For consumer projects (non-Bit workspaces)
|
|
205
|
+
bit mcp-server --consumer-project
|
|
206
|
+
|
|
207
|
+
# Add specific tools to the consumer project set
|
|
208
|
+
bit mcp-server --consumer-project --include-additional "deps,get,preview"
|
|
209
|
+
|
|
163
210
|
# Exclude specific tools from being available
|
|
164
211
|
bit mcp-server --extended --exclude "checkout,remove"
|
|
165
212
|
```
|
package/dist/README.docs.mdx
CHANGED
|
@@ -32,6 +32,7 @@ bit mcp-server [options]
|
|
|
32
32
|
Options:
|
|
33
33
|
|
|
34
34
|
- `-e, --extended`: Enable the full set of Bit CLI commands as MCP tools
|
|
35
|
+
- `--consumer-project`: For non-Bit workspaces that only consume Bit component packages. Enables only "schema", "show", and "remote-search" tools and automatically adds the "--remote" flag to relevant commands.
|
|
35
36
|
- `--include-only <commands>`: Specify a subset of commands to expose as MCP tools (comma-separated list)
|
|
36
37
|
- `--include-additional <commands>`: Add specific commands to the default set (comma-separated list)
|
|
37
38
|
- `--exclude <commands>`: Prevent specific commands from being exposed (comma-separated list)
|
|
@@ -71,6 +72,21 @@ For extended mode with all commands available:
|
|
|
71
72
|
}
|
|
72
73
|
```
|
|
73
74
|
|
|
75
|
+
For consumer projects that only use Bit component packages:
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"mcp": {
|
|
80
|
+
"servers": {
|
|
81
|
+
"bit-cli": {
|
|
82
|
+
"command": "bit",
|
|
83
|
+
"args": ["mcp-server", "--consumer-project"]
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
74
90
|
### Programmatic Usage
|
|
75
91
|
|
|
76
92
|
```javascript
|
|
@@ -90,7 +106,7 @@ async function example() {
|
|
|
90
106
|
|
|
91
107
|
## Available Tools
|
|
92
108
|
|
|
93
|
-
The Bit CLI MCP Server operates in
|
|
109
|
+
The Bit CLI MCP Server operates in three modes:
|
|
94
110
|
|
|
95
111
|
### Default Mode
|
|
96
112
|
|
|
@@ -121,6 +137,31 @@ In default mode, the server exposes a focused set of essential Bit CLI commands
|
|
|
121
137
|
- `bit_schema`: Retrieve component API schema from workspace or remote scopes
|
|
122
138
|
- `bit_remote_search`: Search for components in remote scopes
|
|
123
139
|
|
|
140
|
+
### Consumer Project Mode (--consumer-project)
|
|
141
|
+
|
|
142
|
+
This mode is designed for non-Bit workspaces that only consume Bit component packages. It exposes a minimal set of tools needed for interacting with remote Bit components:
|
|
143
|
+
|
|
144
|
+
- `bit_schema`: Retrieve component API schema from remote scopes
|
|
145
|
+
- `bit_show`: Display component information
|
|
146
|
+
- `bit_remote_search`: Search for components in remote scopes
|
|
147
|
+
|
|
148
|
+
This mode is perfect for projects that use Bit components as dependencies but don't develop or manage Bit components themselves. It provides access to component documentation, API schemas, and search capabilities without the overhead of full workspace management tools.
|
|
149
|
+
|
|
150
|
+
### Consumer Project Mode (--consumer-project)
|
|
151
|
+
|
|
152
|
+
This mode is designed for applications or projects that are not Bit workspaces but need to consume or work with Bit components as packages. It provides a minimal set of tools focused on component discovery and information:
|
|
153
|
+
|
|
154
|
+
- `bit_schema`: Retrieves component API schema from remote scopes (automatically adds `--remote` flag)
|
|
155
|
+
- `bit_show`: Displays component information from remote scopes (automatically adds `--remote` flag)
|
|
156
|
+
- `bit_remote_search`: Searches for components in remote scopes
|
|
157
|
+
|
|
158
|
+
In this mode:
|
|
159
|
+
|
|
160
|
+
1. You don't need a Bit workspace initialization
|
|
161
|
+
2. The `--remote` flag is automatically added to `show` and `schema` commands
|
|
162
|
+
3. The `cwd` parameter is still required but can be any directory (not necessarily a Bit workspace)
|
|
163
|
+
4. You can still add additional tools with the `--include-additional` flag
|
|
164
|
+
|
|
124
165
|
### Extended Mode (--extended)
|
|
125
166
|
|
|
126
167
|
When started with the `--extended` flag, the server exposes nearly all Bit CLI commands as MCP tools, including:
|
|
@@ -160,6 +201,12 @@ bit mcp-server --include-only "status,show,tag,snap,import,export"
|
|
|
160
201
|
# Add specific tools to the default set
|
|
161
202
|
bit mcp-server --include-additional "build,lint,format"
|
|
162
203
|
|
|
204
|
+
# For consumer projects (non-Bit workspaces)
|
|
205
|
+
bit mcp-server --consumer-project
|
|
206
|
+
|
|
207
|
+
# Add specific tools to the consumer project set
|
|
208
|
+
bit mcp-server --consumer-project --include-additional "deps,get,preview"
|
|
209
|
+
|
|
163
210
|
# Exclude specific tools from being available
|
|
164
211
|
bit mcp-server --extended --exclude "checkout,remove"
|
|
165
212
|
```
|
|
@@ -6,6 +6,7 @@ export declare class CliMcpServerMain {
|
|
|
6
6
|
private logger;
|
|
7
7
|
private bitBin;
|
|
8
8
|
private _http;
|
|
9
|
+
private isConsumerProjectMode;
|
|
9
10
|
constructor(cli: CLIMain, logger: Logger);
|
|
10
11
|
getHttp(): Promise<Http>;
|
|
11
12
|
runMcpServer(options: {
|
|
@@ -14,6 +15,7 @@ export declare class CliMcpServerMain {
|
|
|
14
15
|
includeAdditional?: string;
|
|
15
16
|
exclude?: string;
|
|
16
17
|
bitBin?: string;
|
|
18
|
+
consumerProject?: boolean;
|
|
17
19
|
}): Promise<void>;
|
|
18
20
|
private shouldIncludeCommand;
|
|
19
21
|
private buildZodSchema;
|
|
@@ -84,6 +84,7 @@ class CliMcpServerMain {
|
|
|
84
84
|
this.logger = logger;
|
|
85
85
|
_defineProperty(this, "bitBin", 'bit');
|
|
86
86
|
_defineProperty(this, "_http", void 0);
|
|
87
|
+
_defineProperty(this, "isConsumerProjectMode", false);
|
|
87
88
|
}
|
|
88
89
|
async getHttp() {
|
|
89
90
|
if (!this._http) {
|
|
@@ -122,13 +123,34 @@ class CliMcpServerMain {
|
|
|
122
123
|
name: 'bit-cli-mcp',
|
|
123
124
|
version: '0.0.1'
|
|
124
125
|
});
|
|
126
|
+
|
|
127
|
+
// Set of tools for consumer projects (non-Bit workspaces)
|
|
128
|
+
const consumerProjectTools = new Set(['schema', 'show', 'remote-search']);
|
|
129
|
+
const consumerProject = Boolean(options.consumerProject);
|
|
130
|
+
|
|
131
|
+
// Store consumer project mode globally in the class
|
|
132
|
+
this.isConsumerProjectMode = consumerProject;
|
|
133
|
+
|
|
134
|
+
// Validate flags combination
|
|
135
|
+
if (consumerProject) {
|
|
136
|
+
this.logger.debug(`[MCP-DEBUG] Running MCP server in consumer project mode (for non-Bit workspaces) with tools: ${Array.from(consumerProjectTools).join(', ')}`);
|
|
137
|
+
if (options.includeAdditional) {
|
|
138
|
+
this.logger.debug(`[MCP-DEBUG] Additional tools enabled in consumer project mode: ${options.includeAdditional}`);
|
|
139
|
+
}
|
|
140
|
+
if (extended) {
|
|
141
|
+
this.logger.warn('[MCP-DEBUG] Warning: --consumer-project and --extended flags were both provided. The --extended flag will be ignored.');
|
|
142
|
+
}
|
|
143
|
+
}
|
|
125
144
|
const filterOptions = {
|
|
126
145
|
defaultTools,
|
|
127
146
|
additionalCommandsSet,
|
|
128
147
|
userExcludeSet,
|
|
129
148
|
alwaysExcludeTools,
|
|
130
|
-
extended,
|
|
131
|
-
|
|
149
|
+
extended: consumerProject ? false : extended,
|
|
150
|
+
// Ignore extended when consumerProject is true
|
|
151
|
+
includeOnlySet,
|
|
152
|
+
consumerProject,
|
|
153
|
+
consumerProjectTools
|
|
132
154
|
};
|
|
133
155
|
commands.forEach(cmd => {
|
|
134
156
|
const cmdName = (0, _cli().getCommandName)(cmd);
|
|
@@ -171,6 +193,15 @@ class CliMcpServerMain {
|
|
|
171
193
|
// Extended mode includes all commands except excluded ones
|
|
172
194
|
if (options.extended) return true;
|
|
173
195
|
|
|
196
|
+
// Consumer project mode: only include consumer project tools + any additional specified
|
|
197
|
+
if (options.consumerProject) {
|
|
198
|
+
const shouldInclude = options.consumerProjectTools.has(cmdName) || (options.additionalCommandsSet?.has(cmdName) ?? false);
|
|
199
|
+
if (shouldInclude) {
|
|
200
|
+
this.logger.debug(`[MCP-DEBUG] Including command in consumer project mode: ${cmdName}`);
|
|
201
|
+
}
|
|
202
|
+
return shouldInclude;
|
|
203
|
+
}
|
|
204
|
+
|
|
174
205
|
// Default mode: include default tools + any additional specified
|
|
175
206
|
return options.defaultTools.has(cmdName) || (options.additionalCommandsSet?.has(cmdName) ?? false);
|
|
176
207
|
}
|
|
@@ -235,7 +266,12 @@ class CliMcpServerMain {
|
|
|
235
266
|
registerToolForCommand(server, cmd, parentCmd) {
|
|
236
267
|
const cmdName = parentCmd ? `${(0, _cli().getCommandName)(parentCmd)} ${(0, _cli().getCommandName)(cmd)}` : (0, _cli().getCommandName)(cmd);
|
|
237
268
|
const toolName = this.getToolName(cmdName);
|
|
238
|
-
|
|
269
|
+
|
|
270
|
+
// Modify description for show and schema commands in consumer project mode
|
|
271
|
+
let description = `${cmd.description}${cmd.extendedDescription ? `.\n(${cmd.extendedDescription})` : ''}`;
|
|
272
|
+
if (this.isConsumerProjectMode && (cmdName === 'show' || cmdName === 'schema')) {
|
|
273
|
+
description += `\n(In consumer project mode, --remote flag is automatically added)`;
|
|
274
|
+
}
|
|
239
275
|
const config = {
|
|
240
276
|
name: cmdName,
|
|
241
277
|
description,
|
|
@@ -245,6 +281,18 @@ class CliMcpServerMain {
|
|
|
245
281
|
const schema = this.buildZodSchema(config);
|
|
246
282
|
server.tool(toolName, config.description, schema, async params => {
|
|
247
283
|
const argsToRun = this.buildCommandArgs(config, params);
|
|
284
|
+
|
|
285
|
+
// Special handling for consumer projects - auto-add --remote flag for show and schema commands
|
|
286
|
+
if (this.isConsumerProjectMode && (cmdName === 'show' || cmdName === 'schema')) {
|
|
287
|
+
if (!argsToRun.includes('--remote')) {
|
|
288
|
+
this.logger.debug(`[MCP-DEBUG] Auto-adding --remote flag for ${cmdName} in consumer project mode`);
|
|
289
|
+
argsToRun.push('--remote');
|
|
290
|
+
}
|
|
291
|
+
if (cmdName === 'show' && !argsToRun.includes('--legacy')) {
|
|
292
|
+
this.logger.debug(`[MCP-DEBUG] Auto-adding --legacy flag for ${cmdName} in consumer project mode`);
|
|
293
|
+
argsToRun.push('--legacy');
|
|
294
|
+
}
|
|
295
|
+
}
|
|
248
296
|
return this.runBit(argsToRun, params.cwd);
|
|
249
297
|
});
|
|
250
298
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_cli","data","require","_child_process","_interopRequireDefault","_cliMcpServer","_mcpServer","_mcp","_stdio","_zod","_logger","_scope","_legacy","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CliMcpServerMain","constructor","cli","logger","getHttp","_http","Http","connect","SYMPHONY_GRAPHQL","CENTRAL_BIT_HUB_NAME","runMcpServer","options","debug","JSON","stringify","commands","extended","Boolean","bitBin","defaultTools","Set","alwaysExcludeTools","includeOnlySet","includeOnly","split","map","cmd","trim","Array","from","join","additionalCommandsSet","includeAdditional","userExcludeSet","exclude","server","McpServer","name","version","filterOptions","forEach","cmdName","getCommandName","shouldIncludeCommand","registerToolForCommand","length","processSubCommands","remoteCommands","registerToolForRemote","StdioServerTransport","has","shouldInclude","buildZodSchema","config","schema","cwd","z","string","describe","argsData","arg","desc","description","nameRaw","isArray","nameCamelCase","required","array","optional","flagsData","flag","type","boolean","buildCommandArgs","params","args","val","undefined","item","push","stringValue","includes","getToolName","replace","parentCmd","toolName","extendedDescription","getArgsData","getFlagsData","tool","argsToRun","runBit","registerRemoteSearchTool","queryStr","http","results","search","components","content","text","formattedResults","result","parentCmdName","subCmd","subCmdName","fullCmdName","cmdOutput","childProcess","execSync","toString","error","message","provider","loggerMain","createLogger","CliMcpServerAspect","id","mcpServer","register","McpServerCmd","exports","CLIAspect","LoggerAspect","MainRuntime","addRuntime","_default"],"sources":["cli-mcp-server.main.runtime.ts"],"sourcesContent":["/* eslint-disable import/extensions */\n/* eslint-disable import/no-unresolved */\n\nimport { CLIAspect, CLIMain, Command, getArgsData, getCommandName, getFlagsData, MainRuntime } from '@teambit/cli';\nimport childProcess from 'child_process';\nimport { CliMcpServerAspect } from './cli-mcp-server.aspect';\nimport { McpServerCmd } from './mcp-server.cmd';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { CallToolResult } from '@modelcontextprotocol/sdk/types.js';\nimport { z } from 'zod';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { Http } from '@teambit/scope.network';\nimport { CENTRAL_BIT_HUB_NAME, SYMPHONY_GRAPHQL } from '@teambit/legacy.constants';\n\ninterface CommandFilterOptions {\n defaultTools: Set<string>;\n additionalCommandsSet?: Set<string>;\n userExcludeSet?: Set<string>;\n alwaysExcludeTools: Set<string>;\n extended: boolean;\n includeOnlySet?: Set<string>;\n}\n\ninterface CommandConfig {\n name: string;\n description: string;\n argsData: ReturnType<typeof getArgsData>;\n flagsData: ReturnType<typeof getFlagsData>;\n}\n\nexport class CliMcpServerMain {\n private bitBin = 'bit';\n private _http: Http;\n constructor(\n private cli: CLIMain,\n private logger: Logger\n ) {}\n\n async getHttp(): Promise<Http> {\n if (!this._http) {\n this._http = await Http.connect(SYMPHONY_GRAPHQL, CENTRAL_BIT_HUB_NAME);\n }\n return this._http;\n }\n\n async runMcpServer(options: {\n extended?: boolean;\n includeOnly?: string;\n includeAdditional?: string;\n exclude?: string;\n bitBin?: string;\n }) {\n this.logger.debug(`[MCP-DEBUG] Starting MCP server with options: ${JSON.stringify(options)}`);\n const commands = this.cli.commands;\n const extended = Boolean(options.extended);\n this.bitBin = options.bitBin || this.bitBin;\n // Default set of tools to include\n const defaultTools = new Set([\n 'status',\n 'list',\n 'add',\n 'init',\n 'show',\n 'tag',\n 'snap',\n 'import',\n 'export',\n 'remove',\n 'log',\n 'test',\n 'diff',\n 'install',\n 'lane show',\n 'lane create',\n 'lane switch',\n 'lane merge',\n 'create',\n 'templates',\n 'reset',\n 'checkout',\n 'schema',\n 'remote-search',\n ]);\n\n // Tools to always exclude\n const alwaysExcludeTools = new Set([\n 'login',\n 'logout',\n 'completion',\n 'mcp-server',\n 'start',\n 'run-action',\n 'watch',\n 'run',\n 'resume-export',\n 'server',\n 'serve-preview',\n ]);\n\n // Parse command strings from flag options\n let includeOnlySet: Set<string> | undefined;\n if (options.includeOnly) {\n includeOnlySet = new Set(options.includeOnly.split(',').map((cmd) => cmd.trim()));\n this.logger.debug(`[MCP-DEBUG] Including only commands: ${Array.from(includeOnlySet).join(', ')}`);\n }\n\n let additionalCommandsSet: Set<string> | undefined;\n if (options.includeAdditional) {\n additionalCommandsSet = new Set(options.includeAdditional.split(',').map((cmd) => cmd.trim()));\n this.logger.debug(`[MCP-DEBUG] Including additional commands: ${Array.from(additionalCommandsSet).join(', ')}`);\n }\n\n let userExcludeSet: Set<string> | undefined;\n if (options.exclude) {\n userExcludeSet = new Set(options.exclude.split(',').map((cmd) => cmd.trim()));\n this.logger.debug(`[MCP-DEBUG] Excluding commands: ${Array.from(userExcludeSet).join(', ')}`);\n }\n\n const server = new McpServer({\n name: 'bit-cli-mcp',\n version: '0.0.1',\n });\n\n const filterOptions: CommandFilterOptions = {\n defaultTools,\n additionalCommandsSet,\n userExcludeSet,\n alwaysExcludeTools,\n extended,\n includeOnlySet,\n };\n\n commands.forEach((cmd) => {\n const cmdName = getCommandName(cmd);\n\n if (this.shouldIncludeCommand(cmdName, filterOptions)) {\n this.registerToolForCommand(server, cmd);\n }\n\n // Process sub-commands\n if (cmd.commands && cmd.commands.length) {\n this.processSubCommands(server, cmd, filterOptions);\n }\n });\n\n const remoteCommands = ['remote-search'];\n remoteCommands.forEach((cmdName) => {\n if (this.shouldIncludeCommand(cmdName, filterOptions)) {\n this.registerToolForRemote(server, cmdName);\n }\n });\n\n await server.connect(new StdioServerTransport());\n }\n\n private shouldIncludeCommand(cmdName: string, options: CommandFilterOptions): boolean {\n // Always exclude certain commands\n if (options.alwaysExcludeTools.has(cmdName)) return false;\n\n // User-specified exclude takes precedence\n if (options.userExcludeSet?.has(cmdName)) {\n this.logger.debug(`[MCP-DEBUG] Excluding command due to --exclude flag: ${cmdName}`);\n return false;\n }\n\n // If includeOnly is specified, only include those specific commands\n if (options.includeOnlySet) {\n const shouldInclude = options.includeOnlySet.has(cmdName);\n if (shouldInclude) {\n this.logger.debug(`[MCP-DEBUG] Including command due to --include-only flag: ${cmdName}`);\n }\n return shouldInclude;\n }\n\n // Extended mode includes all commands except excluded ones\n if (options.extended) return true;\n\n // Default mode: include default tools + any additional specified\n return options.defaultTools.has(cmdName) || (options.additionalCommandsSet?.has(cmdName) ?? false);\n }\n\n private buildZodSchema(config: CommandConfig): Record<string, any> {\n const schema: Record<string, any> = {\n // Add cwd parameter as mandatory to all commands\n cwd: z.string().describe('Path to workspace'),\n };\n\n config.argsData.forEach((arg) => {\n const desc = arg.description || `Positional argument: ${arg.nameRaw}`;\n if (arg.isArray) {\n schema[arg.nameCamelCase] = arg.required\n ? z.array(z.string()).describe(desc)\n : z.array(z.string()).optional().describe(desc);\n } else {\n schema[arg.nameCamelCase] = arg.required ? z.string().describe(desc) : z.string().optional().describe(desc);\n }\n });\n\n config.flagsData.forEach((flag) => {\n const type = flag.type;\n schema[flag.name] =\n type === 'string'\n ? z.string().optional().describe(flag.description)\n : z.boolean().optional().describe(flag.description);\n });\n\n return schema;\n }\n\n private buildCommandArgs(config: CommandConfig, params: any): string[] {\n // Split the command name on spaces to properly handle subcommands\n const args: string[] = config.name.split(' ');\n\n // Add positional arguments in order\n config.argsData.forEach((arg) => {\n const val = params[arg.nameCamelCase];\n if (val === undefined) return;\n\n if (arg.isArray && Array.isArray(val)) {\n val.forEach((item) => args.push(item));\n } else {\n args.push(val);\n }\n });\n\n // Add options as flags\n config.flagsData.forEach((flag) => {\n const name = flag.name;\n const type = flag.type;\n const val = params[name];\n if (val === undefined) return;\n if (type === 'boolean' && val) {\n args.push(`--${name}`);\n } else if (type === 'string' && val) {\n // Check if the string value contains spaces and quote it if necessary\n const stringValue = String(val);\n if (stringValue.includes(' ')) {\n args.push(`--${name}`, `\"${stringValue}\"`);\n } else {\n args.push(`--${name}`, stringValue);\n }\n }\n });\n\n return args;\n }\n\n private getToolName(name: string): string {\n // replace white spaces (\\s) and dashes (-) with underscores (_)\n return `bit_${name}`.replace(/[-\\s]/g, '_');\n }\n\n private registerToolForCommand(server: McpServer, cmd: Command, parentCmd?: Command) {\n const cmdName = parentCmd ? `${getCommandName(parentCmd)} ${getCommandName(cmd)}` : getCommandName(cmd);\n const toolName = this.getToolName(cmdName);\n const description = `${cmd.description}${cmd.extendedDescription ? `.\\n(${cmd.extendedDescription})` : ''}`;\n const config: CommandConfig = {\n name: cmdName,\n description,\n argsData: getArgsData(cmd),\n flagsData: getFlagsData(cmd),\n };\n\n const schema = this.buildZodSchema(config);\n\n server.tool(toolName, config.description, schema, async (params: any) => {\n const argsToRun = this.buildCommandArgs(config, params);\n return this.runBit(argsToRun, params.cwd);\n });\n }\n\n private registerToolForRemote(server: McpServer, name: string) {\n if (name === 'remote-search') {\n this.registerRemoteSearchTool(server);\n }\n }\n\n private registerRemoteSearchTool(server: McpServer) {\n const toolName = this.getToolName('remote-search');\n const description = 'Search for components in remote scopes';\n const schema: Record<string, any> = {\n queryStr: z.string().describe('Search query string'),\n };\n server.tool(toolName, description, schema, async (params: any) => {\n const http = await this.getHttp();\n const results = await http.search(params.queryStr);\n this.logger.debug(`[MCP-DEBUG] Search results: ${JSON.stringify(results)}`);\n if (!results?.components || results.components.length === 0) {\n return { content: [{ type: 'text', text: 'No results found' }] };\n }\n const formattedResults = results.components.map((result) => ({\n type: 'text',\n text: result,\n }));\n return { content: formattedResults } as CallToolResult;\n });\n }\n\n private processSubCommands(server: McpServer, parentCmd: Command, options: CommandFilterOptions) {\n const parentCmdName = getCommandName(parentCmd);\n\n parentCmd.commands?.forEach((subCmd) => {\n const subCmdName = getCommandName(subCmd);\n const fullCmdName = `${parentCmdName} ${subCmdName}`;\n\n if (this.shouldIncludeCommand(fullCmdName, options)) {\n this.registerToolForCommand(server, subCmd, parentCmd);\n }\n });\n }\n\n private async runBit(args: string[], cwd: string): Promise<CallToolResult> {\n this.logger.debug(`[MCP-DEBUG] Running: ${this.bitBin} ${args.join(' ')} in ${cwd}`);\n const cmd = `${this.bitBin} ${args.join(' ')}`;\n try {\n const cmdOutput = childProcess.execSync(cmd, { cwd });\n this.logger.debug(`[MCP-DEBUG] result. stdout: ${cmdOutput}`);\n\n return { content: [{ type: 'text', text: cmdOutput.toString() }] };\n } catch (error: any) {\n this.logger.error(`[MCP-DEBUG] Error executing ${cmd}`, error);\n\n return { content: [{ type: 'text', text: error.message }] };\n }\n }\n\n static slots = [];\n static dependencies = [CLIAspect, LoggerAspect];\n static runtime = MainRuntime;\n static async provider([cli, loggerMain]: [CLIMain, LoggerMain]) {\n const logger = loggerMain.createLogger(CliMcpServerAspect.id);\n const mcpServer = new CliMcpServerMain(cli, logger);\n cli.register(new McpServerCmd(mcpServer));\n return mcpServer;\n }\n}\n\nCliMcpServerAspect.addRuntime(CliMcpServerMain);\n\nexport default CliMcpServerMain;\n"],"mappings":";;;;;;AAGA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,eAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,cAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,cAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,aAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAA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AACC,YAAY,CAACC,kCAAkB,CAACC,EAAE,CAAC;IAC7D,MAAMC,SAAS,GAAG,IAAIrH,gBAAgB,CAACE,GAAG,EAAEC,MAAM,CAAC;IACnDD,GAAG,CAACoH,QAAQ,CAAC,KAAIC,yBAAY,EAACF,SAAS,CAAC,CAAC;IACzC,OAAOA,SAAS;EAClB;AACF;AAACG,OAAA,CAAAxH,gBAAA,GAAAA,gBAAA;AAAAlB,eAAA,CAjTYkB,gBAAgB,WAwSZ,EAAE;AAAAlB,eAAA,CAxSNkB,gBAAgB,kBAySL,CAACyH,gBAAS,EAAEC,sBAAY,CAAC;AAAA5I,eAAA,CAzSpCkB,gBAAgB,aA0SV2H,kBAAW;AAS9BR,kCAAkB,CAACS,UAAU,CAAC5H,gBAAgB,CAAC;AAAC,IAAA6H,QAAA,GAAAL,OAAA,CAAA3I,OAAA,GAEjCmB,gBAAgB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_cli","data","require","_child_process","_interopRequireDefault","_cliMcpServer","_mcpServer","_mcp","_stdio","_zod","_logger","_scope","_legacy","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CliMcpServerMain","constructor","cli","logger","getHttp","_http","Http","connect","SYMPHONY_GRAPHQL","CENTRAL_BIT_HUB_NAME","runMcpServer","options","debug","JSON","stringify","commands","extended","Boolean","bitBin","defaultTools","Set","alwaysExcludeTools","includeOnlySet","includeOnly","split","map","cmd","trim","Array","from","join","additionalCommandsSet","includeAdditional","userExcludeSet","exclude","server","McpServer","name","version","consumerProjectTools","consumerProject","isConsumerProjectMode","warn","filterOptions","forEach","cmdName","getCommandName","shouldIncludeCommand","registerToolForCommand","length","processSubCommands","remoteCommands","registerToolForRemote","StdioServerTransport","has","shouldInclude","buildZodSchema","config","schema","cwd","z","string","describe","argsData","arg","desc","description","nameRaw","isArray","nameCamelCase","required","array","optional","flagsData","flag","type","boolean","buildCommandArgs","params","args","val","undefined","item","push","stringValue","includes","getToolName","replace","parentCmd","toolName","extendedDescription","getArgsData","getFlagsData","tool","argsToRun","runBit","registerRemoteSearchTool","queryStr","http","results","search","components","content","text","formattedResults","result","parentCmdName","subCmd","subCmdName","fullCmdName","cmdOutput","childProcess","execSync","toString","error","message","provider","loggerMain","createLogger","CliMcpServerAspect","id","mcpServer","register","McpServerCmd","exports","CLIAspect","LoggerAspect","MainRuntime","addRuntime","_default"],"sources":["cli-mcp-server.main.runtime.ts"],"sourcesContent":["/* eslint-disable import/extensions */\n/* eslint-disable import/no-unresolved */\n\nimport { CLIAspect, CLIMain, Command, getArgsData, getCommandName, getFlagsData, MainRuntime } from '@teambit/cli';\nimport childProcess from 'child_process';\nimport { CliMcpServerAspect } from './cli-mcp-server.aspect';\nimport { McpServerCmd } from './mcp-server.cmd';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { CallToolResult } from '@modelcontextprotocol/sdk/types.js';\nimport { z } from 'zod';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { Http } from '@teambit/scope.network';\nimport { CENTRAL_BIT_HUB_NAME, SYMPHONY_GRAPHQL } from '@teambit/legacy.constants';\n\ninterface CommandFilterOptions {\n defaultTools: Set<string>;\n additionalCommandsSet?: Set<string>;\n userExcludeSet?: Set<string>;\n alwaysExcludeTools: Set<string>;\n extended: boolean;\n includeOnlySet?: Set<string>;\n consumerProject: boolean;\n consumerProjectTools: Set<string>;\n}\n\ninterface CommandConfig {\n name: string;\n description: string;\n argsData: ReturnType<typeof getArgsData>;\n flagsData: ReturnType<typeof getFlagsData>;\n}\n\nexport class CliMcpServerMain {\n private bitBin = 'bit';\n private _http: Http;\n private isConsumerProjectMode: boolean = false;\n constructor(\n private cli: CLIMain,\n private logger: Logger\n ) {}\n\n async getHttp(): Promise<Http> {\n if (!this._http) {\n this._http = await Http.connect(SYMPHONY_GRAPHQL, CENTRAL_BIT_HUB_NAME);\n }\n return this._http;\n }\n\n async runMcpServer(options: {\n extended?: boolean;\n includeOnly?: string;\n includeAdditional?: string;\n exclude?: string;\n bitBin?: string;\n consumerProject?: boolean;\n }) {\n this.logger.debug(`[MCP-DEBUG] Starting MCP server with options: ${JSON.stringify(options)}`);\n const commands = this.cli.commands;\n const extended = Boolean(options.extended);\n this.bitBin = options.bitBin || this.bitBin;\n // Default set of tools to include\n const defaultTools = new Set([\n 'status',\n 'list',\n 'add',\n 'init',\n 'show',\n 'tag',\n 'snap',\n 'import',\n 'export',\n 'remove',\n 'log',\n 'test',\n 'diff',\n 'install',\n 'lane show',\n 'lane create',\n 'lane switch',\n 'lane merge',\n 'create',\n 'templates',\n 'reset',\n 'checkout',\n 'schema',\n 'remote-search',\n ]);\n\n // Tools to always exclude\n const alwaysExcludeTools = new Set([\n 'login',\n 'logout',\n 'completion',\n 'mcp-server',\n 'start',\n 'run-action',\n 'watch',\n 'run',\n 'resume-export',\n 'server',\n 'serve-preview',\n ]);\n\n // Parse command strings from flag options\n let includeOnlySet: Set<string> | undefined;\n if (options.includeOnly) {\n includeOnlySet = new Set(options.includeOnly.split(',').map((cmd) => cmd.trim()));\n this.logger.debug(`[MCP-DEBUG] Including only commands: ${Array.from(includeOnlySet).join(', ')}`);\n }\n\n let additionalCommandsSet: Set<string> | undefined;\n if (options.includeAdditional) {\n additionalCommandsSet = new Set(options.includeAdditional.split(',').map((cmd) => cmd.trim()));\n this.logger.debug(`[MCP-DEBUG] Including additional commands: ${Array.from(additionalCommandsSet).join(', ')}`);\n }\n\n let userExcludeSet: Set<string> | undefined;\n if (options.exclude) {\n userExcludeSet = new Set(options.exclude.split(',').map((cmd) => cmd.trim()));\n this.logger.debug(`[MCP-DEBUG] Excluding commands: ${Array.from(userExcludeSet).join(', ')}`);\n }\n\n const server = new McpServer({\n name: 'bit-cli-mcp',\n version: '0.0.1',\n });\n\n // Set of tools for consumer projects (non-Bit workspaces)\n const consumerProjectTools = new Set(['schema', 'show', 'remote-search']);\n\n const consumerProject = Boolean(options.consumerProject);\n\n // Store consumer project mode globally in the class\n this.isConsumerProjectMode = consumerProject;\n\n // Validate flags combination\n if (consumerProject) {\n this.logger.debug(\n `[MCP-DEBUG] Running MCP server in consumer project mode (for non-Bit workspaces) with tools: ${Array.from(consumerProjectTools).join(', ')}`\n );\n if (options.includeAdditional) {\n this.logger.debug(\n `[MCP-DEBUG] Additional tools enabled in consumer project mode: ${options.includeAdditional}`\n );\n }\n if (extended) {\n this.logger.warn(\n '[MCP-DEBUG] Warning: --consumer-project and --extended flags were both provided. The --extended flag will be ignored.'\n );\n }\n }\n\n const filterOptions: CommandFilterOptions = {\n defaultTools,\n additionalCommandsSet,\n userExcludeSet,\n alwaysExcludeTools,\n extended: consumerProject ? false : extended, // Ignore extended when consumerProject is true\n includeOnlySet,\n consumerProject,\n consumerProjectTools,\n };\n\n commands.forEach((cmd) => {\n const cmdName = getCommandName(cmd);\n\n if (this.shouldIncludeCommand(cmdName, filterOptions)) {\n this.registerToolForCommand(server, cmd);\n }\n\n // Process sub-commands\n if (cmd.commands && cmd.commands.length) {\n this.processSubCommands(server, cmd, filterOptions);\n }\n });\n\n const remoteCommands = ['remote-search'];\n remoteCommands.forEach((cmdName) => {\n if (this.shouldIncludeCommand(cmdName, filterOptions)) {\n this.registerToolForRemote(server, cmdName);\n }\n });\n\n await server.connect(new StdioServerTransport());\n }\n\n private shouldIncludeCommand(cmdName: string, options: CommandFilterOptions): boolean {\n // Always exclude certain commands\n if (options.alwaysExcludeTools.has(cmdName)) return false;\n\n // User-specified exclude takes precedence\n if (options.userExcludeSet?.has(cmdName)) {\n this.logger.debug(`[MCP-DEBUG] Excluding command due to --exclude flag: ${cmdName}`);\n return false;\n }\n\n // If includeOnly is specified, only include those specific commands\n if (options.includeOnlySet) {\n const shouldInclude = options.includeOnlySet.has(cmdName);\n if (shouldInclude) {\n this.logger.debug(`[MCP-DEBUG] Including command due to --include-only flag: ${cmdName}`);\n }\n return shouldInclude;\n }\n\n // Extended mode includes all commands except excluded ones\n if (options.extended) return true;\n\n // Consumer project mode: only include consumer project tools + any additional specified\n if (options.consumerProject) {\n const shouldInclude =\n options.consumerProjectTools.has(cmdName) || (options.additionalCommandsSet?.has(cmdName) ?? false);\n if (shouldInclude) {\n this.logger.debug(`[MCP-DEBUG] Including command in consumer project mode: ${cmdName}`);\n }\n return shouldInclude;\n }\n\n // Default mode: include default tools + any additional specified\n return options.defaultTools.has(cmdName) || (options.additionalCommandsSet?.has(cmdName) ?? false);\n }\n\n private buildZodSchema(config: CommandConfig): Record<string, any> {\n const schema: Record<string, any> = {\n // Add cwd parameter as mandatory to all commands\n cwd: z.string().describe('Path to workspace'),\n };\n\n config.argsData.forEach((arg) => {\n const desc = arg.description || `Positional argument: ${arg.nameRaw}`;\n if (arg.isArray) {\n schema[arg.nameCamelCase] = arg.required\n ? z.array(z.string()).describe(desc)\n : z.array(z.string()).optional().describe(desc);\n } else {\n schema[arg.nameCamelCase] = arg.required ? z.string().describe(desc) : z.string().optional().describe(desc);\n }\n });\n\n config.flagsData.forEach((flag) => {\n const type = flag.type;\n schema[flag.name] =\n type === 'string'\n ? z.string().optional().describe(flag.description)\n : z.boolean().optional().describe(flag.description);\n });\n\n return schema;\n }\n\n private buildCommandArgs(config: CommandConfig, params: any): string[] {\n // Split the command name on spaces to properly handle subcommands\n const args: string[] = config.name.split(' ');\n\n // Add positional arguments in order\n config.argsData.forEach((arg) => {\n const val = params[arg.nameCamelCase];\n if (val === undefined) return;\n\n if (arg.isArray && Array.isArray(val)) {\n val.forEach((item) => args.push(item));\n } else {\n args.push(val);\n }\n });\n\n // Add options as flags\n config.flagsData.forEach((flag) => {\n const name = flag.name;\n const type = flag.type;\n const val = params[name];\n if (val === undefined) return;\n if (type === 'boolean' && val) {\n args.push(`--${name}`);\n } else if (type === 'string' && val) {\n // Check if the string value contains spaces and quote it if necessary\n const stringValue = String(val);\n if (stringValue.includes(' ')) {\n args.push(`--${name}`, `\"${stringValue}\"`);\n } else {\n args.push(`--${name}`, stringValue);\n }\n }\n });\n\n return args;\n }\n\n private getToolName(name: string): string {\n // replace white spaces (\\s) and dashes (-) with underscores (_)\n return `bit_${name}`.replace(/[-\\s]/g, '_');\n }\n\n private registerToolForCommand(server: McpServer, cmd: Command, parentCmd?: Command) {\n const cmdName = parentCmd ? `${getCommandName(parentCmd)} ${getCommandName(cmd)}` : getCommandName(cmd);\n const toolName = this.getToolName(cmdName);\n\n // Modify description for show and schema commands in consumer project mode\n let description = `${cmd.description}${cmd.extendedDescription ? `.\\n(${cmd.extendedDescription})` : ''}`;\n if (this.isConsumerProjectMode && (cmdName === 'show' || cmdName === 'schema')) {\n description += `\\n(In consumer project mode, --remote flag is automatically added)`;\n }\n\n const config: CommandConfig = {\n name: cmdName,\n description,\n argsData: getArgsData(cmd),\n flagsData: getFlagsData(cmd),\n };\n\n const schema = this.buildZodSchema(config);\n\n server.tool(toolName, config.description, schema, async (params: any) => {\n const argsToRun = this.buildCommandArgs(config, params);\n\n // Special handling for consumer projects - auto-add --remote flag for show and schema commands\n if (this.isConsumerProjectMode && (cmdName === 'show' || cmdName === 'schema')) {\n if (!argsToRun.includes('--remote')) {\n this.logger.debug(`[MCP-DEBUG] Auto-adding --remote flag for ${cmdName} in consumer project mode`);\n argsToRun.push('--remote');\n }\n if (cmdName === 'show' && !argsToRun.includes('--legacy')) {\n this.logger.debug(`[MCP-DEBUG] Auto-adding --legacy flag for ${cmdName} in consumer project mode`);\n argsToRun.push('--legacy');\n }\n }\n\n return this.runBit(argsToRun, params.cwd);\n });\n }\n\n private registerToolForRemote(server: McpServer, name: string) {\n if (name === 'remote-search') {\n this.registerRemoteSearchTool(server);\n }\n }\n\n private registerRemoteSearchTool(server: McpServer) {\n const toolName = this.getToolName('remote-search');\n const description = 'Search for components in remote scopes';\n const schema: Record<string, any> = {\n queryStr: z.string().describe('Search query string'),\n };\n server.tool(toolName, description, schema, async (params: any) => {\n const http = await this.getHttp();\n const results = await http.search(params.queryStr);\n this.logger.debug(`[MCP-DEBUG] Search results: ${JSON.stringify(results)}`);\n if (!results?.components || results.components.length === 0) {\n return { content: [{ type: 'text', text: 'No results found' }] };\n }\n const formattedResults = results.components.map((result) => ({\n type: 'text',\n text: result,\n }));\n return { content: formattedResults } as CallToolResult;\n });\n }\n\n private processSubCommands(server: McpServer, parentCmd: Command, options: CommandFilterOptions) {\n const parentCmdName = getCommandName(parentCmd);\n\n parentCmd.commands?.forEach((subCmd) => {\n const subCmdName = getCommandName(subCmd);\n const fullCmdName = `${parentCmdName} ${subCmdName}`;\n\n if (this.shouldIncludeCommand(fullCmdName, options)) {\n this.registerToolForCommand(server, subCmd, parentCmd);\n }\n });\n }\n\n private async runBit(args: string[], cwd: string): Promise<CallToolResult> {\n this.logger.debug(`[MCP-DEBUG] Running: ${this.bitBin} ${args.join(' ')} in ${cwd}`);\n const cmd = `${this.bitBin} ${args.join(' ')}`;\n try {\n const cmdOutput = childProcess.execSync(cmd, { cwd });\n this.logger.debug(`[MCP-DEBUG] result. stdout: ${cmdOutput}`);\n\n return { content: [{ type: 'text', text: cmdOutput.toString() }] };\n } catch (error: any) {\n this.logger.error(`[MCP-DEBUG] Error executing ${cmd}`, error);\n\n return { content: [{ type: 'text', text: error.message }] };\n }\n }\n\n static slots = [];\n static dependencies = [CLIAspect, LoggerAspect];\n static runtime = MainRuntime;\n static async provider([cli, loggerMain]: [CLIMain, LoggerMain]) {\n const logger = loggerMain.createLogger(CliMcpServerAspect.id);\n const mcpServer = new CliMcpServerMain(cli, logger);\n cli.register(new McpServerCmd(mcpServer));\n return mcpServer;\n }\n}\n\nCliMcpServerAspect.addRuntime(CliMcpServerMain);\n\nexport default CliMcpServerMain;\n"],"mappings":";;;;;;AAGA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;A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I,OAAA,GAEjCmB,gBAAgB","ignoreList":[]}
|
package/dist/mcp-server.cmd.d.ts
CHANGED
package/dist/mcp-server.cmd.js
CHANGED
|
@@ -15,7 +15,7 @@ class McpServerCmd {
|
|
|
15
15
|
_defineProperty(this, "alias", '');
|
|
16
16
|
_defineProperty(this, "group", 'development');
|
|
17
17
|
_defineProperty(this, "loader", false);
|
|
18
|
-
_defineProperty(this, "options", [['e', 'extended', 'Enable the full set of Bit CLI commands as MCP tools'], ['', 'include-only <commands>', 'Specify a subset of commands to expose as MCP tools. Use comma-separated list in quotes, e.g. "status,install,compile"'], ['', 'include-additional <commands>', 'Add specific commands to the default MCP tools set. Use comma-separated list in quotes. Only applies when --extended is not used'], ['', 'exclude <commands>', 'Prevent specific commands from being exposed as MCP tools. Use comma-separated list in quotes'], ['', 'bit-bin <binary>', 'Specify the binary to use for running Bit commands (default: "bit")']]);
|
|
18
|
+
_defineProperty(this, "options", [['e', 'extended', 'Enable the full set of Bit CLI commands as MCP tools'], ['', 'include-only <commands>', 'Specify a subset of commands to expose as MCP tools. Use comma-separated list in quotes, e.g. "status,install,compile"'], ['', 'include-additional <commands>', 'Add specific commands to the default MCP tools set. Use comma-separated list in quotes. Only applies when --extended is not used'], ['', 'exclude <commands>', 'Prevent specific commands from being exposed as MCP tools. Use comma-separated list in quotes'], ['', 'bit-bin <binary>', 'Specify the binary to use for running Bit commands (default: "bit")'], ['', 'consumer-project', 'For non-Bit workspaces that only consume Bit component packages. Enables only "schema", "show", and "remote_search" tools']]);
|
|
19
19
|
}
|
|
20
20
|
async wait(args, flags) {
|
|
21
21
|
await this.mcpServer.runMcpServer(flags);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["McpServerCmd","constructor","mcpServer","_defineProperty","wait","args","flags","runMcpServer","exports"],"sources":["mcp-server.cmd.ts"],"sourcesContent":["import { CLIArgs, Command, CommandOptions } from '@teambit/cli';\nimport { CliMcpServerMain } from './cli-mcp-server.main.runtime';\n\nexport type McpServerCmdOptions = {\n extended?: boolean;\n includeOnly?: string;\n includeAdditional?: string;\n exclude?: string;\n bitBin?: string;\n};\n\nexport class McpServerCmd implements Command {\n name = 'mcp-server';\n description
|
|
1
|
+
{"version":3,"names":["McpServerCmd","constructor","mcpServer","_defineProperty","wait","args","flags","runMcpServer","exports"],"sources":["mcp-server.cmd.ts"],"sourcesContent":["import { CLIArgs, Command, CommandOptions } from '@teambit/cli';\nimport { CliMcpServerMain } from './cli-mcp-server.main.runtime';\n\nexport type McpServerCmdOptions = {\n extended?: boolean;\n includeOnly?: string;\n includeAdditional?: string;\n exclude?: string;\n bitBin?: string;\n consumerProject?: boolean;\n};\n\nexport class McpServerCmd implements Command {\n name = 'mcp-server';\n description =\n 'Start the Bit CLI Model Context Protocol (MCP) server for programmatic and remote access to Bit commands.';\n alias = '';\n group = 'development';\n loader = false;\n options = [\n ['e', 'extended', 'Enable the full set of Bit CLI commands as MCP tools'],\n [\n '',\n 'include-only <commands>',\n 'Specify a subset of commands to expose as MCP tools. Use comma-separated list in quotes, e.g. \"status,install,compile\"',\n ],\n [\n '',\n 'include-additional <commands>',\n 'Add specific commands to the default MCP tools set. Use comma-separated list in quotes. Only applies when --extended is not used',\n ],\n [\n '',\n 'exclude <commands>',\n 'Prevent specific commands from being exposed as MCP tools. Use comma-separated list in quotes',\n ],\n ['', 'bit-bin <binary>', 'Specify the binary to use for running Bit commands (default: \"bit\")'],\n [\n '',\n 'consumer-project',\n 'For non-Bit workspaces that only consume Bit component packages. Enables only \"schema\", \"show\", and \"remote_search\" tools',\n ],\n ] as CommandOptions;\n\n constructor(private mcpServer: CliMcpServerMain) {}\n\n async wait(args: CLIArgs, flags: McpServerCmdOptions): Promise<void> {\n await this.mcpServer.runMcpServer(flags);\n }\n}\n"],"mappings":";;;;;;;;;AAYO,MAAMA,YAAY,CAAoB;EAgC3CC,WAAWA,CAASC,SAA2B,EAAE;IAAA,KAA7BA,SAA2B,GAA3BA,SAA2B;IAAAC,eAAA,eA/BxC,YAAY;IAAAA,eAAA,sBAEjB,2GAA2G;IAAAA,eAAA,gBACrG,EAAE;IAAAA,eAAA,gBACF,aAAa;IAAAA,eAAA,iBACZ,KAAK;IAAAA,eAAA,kBACJ,CACR,CAAC,GAAG,EAAE,UAAU,EAAE,sDAAsD,CAAC,EACzE,CACE,EAAE,EACF,yBAAyB,EACzB,wHAAwH,CACzH,EACD,CACE,EAAE,EACF,+BAA+B,EAC/B,kIAAkI,CACnI,EACD,CACE,EAAE,EACF,oBAAoB,EACpB,+FAA+F,CAChG,EACD,CAAC,EAAE,EAAE,kBAAkB,EAAE,qEAAqE,CAAC,EAC/F,CACE,EAAE,EACF,kBAAkB,EAClB,2HAA2H,CAC5H,CACF;EAEiD;EAElD,MAAMC,IAAIA,CAACC,IAAa,EAAEC,KAA0B,EAAiB;IACnE,MAAM,IAAI,CAACJ,SAAS,CAACK,YAAY,CAACD,KAAK,CAAC;EAC1C;AACF;AAACE,OAAA,CAAAR,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
;
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.mcp_cli-mcp-server@0.0.
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.mcp_cli-mcp-server@0.0.6/dist/README.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [];
|
|
5
5
|
export const overview = [overview_0];
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/cli-mcp-server",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/mcp/cli-mcp-server",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.mcp",
|
|
8
8
|
"name": "cli-mcp-server",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.6"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"zod": "^3.24.4",
|
|
13
13
|
"@modelcontextprotocol/sdk": "^1.11.0",
|
|
14
14
|
"@teambit/harmony": "0.4.7",
|
|
15
|
-
"@teambit/cli": "0.0.
|
|
15
|
+
"@teambit/cli": "0.0.1198",
|
|
16
16
|
"@teambit/legacy.constants": "0.0.11",
|
|
17
|
-
"@teambit/logger": "0.0.
|
|
17
|
+
"@teambit/logger": "0.0.1291",
|
|
18
18
|
"@teambit/scope.network": "0.0.50"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|