mcp-vector-search 0.7.4__py3-none-any.whl → 0.7.6__py3-none-any.whl
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.
Potentially problematic release.
This version of mcp-vector-search might be problematic. Click here for more details.
- mcp_vector_search/__init__.py +2 -2
- mcp_vector_search/cli/commands/demo.py +2 -4
- mcp_vector_search/cli/commands/index.py +130 -30
- mcp_vector_search/cli/commands/mcp.py +673 -36
- mcp_vector_search/cli/commands/status.py +23 -9
- mcp_vector_search/cli/main.py +2 -4
- mcp_vector_search/core/database.py +117 -54
- mcp_vector_search/core/indexer.py +191 -15
- mcp_vector_search/core/project.py +6 -3
- mcp_vector_search/utils/gitignore.py +31 -23
- {mcp_vector_search-0.7.4.dist-info → mcp_vector_search-0.7.6.dist-info}/METADATA +1 -1
- {mcp_vector_search-0.7.4.dist-info → mcp_vector_search-0.7.6.dist-info}/RECORD +15 -15
- {mcp_vector_search-0.7.4.dist-info → mcp_vector_search-0.7.6.dist-info}/WHEEL +0 -0
- {mcp_vector_search-0.7.4.dist-info → mcp_vector_search-0.7.6.dist-info}/entry_points.txt +0 -0
- {mcp_vector_search-0.7.4.dist-info → mcp_vector_search-0.7.6.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
"""MCP integration commands for
|
|
1
|
+
"""MCP integration commands for multiple AI tools."""
|
|
2
2
|
|
|
3
3
|
import json
|
|
4
4
|
import os
|
|
5
5
|
import shutil
|
|
6
6
|
import subprocess
|
|
7
7
|
import sys
|
|
8
|
+
import tomllib
|
|
8
9
|
from pathlib import Path
|
|
10
|
+
from typing import Any
|
|
9
11
|
|
|
10
12
|
import typer
|
|
11
13
|
from rich.console import Console
|
|
@@ -18,10 +20,57 @@ from ..didyoumean import create_enhanced_typer
|
|
|
18
20
|
from ..output import print_error, print_info, print_success, print_warning
|
|
19
21
|
|
|
20
22
|
# Create MCP subcommand app with "did you mean" functionality
|
|
21
|
-
mcp_app = create_enhanced_typer(
|
|
23
|
+
mcp_app = create_enhanced_typer(
|
|
24
|
+
help="""🤖 Manage MCP integration for AI tools
|
|
25
|
+
|
|
26
|
+
Configure mcp-vector-search as an MCP server for various AI coding assistants.
|
|
27
|
+
Each tool has its own configuration format and location.
|
|
28
|
+
|
|
29
|
+
[bold cyan]Supported Tools:[/bold cyan]
|
|
30
|
+
• [green]auggie[/green] - Augment Code AI assistant
|
|
31
|
+
• [green]claude-code[/green] - Claude Code (project-scoped)
|
|
32
|
+
• [green]codex[/green] - OpenAI Codex CLI
|
|
33
|
+
• [green]gemini[/green] - Google Gemini CLI
|
|
34
|
+
|
|
35
|
+
[bold cyan]Quick Start:[/bold cyan]
|
|
36
|
+
1. List tools: [green]mcp-vector-search mcp list[/green]
|
|
37
|
+
2. Configure tool: [green]mcp-vector-search mcp <tool>[/green]
|
|
38
|
+
3. Test setup: [green]mcp-vector-search mcp test[/green]
|
|
39
|
+
|
|
40
|
+
[dim]Use --force to overwrite existing configurations[/dim]
|
|
41
|
+
"""
|
|
42
|
+
)
|
|
22
43
|
|
|
23
44
|
console = Console()
|
|
24
45
|
|
|
46
|
+
# Supported AI tools and their configuration details
|
|
47
|
+
SUPPORTED_TOOLS = {
|
|
48
|
+
"auggie": {
|
|
49
|
+
"name": "Auggie",
|
|
50
|
+
"config_path": "~/.augment/settings.json",
|
|
51
|
+
"format": "json",
|
|
52
|
+
"description": "Augment Code AI assistant",
|
|
53
|
+
},
|
|
54
|
+
"claude-code": {
|
|
55
|
+
"name": "Claude Code",
|
|
56
|
+
"config_path": ".mcp.json",
|
|
57
|
+
"format": "json",
|
|
58
|
+
"description": "Claude Code (project-scoped)",
|
|
59
|
+
},
|
|
60
|
+
"codex": {
|
|
61
|
+
"name": "Codex",
|
|
62
|
+
"config_path": "~/.codex/config.toml",
|
|
63
|
+
"format": "toml",
|
|
64
|
+
"description": "OpenAI Codex CLI",
|
|
65
|
+
},
|
|
66
|
+
"gemini": {
|
|
67
|
+
"name": "Gemini",
|
|
68
|
+
"config_path": "~/.gemini/mcp.json",
|
|
69
|
+
"format": "json",
|
|
70
|
+
"description": "Google Gemini CLI",
|
|
71
|
+
},
|
|
72
|
+
}
|
|
73
|
+
|
|
25
74
|
|
|
26
75
|
def get_claude_command() -> str | None:
|
|
27
76
|
"""Get the Claude Code command path."""
|
|
@@ -74,6 +123,42 @@ def get_mcp_server_command(
|
|
|
74
123
|
return f"{python_exe} -m mcp_vector_search.mcp.server{watch_flag} {project_root}"
|
|
75
124
|
|
|
76
125
|
|
|
126
|
+
def get_mcp_server_config_for_tool(
|
|
127
|
+
project_root: Path,
|
|
128
|
+
tool_name: str,
|
|
129
|
+
server_name: str,
|
|
130
|
+
enable_file_watching: bool = True,
|
|
131
|
+
) -> dict[str, Any]:
|
|
132
|
+
"""Generate MCP server configuration for a specific tool."""
|
|
133
|
+
base_config = {
|
|
134
|
+
"command": "uv",
|
|
135
|
+
"args": ["run", "mcp-vector-search", "mcp"],
|
|
136
|
+
"env": {
|
|
137
|
+
"MCP_ENABLE_FILE_WATCHING": "true" if enable_file_watching else "false"
|
|
138
|
+
},
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if tool_name == "auggie":
|
|
142
|
+
# Auggie uses stdio transport
|
|
143
|
+
return base_config
|
|
144
|
+
elif tool_name == "claude-code":
|
|
145
|
+
# Claude Code requires type: stdio and no cwd
|
|
146
|
+
return {"type": "stdio", **base_config}
|
|
147
|
+
elif tool_name == "codex":
|
|
148
|
+
# Codex uses TOML format with different structure
|
|
149
|
+
return {
|
|
150
|
+
"command": base_config["command"],
|
|
151
|
+
"args": base_config["args"],
|
|
152
|
+
"env": base_config["env"],
|
|
153
|
+
}
|
|
154
|
+
elif tool_name == "gemini":
|
|
155
|
+
# Gemini uses standard format with cwd
|
|
156
|
+
return {**base_config, "cwd": str(project_root.absolute())}
|
|
157
|
+
else:
|
|
158
|
+
# Default configuration
|
|
159
|
+
return {**base_config, "cwd": str(project_root.absolute())}
|
|
160
|
+
|
|
161
|
+
|
|
77
162
|
def create_project_claude_config(
|
|
78
163
|
project_root: Path, server_name: str, enable_file_watching: bool = True
|
|
79
164
|
) -> None:
|
|
@@ -119,9 +204,254 @@ def create_project_claude_config(
|
|
|
119
204
|
print_info("File watching is disabled")
|
|
120
205
|
|
|
121
206
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
207
|
+
def configure_tool_mcp(
|
|
208
|
+
tool_name: str,
|
|
209
|
+
project_root: Path,
|
|
210
|
+
server_name: str = "mcp-vector-search",
|
|
211
|
+
enable_file_watching: bool = True,
|
|
212
|
+
force: bool = False,
|
|
213
|
+
) -> bool:
|
|
214
|
+
"""Configure MCP integration for a specific AI tool."""
|
|
215
|
+
if tool_name not in SUPPORTED_TOOLS:
|
|
216
|
+
print_error(f"Unsupported tool: {tool_name}")
|
|
217
|
+
print_info(f"Supported tools: {', '.join(SUPPORTED_TOOLS.keys())}")
|
|
218
|
+
return False
|
|
219
|
+
|
|
220
|
+
tool_info = SUPPORTED_TOOLS[tool_name]
|
|
221
|
+
config_path_str = tool_info["config_path"]
|
|
222
|
+
|
|
223
|
+
# Handle path expansion
|
|
224
|
+
if config_path_str.startswith("~/"):
|
|
225
|
+
config_path = Path.home() / config_path_str[2:]
|
|
226
|
+
elif config_path_str.startswith("."):
|
|
227
|
+
config_path = project_root / config_path_str
|
|
228
|
+
else:
|
|
229
|
+
config_path = Path(config_path_str)
|
|
230
|
+
|
|
231
|
+
try:
|
|
232
|
+
if tool_name == "auggie":
|
|
233
|
+
return configure_auggie_mcp(
|
|
234
|
+
config_path, project_root, server_name, enable_file_watching, force
|
|
235
|
+
)
|
|
236
|
+
elif tool_name == "claude-code":
|
|
237
|
+
return configure_claude_code_mcp(
|
|
238
|
+
config_path, project_root, server_name, enable_file_watching, force
|
|
239
|
+
)
|
|
240
|
+
elif tool_name == "codex":
|
|
241
|
+
return configure_codex_mcp(
|
|
242
|
+
config_path, project_root, server_name, enable_file_watching, force
|
|
243
|
+
)
|
|
244
|
+
elif tool_name == "gemini":
|
|
245
|
+
return configure_gemini_mcp(
|
|
246
|
+
config_path, project_root, server_name, enable_file_watching, force
|
|
247
|
+
)
|
|
248
|
+
else:
|
|
249
|
+
print_error(f"Configuration for {tool_name} not implemented yet")
|
|
250
|
+
return False
|
|
251
|
+
except Exception as e:
|
|
252
|
+
print_error(f"Failed to configure {tool_name}: {e}")
|
|
253
|
+
return False
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
def configure_auggie_mcp(
|
|
257
|
+
config_path: Path,
|
|
258
|
+
project_root: Path,
|
|
259
|
+
server_name: str,
|
|
260
|
+
enable_file_watching: bool,
|
|
261
|
+
force: bool,
|
|
262
|
+
) -> bool:
|
|
263
|
+
"""Configure Auggie MCP integration."""
|
|
264
|
+
# Create backup if file exists
|
|
265
|
+
backup_path = config_path.with_suffix(config_path.suffix + ".backup")
|
|
266
|
+
|
|
267
|
+
# Load existing config or create new one
|
|
268
|
+
if config_path.exists():
|
|
269
|
+
if not force:
|
|
270
|
+
with open(config_path) as f:
|
|
271
|
+
config = json.load(f)
|
|
272
|
+
if config.get("mcpServers", {}).get(server_name):
|
|
273
|
+
print_warning(
|
|
274
|
+
f"MCP server '{server_name}' already exists in Auggie config"
|
|
275
|
+
)
|
|
276
|
+
print_info("Use --force to overwrite")
|
|
277
|
+
return False
|
|
278
|
+
shutil.copy2(config_path, backup_path)
|
|
279
|
+
with open(config_path) as f:
|
|
280
|
+
config = json.load(f)
|
|
281
|
+
else:
|
|
282
|
+
config_path.parent.mkdir(parents=True, exist_ok=True)
|
|
283
|
+
config = {}
|
|
284
|
+
|
|
285
|
+
# Ensure mcpServers section exists
|
|
286
|
+
if "mcpServers" not in config:
|
|
287
|
+
config["mcpServers"] = {}
|
|
288
|
+
|
|
289
|
+
# Get server configuration
|
|
290
|
+
server_config = get_mcp_server_config_for_tool(
|
|
291
|
+
project_root, "auggie", server_name, enable_file_watching
|
|
292
|
+
)
|
|
293
|
+
config["mcpServers"][server_name] = server_config
|
|
294
|
+
|
|
295
|
+
# Write updated config
|
|
296
|
+
with open(config_path, "w") as f:
|
|
297
|
+
json.dump(config, f, indent=2)
|
|
298
|
+
|
|
299
|
+
print_success(f"✅ Configured Auggie at {config_path}")
|
|
300
|
+
return True
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
def configure_claude_code_mcp(
|
|
304
|
+
config_path: Path,
|
|
305
|
+
project_root: Path,
|
|
306
|
+
server_name: str,
|
|
307
|
+
enable_file_watching: bool,
|
|
308
|
+
force: bool,
|
|
309
|
+
) -> bool:
|
|
310
|
+
"""Configure Claude Code MCP integration."""
|
|
311
|
+
# Use existing function for Claude Code
|
|
312
|
+
if config_path.exists() and not force:
|
|
313
|
+
with open(config_path) as f:
|
|
314
|
+
config = json.load(f)
|
|
315
|
+
if config.get("mcpServers", {}).get(server_name):
|
|
316
|
+
print_warning(
|
|
317
|
+
f"MCP server '{server_name}' already exists in Claude Code config"
|
|
318
|
+
)
|
|
319
|
+
print_info("Use --force to overwrite")
|
|
320
|
+
return False
|
|
321
|
+
|
|
322
|
+
create_project_claude_config(project_root, server_name, enable_file_watching)
|
|
323
|
+
print_success(f"✅ Configured Claude Code at {config_path}")
|
|
324
|
+
return True
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
def configure_codex_mcp(
|
|
328
|
+
config_path: Path,
|
|
329
|
+
project_root: Path,
|
|
330
|
+
server_name: str,
|
|
331
|
+
enable_file_watching: bool,
|
|
332
|
+
force: bool,
|
|
333
|
+
) -> bool:
|
|
334
|
+
"""Configure Codex MCP integration."""
|
|
335
|
+
# Create backup if file exists
|
|
336
|
+
backup_path = config_path.with_suffix(config_path.suffix + ".backup")
|
|
337
|
+
|
|
338
|
+
# Load existing config or create new one
|
|
339
|
+
if config_path.exists():
|
|
340
|
+
if not force:
|
|
341
|
+
try:
|
|
342
|
+
with open(config_path, "rb") as f:
|
|
343
|
+
config = tomllib.load(f)
|
|
344
|
+
if config.get("mcp_servers", {}).get(server_name):
|
|
345
|
+
print_warning(
|
|
346
|
+
f"MCP server '{server_name}' already exists in Codex config"
|
|
347
|
+
)
|
|
348
|
+
print_info("Use --force to overwrite")
|
|
349
|
+
return False
|
|
350
|
+
except Exception as e:
|
|
351
|
+
print_warning(f"Could not parse existing Codex config: {e}")
|
|
352
|
+
|
|
353
|
+
shutil.copy2(config_path, backup_path)
|
|
354
|
+
# Read as text to preserve existing content
|
|
355
|
+
with open(config_path) as f:
|
|
356
|
+
config_text = f.read()
|
|
357
|
+
else:
|
|
358
|
+
config_path.parent.mkdir(parents=True, exist_ok=True)
|
|
359
|
+
config_text = ""
|
|
360
|
+
|
|
361
|
+
# Get server configuration
|
|
362
|
+
server_config = get_mcp_server_config_for_tool(
|
|
363
|
+
project_root, "codex", server_name, enable_file_watching
|
|
364
|
+
)
|
|
365
|
+
|
|
366
|
+
# Generate TOML section for the server
|
|
367
|
+
toml_section = f"\n[mcp_servers.{server_name}]\n"
|
|
368
|
+
toml_section += f'command = "{server_config["command"]}"\n'
|
|
369
|
+
toml_section += f"args = {server_config['args']}\n"
|
|
370
|
+
|
|
371
|
+
if server_config.get("env"):
|
|
372
|
+
toml_section += f"\n[mcp_servers.{server_name}.env]\n"
|
|
373
|
+
for key, value in server_config["env"].items():
|
|
374
|
+
toml_section += f'{key} = "{value}"\n'
|
|
375
|
+
|
|
376
|
+
# Append or replace the section
|
|
377
|
+
if f"[mcp_servers.{server_name}]" in config_text:
|
|
378
|
+
# Replace existing section (simple approach)
|
|
379
|
+
lines = config_text.split("\n")
|
|
380
|
+
new_lines = []
|
|
381
|
+
skip_section = False
|
|
382
|
+
|
|
383
|
+
for line in lines:
|
|
384
|
+
if line.strip() == f"[mcp_servers.{server_name}]":
|
|
385
|
+
skip_section = True
|
|
386
|
+
continue
|
|
387
|
+
elif line.strip().startswith("[") and skip_section:
|
|
388
|
+
skip_section = False
|
|
389
|
+
new_lines.append(line)
|
|
390
|
+
elif not skip_section:
|
|
391
|
+
new_lines.append(line)
|
|
392
|
+
|
|
393
|
+
config_text = "\n".join(new_lines) + toml_section
|
|
394
|
+
else:
|
|
395
|
+
config_text += toml_section
|
|
396
|
+
|
|
397
|
+
# Write updated config
|
|
398
|
+
with open(config_path, "w") as f:
|
|
399
|
+
f.write(config_text)
|
|
400
|
+
|
|
401
|
+
print_success(f"✅ Configured Codex at {config_path}")
|
|
402
|
+
return True
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
def configure_gemini_mcp(
|
|
406
|
+
config_path: Path,
|
|
407
|
+
project_root: Path,
|
|
408
|
+
server_name: str,
|
|
409
|
+
enable_file_watching: bool,
|
|
410
|
+
force: bool,
|
|
411
|
+
) -> bool:
|
|
412
|
+
"""Configure Gemini MCP integration."""
|
|
413
|
+
# Create backup if file exists
|
|
414
|
+
backup_path = config_path.with_suffix(config_path.suffix + ".backup")
|
|
415
|
+
|
|
416
|
+
# Load existing config or create new one
|
|
417
|
+
if config_path.exists():
|
|
418
|
+
if not force:
|
|
419
|
+
with open(config_path) as f:
|
|
420
|
+
config = json.load(f)
|
|
421
|
+
if config.get("mcpServers", {}).get(server_name):
|
|
422
|
+
print_warning(
|
|
423
|
+
f"MCP server '{server_name}' already exists in Gemini config"
|
|
424
|
+
)
|
|
425
|
+
print_info("Use --force to overwrite")
|
|
426
|
+
return False
|
|
427
|
+
shutil.copy2(config_path, backup_path)
|
|
428
|
+
with open(config_path) as f:
|
|
429
|
+
config = json.load(f)
|
|
430
|
+
else:
|
|
431
|
+
config_path.parent.mkdir(parents=True, exist_ok=True)
|
|
432
|
+
config = {}
|
|
433
|
+
|
|
434
|
+
# Ensure mcpServers section exists
|
|
435
|
+
if "mcpServers" not in config:
|
|
436
|
+
config["mcpServers"] = {}
|
|
437
|
+
|
|
438
|
+
# Get server configuration
|
|
439
|
+
server_config = get_mcp_server_config_for_tool(
|
|
440
|
+
project_root, "gemini", server_name, enable_file_watching
|
|
441
|
+
)
|
|
442
|
+
config["mcpServers"][server_name] = server_config
|
|
443
|
+
|
|
444
|
+
# Write updated config
|
|
445
|
+
with open(config_path, "w") as f:
|
|
446
|
+
json.dump(config, f, indent=2)
|
|
447
|
+
|
|
448
|
+
print_success(f"✅ Configured Gemini at {config_path}")
|
|
449
|
+
return True
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
# Tool-specific commands
|
|
453
|
+
@mcp_app.command("auggie")
|
|
454
|
+
def configure_auggie(
|
|
125
455
|
ctx: typer.Context,
|
|
126
456
|
server_name: str = typer.Option(
|
|
127
457
|
"mcp-vector-search",
|
|
@@ -143,59 +473,298 @@ def install_mcp_integration(
|
|
|
143
473
|
rich_help_panel="⚙️ Advanced Options",
|
|
144
474
|
),
|
|
145
475
|
) -> None:
|
|
146
|
-
"""
|
|
476
|
+
"""🤖 Configure MCP integration for Auggie AI.
|
|
147
477
|
|
|
148
|
-
|
|
149
|
-
|
|
478
|
+
Sets up mcp-vector-search as an MCP server for Auggie AI assistant.
|
|
479
|
+
Configuration is stored in ~/.augment/settings.json.
|
|
150
480
|
|
|
151
|
-
[bold cyan]
|
|
481
|
+
[bold cyan]Examples:[/bold cyan]
|
|
152
482
|
|
|
153
|
-
[green]
|
|
154
|
-
$ mcp-vector-search mcp
|
|
483
|
+
[green]Configure with defaults:[/green]
|
|
484
|
+
$ mcp-vector-search mcp auggie
|
|
155
485
|
|
|
156
|
-
[green]
|
|
157
|
-
$ mcp-vector-search mcp
|
|
486
|
+
[green]Force overwrite existing config:[/green]
|
|
487
|
+
$ mcp-vector-search mcp auggie --force
|
|
158
488
|
|
|
159
|
-
[green]
|
|
160
|
-
$ mcp-vector-search mcp
|
|
489
|
+
[green]Disable file watching:[/green]
|
|
490
|
+
$ mcp-vector-search mcp auggie --no-watch
|
|
491
|
+
"""
|
|
492
|
+
try:
|
|
493
|
+
project_root = ctx.obj.get("project_root") or Path.cwd()
|
|
494
|
+
project_manager = ProjectManager(project_root)
|
|
495
|
+
if not project_manager.is_initialized():
|
|
496
|
+
print_error("Project not initialized. Run 'mcp-vector-search init' first.")
|
|
497
|
+
raise typer.Exit(1)
|
|
161
498
|
|
|
162
|
-
|
|
499
|
+
enable_file_watching = not no_watch
|
|
500
|
+
success = configure_tool_mcp(
|
|
501
|
+
"auggie", project_root, server_name, enable_file_watching, force
|
|
502
|
+
)
|
|
163
503
|
|
|
164
|
-
|
|
165
|
-
|
|
504
|
+
if success:
|
|
505
|
+
print_info("Auggie will automatically detect the server when restarted")
|
|
506
|
+
else:
|
|
507
|
+
raise typer.Exit(1)
|
|
508
|
+
|
|
509
|
+
except Exception as e:
|
|
510
|
+
print_error(f"Configuration failed: {e}")
|
|
511
|
+
raise typer.Exit(1)
|
|
166
512
|
|
|
167
|
-
|
|
168
|
-
|
|
513
|
+
|
|
514
|
+
@mcp_app.command("claude-code")
|
|
515
|
+
def configure_claude_code(
|
|
516
|
+
ctx: typer.Context,
|
|
517
|
+
server_name: str = typer.Option(
|
|
518
|
+
"mcp-vector-search",
|
|
519
|
+
"--name",
|
|
520
|
+
help="Name for the MCP server",
|
|
521
|
+
rich_help_panel="📁 Configuration",
|
|
522
|
+
),
|
|
523
|
+
force: bool = typer.Option(
|
|
524
|
+
False,
|
|
525
|
+
"--force",
|
|
526
|
+
"-f",
|
|
527
|
+
help="Force installation even if server already exists",
|
|
528
|
+
rich_help_panel="⚙️ Advanced Options",
|
|
529
|
+
),
|
|
530
|
+
no_watch: bool = typer.Option(
|
|
531
|
+
False,
|
|
532
|
+
"--no-watch",
|
|
533
|
+
help="Disable file watching for automatic reindexing",
|
|
534
|
+
rich_help_panel="⚙️ Advanced Options",
|
|
535
|
+
),
|
|
536
|
+
) -> None:
|
|
537
|
+
"""🤖 Configure MCP integration for Claude Code.
|
|
538
|
+
|
|
539
|
+
Creates .mcp.json to enable semantic code search in Claude Code.
|
|
540
|
+
Configuration is project-scoped for team sharing.
|
|
541
|
+
|
|
542
|
+
[bold cyan]Examples:[/bold cyan]
|
|
543
|
+
|
|
544
|
+
[green]Configure with defaults:[/green]
|
|
545
|
+
$ mcp-vector-search mcp claude-code
|
|
546
|
+
|
|
547
|
+
[green]Force overwrite existing config:[/green]
|
|
548
|
+
$ mcp-vector-search mcp claude-code --force
|
|
549
|
+
|
|
550
|
+
[green]Disable file watching:[/green]
|
|
551
|
+
$ mcp-vector-search mcp claude-code --no-watch
|
|
169
552
|
"""
|
|
170
553
|
try:
|
|
171
|
-
# Get project root for checking initialization
|
|
172
554
|
project_root = ctx.obj.get("project_root") or Path.cwd()
|
|
555
|
+
project_manager = ProjectManager(project_root)
|
|
556
|
+
if not project_manager.is_initialized():
|
|
557
|
+
print_error("Project not initialized. Run 'mcp-vector-search init' first.")
|
|
558
|
+
raise typer.Exit(1)
|
|
559
|
+
|
|
560
|
+
enable_file_watching = not no_watch
|
|
561
|
+
success = configure_tool_mcp(
|
|
562
|
+
"claude-code", project_root, server_name, enable_file_watching, force
|
|
563
|
+
)
|
|
564
|
+
|
|
565
|
+
if success:
|
|
566
|
+
print_info(
|
|
567
|
+
"Claude Code will automatically detect the server when you open this project"
|
|
568
|
+
)
|
|
569
|
+
else:
|
|
570
|
+
raise typer.Exit(1)
|
|
571
|
+
|
|
572
|
+
except Exception as e:
|
|
573
|
+
print_error(f"Configuration failed: {e}")
|
|
574
|
+
raise typer.Exit(1)
|
|
575
|
+
|
|
173
576
|
|
|
174
|
-
|
|
577
|
+
@mcp_app.command("codex")
|
|
578
|
+
def configure_codex(
|
|
579
|
+
ctx: typer.Context,
|
|
580
|
+
server_name: str = typer.Option(
|
|
581
|
+
"mcp-vector-search",
|
|
582
|
+
"--name",
|
|
583
|
+
help="Name for the MCP server",
|
|
584
|
+
rich_help_panel="📁 Configuration",
|
|
585
|
+
),
|
|
586
|
+
force: bool = typer.Option(
|
|
587
|
+
False,
|
|
588
|
+
"--force",
|
|
589
|
+
"-f",
|
|
590
|
+
help="Force installation even if server already exists",
|
|
591
|
+
rich_help_panel="⚙️ Advanced Options",
|
|
592
|
+
),
|
|
593
|
+
no_watch: bool = typer.Option(
|
|
594
|
+
False,
|
|
595
|
+
"--no-watch",
|
|
596
|
+
help="Disable file watching for automatic reindexing",
|
|
597
|
+
rich_help_panel="⚙️ Advanced Options",
|
|
598
|
+
),
|
|
599
|
+
) -> None:
|
|
600
|
+
"""🤖 Configure MCP integration for OpenAI Codex.
|
|
601
|
+
|
|
602
|
+
Sets up mcp-vector-search as an MCP server for OpenAI Codex CLI.
|
|
603
|
+
Configuration is stored in ~/.codex/config.toml.
|
|
604
|
+
|
|
605
|
+
[bold cyan]Examples:[/bold cyan]
|
|
606
|
+
|
|
607
|
+
[green]Configure with defaults:[/green]
|
|
608
|
+
$ mcp-vector-search mcp codex
|
|
609
|
+
|
|
610
|
+
[green]Force overwrite existing config:[/green]
|
|
611
|
+
$ mcp-vector-search mcp codex --force
|
|
612
|
+
|
|
613
|
+
[green]Disable file watching:[/green]
|
|
614
|
+
$ mcp-vector-search mcp codex --no-watch
|
|
615
|
+
"""
|
|
616
|
+
try:
|
|
617
|
+
project_root = ctx.obj.get("project_root") or Path.cwd()
|
|
175
618
|
project_manager = ProjectManager(project_root)
|
|
176
619
|
if not project_manager.is_initialized():
|
|
177
620
|
print_error("Project not initialized. Run 'mcp-vector-search init' first.")
|
|
178
621
|
raise typer.Exit(1)
|
|
179
622
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
623
|
+
enable_file_watching = not no_watch
|
|
624
|
+
success = configure_tool_mcp(
|
|
625
|
+
"codex", project_root, server_name, enable_file_watching, force
|
|
626
|
+
)
|
|
627
|
+
|
|
628
|
+
if success:
|
|
629
|
+
print_info("Codex will automatically detect the server when restarted")
|
|
630
|
+
else:
|
|
631
|
+
raise typer.Exit(1)
|
|
632
|
+
|
|
633
|
+
except Exception as e:
|
|
634
|
+
print_error(f"Configuration failed: {e}")
|
|
635
|
+
raise typer.Exit(1)
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
@mcp_app.command("gemini")
|
|
639
|
+
def configure_gemini(
|
|
640
|
+
ctx: typer.Context,
|
|
641
|
+
server_name: str = typer.Option(
|
|
642
|
+
"mcp-vector-search",
|
|
643
|
+
"--name",
|
|
644
|
+
help="Name for the MCP server",
|
|
645
|
+
rich_help_panel="📁 Configuration",
|
|
646
|
+
),
|
|
647
|
+
force: bool = typer.Option(
|
|
648
|
+
False,
|
|
649
|
+
"--force",
|
|
650
|
+
"-f",
|
|
651
|
+
help="Force installation even if server already exists",
|
|
652
|
+
rich_help_panel="⚙️ Advanced Options",
|
|
653
|
+
),
|
|
654
|
+
no_watch: bool = typer.Option(
|
|
655
|
+
False,
|
|
656
|
+
"--no-watch",
|
|
657
|
+
help="Disable file watching for automatic reindexing",
|
|
658
|
+
rich_help_panel="⚙️ Advanced Options",
|
|
659
|
+
),
|
|
660
|
+
) -> None:
|
|
661
|
+
"""🤖 Configure MCP integration for Google Gemini.
|
|
662
|
+
|
|
663
|
+
Sets up mcp-vector-search as an MCP server for Google Gemini CLI.
|
|
664
|
+
Configuration is stored in ~/.gemini/mcp.json.
|
|
665
|
+
|
|
666
|
+
[bold cyan]Examples:[/bold cyan]
|
|
667
|
+
|
|
668
|
+
[green]Configure with defaults:[/green]
|
|
669
|
+
$ mcp-vector-search mcp gemini
|
|
670
|
+
|
|
671
|
+
[green]Force overwrite existing config:[/green]
|
|
672
|
+
$ mcp-vector-search mcp gemini --force
|
|
673
|
+
|
|
674
|
+
[green]Disable file watching:[/green]
|
|
675
|
+
$ mcp-vector-search mcp gemini --no-watch
|
|
676
|
+
"""
|
|
677
|
+
try:
|
|
678
|
+
project_root = ctx.obj.get("project_root") or Path.cwd()
|
|
679
|
+
project_manager = ProjectManager(project_root)
|
|
680
|
+
if not project_manager.is_initialized():
|
|
681
|
+
print_error("Project not initialized. Run 'mcp-vector-search init' first.")
|
|
682
|
+
raise typer.Exit(1)
|
|
189
683
|
|
|
190
|
-
# Create configuration in project root
|
|
191
684
|
enable_file_watching = not no_watch
|
|
192
|
-
|
|
685
|
+
success = configure_tool_mcp(
|
|
686
|
+
"gemini", project_root, server_name, enable_file_watching, force
|
|
687
|
+
)
|
|
193
688
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
689
|
+
if success:
|
|
690
|
+
print_info("Gemini will automatically detect the server when restarted")
|
|
691
|
+
else:
|
|
692
|
+
raise typer.Exit(1)
|
|
693
|
+
|
|
694
|
+
except Exception as e:
|
|
695
|
+
print_error(f"Configuration failed: {e}")
|
|
696
|
+
raise typer.Exit(1)
|
|
697
|
+
|
|
698
|
+
|
|
699
|
+
# Legacy install command (deprecated)
|
|
700
|
+
@mcp_app.command("install", hidden=True)
|
|
701
|
+
@mcp_app.command("init", hidden=True) # Add 'init' as an alias
|
|
702
|
+
def install_mcp_integration(
|
|
703
|
+
ctx: typer.Context,
|
|
704
|
+
server_name: str = typer.Option(
|
|
705
|
+
"mcp-vector-search",
|
|
706
|
+
"--name",
|
|
707
|
+
help="Name for the MCP server",
|
|
708
|
+
rich_help_panel="📁 Configuration",
|
|
709
|
+
),
|
|
710
|
+
force: bool = typer.Option(
|
|
711
|
+
False,
|
|
712
|
+
"--force",
|
|
713
|
+
"-f",
|
|
714
|
+
help="Force installation even if server already exists",
|
|
715
|
+
rich_help_panel="⚙️ Advanced Options",
|
|
716
|
+
),
|
|
717
|
+
no_watch: bool = typer.Option(
|
|
718
|
+
False,
|
|
719
|
+
"--no-watch",
|
|
720
|
+
help="Disable file watching for automatic reindexing",
|
|
721
|
+
rich_help_panel="⚙️ Advanced Options",
|
|
722
|
+
),
|
|
723
|
+
) -> None:
|
|
724
|
+
"""[DEPRECATED] Use tool-specific commands instead.
|
|
725
|
+
|
|
726
|
+
This command is deprecated. Use the tool-specific commands instead:
|
|
727
|
+
|
|
728
|
+
[bold cyan]New Commands:[/bold cyan]
|
|
729
|
+
|
|
730
|
+
[green]For Auggie:[/green]
|
|
731
|
+
$ mcp-vector-search mcp auggie
|
|
732
|
+
|
|
733
|
+
[green]For Claude Code:[/green]
|
|
734
|
+
$ mcp-vector-search mcp claude-code
|
|
735
|
+
|
|
736
|
+
[green]For Codex:[/green]
|
|
737
|
+
$ mcp-vector-search mcp codex
|
|
738
|
+
|
|
739
|
+
[green]For Gemini:[/green]
|
|
740
|
+
$ mcp-vector-search mcp gemini
|
|
741
|
+
"""
|
|
742
|
+
print_warning("⚠️ The 'mcp install' command is deprecated.")
|
|
743
|
+
print_info("Use tool-specific commands instead:")
|
|
744
|
+
print_info(" • mcp-vector-search mcp auggie")
|
|
745
|
+
print_info(" • mcp-vector-search mcp claude-code")
|
|
746
|
+
print_info(" • mcp-vector-search mcp codex")
|
|
747
|
+
print_info(" • mcp-vector-search mcp gemini")
|
|
748
|
+
print_info("")
|
|
749
|
+
print_info("Defaulting to Claude Code configuration...")
|
|
750
|
+
|
|
751
|
+
try:
|
|
752
|
+
project_root = ctx.obj.get("project_root") or Path.cwd()
|
|
753
|
+
project_manager = ProjectManager(project_root)
|
|
754
|
+
if not project_manager.is_initialized():
|
|
755
|
+
print_error("Project not initialized. Run 'mcp-vector-search init' first.")
|
|
756
|
+
raise typer.Exit(1)
|
|
757
|
+
|
|
758
|
+
enable_file_watching = not no_watch
|
|
759
|
+
success = configure_tool_mcp(
|
|
760
|
+
"claude-code", project_root, server_name, enable_file_watching, force
|
|
197
761
|
)
|
|
198
762
|
|
|
763
|
+
if success:
|
|
764
|
+
print_info(
|
|
765
|
+
"Claude Code will automatically detect the server when you open this project"
|
|
766
|
+
)
|
|
767
|
+
|
|
199
768
|
# Test the server (using project_root for the server command)
|
|
200
769
|
print_info("Testing server startup...")
|
|
201
770
|
|
|
@@ -277,6 +846,74 @@ def install_mcp_integration(
|
|
|
277
846
|
raise typer.Exit(1)
|
|
278
847
|
|
|
279
848
|
|
|
849
|
+
@mcp_app.command("list")
|
|
850
|
+
def list_tools() -> None:
|
|
851
|
+
"""📋 List supported AI tools and their configuration status.
|
|
852
|
+
|
|
853
|
+
Shows all supported AI tools, their configuration paths, and whether
|
|
854
|
+
they are currently configured with mcp-vector-search.
|
|
855
|
+
|
|
856
|
+
[bold cyan]Examples:[/bold cyan]
|
|
857
|
+
|
|
858
|
+
[green]List all tools:[/green]
|
|
859
|
+
$ mcp-vector-search mcp list
|
|
860
|
+
"""
|
|
861
|
+
console.print("\n[bold blue]🤖 Supported AI Tools[/bold blue]\n")
|
|
862
|
+
|
|
863
|
+
table = Table(show_header=True, header_style="bold magenta")
|
|
864
|
+
table.add_column("Tool", style="cyan", no_wrap=True)
|
|
865
|
+
table.add_column("Name", style="white")
|
|
866
|
+
table.add_column("Config Path", style="dim")
|
|
867
|
+
table.add_column("Status", justify="center")
|
|
868
|
+
|
|
869
|
+
for tool_id, tool_info in SUPPORTED_TOOLS.items():
|
|
870
|
+
config_path_str = tool_info["config_path"]
|
|
871
|
+
|
|
872
|
+
# Handle path expansion
|
|
873
|
+
if config_path_str.startswith("~/"):
|
|
874
|
+
config_path = Path.home() / config_path_str[2:]
|
|
875
|
+
elif config_path_str.startswith("."):
|
|
876
|
+
config_path = Path.cwd() / config_path_str
|
|
877
|
+
else:
|
|
878
|
+
config_path = Path(config_path_str)
|
|
879
|
+
|
|
880
|
+
# Check if configured
|
|
881
|
+
status = "❌ Not configured"
|
|
882
|
+
try:
|
|
883
|
+
if config_path.exists():
|
|
884
|
+
if tool_info["format"] == "json":
|
|
885
|
+
with open(config_path) as f:
|
|
886
|
+
config = json.load(f)
|
|
887
|
+
if config.get("mcpServers", {}).get("mcp-vector-search"):
|
|
888
|
+
status = "✅ Configured"
|
|
889
|
+
else:
|
|
890
|
+
status = "⚠️ Config exists"
|
|
891
|
+
elif tool_info["format"] == "toml":
|
|
892
|
+
with open(config_path, "rb") as f:
|
|
893
|
+
config = tomllib.load(f)
|
|
894
|
+
if config.get("mcp_servers", {}).get("mcp-vector-search"):
|
|
895
|
+
status = "✅ Configured"
|
|
896
|
+
else:
|
|
897
|
+
status = "⚠️ Config exists"
|
|
898
|
+
else:
|
|
899
|
+
status = "❌ No config file"
|
|
900
|
+
except Exception:
|
|
901
|
+
status = "❓ Unknown"
|
|
902
|
+
|
|
903
|
+
table.add_row(tool_id, tool_info["name"], str(config_path), status)
|
|
904
|
+
|
|
905
|
+
console.print(table)
|
|
906
|
+
console.print(
|
|
907
|
+
"\n[dim]💡 Use 'mcp-vector-search mcp <tool>' to configure a specific tool[/dim]"
|
|
908
|
+
)
|
|
909
|
+
|
|
910
|
+
|
|
911
|
+
@mcp_app.command("tools")
|
|
912
|
+
def list_tools_alias() -> None:
|
|
913
|
+
"""📋 Alias for 'list' command."""
|
|
914
|
+
list_tools()
|
|
915
|
+
|
|
916
|
+
|
|
280
917
|
@mcp_app.command("test")
|
|
281
918
|
def test_mcp_integration(
|
|
282
919
|
ctx: typer.Context,
|