mcp-vector-search 0.12.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.
Files changed (68) hide show
  1. mcp_vector_search/__init__.py +10 -0
  2. mcp_vector_search/cli/__init__.py +1 -0
  3. mcp_vector_search/cli/commands/__init__.py +1 -0
  4. mcp_vector_search/cli/commands/auto_index.py +397 -0
  5. mcp_vector_search/cli/commands/config.py +393 -0
  6. mcp_vector_search/cli/commands/demo.py +358 -0
  7. mcp_vector_search/cli/commands/index.py +744 -0
  8. mcp_vector_search/cli/commands/init.py +645 -0
  9. mcp_vector_search/cli/commands/install.py +675 -0
  10. mcp_vector_search/cli/commands/install_old.py +696 -0
  11. mcp_vector_search/cli/commands/mcp.py +1182 -0
  12. mcp_vector_search/cli/commands/reset.py +393 -0
  13. mcp_vector_search/cli/commands/search.py +773 -0
  14. mcp_vector_search/cli/commands/status.py +549 -0
  15. mcp_vector_search/cli/commands/uninstall.py +485 -0
  16. mcp_vector_search/cli/commands/visualize.py +1467 -0
  17. mcp_vector_search/cli/commands/watch.py +287 -0
  18. mcp_vector_search/cli/didyoumean.py +500 -0
  19. mcp_vector_search/cli/export.py +320 -0
  20. mcp_vector_search/cli/history.py +295 -0
  21. mcp_vector_search/cli/interactive.py +342 -0
  22. mcp_vector_search/cli/main.py +461 -0
  23. mcp_vector_search/cli/output.py +412 -0
  24. mcp_vector_search/cli/suggestions.py +375 -0
  25. mcp_vector_search/config/__init__.py +1 -0
  26. mcp_vector_search/config/constants.py +24 -0
  27. mcp_vector_search/config/defaults.py +200 -0
  28. mcp_vector_search/config/settings.py +134 -0
  29. mcp_vector_search/core/__init__.py +1 -0
  30. mcp_vector_search/core/auto_indexer.py +298 -0
  31. mcp_vector_search/core/connection_pool.py +360 -0
  32. mcp_vector_search/core/database.py +1214 -0
  33. mcp_vector_search/core/directory_index.py +318 -0
  34. mcp_vector_search/core/embeddings.py +294 -0
  35. mcp_vector_search/core/exceptions.py +89 -0
  36. mcp_vector_search/core/factory.py +318 -0
  37. mcp_vector_search/core/git_hooks.py +345 -0
  38. mcp_vector_search/core/indexer.py +1002 -0
  39. mcp_vector_search/core/models.py +294 -0
  40. mcp_vector_search/core/project.py +333 -0
  41. mcp_vector_search/core/scheduler.py +330 -0
  42. mcp_vector_search/core/search.py +952 -0
  43. mcp_vector_search/core/watcher.py +322 -0
  44. mcp_vector_search/mcp/__init__.py +5 -0
  45. mcp_vector_search/mcp/__main__.py +25 -0
  46. mcp_vector_search/mcp/server.py +733 -0
  47. mcp_vector_search/parsers/__init__.py +8 -0
  48. mcp_vector_search/parsers/base.py +296 -0
  49. mcp_vector_search/parsers/dart.py +605 -0
  50. mcp_vector_search/parsers/html.py +413 -0
  51. mcp_vector_search/parsers/javascript.py +643 -0
  52. mcp_vector_search/parsers/php.py +694 -0
  53. mcp_vector_search/parsers/python.py +502 -0
  54. mcp_vector_search/parsers/registry.py +223 -0
  55. mcp_vector_search/parsers/ruby.py +678 -0
  56. mcp_vector_search/parsers/text.py +186 -0
  57. mcp_vector_search/parsers/utils.py +265 -0
  58. mcp_vector_search/py.typed +1 -0
  59. mcp_vector_search/utils/__init__.py +40 -0
  60. mcp_vector_search/utils/gitignore.py +250 -0
  61. mcp_vector_search/utils/monorepo.py +277 -0
  62. mcp_vector_search/utils/timing.py +334 -0
  63. mcp_vector_search/utils/version.py +47 -0
  64. mcp_vector_search-0.12.6.dist-info/METADATA +754 -0
  65. mcp_vector_search-0.12.6.dist-info/RECORD +68 -0
  66. mcp_vector_search-0.12.6.dist-info/WHEEL +4 -0
  67. mcp_vector_search-0.12.6.dist-info/entry_points.txt +2 -0
  68. mcp_vector_search-0.12.6.dist-info/licenses/LICENSE +21 -0
@@ -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()