@teambit/cli-mcp-server 0.0.0-01a64fc189fd54260378eef7ec9b3e522f9d6315
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 +345 -0
- package/dist/README.docs.mdx +345 -0
- package/dist/cli-mcp-server.aspect.d.ts +2 -0
- package/dist/cli-mcp-server.aspect.js +18 -0
- package/dist/cli-mcp-server.aspect.js.map +1 -0
- package/dist/cli-mcp-server.main.runtime.d.ts +93 -0
- package/dist/cli-mcp-server.main.runtime.js +1285 -0
- package/dist/cli-mcp-server.main.runtime.js.map +1 -0
- package/dist/cli-mcp-server.spec.d.ts +1 -0
- package/dist/cli-mcp-server.spec.js +679 -0
- package/dist/cli-mcp-server.spec.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-server.cmd.d.ts +31 -0
- package/dist/mcp-server.cmd.js +53 -0
- package/dist/mcp-server.cmd.js.map +1 -0
- package/dist/preview-1755895122061.js +7 -0
- package/dist/rules-cmd.d.ts +20 -0
- package/dist/rules-cmd.js +69 -0
- package/dist/rules-cmd.js.map +1 -0
- package/dist/setup-cmd.d.ts +20 -0
- package/dist/setup-cmd.js +60 -0
- package/dist/setup-cmd.js.map +1 -0
- package/package.json +71 -0
- package/types/asset.d.ts +41 -0
- package/types/style.d.ts +42 -0
package/README.docs.mdx
ADDED
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
# Bit CLI MCP Server
|
|
2
|
+
|
|
3
|
+
The Bit CLI MCP Server provides a [Model Context Protocol (MCP)](https://github.com/modelcontextprotocol/mcp) interface to Bit's command-line functionality, enabling programmatic access to Bit workspace and component management operations. This server exposes Bit CLI commands as MCP tools, making it possible to automate, script, or integrate Bit operations with other tools and platforms.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This server acts as a bridge between MCP clients (such as VS Code, AI tools, or your own applications) and the Bit CLI. It leverages the Bit server API for efficient communication and provides both individual CLI command tools and specialized composite tools for common workflows. The server automatically manages a Bit server instance in the background for optimal performance.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
### Prerequisites
|
|
12
|
+
|
|
13
|
+
- Node.js (v18 or later recommended)
|
|
14
|
+
- Bit CLI installed and available in your PATH
|
|
15
|
+
|
|
16
|
+
### Getting Started
|
|
17
|
+
|
|
18
|
+
The Bit CLI MCP Server is included with Bit. If you have Bit installed, you can run the server using:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
bit mcp-server start
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
### Command-Line Options
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
bit mcp-server start [options]
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Options:
|
|
33
|
+
|
|
34
|
+
- `--consumer-project`: For non-Bit workspaces that only consume Bit component packages. Enables only "bit_remote_search" and "bit_remote_component_details" tools and automatically adds the "--remote" flag to relevant commands.
|
|
35
|
+
- `--include-additional <commands>`: Add specific commands to the available tools (comma-separated list)
|
|
36
|
+
|
|
37
|
+
### Integrating with IDEs
|
|
38
|
+
|
|
39
|
+
The easiest way to integrate the MCP server with your IDE is to use the `setup` command:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Basic setup for VS Code (default)
|
|
43
|
+
bit mcp-server setup
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
This will automatically configure your VS Code settings to use the Bit MCP server. See the [Automatic Setup](#automatic-integration-setup) section below for more options.
|
|
47
|
+
|
|
48
|
+
### Automatic Integration Setup
|
|
49
|
+
|
|
50
|
+
The **recommended way** to integrate the MCP server with your IDE is using the `setup` command:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
bit mcp-server setup [vscode|cursor|windsurf|roo|cline|claude-code] [options]
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
This command automatically configures the MCP server settings in your chosen editor. If no editor is specified, it defaults to VS Code.
|
|
57
|
+
|
|
58
|
+
#### Supported Editors
|
|
59
|
+
|
|
60
|
+
- **VS Code**: `bit mcp-server setup vscode` (or just `bit mcp-server setup`)
|
|
61
|
+
- **Cursor**: `bit mcp-server setup cursor`
|
|
62
|
+
- **Windsurf**: `bit mcp-server setup windsurf`
|
|
63
|
+
- **Roo Code**: `bit mcp-server setup roo`
|
|
64
|
+
- **Cline**: `bit mcp-server setup cline`
|
|
65
|
+
- **Claude Code**: `bit mcp-server setup claude-code`
|
|
66
|
+
|
|
67
|
+
#### Configuration Options
|
|
68
|
+
|
|
69
|
+
- `--global`: Apply configuration globally (user settings) instead of workspace settings
|
|
70
|
+
- `--consumer-project`: Configure for consumer projects
|
|
71
|
+
- `--include-additional <commands>`: Add specific commands to the available tools
|
|
72
|
+
|
|
73
|
+
#### Examples
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Basic VS Code setup (workspace level)
|
|
77
|
+
bit mcp-server setup
|
|
78
|
+
|
|
79
|
+
# Global setup for Cursor
|
|
80
|
+
bit mcp-server setup cursor --global
|
|
81
|
+
|
|
82
|
+
# Setup with consumer project mode
|
|
83
|
+
bit mcp-server setup --consumer-project
|
|
84
|
+
|
|
85
|
+
# Setup for Claude Code (creates .mcp.json file)
|
|
86
|
+
bit mcp-server setup claude-code
|
|
87
|
+
|
|
88
|
+
# Global setup for Claude Code
|
|
89
|
+
bit mcp-server setup claude-code --global
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
#### Manual Configuration
|
|
93
|
+
|
|
94
|
+
If you need to manually configure the settings, here's how to set up VS Code MCP integration:
|
|
95
|
+
|
|
96
|
+
**For workspace-specific configuration:**
|
|
97
|
+
|
|
98
|
+
1. Create a `.vscode/mcp.json` file in your workspace folder
|
|
99
|
+
2. Add the following configuration:
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"servers": {
|
|
104
|
+
"bit-cli": {
|
|
105
|
+
"type": "stdio",
|
|
106
|
+
"command": "bit",
|
|
107
|
+
"args": ["mcp-server", "start"]
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**For global configuration:**
|
|
114
|
+
|
|
115
|
+
1. Open VS Code settings (JSON) by pressing `Ctrl + Shift + P` (or `Cmd + Shift + P` on macOS) and typing `Preferences: Open Settings (JSON)`
|
|
116
|
+
2. Add the following configuration:
|
|
117
|
+
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"mcp": {
|
|
121
|
+
"servers": {
|
|
122
|
+
"bit-cli": {
|
|
123
|
+
"type": "stdio",
|
|
124
|
+
"command": "bit",
|
|
125
|
+
"args": ["mcp-server", "start"]
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
#### Claude Code Setup
|
|
133
|
+
|
|
134
|
+
Claude Code uses `.mcp.json` files for MCP server configuration. The setup command creates these files automatically:
|
|
135
|
+
|
|
136
|
+
**Workspace Configuration:**
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
bit mcp-server setup claude-code
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
This creates a `.mcp.json` file in your project root:
|
|
143
|
+
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"mcpServers": {
|
|
147
|
+
"bit": {
|
|
148
|
+
"command": "bit",
|
|
149
|
+
"args": ["mcp-server", "start"]
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Global Configuration:**
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
bit mcp-server setup claude-code --global
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
This creates/updates the global configuration file:
|
|
162
|
+
|
|
163
|
+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
164
|
+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
165
|
+
- **Linux**: `~/.config/claude/claude_desktop_config.json`
|
|
166
|
+
|
|
167
|
+
**Important**: After setup, restart Claude Code for the MCP server to be available.
|
|
168
|
+
|
|
169
|
+
**Claude Code Rules:**
|
|
170
|
+
|
|
171
|
+
To provide Bit-specific guidance to Claude Code, use the rules command:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
bit mcp-server rules claude-code
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
This creates `.claude/bit.md` with Bit instructions. To integrate with your existing `CLAUDE.md`, add:
|
|
178
|
+
|
|
179
|
+
```markdown
|
|
180
|
+
@.claude/bit.md
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
This approach ensures your existing `CLAUDE.md` file is never overwritten.
|
|
184
|
+
|
|
185
|
+
### Programmatic Usage
|
|
186
|
+
|
|
187
|
+
```javascript
|
|
188
|
+
import { McpClient } from '@modelcontextprotocol/sdk/client';
|
|
189
|
+
|
|
190
|
+
async function example() {
|
|
191
|
+
const client = await McpClient.spawn('bit', ['mcp-server', 'start']);
|
|
192
|
+
|
|
193
|
+
// Call a Bit CLI tool via MCP
|
|
194
|
+
const result = await client.callTool('bit_status', { cwd: '/path/to/workspace' });
|
|
195
|
+
console.log(result.content[0].text);
|
|
196
|
+
|
|
197
|
+
// Close the connection when done
|
|
198
|
+
await client.close();
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Available Tools
|
|
203
|
+
|
|
204
|
+
The Bit CLI MCP Server operates in two modes and provides several specialized tools:
|
|
205
|
+
|
|
206
|
+
### Default Mode
|
|
207
|
+
|
|
208
|
+
In default mode, the server exposes a minimal set of essential tools focused on core functionality. This ensures optimal performance and safety:
|
|
209
|
+
|
|
210
|
+
- **Always Available Tools:**
|
|
211
|
+
|
|
212
|
+
- `bit_remote_search`: Search for components in remote scopes
|
|
213
|
+
- `bit_workspace_info`: Get comprehensive workspace information including status, components list, apps, templates, and dependency graph
|
|
214
|
+
- `bit_component_details`: Get detailed information about a specific component including basic info and optionally its public API schema
|
|
215
|
+
- `bit_query`: Execute read-only Bit commands that safely inspect workspace and component state without making modifications
|
|
216
|
+
- `bit_execute`: Execute any Bit command, including those that modify workspace or repository state (use with caution)
|
|
217
|
+
- `bit_commands_list`: Get all available Bit commands with descriptions and groups (for command discovery)
|
|
218
|
+
- `bit_command_help`: Get detailed help for a specific Bit command including syntax, arguments, flags, and usage examples
|
|
219
|
+
|
|
220
|
+
> **Command Discovery vs. Command Help**: Use `bit_commands_list` to discover what commands are available in Bit, then use `bit_command_help` with a specific command name to get detailed usage information including arguments, flags, and examples.
|
|
221
|
+
|
|
222
|
+
### Consumer Project Mode (--consumer-project)
|
|
223
|
+
|
|
224
|
+
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:
|
|
225
|
+
|
|
226
|
+
- `bit_remote_search`: Search for components in remote scopes
|
|
227
|
+
- `bit_remote_component_details`: Get detailed information about a remote component including basic info and its public API schema (combines the functionality of show and schema commands)
|
|
228
|
+
|
|
229
|
+
In this mode:
|
|
230
|
+
|
|
231
|
+
1. You don't need a Bit workspace initialization
|
|
232
|
+
2. Only these 2 tools are available (no workspace-specific tools)
|
|
233
|
+
3. The `--remote` flag is automatically added to component detail queries
|
|
234
|
+
4. The `cwd` parameter is still required but can be any directory (not necessarily a Bit workspace)
|
|
235
|
+
5. You can still add additional tools with the `--include-additional` flag
|
|
236
|
+
|
|
237
|
+
## Tool Parameters
|
|
238
|
+
|
|
239
|
+
All tools accept a `cwd` parameter specifying the workspace path. Additional parameters vary by command.
|
|
240
|
+
|
|
241
|
+
### bit_remote_search
|
|
242
|
+
|
|
243
|
+
Search for multiple components in parallel for efficient discovery:
|
|
244
|
+
|
|
245
|
+
```json
|
|
246
|
+
{
|
|
247
|
+
"queries": ["input", "button", "validation"],
|
|
248
|
+
"cwd": "/path/to/workspace"
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
**Parameters:**
|
|
253
|
+
|
|
254
|
+
- `queries` (required): Array of search terms. Use either variations/synonyms of one component type (`["btn", "button"]`) or different components needed for a task (`["table", "pagination", "filter"]`)
|
|
255
|
+
- `cwd` (optional): Path to workspace directory
|
|
256
|
+
- `owners` (optional): Filter by specific owners (auto-extracted from workspace.jsonc if not provided)
|
|
257
|
+
- `skipAutoOwner` (optional): Disable automatic owner extraction
|
|
258
|
+
|
|
259
|
+
**Examples:**
|
|
260
|
+
|
|
261
|
+
- Form components: `["input", "button", "validation", "dropdown"]`
|
|
262
|
+
- Layout components: `["header", "navigation", "footer"]`
|
|
263
|
+
- Data display: `["table", "pagination", "filter", "sort"]`
|
|
264
|
+
- Button variations: `["button", "btn", "click"]`
|
|
265
|
+
|
|
266
|
+
Example tool call for `bit_status`:
|
|
267
|
+
|
|
268
|
+
```json
|
|
269
|
+
{
|
|
270
|
+
"cwd": "/path/to/workspace",
|
|
271
|
+
"warnings": true,
|
|
272
|
+
"json": true
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Custom Tool Selection
|
|
277
|
+
|
|
278
|
+
To customize the available tools:
|
|
279
|
+
|
|
280
|
+
```
|
|
281
|
+
# Add specific tools to the available tools
|
|
282
|
+
bit mcp-server start --include-additional "build,lint,format,create,schema"
|
|
283
|
+
|
|
284
|
+
# For consumer projects (non-Bit workspaces)
|
|
285
|
+
bit mcp-server start --consumer-project
|
|
286
|
+
|
|
287
|
+
# Add specific tools to the consumer project set
|
|
288
|
+
bit mcp-server start --consumer-project --include-additional "deps,get,preview"
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### Writing AI Assistant Rules
|
|
292
|
+
|
|
293
|
+
The MCP server provides a `rules` command to create instruction files for AI assistants:
|
|
294
|
+
|
|
295
|
+
```bash
|
|
296
|
+
bit mcp-server rules [vscode|cursor|windsurf|roo|cline|claude-code] [options]
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
This command creates rules/instructions markdown files that provide guidance to AI assistants on how to effectively use the Bit MCP server and follow best practices when working with Bit components.
|
|
300
|
+
|
|
301
|
+
#### Supported Editors
|
|
302
|
+
|
|
303
|
+
- **VS Code**: `bit mcp-server rules vscode` (or just `bit mcp-server rules`)
|
|
304
|
+
- **Cursor**: `bit mcp-server rules cursor`
|
|
305
|
+
- **Windsurf**: `bit mcp-server rules windsurf`
|
|
306
|
+
- **Roo Code**: `bit mcp-server rules roo`
|
|
307
|
+
- **Cline**: `bit mcp-server rules cline`
|
|
308
|
+
- **Claude Code**: `bit mcp-server rules claude-code`
|
|
309
|
+
|
|
310
|
+
#### Configuration Options
|
|
311
|
+
|
|
312
|
+
- `--global`: Write rules to global configuration (default: workspace-specific)
|
|
313
|
+
- `--print`: Print rules content to screen instead of writing to file
|
|
314
|
+
- `--consumer-project`: Generate rules for consumer projects that only use Bit components as packages
|
|
315
|
+
|
|
316
|
+
#### Examples
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
# Basic VS Code rules (workspace level)
|
|
320
|
+
bit mcp-server rules
|
|
321
|
+
|
|
322
|
+
# Global rules for Cursor
|
|
323
|
+
bit mcp-server rules cursor --global
|
|
324
|
+
|
|
325
|
+
# Consumer project rules for VS Code
|
|
326
|
+
bit mcp-server rules --consumer-project
|
|
327
|
+
|
|
328
|
+
# Claude Code rules (creates .claude/bit.md)
|
|
329
|
+
bit mcp-server rules claude-code
|
|
330
|
+
|
|
331
|
+
# Global Claude Code rules
|
|
332
|
+
bit mcp-server rules claude-code --global
|
|
333
|
+
|
|
334
|
+
# Global rules for Cline (macOS only)
|
|
335
|
+
bit mcp-server rules cline --global
|
|
336
|
+
|
|
337
|
+
# Workspace-specific rules for Cline
|
|
338
|
+
bit mcp-server rules cline
|
|
339
|
+
|
|
340
|
+
# Print rules content to screen for manual setup
|
|
341
|
+
bit mcp-server rules --print
|
|
342
|
+
|
|
343
|
+
# Print consumer project content for Windsurf (requires manual addition to .windsurfrules)
|
|
344
|
+
bit mcp-server rules windsurf --print --consumer-project
|
|
345
|
+
```
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
# Bit CLI MCP Server
|
|
2
|
+
|
|
3
|
+
The Bit CLI MCP Server provides a [Model Context Protocol (MCP)](https://github.com/modelcontextprotocol/mcp) interface to Bit's command-line functionality, enabling programmatic access to Bit workspace and component management operations. This server exposes Bit CLI commands as MCP tools, making it possible to automate, script, or integrate Bit operations with other tools and platforms.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This server acts as a bridge between MCP clients (such as VS Code, AI tools, or your own applications) and the Bit CLI. It leverages the Bit server API for efficient communication and provides both individual CLI command tools and specialized composite tools for common workflows. The server automatically manages a Bit server instance in the background for optimal performance.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
### Prerequisites
|
|
12
|
+
|
|
13
|
+
- Node.js (v18 or later recommended)
|
|
14
|
+
- Bit CLI installed and available in your PATH
|
|
15
|
+
|
|
16
|
+
### Getting Started
|
|
17
|
+
|
|
18
|
+
The Bit CLI MCP Server is included with Bit. If you have Bit installed, you can run the server using:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
bit mcp-server start
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
### Command-Line Options
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
bit mcp-server start [options]
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Options:
|
|
33
|
+
|
|
34
|
+
- `--consumer-project`: For non-Bit workspaces that only consume Bit component packages. Enables only "bit_remote_search" and "bit_remote_component_details" tools and automatically adds the "--remote" flag to relevant commands.
|
|
35
|
+
- `--include-additional <commands>`: Add specific commands to the available tools (comma-separated list)
|
|
36
|
+
|
|
37
|
+
### Integrating with IDEs
|
|
38
|
+
|
|
39
|
+
The easiest way to integrate the MCP server with your IDE is to use the `setup` command:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Basic setup for VS Code (default)
|
|
43
|
+
bit mcp-server setup
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
This will automatically configure your VS Code settings to use the Bit MCP server. See the [Automatic Setup](#automatic-integration-setup) section below for more options.
|
|
47
|
+
|
|
48
|
+
### Automatic Integration Setup
|
|
49
|
+
|
|
50
|
+
The **recommended way** to integrate the MCP server with your IDE is using the `setup` command:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
bit mcp-server setup [vscode|cursor|windsurf|roo|cline|claude-code] [options]
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
This command automatically configures the MCP server settings in your chosen editor. If no editor is specified, it defaults to VS Code.
|
|
57
|
+
|
|
58
|
+
#### Supported Editors
|
|
59
|
+
|
|
60
|
+
- **VS Code**: `bit mcp-server setup vscode` (or just `bit mcp-server setup`)
|
|
61
|
+
- **Cursor**: `bit mcp-server setup cursor`
|
|
62
|
+
- **Windsurf**: `bit mcp-server setup windsurf`
|
|
63
|
+
- **Roo Code**: `bit mcp-server setup roo`
|
|
64
|
+
- **Cline**: `bit mcp-server setup cline`
|
|
65
|
+
- **Claude Code**: `bit mcp-server setup claude-code`
|
|
66
|
+
|
|
67
|
+
#### Configuration Options
|
|
68
|
+
|
|
69
|
+
- `--global`: Apply configuration globally (user settings) instead of workspace settings
|
|
70
|
+
- `--consumer-project`: Configure for consumer projects
|
|
71
|
+
- `--include-additional <commands>`: Add specific commands to the available tools
|
|
72
|
+
|
|
73
|
+
#### Examples
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Basic VS Code setup (workspace level)
|
|
77
|
+
bit mcp-server setup
|
|
78
|
+
|
|
79
|
+
# Global setup for Cursor
|
|
80
|
+
bit mcp-server setup cursor --global
|
|
81
|
+
|
|
82
|
+
# Setup with consumer project mode
|
|
83
|
+
bit mcp-server setup --consumer-project
|
|
84
|
+
|
|
85
|
+
# Setup for Claude Code (creates .mcp.json file)
|
|
86
|
+
bit mcp-server setup claude-code
|
|
87
|
+
|
|
88
|
+
# Global setup for Claude Code
|
|
89
|
+
bit mcp-server setup claude-code --global
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
#### Manual Configuration
|
|
93
|
+
|
|
94
|
+
If you need to manually configure the settings, here's how to set up VS Code MCP integration:
|
|
95
|
+
|
|
96
|
+
**For workspace-specific configuration:**
|
|
97
|
+
|
|
98
|
+
1. Create a `.vscode/mcp.json` file in your workspace folder
|
|
99
|
+
2. Add the following configuration:
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"servers": {
|
|
104
|
+
"bit-cli": {
|
|
105
|
+
"type": "stdio",
|
|
106
|
+
"command": "bit",
|
|
107
|
+
"args": ["mcp-server", "start"]
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**For global configuration:**
|
|
114
|
+
|
|
115
|
+
1. Open VS Code settings (JSON) by pressing `Ctrl + Shift + P` (or `Cmd + Shift + P` on macOS) and typing `Preferences: Open Settings (JSON)`
|
|
116
|
+
2. Add the following configuration:
|
|
117
|
+
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"mcp": {
|
|
121
|
+
"servers": {
|
|
122
|
+
"bit-cli": {
|
|
123
|
+
"type": "stdio",
|
|
124
|
+
"command": "bit",
|
|
125
|
+
"args": ["mcp-server", "start"]
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
#### Claude Code Setup
|
|
133
|
+
|
|
134
|
+
Claude Code uses `.mcp.json` files for MCP server configuration. The setup command creates these files automatically:
|
|
135
|
+
|
|
136
|
+
**Workspace Configuration:**
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
bit mcp-server setup claude-code
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
This creates a `.mcp.json` file in your project root:
|
|
143
|
+
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"mcpServers": {
|
|
147
|
+
"bit": {
|
|
148
|
+
"command": "bit",
|
|
149
|
+
"args": ["mcp-server", "start"]
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Global Configuration:**
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
bit mcp-server setup claude-code --global
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
This creates/updates the global configuration file:
|
|
162
|
+
|
|
163
|
+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
164
|
+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
165
|
+
- **Linux**: `~/.config/claude/claude_desktop_config.json`
|
|
166
|
+
|
|
167
|
+
**Important**: After setup, restart Claude Code for the MCP server to be available.
|
|
168
|
+
|
|
169
|
+
**Claude Code Rules:**
|
|
170
|
+
|
|
171
|
+
To provide Bit-specific guidance to Claude Code, use the rules command:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
bit mcp-server rules claude-code
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
This creates `.claude/bit.md` with Bit instructions. To integrate with your existing `CLAUDE.md`, add:
|
|
178
|
+
|
|
179
|
+
```markdown
|
|
180
|
+
@.claude/bit.md
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
This approach ensures your existing `CLAUDE.md` file is never overwritten.
|
|
184
|
+
|
|
185
|
+
### Programmatic Usage
|
|
186
|
+
|
|
187
|
+
```javascript
|
|
188
|
+
import { McpClient } from '@modelcontextprotocol/sdk/client';
|
|
189
|
+
|
|
190
|
+
async function example() {
|
|
191
|
+
const client = await McpClient.spawn('bit', ['mcp-server', 'start']);
|
|
192
|
+
|
|
193
|
+
// Call a Bit CLI tool via MCP
|
|
194
|
+
const result = await client.callTool('bit_status', { cwd: '/path/to/workspace' });
|
|
195
|
+
console.log(result.content[0].text);
|
|
196
|
+
|
|
197
|
+
// Close the connection when done
|
|
198
|
+
await client.close();
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Available Tools
|
|
203
|
+
|
|
204
|
+
The Bit CLI MCP Server operates in two modes and provides several specialized tools:
|
|
205
|
+
|
|
206
|
+
### Default Mode
|
|
207
|
+
|
|
208
|
+
In default mode, the server exposes a minimal set of essential tools focused on core functionality. This ensures optimal performance and safety:
|
|
209
|
+
|
|
210
|
+
- **Always Available Tools:**
|
|
211
|
+
|
|
212
|
+
- `bit_remote_search`: Search for components in remote scopes
|
|
213
|
+
- `bit_workspace_info`: Get comprehensive workspace information including status, components list, apps, templates, and dependency graph
|
|
214
|
+
- `bit_component_details`: Get detailed information about a specific component including basic info and optionally its public API schema
|
|
215
|
+
- `bit_query`: Execute read-only Bit commands that safely inspect workspace and component state without making modifications
|
|
216
|
+
- `bit_execute`: Execute any Bit command, including those that modify workspace or repository state (use with caution)
|
|
217
|
+
- `bit_commands_list`: Get all available Bit commands with descriptions and groups (for command discovery)
|
|
218
|
+
- `bit_command_help`: Get detailed help for a specific Bit command including syntax, arguments, flags, and usage examples
|
|
219
|
+
|
|
220
|
+
> **Command Discovery vs. Command Help**: Use `bit_commands_list` to discover what commands are available in Bit, then use `bit_command_help` with a specific command name to get detailed usage information including arguments, flags, and examples.
|
|
221
|
+
|
|
222
|
+
### Consumer Project Mode (--consumer-project)
|
|
223
|
+
|
|
224
|
+
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:
|
|
225
|
+
|
|
226
|
+
- `bit_remote_search`: Search for components in remote scopes
|
|
227
|
+
- `bit_remote_component_details`: Get detailed information about a remote component including basic info and its public API schema (combines the functionality of show and schema commands)
|
|
228
|
+
|
|
229
|
+
In this mode:
|
|
230
|
+
|
|
231
|
+
1. You don't need a Bit workspace initialization
|
|
232
|
+
2. Only these 2 tools are available (no workspace-specific tools)
|
|
233
|
+
3. The `--remote` flag is automatically added to component detail queries
|
|
234
|
+
4. The `cwd` parameter is still required but can be any directory (not necessarily a Bit workspace)
|
|
235
|
+
5. You can still add additional tools with the `--include-additional` flag
|
|
236
|
+
|
|
237
|
+
## Tool Parameters
|
|
238
|
+
|
|
239
|
+
All tools accept a `cwd` parameter specifying the workspace path. Additional parameters vary by command.
|
|
240
|
+
|
|
241
|
+
### bit_remote_search
|
|
242
|
+
|
|
243
|
+
Search for multiple components in parallel for efficient discovery:
|
|
244
|
+
|
|
245
|
+
```json
|
|
246
|
+
{
|
|
247
|
+
"queries": ["input", "button", "validation"],
|
|
248
|
+
"cwd": "/path/to/workspace"
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
**Parameters:**
|
|
253
|
+
|
|
254
|
+
- `queries` (required): Array of search terms. Use either variations/synonyms of one component type (`["btn", "button"]`) or different components needed for a task (`["table", "pagination", "filter"]`)
|
|
255
|
+
- `cwd` (optional): Path to workspace directory
|
|
256
|
+
- `owners` (optional): Filter by specific owners (auto-extracted from workspace.jsonc if not provided)
|
|
257
|
+
- `skipAutoOwner` (optional): Disable automatic owner extraction
|
|
258
|
+
|
|
259
|
+
**Examples:**
|
|
260
|
+
|
|
261
|
+
- Form components: `["input", "button", "validation", "dropdown"]`
|
|
262
|
+
- Layout components: `["header", "navigation", "footer"]`
|
|
263
|
+
- Data display: `["table", "pagination", "filter", "sort"]`
|
|
264
|
+
- Button variations: `["button", "btn", "click"]`
|
|
265
|
+
|
|
266
|
+
Example tool call for `bit_status`:
|
|
267
|
+
|
|
268
|
+
```json
|
|
269
|
+
{
|
|
270
|
+
"cwd": "/path/to/workspace",
|
|
271
|
+
"warnings": true,
|
|
272
|
+
"json": true
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Custom Tool Selection
|
|
277
|
+
|
|
278
|
+
To customize the available tools:
|
|
279
|
+
|
|
280
|
+
```
|
|
281
|
+
# Add specific tools to the available tools
|
|
282
|
+
bit mcp-server start --include-additional "build,lint,format,create,schema"
|
|
283
|
+
|
|
284
|
+
# For consumer projects (non-Bit workspaces)
|
|
285
|
+
bit mcp-server start --consumer-project
|
|
286
|
+
|
|
287
|
+
# Add specific tools to the consumer project set
|
|
288
|
+
bit mcp-server start --consumer-project --include-additional "deps,get,preview"
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### Writing AI Assistant Rules
|
|
292
|
+
|
|
293
|
+
The MCP server provides a `rules` command to create instruction files for AI assistants:
|
|
294
|
+
|
|
295
|
+
```bash
|
|
296
|
+
bit mcp-server rules [vscode|cursor|windsurf|roo|cline|claude-code] [options]
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
This command creates rules/instructions markdown files that provide guidance to AI assistants on how to effectively use the Bit MCP server and follow best practices when working with Bit components.
|
|
300
|
+
|
|
301
|
+
#### Supported Editors
|
|
302
|
+
|
|
303
|
+
- **VS Code**: `bit mcp-server rules vscode` (or just `bit mcp-server rules`)
|
|
304
|
+
- **Cursor**: `bit mcp-server rules cursor`
|
|
305
|
+
- **Windsurf**: `bit mcp-server rules windsurf`
|
|
306
|
+
- **Roo Code**: `bit mcp-server rules roo`
|
|
307
|
+
- **Cline**: `bit mcp-server rules cline`
|
|
308
|
+
- **Claude Code**: `bit mcp-server rules claude-code`
|
|
309
|
+
|
|
310
|
+
#### Configuration Options
|
|
311
|
+
|
|
312
|
+
- `--global`: Write rules to global configuration (default: workspace-specific)
|
|
313
|
+
- `--print`: Print rules content to screen instead of writing to file
|
|
314
|
+
- `--consumer-project`: Generate rules for consumer projects that only use Bit components as packages
|
|
315
|
+
|
|
316
|
+
#### Examples
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
# Basic VS Code rules (workspace level)
|
|
320
|
+
bit mcp-server rules
|
|
321
|
+
|
|
322
|
+
# Global rules for Cursor
|
|
323
|
+
bit mcp-server rules cursor --global
|
|
324
|
+
|
|
325
|
+
# Consumer project rules for VS Code
|
|
326
|
+
bit mcp-server rules --consumer-project
|
|
327
|
+
|
|
328
|
+
# Claude Code rules (creates .claude/bit.md)
|
|
329
|
+
bit mcp-server rules claude-code
|
|
330
|
+
|
|
331
|
+
# Global Claude Code rules
|
|
332
|
+
bit mcp-server rules claude-code --global
|
|
333
|
+
|
|
334
|
+
# Global rules for Cline (macOS only)
|
|
335
|
+
bit mcp-server rules cline --global
|
|
336
|
+
|
|
337
|
+
# Workspace-specific rules for Cline
|
|
338
|
+
bit mcp-server rules cline
|
|
339
|
+
|
|
340
|
+
# Print rules content to screen for manual setup
|
|
341
|
+
bit mcp-server rules --print
|
|
342
|
+
|
|
343
|
+
# Print consumer project content for Windsurf (requires manual addition to .windsurfrules)
|
|
344
|
+
bit mcp-server rules windsurf --print --consumer-project
|
|
345
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CliMcpServerAspect = void 0;
|
|
7
|
+
function _harmony() {
|
|
8
|
+
const data = require("@teambit/harmony");
|
|
9
|
+
_harmony = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
const CliMcpServerAspect = exports.CliMcpServerAspect = _harmony().Aspect.create({
|
|
15
|
+
id: 'teambit.mcp/cli-mcp-server'
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=cli-mcp-server.aspect.js.map
|