embark-cli 1.1.7
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/.claude/CLAUDE.md +33 -0
- package/.claude/settings.local.json +32 -0
- package/.github/WORKFLOWS.md +147 -0
- package/.github/workflows/ci.yml +49 -0
- package/.github/workflows/publish.yml +109 -0
- package/.idea/embark-remote-mcp.iml +9 -0
- package/.idea/encodings.xml +4 -0
- package/.idea/indexLayout.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/.mcp.json +14 -0
- package/GIT_DISCOVERY.md +231 -0
- package/INTEGRATION_TESTING.md +243 -0
- package/MULTI_REPOSITORY_SEARCH.md +242 -0
- package/README.md +434 -0
- package/dist/auth/auth-helper.d.ts +3 -0
- package/dist/auth/auth-helper.d.ts.map +1 -0
- package/dist/auth/auth-helper.js +171 -0
- package/dist/auth/auth-helper.js.map +1 -0
- package/dist/auth/index.d.ts +4 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +24 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/jba-login.d.ts +17 -0
- package/dist/auth/jba-login.d.ts.map +1 -0
- package/dist/auth/jba-login.js +345 -0
- package/dist/auth/jba-login.js.map +1 -0
- package/dist/auth/types.d.ts +16 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/auth/types.js +3 -0
- package/dist/auth/types.js.map +1 -0
- package/dist/config.d.ts +26 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +54 -0
- package/dist/config.js.map +1 -0
- package/dist/embark-client.d.ts +56 -0
- package/dist/embark-client.d.ts.map +1 -0
- package/dist/embark-client.js +543 -0
- package/dist/embark-client.js.map +1 -0
- package/dist/git-utils.d.ts +47 -0
- package/dist/git-utils.d.ts.map +1 -0
- package/dist/git-utils.js +232 -0
- package/dist/git-utils.js.map +1 -0
- package/dist/handlers.d.ts +80 -0
- package/dist/handlers.d.ts.map +1 -0
- package/dist/handlers.js +301 -0
- package/dist/handlers.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +165 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +4 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +92 -0
- package/dist/logger.js.map +1 -0
- package/dist/stats-server.d.ts +3 -0
- package/dist/stats-server.d.ts.map +1 -0
- package/dist/stats-server.js +623 -0
- package/dist/stats-server.js.map +1 -0
- package/dist/stats.d.ts +118 -0
- package/dist/stats.d.ts.map +1 -0
- package/dist/stats.js +206 -0
- package/dist/stats.js.map +1 -0
- package/dist/tools.d.ts +9 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +62 -0
- package/dist/tools.js.map +1 -0
- package/package.json +47 -0
- package/test-git-discovery.mjs +322 -0
- package/test-multi-repo-filters.mjs +151 -0
- package/test-multiple-roots.mjs +436 -0
- package/test-roots.mjs +306 -0
- package/test-snippet-extraction.mjs +136 -0
- package/watch-logs.sh +78 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# Integration Testing with Claude Code
|
|
2
|
+
|
|
3
|
+
This guide explains how to test the Embark MCP Server integration with Claude Code and verify that roots are being passed correctly.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
### 1. Configure Claude Code
|
|
8
|
+
|
|
9
|
+
Add your development server to `.mcp.json` in your project root or Claude Code's global config:
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"mcpServers": {
|
|
14
|
+
"embark-mcp": {
|
|
15
|
+
"command": "node",
|
|
16
|
+
"args": ["/Users/dmitry.loktev/Projects/embark-remote-mcp/dist/index.js"],
|
|
17
|
+
"env": {
|
|
18
|
+
"REPOSITORY_GIT_REMOTE_URL": "https://github.com/jetbrains/embark-mcp.git",
|
|
19
|
+
"ENABLE_LOCAL_LOGS": "true"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Important**: Set `ENABLE_LOCAL_LOGS=true` to enable detailed logging.
|
|
27
|
+
|
|
28
|
+
### 2. Build the Server
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm run build
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 3. Start Log Watching
|
|
35
|
+
|
|
36
|
+
In a terminal, run the log watcher script:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
./watch-logs.sh
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This will:
|
|
43
|
+
- Monitor `~/.embark/debug.log` in real-time
|
|
44
|
+
- Highlight roots-related log entries in green
|
|
45
|
+
- Show errors in red and warnings in yellow
|
|
46
|
+
- Wait for the log file if it doesn't exist yet
|
|
47
|
+
|
|
48
|
+
### 4. Restart Claude Code
|
|
49
|
+
|
|
50
|
+
Restart Claude Code to load the MCP server with the new configuration.
|
|
51
|
+
|
|
52
|
+
### 5. Watch for Logs
|
|
53
|
+
|
|
54
|
+
When Claude Code connects to your MCP server, you should see log entries like:
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"timestamp": "2025-10-15T09:49:23.456Z",
|
|
59
|
+
"level": "info",
|
|
60
|
+
"message": "Server launch initiated."
|
|
61
|
+
}
|
|
62
|
+
{
|
|
63
|
+
"timestamp": "2025-10-15T09:49:23.500Z",
|
|
64
|
+
"level": "info",
|
|
65
|
+
"message": "ListRoots request received"
|
|
66
|
+
}
|
|
67
|
+
{
|
|
68
|
+
"timestamp": "2025-10-15T09:49:23.501Z",
|
|
69
|
+
"level": "info",
|
|
70
|
+
"message": "ListRoots returning repository root",
|
|
71
|
+
"data": {
|
|
72
|
+
"uri": "embark://https://github.com/jetbrains/embark-mcp.git",
|
|
73
|
+
"name": "embark-mcp"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## What to Look For
|
|
79
|
+
|
|
80
|
+
### ✅ Successful Integration
|
|
81
|
+
|
|
82
|
+
You should see these log entries when Claude Code connects:
|
|
83
|
+
|
|
84
|
+
1. **Server startup**: "Server launch initiated"
|
|
85
|
+
2. **Initialization**: "Server connected to stdio transport"
|
|
86
|
+
3. **Roots request**: "ListRoots request received"
|
|
87
|
+
4. **Roots response**: "ListRoots returning repository root" with URI and name
|
|
88
|
+
|
|
89
|
+
### ❌ Common Issues
|
|
90
|
+
|
|
91
|
+
**No logs appearing:**
|
|
92
|
+
- Check `ENABLE_LOCAL_LOGS=true` is set in your `.mcp.json`
|
|
93
|
+
- Verify the server path in `.mcp.json` points to `dist/index.js`
|
|
94
|
+
- Restart Claude Code
|
|
95
|
+
|
|
96
|
+
**"No REPOSITORY_GIT_REMOTE_URL configured" warning:**
|
|
97
|
+
- Add `REPOSITORY_GIT_REMOTE_URL` to the `env` section in `.mcp.json`
|
|
98
|
+
- Restart Claude Code
|
|
99
|
+
|
|
100
|
+
**Server not starting:**
|
|
101
|
+
- Check the build succeeded: `ls dist/index.js`
|
|
102
|
+
- Look for TypeScript errors: `npm run build`
|
|
103
|
+
- Verify Node.js version: `node --version` (should be 18+)
|
|
104
|
+
|
|
105
|
+
## Advanced: Manual Log Inspection
|
|
106
|
+
|
|
107
|
+
If you prefer to inspect logs manually:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# View entire log file
|
|
111
|
+
cat ~/.embark/debug.log
|
|
112
|
+
|
|
113
|
+
# View recent entries
|
|
114
|
+
tail -n 50 ~/.embark/debug.log
|
|
115
|
+
|
|
116
|
+
# Follow logs in real-time
|
|
117
|
+
tail -f ~/.embark/debug.log
|
|
118
|
+
|
|
119
|
+
# Search for roots-related entries
|
|
120
|
+
grep -i "root" ~/.embark/debug.log
|
|
121
|
+
|
|
122
|
+
# Filter by level
|
|
123
|
+
jq 'select(.level == "error")' ~/.embark/debug.log
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Log File Location
|
|
127
|
+
|
|
128
|
+
Logs are written to: `~/.embark/debug.log`
|
|
129
|
+
|
|
130
|
+
The log file uses JSON format with entries like:
|
|
131
|
+
|
|
132
|
+
```json
|
|
133
|
+
{
|
|
134
|
+
"timestamp": "2025-10-15T09:49:23.456Z",
|
|
135
|
+
"level": "info",
|
|
136
|
+
"message": "...",
|
|
137
|
+
"data": { ... }
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Testing Workflow
|
|
142
|
+
|
|
143
|
+
1. **Start log watcher** in one terminal:
|
|
144
|
+
```bash
|
|
145
|
+
./watch-logs.sh
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
2. **Make code changes** in your editor
|
|
149
|
+
|
|
150
|
+
3. **Rebuild**:
|
|
151
|
+
```bash
|
|
152
|
+
npm run build
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
4. **Restart Claude Code** to reload the server
|
|
156
|
+
|
|
157
|
+
5. **Watch logs** for the roots/list request and response
|
|
158
|
+
|
|
159
|
+
6. **Test functionality** by asking Claude to search code or interact with your repository
|
|
160
|
+
|
|
161
|
+
## Verifying Roots Are Passed
|
|
162
|
+
|
|
163
|
+
To verify Claude Code is receiving and using the roots:
|
|
164
|
+
|
|
165
|
+
1. Check logs show "ListRoots returning repository root"
|
|
166
|
+
2. The root URI should match your `REPOSITORY_GIT_REMOTE_URL`
|
|
167
|
+
3. The root name should be extracted from the repository URL
|
|
168
|
+
4. Ask Claude to search your codebase - it should be aware of the repository context
|
|
169
|
+
|
|
170
|
+
## Example Log Session
|
|
171
|
+
|
|
172
|
+
Here's what a successful session looks like:
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
============================================================
|
|
176
|
+
Embark MCP Server Log Watcher
|
|
177
|
+
============================================================
|
|
178
|
+
|
|
179
|
+
Log file: /Users/dmitry.loktev/.embark/debug.log
|
|
180
|
+
|
|
181
|
+
✓ Watching logs...
|
|
182
|
+
ℹ Press Ctrl+C to stop
|
|
183
|
+
|
|
184
|
+
------------------------------------------------------------
|
|
185
|
+
|
|
186
|
+
{
|
|
187
|
+
"timestamp": "2025-10-15T09:49:23.456Z",
|
|
188
|
+
"level": "info",
|
|
189
|
+
"message": "Server launch initiated."
|
|
190
|
+
}
|
|
191
|
+
{
|
|
192
|
+
"timestamp": "2025-10-15T09:49:23.500Z",
|
|
193
|
+
"level": "info",
|
|
194
|
+
"message": "ListRoots request received"
|
|
195
|
+
}
|
|
196
|
+
{
|
|
197
|
+
"timestamp": "2025-10-15T09:49:23.501Z",
|
|
198
|
+
"level": "info",
|
|
199
|
+
"message": "ListRoots returning repository root",
|
|
200
|
+
"data": {
|
|
201
|
+
"uri": "embark://https://github.com/jetbrains/embark-mcp.git",
|
|
202
|
+
"name": "embark-mcp"
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Troubleshooting
|
|
208
|
+
|
|
209
|
+
### Logs show old timestamps
|
|
210
|
+
|
|
211
|
+
The log file persists across sessions. Look for the most recent "--- New Session: ..." marker:
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
grep "New Session" ~/.embark/debug.log
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Want to clear logs
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
rm ~/.embark/debug.log
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Then restart Claude Code to create a fresh log.
|
|
224
|
+
|
|
225
|
+
### Server crashes immediately
|
|
226
|
+
|
|
227
|
+
Check stderr output in Claude Code's console or add stderr logging to see the error.
|
|
228
|
+
|
|
229
|
+
## Integration with Automated Tests
|
|
230
|
+
|
|
231
|
+
You can also run the automated test script while watching logs:
|
|
232
|
+
|
|
233
|
+
**Terminal 1:**
|
|
234
|
+
```bash
|
|
235
|
+
./watch-logs.sh
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**Terminal 2:**
|
|
239
|
+
```bash
|
|
240
|
+
ENABLE_LOCAL_LOGS=true node test-roots.mjs
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
This lets you see both the test output and the detailed server logs side-by-side.
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
# Multi-Repository Search
|
|
2
|
+
|
|
3
|
+
The Embark MCP server now supports searching across multiple Git repositories simultaneously, with flexible filtering options.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
When multiple workspace roots are provided by the MCP client, the server will:
|
|
8
|
+
|
|
9
|
+
1. **Discover** all Git repositories from the provided roots
|
|
10
|
+
2. **Add** repositories provided via environment variables (optional)
|
|
11
|
+
3. **Exclude** repositories based on environment variables (optional)
|
|
12
|
+
4. **Search** across all repositories in parallel
|
|
13
|
+
5. **Aggregate** results with clear repository labels
|
|
14
|
+
|
|
15
|
+
## How It Works
|
|
16
|
+
|
|
17
|
+
### Default Behavior
|
|
18
|
+
|
|
19
|
+
By default, when multiple repositories are discovered from workspace roots, the semantic code search will search **all of them** and return aggregated results.
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# No configuration needed - searches all discovered repositories
|
|
23
|
+
node dist/index.js
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Adding and Filtering Repositories
|
|
27
|
+
|
|
28
|
+
You can control which repositories are searched using environment variables:
|
|
29
|
+
|
|
30
|
+
#### Include Additional Repositories
|
|
31
|
+
|
|
32
|
+
Use `INCLUDE_REPOSITORY_URLS` to **add** repositories to the search list, even if they are not part of the current workspace roots (for example, a remote microservice you haven't cloned locally).
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
export INCLUDE_REPOSITORY_URLS="https://github.com/owner/repo1.git,https://github.com/owner/repo2.git"
|
|
36
|
+
node dist/index.js
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
All discovered repositories **plus** the ones in `INCLUDE_REPOSITORY_URLS` will be searched.
|
|
40
|
+
|
|
41
|
+
#### Exclude Specific Repositories
|
|
42
|
+
|
|
43
|
+
Use `EXCLUDE_REPOSITORY_URLS` to skip certain repositories:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
export EXCLUDE_REPOSITORY_URLS="https://github.com/owner/large-repo.git,https://github.com/owner/deprecated-repo.git"
|
|
47
|
+
node dist/index.js
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
All discovered (and included) repositories **except** those listed in `EXCLUDE_REPOSITORY_URLS` will be searched.
|
|
51
|
+
|
|
52
|
+
#### Combine Both Filters
|
|
53
|
+
|
|
54
|
+
You can add repositories and then remove specific ones with the exclude list:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
export INCLUDE_REPOSITORY_URLS="https://github.com/owner/repo1.git,https://github.com/owner/repo2.git,https://github.com/owner/repo3.git"
|
|
58
|
+
export EXCLUDE_REPOSITORY_URLS="https://github.com/owner/repo3.git"
|
|
59
|
+
node dist/index.js
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
This will search all discovered repositories, plus `repo1` and `repo2`, while skipping `repo3`.
|
|
63
|
+
|
|
64
|
+
## Environment Variables
|
|
65
|
+
|
|
66
|
+
### `INCLUDE_REPOSITORY_URLS`
|
|
67
|
+
|
|
68
|
+
- **Format**: Comma-separated list of Git repository URLs
|
|
69
|
+
- **Effect**: Repositories in this list will be added to the discovered set and searched alongside any workspace repositories
|
|
70
|
+
- **Example**: `"https://github.com/org/repo1.git,git@github.com:org/repo2.git"`
|
|
71
|
+
|
|
72
|
+
### `EXCLUDE_REPOSITORY_URLS`
|
|
73
|
+
|
|
74
|
+
- **Format**: Comma-separated list of Git repository URLs
|
|
75
|
+
- **Effect**: Repositories in this list will be skipped
|
|
76
|
+
- **Example**: `"https://github.com/org/large-repo.git"`
|
|
77
|
+
|
|
78
|
+
### Repository URL Matching
|
|
79
|
+
|
|
80
|
+
Repository URLs are matched by exact string when deduping or excluding:
|
|
81
|
+
|
|
82
|
+
- When **including** a repository, you can provide any valid Git URL (it doesn't need to be part of the current workspace).
|
|
83
|
+
- When **excluding** or when you want to target a discovered repository explicitly, use the exact remote URL shown in server logs.
|
|
84
|
+
|
|
85
|
+
Common formats:
|
|
86
|
+
- HTTPS: `https://github.com/owner/repo.git`
|
|
87
|
+
- SSH: `git@github.com:owner/repo.git`
|
|
88
|
+
- Enterprise: `https://git.company.com/owner/repo.git`
|
|
89
|
+
|
|
90
|
+
## Search Behavior
|
|
91
|
+
|
|
92
|
+
### Single Repository
|
|
93
|
+
|
|
94
|
+
When only one repository is available (after filtering or discovery), the search behaves like a traditional single-repository search with clean, simple output.
|
|
95
|
+
|
|
96
|
+
### Multiple Repositories
|
|
97
|
+
|
|
98
|
+
When multiple repositories are available, the search:
|
|
99
|
+
|
|
100
|
+
1. Queries all repositories **in parallel** for better performance
|
|
101
|
+
2. Aggregates results by repository
|
|
102
|
+
3. Returns formatted results with repository headers:
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
Searched 3 of 3 repositories for "authentication handler". Found 15 total results.
|
|
106
|
+
|
|
107
|
+
## Repository: frontend-app
|
|
108
|
+
|
|
109
|
+
Found 5 results for "authentication handler" in repository "https://github.com/owner/frontend-app.git":
|
|
110
|
+
|
|
111
|
+
1. File=src/auth/handler.ts, offset=120:450, similarity=0.892, type=FUNCTION
|
|
112
|
+
...
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Repository: backend-api
|
|
117
|
+
|
|
118
|
+
Found 10 results for "authentication handler" in repository "https://github.com/owner/backend-api.git":
|
|
119
|
+
|
|
120
|
+
1. File=api/auth.py, offset=200:550, similarity=0.876, type=CLASS
|
|
121
|
+
...
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Backward Compatibility
|
|
125
|
+
|
|
126
|
+
This feature is fully backward compatible:
|
|
127
|
+
|
|
128
|
+
- ✅ Single-repository setups continue to work unchanged
|
|
129
|
+
- ✅ `REPOSITORY_GIT_REMOTE_URL` environment variable still supported as fallback
|
|
130
|
+
- ✅ No changes to tool parameters or API
|
|
131
|
+
- ✅ Existing integrations remain functional
|
|
132
|
+
|
|
133
|
+
## Use Cases
|
|
134
|
+
|
|
135
|
+
### Monorepo with Multiple Projects
|
|
136
|
+
|
|
137
|
+
Search across all projects in a monorepo:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# Search all projects
|
|
141
|
+
node dist/index.js
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Multi-Repo Development
|
|
145
|
+
|
|
146
|
+
Search across related repositories you're working on:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# Add active development repos (even if they aren't part of the current workspace)
|
|
150
|
+
export INCLUDE_REPOSITORY_URLS="https://github.com/org/frontend.git,https://github.com/org/backend.git"
|
|
151
|
+
node dist/index.js
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Exclude Large/Archived Repositories
|
|
155
|
+
|
|
156
|
+
Skip repositories that are large or not relevant:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# Exclude archived and large repos
|
|
160
|
+
export EXCLUDE_REPOSITORY_URLS="https://github.com/org/archived-legacy.git,https://github.com/org/huge-data-repo.git"
|
|
161
|
+
node dist/index.js
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Troubleshooting
|
|
165
|
+
|
|
166
|
+
### No Results Across All Repositories
|
|
167
|
+
|
|
168
|
+
If you're getting "No repositories available for search":
|
|
169
|
+
|
|
170
|
+
1. Check that Git repositories are present in your workspace roots
|
|
171
|
+
2. Verify repositories have a `git remote` configured
|
|
172
|
+
3. If using `INCLUDE_REPOSITORY_URLS`, ensure the URLs are valid Git remotes (you can use this even when no workspace roots are available)
|
|
173
|
+
4. If using `EXCLUDE_REPOSITORY_URLS`, double-check that you're not excluding every repository
|
|
174
|
+
5. Check server logs for discovered and included repository URLs
|
|
175
|
+
|
|
176
|
+
### Repository Not Being Searched
|
|
177
|
+
|
|
178
|
+
If a repository isn't appearing in results:
|
|
179
|
+
|
|
180
|
+
1. Verify it was discovered during initialization (check logs)
|
|
181
|
+
2. If using `INCLUDE_REPOSITORY_URLS`, ensure the URL is listed and matches the remote you expect
|
|
182
|
+
3. If using `EXCLUDE_REPOSITORY_URLS`, ensure the URL is not listed (and that you are not excluding it indirectly with a duplicate format)
|
|
183
|
+
4. Verify the repository URL format matches exactly (HTTPS vs SSH) to avoid duplicates being treated as different URLs
|
|
184
|
+
|
|
185
|
+
### Performance with Many Repositories
|
|
186
|
+
|
|
187
|
+
Searches across multiple repositories run in parallel, but:
|
|
188
|
+
|
|
189
|
+
- Avoid adding unnecessary repositories via `INCLUDE_REPOSITORY_URLS` when troubleshooting performance
|
|
190
|
+
- Use `pathFilter` parameter to narrow search within repositories
|
|
191
|
+
- Large repositories may take longer to search
|
|
192
|
+
|
|
193
|
+
## Implementation Details
|
|
194
|
+
|
|
195
|
+
### Repository Discovery
|
|
196
|
+
|
|
197
|
+
1. Server requests roots from MCP client using `listRoots()`
|
|
198
|
+
2. Each root is checked for Git repositories using `git rev-parse --git-dir`
|
|
199
|
+
3. Git remote URL is extracted using `git remote get-url origin`
|
|
200
|
+
4. Repositories defined in `INCLUDE_REPOSITORY_URLS` are added (deduped by URL)
|
|
201
|
+
5. Repositories are cached for the duration of the server session
|
|
202
|
+
|
|
203
|
+
### Filtering Logic
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
All Discovered Repositories
|
|
207
|
+
↓
|
|
208
|
+
If INCLUDE_REPOSITORY_URLS is set:
|
|
209
|
+
Add repositories from include list (deduped by URL)
|
|
210
|
+
↓
|
|
211
|
+
If EXCLUDE_REPOSITORY_URLS is set:
|
|
212
|
+
Remove repositories in exclude list
|
|
213
|
+
↓
|
|
214
|
+
Filtered Repositories
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Search Execution
|
|
218
|
+
|
|
219
|
+
- **Single repo**: Direct search, clean output
|
|
220
|
+
- **Multiple repos**: Parallel searches, aggregated results
|
|
221
|
+
- **No repos**: Clear error message
|
|
222
|
+
|
|
223
|
+
## Future Enhancements
|
|
224
|
+
|
|
225
|
+
Potential future improvements:
|
|
226
|
+
|
|
227
|
+
- [ ] Support for repository name patterns (wildcards)
|
|
228
|
+
- [ ] Per-repository search configuration
|
|
229
|
+
- [ ] Result ranking across repositories
|
|
230
|
+
- [ ] Repository-specific pathFilter
|
|
231
|
+
- [ ] Dynamic repository discovery during runtime
|
|
232
|
+
|
|
233
|
+
## Testing
|
|
234
|
+
|
|
235
|
+
Run the test suite to see examples:
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
# Run multi-repository filter demonstration
|
|
239
|
+
node test-multi-repo-filters.mjs
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
This will show example scenarios and configuration patterns.
|