mcp-vector-search 0.9.3__py3-none-any.whl → 0.12.1__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.

@@ -158,11 +158,10 @@ async def show_status(
158
158
  print_info("Run 'mcp-vector-search init' to initialize the project")
159
159
  return
160
160
 
161
- # Get project information
162
- project_info = project_manager.get_project_info()
161
+ # Get configuration first
163
162
  config = project_manager.load_config()
164
163
 
165
- # Get indexing statistics
164
+ # Get indexing statistics from database (fast, no filesystem scan)
166
165
  embedding_function, _ = create_embedding_function(config.embedding_model)
167
166
  database = ChromaVectorDatabase(
168
167
  persist_directory=config.index_path,
@@ -175,10 +174,13 @@ async def show_status(
175
174
  file_extensions=config.file_extensions,
176
175
  )
177
176
 
178
- # Get indexing stats (runs async file scanning in thread pool)
177
+ # Get indexing stats (using database stats only, no filesystem scan)
179
178
  async with database:
180
- index_stats = await indexer.get_indexing_stats()
181
179
  db_stats = await database.get_stats()
180
+ index_stats = await indexer.get_indexing_stats(db_stats=db_stats)
181
+
182
+ # Get project information with pre-computed file count (avoids filesystem scan)
183
+ project_info = project_manager.get_project_info(file_count=db_stats.total_files)
182
184
 
183
185
  # Get version information
184
186
  index_version = indexer.get_index_version()
@@ -0,0 +1,485 @@
1
+ """Uninstall commands for MCP Vector Search CLI.
2
+
3
+ This module provides commands to remove MCP integrations from various platforms.
4
+
5
+ Examples:
6
+ # Remove Claude Code integration
7
+ $ mcp-vector-search uninstall claude-code
8
+
9
+ # Remove all integrations
10
+ $ mcp-vector-search uninstall --all
11
+
12
+ # Use alias
13
+ $ mcp-vector-search remove claude-code
14
+ """
15
+
16
+ import json
17
+ import shutil
18
+ from pathlib import Path
19
+
20
+ import typer
21
+ from loguru import logger
22
+ from rich.console import Console
23
+ from rich.panel import Panel
24
+ from rich.table import Table
25
+
26
+ from ..didyoumean import create_enhanced_typer
27
+ from ..output import (
28
+ confirm_action,
29
+ print_error,
30
+ print_info,
31
+ print_success,
32
+ print_warning,
33
+ )
34
+
35
+ # Create console for rich output
36
+ console = Console()
37
+
38
+ # Create uninstall app with subcommands
39
+ uninstall_app = create_enhanced_typer(
40
+ help="""🗑️ Remove MCP integrations from platforms
41
+
42
+ [bold cyan]Usage Patterns:[/bold cyan]
43
+
44
+ [green]1. Remove Specific Platform[/green]
45
+ Remove MCP integration from a platform:
46
+ [code]$ mcp-vector-search uninstall claude-code[/code]
47
+ [code]$ mcp-vector-search uninstall cursor[/code]
48
+
49
+ [green]2. Remove All Integrations[/green]
50
+ Remove from all configured platforms:
51
+ [code]$ mcp-vector-search uninstall --all[/code]
52
+
53
+ [green]3. List Current Installations[/green]
54
+ See what's currently configured:
55
+ [code]$ mcp-vector-search uninstall list[/code]
56
+
57
+ [bold cyan]Supported Platforms:[/bold cyan]
58
+ • [green]claude-code[/green] - Claude Code (project-scoped .mcp.json)
59
+ • [green]claude-desktop[/green] - Claude Desktop (~/.claude/config.json)
60
+ • [green]cursor[/green] - Cursor IDE (~/.cursor/mcp.json)
61
+ • [green]windsurf[/green] - Windsurf IDE (~/.codeium/windsurf/mcp_config.json)
62
+ • [green]vscode[/green] - VS Code (~/.vscode/mcp.json)
63
+
64
+ [dim]💡 Alias: 'mcp-vector-search remove' works the same way[/dim]
65
+ """,
66
+ invoke_without_command=True,
67
+ no_args_is_help=True,
68
+ )
69
+
70
+
71
+ # ==============================================================================
72
+ # Platform Configuration (shared with install.py)
73
+ # ==============================================================================
74
+
75
+ SUPPORTED_PLATFORMS = {
76
+ "claude-code": {
77
+ "name": "Claude Code",
78
+ "config_path": ".mcp.json",
79
+ "scope": "project",
80
+ },
81
+ "claude-desktop": {
82
+ "name": "Claude Desktop",
83
+ "config_path": "~/Library/Application Support/Claude/claude_desktop_config.json",
84
+ "scope": "global",
85
+ },
86
+ "cursor": {
87
+ "name": "Cursor",
88
+ "config_path": "~/.cursor/mcp.json",
89
+ "scope": "global",
90
+ },
91
+ "windsurf": {
92
+ "name": "Windsurf",
93
+ "config_path": "~/.codeium/windsurf/mcp_config.json",
94
+ "scope": "global",
95
+ },
96
+ "vscode": {
97
+ "name": "VS Code",
98
+ "config_path": "~/.vscode/mcp.json",
99
+ "scope": "global",
100
+ },
101
+ }
102
+
103
+
104
+ def get_platform_config_path(platform: str, project_root: Path) -> Path:
105
+ """Get the configuration file path for a platform."""
106
+ if platform not in SUPPORTED_PLATFORMS:
107
+ raise ValueError(f"Unsupported platform: {platform}")
108
+
109
+ config_info = SUPPORTED_PLATFORMS[platform]
110
+ config_path_str = config_info["config_path"]
111
+
112
+ if config_info["scope"] == "project":
113
+ return project_root / config_path_str
114
+ else:
115
+ return Path(config_path_str).expanduser()
116
+
117
+
118
+ def unconfigure_platform(
119
+ platform: str,
120
+ project_root: Path,
121
+ server_name: str = "mcp-vector-search",
122
+ backup: bool = True,
123
+ ) -> bool:
124
+ """Remove MCP integration from a platform's configuration.
125
+
126
+ Args:
127
+ platform: Platform name (e.g., "claude-code", "cursor")
128
+ project_root: Project root directory
129
+ server_name: Name of the MCP server to remove
130
+ backup: Whether to create a backup before modification
131
+
132
+ Returns:
133
+ True if removal was successful, False otherwise
134
+ """
135
+ try:
136
+ config_path = get_platform_config_path(platform, project_root)
137
+
138
+ # Check if config file exists
139
+ if not config_path.exists():
140
+ print_warning(f" ⚠️ No configuration file found for {platform}")
141
+ return False
142
+
143
+ # Create backup
144
+ if backup:
145
+ backup_path = config_path.with_suffix(config_path.suffix + ".backup")
146
+ shutil.copy2(config_path, backup_path)
147
+
148
+ # Load config
149
+ with open(config_path) as f:
150
+ config = json.load(f)
151
+
152
+ # Check if server exists
153
+ if "mcpServers" not in config or server_name not in config["mcpServers"]:
154
+ print_warning(f" ⚠️ Server '{server_name}' not found in {platform} config")
155
+ return False
156
+
157
+ # Remove server
158
+ del config["mcpServers"][server_name]
159
+
160
+ # Clean up empty mcpServers section
161
+ if not config["mcpServers"]:
162
+ del config["mcpServers"]
163
+
164
+ # Write updated config (or remove file if empty)
165
+ if config:
166
+ with open(config_path, "w") as f:
167
+ json.dump(config, f, indent=2)
168
+ else:
169
+ # If config is now empty, remove the file for project-scoped configs
170
+ if SUPPORTED_PLATFORMS[platform]["scope"] == "project":
171
+ config_path.unlink()
172
+ print_info(f" Removed empty config file: {config_path}")
173
+
174
+ platform_name = SUPPORTED_PLATFORMS[platform]["name"]
175
+ print_success(f" ✅ Removed {platform_name} integration")
176
+
177
+ return True
178
+
179
+ except Exception as e:
180
+ logger.error(f"Failed to unconfigure {platform}: {e}")
181
+ print_error(f" ❌ Failed to remove {platform} integration: {e}")
182
+ return False
183
+
184
+
185
+ def find_configured_platforms(project_root: Path) -> dict[str, Path]:
186
+ """Find all platforms that have mcp-vector-search configured.
187
+
188
+ Args:
189
+ project_root: Project root directory
190
+
191
+ Returns:
192
+ Dictionary mapping platform names to their config paths
193
+ """
194
+ configured = {}
195
+
196
+ for platform in SUPPORTED_PLATFORMS:
197
+ try:
198
+ config_path = get_platform_config_path(platform, project_root)
199
+
200
+ if not config_path.exists():
201
+ continue
202
+
203
+ # Check if mcp-vector-search is in the config
204
+ with open(config_path) as f:
205
+ config = json.load(f)
206
+
207
+ if "mcp-vector-search" in config.get("mcpServers", {}):
208
+ configured[platform] = config_path
209
+
210
+ except Exception:
211
+ # Ignore errors for individual platforms
212
+ continue
213
+
214
+ return configured
215
+
216
+
217
+ # ==============================================================================
218
+ # Main Uninstall Command
219
+ # ==============================================================================
220
+
221
+
222
+ @uninstall_app.callback()
223
+ def main(
224
+ ctx: typer.Context,
225
+ all_platforms: bool = typer.Option(
226
+ False,
227
+ "--all",
228
+ help="Remove from all configured platforms",
229
+ ),
230
+ no_backup: bool = typer.Option(
231
+ False,
232
+ "--no-backup",
233
+ help="Skip creating backup files",
234
+ ),
235
+ ) -> None:
236
+ """🗑️ Remove MCP integrations from platforms.
237
+
238
+ Use subcommands to remove from specific platforms, or use --all
239
+ to remove from all configured platforms.
240
+
241
+ [bold cyan]Examples:[/bold cyan]
242
+
243
+ [green]Remove from specific platform:[/green]
244
+ $ mcp-vector-search uninstall claude-code
245
+
246
+ [green]Remove from all platforms:[/green]
247
+ $ mcp-vector-search uninstall --all
248
+
249
+ [green]List configured platforms:[/green]
250
+ $ mcp-vector-search uninstall list
251
+
252
+ [dim]💡 Backup files are created automatically unless --no-backup is used[/dim]
253
+ """
254
+ # Only run if --all flag is used and no subcommand
255
+ if not all_platforms or ctx.invoked_subcommand is not None:
256
+ return
257
+
258
+ project_root = ctx.obj.get("project_root") or Path.cwd()
259
+
260
+ console.print(
261
+ Panel.fit(
262
+ "[bold yellow]Removing All MCP Integrations[/bold yellow]\n"
263
+ f"📁 Project: {project_root}",
264
+ border_style="yellow",
265
+ )
266
+ )
267
+
268
+ # Find all configured platforms
269
+ configured = find_configured_platforms(project_root)
270
+
271
+ if not configured:
272
+ print_info("No MCP integrations found to remove")
273
+ return
274
+
275
+ # Show what will be removed
276
+ console.print("\n[bold]Found integrations:[/bold]")
277
+ for platform in configured:
278
+ platform_name = SUPPORTED_PLATFORMS[platform]["name"]
279
+ console.print(f" • {platform_name}")
280
+
281
+ # Confirm removal
282
+ if not confirm_action("\nRemove all integrations?", default=False):
283
+ print_info("Cancelled")
284
+ raise typer.Exit(0)
285
+
286
+ # Remove from all platforms
287
+ console.print("\n[bold]Removing integrations...[/bold]")
288
+ results = {}
289
+
290
+ for platform in configured:
291
+ results[platform] = unconfigure_platform(
292
+ platform, project_root, backup=not no_backup
293
+ )
294
+
295
+ # Summary
296
+ successful = sum(1 for success in results.values() if success)
297
+ total = len(results)
298
+
299
+ console.print(
300
+ f"\n[bold green]✨ Removed {successful}/{total} integrations[/bold green]"
301
+ )
302
+
303
+ if successful < total:
304
+ print_warning("Some integrations could not be removed")
305
+ print_info("Check the output above for details")
306
+
307
+
308
+ # ==============================================================================
309
+ # Platform-Specific Uninstall Commands
310
+ # ==============================================================================
311
+
312
+
313
+ @uninstall_app.command("claude-code")
314
+ def uninstall_claude_code(
315
+ ctx: typer.Context,
316
+ no_backup: bool = typer.Option(False, "--no-backup", help="Skip backup creation"),
317
+ ) -> None:
318
+ """Remove Claude Code MCP integration (project-scoped)."""
319
+ project_root = ctx.obj.get("project_root") or Path.cwd()
320
+
321
+ console.print(
322
+ Panel.fit(
323
+ "[bold yellow]Removing Claude Code Integration[/bold yellow]\n"
324
+ "📁 Project-scoped configuration",
325
+ border_style="yellow",
326
+ )
327
+ )
328
+
329
+ success = unconfigure_platform("claude-code", project_root, backup=not no_backup)
330
+
331
+ if success:
332
+ console.print("\n[bold green]✅ Claude Code Integration Removed[/bold green]")
333
+ console.print("\n[dim]💡 Restart Claude Code to apply changes[/dim]")
334
+ else:
335
+ raise typer.Exit(1)
336
+
337
+
338
+ @uninstall_app.command("cursor")
339
+ def uninstall_cursor(
340
+ ctx: typer.Context,
341
+ no_backup: bool = typer.Option(False, "--no-backup"),
342
+ ) -> None:
343
+ """Remove Cursor IDE MCP integration (global)."""
344
+ project_root = ctx.obj.get("project_root") or Path.cwd()
345
+
346
+ console.print(
347
+ Panel.fit(
348
+ "[bold yellow]Removing Cursor Integration[/bold yellow]\n"
349
+ "🌐 Global configuration",
350
+ border_style="yellow",
351
+ )
352
+ )
353
+
354
+ success = unconfigure_platform("cursor", project_root, backup=not no_backup)
355
+
356
+ if success:
357
+ console.print("\n[bold green]✅ Cursor Integration Removed[/bold green]")
358
+ console.print("\n[dim]💡 Restart Cursor to apply changes[/dim]")
359
+ else:
360
+ raise typer.Exit(1)
361
+
362
+
363
+ @uninstall_app.command("windsurf")
364
+ def uninstall_windsurf(
365
+ ctx: typer.Context,
366
+ no_backup: bool = typer.Option(False, "--no-backup"),
367
+ ) -> None:
368
+ """Remove Windsurf IDE MCP integration (global)."""
369
+ project_root = ctx.obj.get("project_root") or Path.cwd()
370
+
371
+ console.print(
372
+ Panel.fit(
373
+ "[bold yellow]Removing Windsurf Integration[/bold yellow]\n"
374
+ "🌐 Global configuration",
375
+ border_style="yellow",
376
+ )
377
+ )
378
+
379
+ success = unconfigure_platform("windsurf", project_root, backup=not no_backup)
380
+
381
+ if success:
382
+ console.print("\n[bold green]✅ Windsurf Integration Removed[/bold green]")
383
+ console.print("\n[dim]💡 Restart Windsurf to apply changes[/dim]")
384
+ else:
385
+ raise typer.Exit(1)
386
+
387
+
388
+ @uninstall_app.command("claude-desktop")
389
+ def uninstall_claude_desktop(
390
+ ctx: typer.Context,
391
+ no_backup: bool = typer.Option(False, "--no-backup"),
392
+ ) -> None:
393
+ """Remove Claude Desktop MCP integration (global)."""
394
+ project_root = ctx.obj.get("project_root") or Path.cwd()
395
+
396
+ console.print(
397
+ Panel.fit(
398
+ "[bold yellow]Removing Claude Desktop Integration[/bold yellow]\n"
399
+ "🌐 Global configuration",
400
+ border_style="yellow",
401
+ )
402
+ )
403
+
404
+ success = unconfigure_platform("claude-desktop", project_root, backup=not no_backup)
405
+
406
+ if success:
407
+ console.print(
408
+ "\n[bold green]✅ Claude Desktop Integration Removed[/bold green]"
409
+ )
410
+ console.print("\n[dim]💡 Restart Claude Desktop to apply changes[/dim]")
411
+ else:
412
+ raise typer.Exit(1)
413
+
414
+
415
+ @uninstall_app.command("vscode")
416
+ def uninstall_vscode(
417
+ ctx: typer.Context,
418
+ no_backup: bool = typer.Option(False, "--no-backup"),
419
+ ) -> None:
420
+ """Remove VS Code MCP integration (global)."""
421
+ project_root = ctx.obj.get("project_root") or Path.cwd()
422
+
423
+ console.print(
424
+ Panel.fit(
425
+ "[bold yellow]Removing VS Code Integration[/bold yellow]\n"
426
+ "🌐 Global configuration",
427
+ border_style="yellow",
428
+ )
429
+ )
430
+
431
+ success = unconfigure_platform("vscode", project_root, backup=not no_backup)
432
+
433
+ if success:
434
+ console.print("\n[bold green]✅ VS Code Integration Removed[/bold green]")
435
+ console.print("\n[dim]💡 Restart VS Code to apply changes[/dim]")
436
+ else:
437
+ raise typer.Exit(1)
438
+
439
+
440
+ @uninstall_app.command("list")
441
+ def list_integrations(ctx: typer.Context) -> None:
442
+ """List all currently configured MCP integrations."""
443
+ project_root = ctx.obj.get("project_root") or Path.cwd()
444
+
445
+ console.print(
446
+ Panel.fit(
447
+ "[bold cyan]Configured MCP Integrations[/bold cyan]", border_style="cyan"
448
+ )
449
+ )
450
+
451
+ configured = find_configured_platforms(project_root)
452
+
453
+ if not configured:
454
+ console.print("\n[yellow]No MCP integrations configured[/yellow]")
455
+ console.print(
456
+ "\n[dim]Use 'mcp-vector-search install <platform>' to add integrations[/dim]"
457
+ )
458
+ return
459
+
460
+ table = Table(show_header=True, header_style="bold cyan")
461
+ table.add_column("Platform", style="cyan")
462
+ table.add_column("Name")
463
+ table.add_column("Config Location")
464
+ table.add_column("Removal Command", style="dim")
465
+
466
+ for platform, config_path in configured.items():
467
+ platform_info = SUPPORTED_PLATFORMS[platform]
468
+ table.add_row(
469
+ platform,
470
+ platform_info["name"],
471
+ str(config_path),
472
+ f"mcp-vector-search uninstall {platform}",
473
+ )
474
+
475
+ console.print(table)
476
+
477
+ console.print("\n[bold blue]Removal Options:[/bold blue]")
478
+ console.print(
479
+ " • Remove specific: [code]mcp-vector-search uninstall <platform>[/code]"
480
+ )
481
+ console.print(" • Remove all: [code]mcp-vector-search uninstall --all[/code]")
482
+
483
+
484
+ if __name__ == "__main__":
485
+ uninstall_app()