mcp-vector-search 0.4.14__py3-none-any.whl → 0.5.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.
- mcp_vector_search/__init__.py +2 -2
- mcp_vector_search/cli/commands/index.py +73 -31
- mcp_vector_search/cli/commands/init.py +189 -113
- mcp_vector_search/cli/commands/install.py +525 -113
- mcp_vector_search/cli/commands/mcp.py +201 -151
- mcp_vector_search/cli/commands/reset.py +41 -41
- mcp_vector_search/cli/commands/search.py +73 -14
- mcp_vector_search/cli/commands/status.py +51 -17
- mcp_vector_search/cli/didyoumean.py +254 -246
- mcp_vector_search/cli/main.py +114 -43
- mcp_vector_search/cli/output.py +152 -0
- mcp_vector_search/cli/suggestions.py +246 -197
- mcp_vector_search/core/database.py +81 -49
- mcp_vector_search/core/indexer.py +10 -4
- mcp_vector_search/core/search.py +17 -6
- mcp_vector_search/mcp/__main__.py +1 -1
- mcp_vector_search/mcp/server.py +211 -203
- mcp_vector_search/parsers/__init__.py +7 -0
- mcp_vector_search/parsers/dart.py +605 -0
- mcp_vector_search/parsers/html.py +413 -0
- mcp_vector_search/parsers/php.py +694 -0
- mcp_vector_search/parsers/registry.py +21 -1
- mcp_vector_search/parsers/ruby.py +678 -0
- mcp_vector_search/parsers/text.py +32 -26
- mcp_vector_search/utils/gitignore.py +72 -71
- {mcp_vector_search-0.4.14.dist-info → mcp_vector_search-0.5.1.dist-info}/METADATA +76 -5
- {mcp_vector_search-0.4.14.dist-info → mcp_vector_search-0.5.1.dist-info}/RECORD +30 -26
- {mcp_vector_search-0.4.14.dist-info → mcp_vector_search-0.5.1.dist-info}/WHEEL +0 -0
- {mcp_vector_search-0.4.14.dist-info → mcp_vector_search-0.5.1.dist-info}/entry_points.txt +0 -0
- {mcp_vector_search-0.4.14.dist-info → mcp_vector_search-0.5.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -6,11 +6,8 @@ import shutil
|
|
|
6
6
|
import subprocess
|
|
7
7
|
import sys
|
|
8
8
|
from pathlib import Path
|
|
9
|
-
from typing import Optional
|
|
10
9
|
|
|
11
10
|
import typer
|
|
12
|
-
import click
|
|
13
|
-
from loguru import logger
|
|
14
11
|
from rich.console import Console
|
|
15
12
|
from rich.panel import Panel
|
|
16
13
|
from rich.table import Table
|
|
@@ -26,24 +23,24 @@ mcp_app = create_enhanced_typer(help="Manage Claude Code MCP integration")
|
|
|
26
23
|
console = Console()
|
|
27
24
|
|
|
28
25
|
|
|
29
|
-
def get_claude_command() ->
|
|
26
|
+
def get_claude_command() -> str | None:
|
|
30
27
|
"""Get the Claude Code command path."""
|
|
31
28
|
# Check if claude command is available
|
|
32
29
|
claude_cmd = shutil.which("claude")
|
|
33
30
|
if claude_cmd:
|
|
34
31
|
return "claude"
|
|
35
|
-
|
|
32
|
+
|
|
36
33
|
# Check common installation paths
|
|
37
34
|
possible_paths = [
|
|
38
35
|
"/usr/local/bin/claude",
|
|
39
36
|
"/opt/homebrew/bin/claude",
|
|
40
37
|
os.path.expanduser("~/.local/bin/claude"),
|
|
41
38
|
]
|
|
42
|
-
|
|
39
|
+
|
|
43
40
|
for path in possible_paths:
|
|
44
41
|
if os.path.exists(path) and os.access(path, os.X_OK):
|
|
45
42
|
return path
|
|
46
|
-
|
|
43
|
+
|
|
47
44
|
return None
|
|
48
45
|
|
|
49
46
|
|
|
@@ -52,22 +49,21 @@ def check_claude_code_available() -> bool:
|
|
|
52
49
|
claude_cmd = get_claude_command()
|
|
53
50
|
if not claude_cmd:
|
|
54
51
|
return False
|
|
55
|
-
|
|
52
|
+
|
|
56
53
|
try:
|
|
57
54
|
result = subprocess.run(
|
|
58
|
-
[claude_cmd, "--version"],
|
|
59
|
-
capture_output=True,
|
|
60
|
-
text=True,
|
|
61
|
-
timeout=10
|
|
55
|
+
[claude_cmd, "--version"], capture_output=True, text=True, timeout=10
|
|
62
56
|
)
|
|
63
57
|
return result.returncode == 0
|
|
64
58
|
except (subprocess.TimeoutExpired, FileNotFoundError):
|
|
65
59
|
return False
|
|
66
60
|
|
|
67
61
|
|
|
68
|
-
def get_mcp_server_command(
|
|
62
|
+
def get_mcp_server_command(
|
|
63
|
+
project_root: Path, enable_file_watching: bool = True
|
|
64
|
+
) -> str:
|
|
69
65
|
"""Get the command to run the MCP server.
|
|
70
|
-
|
|
66
|
+
|
|
71
67
|
Args:
|
|
72
68
|
project_root: Path to the project root directory
|
|
73
69
|
enable_file_watching: Whether to enable file watching (default: True)
|
|
@@ -78,26 +74,22 @@ def get_mcp_server_command(project_root: Path, enable_file_watching: bool = True
|
|
|
78
74
|
return f"{python_exe} -m mcp_vector_search.mcp.server{watch_flag} {project_root}"
|
|
79
75
|
|
|
80
76
|
|
|
77
|
+
def create_project_claude_config(
|
|
78
|
+
project_root: Path, server_name: str, enable_file_watching: bool = True
|
|
79
|
+
) -> None:
|
|
80
|
+
"""Create or update project-level .mcp.json file.
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
def create_project_claude_config(project_root: Path, server_name: str, enable_file_watching: bool = True) -> None:
|
|
84
|
-
"""Create or update project-level .claude/settings.local.json file.
|
|
85
|
-
|
|
86
82
|
Args:
|
|
87
83
|
project_root: Path to the project root directory
|
|
88
84
|
server_name: Name for the MCP server
|
|
89
85
|
enable_file_watching: Whether to enable file watching (default: True)
|
|
90
86
|
"""
|
|
91
|
-
#
|
|
92
|
-
|
|
93
|
-
claude_dir.mkdir(exist_ok=True)
|
|
94
|
-
|
|
95
|
-
# Path to settings.local.json in .claude directory
|
|
96
|
-
settings_path = claude_dir / "settings.local.json"
|
|
87
|
+
# Path to .mcp.json in project root (recommended by Claude Code)
|
|
88
|
+
mcp_config_path = project_root / ".mcp.json"
|
|
97
89
|
|
|
98
90
|
# Load existing config or create new one
|
|
99
|
-
if
|
|
100
|
-
with open(
|
|
91
|
+
if mcp_config_path.exists():
|
|
92
|
+
with open(mcp_config_path) as f:
|
|
101
93
|
config = json.load(f)
|
|
102
94
|
else:
|
|
103
95
|
config = {}
|
|
@@ -106,25 +98,21 @@ def create_project_claude_config(project_root: Path, server_name: str, enable_fi
|
|
|
106
98
|
if "mcpServers" not in config:
|
|
107
99
|
config["mcpServers"] = {}
|
|
108
100
|
|
|
109
|
-
#
|
|
110
|
-
server_command = get_mcp_server_command(project_root, enable_file_watching)
|
|
111
|
-
command_parts = server_command.split()
|
|
112
|
-
|
|
113
|
-
# Add the server configuration with required "type": "stdio"
|
|
101
|
+
# Use uv for better compatibility, with proper args structure
|
|
114
102
|
config["mcpServers"][server_name] = {
|
|
115
103
|
"type": "stdio",
|
|
116
|
-
"command":
|
|
117
|
-
"args":
|
|
104
|
+
"command": "uv",
|
|
105
|
+
"args": ["run", "mcp-vector-search", "mcp"],
|
|
118
106
|
"env": {
|
|
119
107
|
"MCP_ENABLE_FILE_WATCHING": "true" if enable_file_watching else "false"
|
|
120
|
-
}
|
|
108
|
+
},
|
|
121
109
|
}
|
|
122
110
|
|
|
123
111
|
# Write the config
|
|
124
|
-
with open(
|
|
112
|
+
with open(mcp_config_path, "w") as f:
|
|
125
113
|
json.dump(config, f, indent=2)
|
|
126
114
|
|
|
127
|
-
print_success(
|
|
115
|
+
print_success("Created project-level .mcp.json with MCP server configuration")
|
|
128
116
|
if enable_file_watching:
|
|
129
117
|
print_info("File watching is enabled for automatic reindexing")
|
|
130
118
|
else:
|
|
@@ -138,56 +126,75 @@ def install_mcp_integration(
|
|
|
138
126
|
server_name: str = typer.Option(
|
|
139
127
|
"mcp-vector-search",
|
|
140
128
|
"--name",
|
|
141
|
-
help="Name for the MCP server"
|
|
129
|
+
help="Name for the MCP server",
|
|
130
|
+
rich_help_panel="📁 Configuration",
|
|
142
131
|
),
|
|
143
132
|
force: bool = typer.Option(
|
|
144
133
|
False,
|
|
145
134
|
"--force",
|
|
146
135
|
"-f",
|
|
147
|
-
help="Force installation even if server already exists"
|
|
136
|
+
help="Force installation even if server already exists",
|
|
137
|
+
rich_help_panel="⚙️ Advanced Options",
|
|
148
138
|
),
|
|
149
139
|
no_watch: bool = typer.Option(
|
|
150
140
|
False,
|
|
151
141
|
"--no-watch",
|
|
152
|
-
help="Disable file watching for automatic reindexing"
|
|
153
|
-
|
|
142
|
+
help="Disable file watching for automatic reindexing",
|
|
143
|
+
rich_help_panel="⚙️ Advanced Options",
|
|
144
|
+
),
|
|
154
145
|
) -> None:
|
|
155
|
-
"""Install MCP integration for Claude Code in the current project.
|
|
156
|
-
|
|
157
|
-
Creates .
|
|
158
|
-
|
|
159
|
-
|
|
146
|
+
"""🔗 Install MCP integration for Claude Code in the current project.
|
|
147
|
+
|
|
148
|
+
Creates .mcp.json to enable semantic code search in Claude Code.
|
|
149
|
+
The integration provides AI-powered semantic search tools directly in Claude Code.
|
|
150
|
+
|
|
151
|
+
[bold cyan]Basic Examples:[/bold cyan]
|
|
152
|
+
|
|
153
|
+
[green]Install with defaults:[/green]
|
|
154
|
+
$ mcp-vector-search mcp install
|
|
155
|
+
|
|
156
|
+
[green]Install with custom server name:[/green]
|
|
157
|
+
$ mcp-vector-search mcp install --name my-search-server
|
|
158
|
+
|
|
159
|
+
[green]Reinstall/update configuration:[/green]
|
|
160
|
+
$ mcp-vector-search mcp install --force
|
|
161
|
+
|
|
162
|
+
[bold cyan]Advanced:[/bold cyan]
|
|
163
|
+
|
|
164
|
+
[green]Disable file watching:[/green]
|
|
165
|
+
$ mcp-vector-search mcp install --no-watch
|
|
166
|
+
|
|
167
|
+
[dim]💡 Tip: The .mcp.json file can be committed to share
|
|
168
|
+
MCP integration with your team.[/dim]
|
|
160
169
|
"""
|
|
161
170
|
try:
|
|
162
171
|
# Get project root for checking initialization
|
|
163
172
|
project_root = ctx.obj.get("project_root") or Path.cwd()
|
|
164
|
-
|
|
173
|
+
|
|
165
174
|
# Check if project is initialized
|
|
166
175
|
project_manager = ProjectManager(project_root)
|
|
167
176
|
if not project_manager.is_initialized():
|
|
168
177
|
print_error("Project not initialized. Run 'mcp-vector-search init' first.")
|
|
169
178
|
raise typer.Exit(1)
|
|
170
179
|
|
|
171
|
-
#
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
# Check if .claude/settings.local.json already has the server in current directory
|
|
176
|
-
settings_path = claude_dir / "settings.local.json"
|
|
177
|
-
if settings_path.exists() and not force:
|
|
178
|
-
with open(settings_path, 'r') as f:
|
|
180
|
+
# Check if .mcp.json already has the server configuration
|
|
181
|
+
mcp_config_path = project_root / ".mcp.json"
|
|
182
|
+
if mcp_config_path.exists() and not force:
|
|
183
|
+
with open(mcp_config_path) as f:
|
|
179
184
|
config = json.load(f)
|
|
180
185
|
if config.get("mcpServers", {}).get(server_name):
|
|
181
|
-
print_warning(f"MCP server '{server_name}' already exists in
|
|
186
|
+
print_warning(f"MCP server '{server_name}' already exists in .mcp.json")
|
|
182
187
|
print_info("Use --force to overwrite")
|
|
183
188
|
raise typer.Exit(1)
|
|
184
189
|
|
|
185
|
-
# Create configuration in
|
|
190
|
+
# Create configuration in project root
|
|
186
191
|
enable_file_watching = not no_watch
|
|
187
|
-
create_project_claude_config(
|
|
192
|
+
create_project_claude_config(project_root, server_name, enable_file_watching)
|
|
188
193
|
|
|
189
|
-
print_info(f"MCP server '{server_name}' installed in
|
|
190
|
-
print_info(
|
|
194
|
+
print_info(f"MCP server '{server_name}' installed in {mcp_config_path}")
|
|
195
|
+
print_info(
|
|
196
|
+
"Claude Code will automatically detect the server when you open this project"
|
|
197
|
+
)
|
|
191
198
|
|
|
192
199
|
# Test the server (using project_root for the server command)
|
|
193
200
|
print_info("Testing server startup...")
|
|
@@ -199,7 +206,7 @@ def install_mcp_integration(
|
|
|
199
206
|
stdin=subprocess.PIPE,
|
|
200
207
|
stdout=subprocess.PIPE,
|
|
201
208
|
stderr=subprocess.PIPE,
|
|
202
|
-
text=True
|
|
209
|
+
text=True,
|
|
203
210
|
)
|
|
204
211
|
|
|
205
212
|
# Send a simple initialization request
|
|
@@ -210,8 +217,8 @@ def install_mcp_integration(
|
|
|
210
217
|
"params": {
|
|
211
218
|
"protocolVersion": "2024-11-05",
|
|
212
219
|
"capabilities": {},
|
|
213
|
-
"clientInfo": {"name": "test", "version": "1.0.0"}
|
|
214
|
-
}
|
|
220
|
+
"clientInfo": {"name": "test", "version": "1.0.0"},
|
|
221
|
+
},
|
|
215
222
|
}
|
|
216
223
|
|
|
217
224
|
try:
|
|
@@ -237,15 +244,25 @@ def install_mcp_integration(
|
|
|
237
244
|
table.add_column("Description", style="white")
|
|
238
245
|
|
|
239
246
|
table.add_row("search_code", "Search for code using semantic similarity")
|
|
240
|
-
table.add_row(
|
|
241
|
-
|
|
242
|
-
|
|
247
|
+
table.add_row(
|
|
248
|
+
"search_similar", "Find code similar to a specific file or function"
|
|
249
|
+
)
|
|
250
|
+
table.add_row(
|
|
251
|
+
"search_context", "Search for code based on contextual description"
|
|
252
|
+
)
|
|
253
|
+
table.add_row(
|
|
254
|
+
"get_project_status", "Get project indexing status and statistics"
|
|
255
|
+
)
|
|
243
256
|
table.add_row("index_project", "Index or reindex the project codebase")
|
|
244
|
-
|
|
257
|
+
|
|
245
258
|
if enable_file_watching:
|
|
246
|
-
console.print(
|
|
259
|
+
console.print(
|
|
260
|
+
"\n[green]✅ File watching is enabled[/green] - Changes will be automatically indexed"
|
|
261
|
+
)
|
|
247
262
|
else:
|
|
248
|
-
console.print(
|
|
263
|
+
console.print(
|
|
264
|
+
"\n[yellow]⚠️ File watching is disabled[/yellow] - Manual reindexing required for changes"
|
|
265
|
+
)
|
|
249
266
|
|
|
250
267
|
console.print(table)
|
|
251
268
|
|
|
@@ -266,51 +283,68 @@ def test_mcp_integration(
|
|
|
266
283
|
server_name: str = typer.Option(
|
|
267
284
|
"mcp-vector-search",
|
|
268
285
|
"--name",
|
|
269
|
-
help="Name of the MCP server to test"
|
|
270
|
-
|
|
286
|
+
help="Name of the MCP server to test",
|
|
287
|
+
rich_help_panel="📁 Configuration",
|
|
288
|
+
),
|
|
271
289
|
) -> None:
|
|
272
|
-
"""Test the MCP integration.
|
|
290
|
+
"""🧪 Test the MCP integration.
|
|
291
|
+
|
|
292
|
+
Verifies that the MCP server is properly configured and can start successfully.
|
|
293
|
+
Use this to diagnose integration issues.
|
|
294
|
+
|
|
295
|
+
[bold cyan]Examples:[/bold cyan]
|
|
296
|
+
|
|
297
|
+
[green]Test default server:[/green]
|
|
298
|
+
$ mcp-vector-search mcp test
|
|
299
|
+
|
|
300
|
+
[green]Test custom server:[/green]
|
|
301
|
+
$ mcp-vector-search mcp test --name my-search-server
|
|
302
|
+
|
|
303
|
+
[dim]💡 Tip: Run this after installation to verify everything works.[/dim]
|
|
304
|
+
"""
|
|
273
305
|
try:
|
|
274
306
|
# Get project root
|
|
275
307
|
project_root = ctx.obj.get("project_root") or Path.cwd()
|
|
276
|
-
|
|
308
|
+
|
|
277
309
|
# Check if Claude Code is available
|
|
278
310
|
if not check_claude_code_available():
|
|
279
311
|
print_error("Claude Code not found. Please install Claude Code first.")
|
|
280
312
|
raise typer.Exit(1)
|
|
281
|
-
|
|
313
|
+
|
|
282
314
|
claude_cmd = get_claude_command()
|
|
283
|
-
|
|
315
|
+
|
|
284
316
|
# Check if server exists
|
|
285
317
|
print_info(f"Testing MCP server '{server_name}'...")
|
|
286
|
-
|
|
318
|
+
|
|
287
319
|
try:
|
|
288
320
|
result = subprocess.run(
|
|
289
321
|
[claude_cmd, "mcp", "get", server_name],
|
|
290
322
|
capture_output=True,
|
|
291
323
|
text=True,
|
|
292
|
-
timeout=10
|
|
324
|
+
timeout=10,
|
|
293
325
|
)
|
|
294
|
-
|
|
326
|
+
|
|
295
327
|
if result.returncode != 0:
|
|
296
328
|
print_error(f"MCP server '{server_name}' not found.")
|
|
297
|
-
print_info(
|
|
329
|
+
print_info(
|
|
330
|
+
"Run 'mcp-vector-search mcp install' or 'mcp-vector-search mcp init' first"
|
|
331
|
+
)
|
|
298
332
|
raise typer.Exit(1)
|
|
299
|
-
|
|
333
|
+
|
|
300
334
|
print_success(f"✅ MCP server '{server_name}' is configured")
|
|
301
|
-
|
|
335
|
+
|
|
302
336
|
# Test if we can run the server directly
|
|
303
337
|
print_info("Testing server startup...")
|
|
304
|
-
|
|
338
|
+
|
|
305
339
|
server_command = get_mcp_server_command(project_root)
|
|
306
340
|
test_process = subprocess.Popen(
|
|
307
341
|
server_command.split(),
|
|
308
342
|
stdin=subprocess.PIPE,
|
|
309
343
|
stdout=subprocess.PIPE,
|
|
310
344
|
stderr=subprocess.PIPE,
|
|
311
|
-
text=True
|
|
345
|
+
text=True,
|
|
312
346
|
)
|
|
313
|
-
|
|
347
|
+
|
|
314
348
|
# Send a simple initialization request
|
|
315
349
|
init_request = {
|
|
316
350
|
"jsonrpc": "2.0",
|
|
@@ -319,34 +353,36 @@ def test_mcp_integration(
|
|
|
319
353
|
"params": {
|
|
320
354
|
"protocolVersion": "2024-11-05",
|
|
321
355
|
"capabilities": {},
|
|
322
|
-
"clientInfo": {"name": "test", "version": "1.0.0"}
|
|
323
|
-
}
|
|
356
|
+
"clientInfo": {"name": "test", "version": "1.0.0"},
|
|
357
|
+
},
|
|
324
358
|
}
|
|
325
|
-
|
|
359
|
+
|
|
326
360
|
try:
|
|
327
361
|
test_process.stdin.write(json.dumps(init_request) + "\n")
|
|
328
362
|
test_process.stdin.flush()
|
|
329
|
-
|
|
363
|
+
|
|
330
364
|
# Wait for response with timeout
|
|
331
365
|
test_process.wait(timeout=5)
|
|
332
|
-
|
|
366
|
+
|
|
333
367
|
if test_process.returncode == 0:
|
|
334
368
|
print_success("✅ MCP server starts successfully")
|
|
335
369
|
else:
|
|
336
370
|
stderr_output = test_process.stderr.read()
|
|
337
|
-
print_warning(
|
|
338
|
-
|
|
371
|
+
print_warning(
|
|
372
|
+
f"⚠️ Server startup test inconclusive: {stderr_output}"
|
|
373
|
+
)
|
|
374
|
+
|
|
339
375
|
except subprocess.TimeoutExpired:
|
|
340
376
|
test_process.terminate()
|
|
341
377
|
print_success("✅ MCP server is responsive")
|
|
342
|
-
|
|
378
|
+
|
|
343
379
|
print_success("🎉 MCP integration test completed!")
|
|
344
380
|
print_info("You can now use the vector search tools in Claude Code.")
|
|
345
|
-
|
|
381
|
+
|
|
346
382
|
except subprocess.TimeoutExpired:
|
|
347
383
|
print_error("Timeout testing MCP server")
|
|
348
384
|
raise typer.Exit(1)
|
|
349
|
-
|
|
385
|
+
|
|
350
386
|
except Exception as e:
|
|
351
387
|
print_error(f"Test failed: {e}")
|
|
352
388
|
raise typer.Exit(1)
|
|
@@ -356,66 +392,58 @@ def test_mcp_integration(
|
|
|
356
392
|
def remove_mcp_integration(
|
|
357
393
|
ctx: typer.Context,
|
|
358
394
|
server_name: str = typer.Option(
|
|
359
|
-
"mcp-vector-search",
|
|
360
|
-
"--name",
|
|
361
|
-
help="Name of the MCP server to remove"
|
|
395
|
+
"mcp-vector-search", "--name", help="Name of the MCP server to remove"
|
|
362
396
|
),
|
|
363
|
-
confirm: bool = typer.Option(
|
|
364
|
-
False,
|
|
365
|
-
"--yes",
|
|
366
|
-
"-y",
|
|
367
|
-
help="Skip confirmation prompt"
|
|
368
|
-
)
|
|
397
|
+
confirm: bool = typer.Option(False, "--yes", "-y", help="Skip confirmation prompt"),
|
|
369
398
|
) -> None:
|
|
370
399
|
"""Remove MCP integration from the current project.
|
|
371
|
-
|
|
372
|
-
Removes the server configuration from .
|
|
400
|
+
|
|
401
|
+
Removes the server configuration from .mcp.json in the project root.
|
|
373
402
|
"""
|
|
374
403
|
try:
|
|
375
|
-
#
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
print_warning(f"No {config_location} found at {settings_path}")
|
|
404
|
+
# Get project root
|
|
405
|
+
project_root = ctx.obj.get("project_root") or Path.cwd()
|
|
406
|
+
mcp_config_path = project_root / ".mcp.json"
|
|
407
|
+
|
|
408
|
+
# Check if .mcp.json exists
|
|
409
|
+
if not mcp_config_path.exists():
|
|
410
|
+
print_warning(f"No .mcp.json found at {mcp_config_path}")
|
|
383
411
|
return
|
|
384
|
-
|
|
412
|
+
|
|
385
413
|
# Load configuration
|
|
386
|
-
with open(
|
|
414
|
+
with open(mcp_config_path) as f:
|
|
387
415
|
config = json.load(f)
|
|
388
|
-
|
|
416
|
+
|
|
389
417
|
# Check if server exists in configuration
|
|
390
418
|
if "mcpServers" not in config or server_name not in config["mcpServers"]:
|
|
391
|
-
print_warning(f"MCP server '{server_name}' not found in
|
|
419
|
+
print_warning(f"MCP server '{server_name}' not found in .mcp.json")
|
|
392
420
|
return
|
|
393
|
-
|
|
421
|
+
|
|
394
422
|
# Confirm removal
|
|
395
423
|
if not confirm:
|
|
396
424
|
confirmed = typer.confirm(
|
|
397
|
-
f"Remove MCP server '{server_name}' from
|
|
425
|
+
f"Remove MCP server '{server_name}' from .mcp.json?"
|
|
398
426
|
)
|
|
399
427
|
if not confirmed:
|
|
400
428
|
print_info("Removal cancelled.")
|
|
401
429
|
return
|
|
402
|
-
|
|
430
|
+
|
|
403
431
|
# Remove the MCP server from configuration
|
|
404
|
-
print_info(f"Removing MCP server '{server_name}' from
|
|
405
|
-
|
|
432
|
+
print_info(f"Removing MCP server '{server_name}' from .mcp.json...")
|
|
433
|
+
|
|
406
434
|
del config["mcpServers"][server_name]
|
|
407
|
-
|
|
435
|
+
|
|
408
436
|
# Clean up empty mcpServers section
|
|
409
437
|
if not config["mcpServers"]:
|
|
410
438
|
del config["mcpServers"]
|
|
411
|
-
|
|
439
|
+
|
|
412
440
|
# Write updated configuration
|
|
413
|
-
with open(
|
|
441
|
+
with open(mcp_config_path, "w") as f:
|
|
414
442
|
json.dump(config, f, indent=2)
|
|
415
|
-
|
|
416
|
-
print_success(f"✅ MCP server '{server_name}' removed from
|
|
443
|
+
|
|
444
|
+
print_success(f"✅ MCP server '{server_name}' removed from .mcp.json!")
|
|
417
445
|
print_info("The server is no longer available for this project")
|
|
418
|
-
|
|
446
|
+
|
|
419
447
|
except Exception as e:
|
|
420
448
|
print_error(f"Removal failed: {e}")
|
|
421
449
|
raise typer.Exit(1)
|
|
@@ -427,65 +455,87 @@ def show_mcp_status(
|
|
|
427
455
|
server_name: str = typer.Option(
|
|
428
456
|
"mcp-vector-search",
|
|
429
457
|
"--name",
|
|
430
|
-
help="Name of the MCP server to check"
|
|
431
|
-
|
|
458
|
+
help="Name of the MCP server to check",
|
|
459
|
+
rich_help_panel="📁 Configuration",
|
|
460
|
+
),
|
|
432
461
|
) -> None:
|
|
433
|
-
"""Show MCP integration status.
|
|
462
|
+
"""📊 Show MCP integration status.
|
|
463
|
+
|
|
464
|
+
Displays comprehensive status of MCP integration including Claude Code availability,
|
|
465
|
+
server configuration, and project status.
|
|
466
|
+
|
|
467
|
+
[bold cyan]Examples:[/bold cyan]
|
|
468
|
+
|
|
469
|
+
[green]Check integration status:[/green]
|
|
470
|
+
$ mcp-vector-search mcp status
|
|
471
|
+
|
|
472
|
+
[green]Check specific server:[/green]
|
|
473
|
+
$ mcp-vector-search mcp status --name my-search-server
|
|
474
|
+
|
|
475
|
+
[dim]💡 Tip: Use this to verify Claude Code can detect the MCP server.[/dim]
|
|
476
|
+
"""
|
|
434
477
|
try:
|
|
435
478
|
# Check if Claude Code is available
|
|
436
479
|
claude_available = check_claude_code_available()
|
|
437
|
-
|
|
480
|
+
|
|
438
481
|
# Create status panel
|
|
439
482
|
status_lines = []
|
|
440
|
-
|
|
483
|
+
|
|
441
484
|
if claude_available:
|
|
442
485
|
status_lines.append("✅ Claude Code: Available")
|
|
443
486
|
else:
|
|
444
487
|
status_lines.append("❌ Claude Code: Not available")
|
|
445
488
|
status_lines.append(" Install from: https://claude.ai/download")
|
|
446
|
-
|
|
489
|
+
|
|
447
490
|
# Check project configuration
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
if
|
|
451
|
-
with open(
|
|
491
|
+
project_root = ctx.obj.get("project_root") or Path.cwd()
|
|
492
|
+
mcp_config_path = project_root / ".mcp.json"
|
|
493
|
+
if mcp_config_path.exists():
|
|
494
|
+
with open(mcp_config_path) as f:
|
|
452
495
|
project_config = json.load(f)
|
|
453
|
-
|
|
454
|
-
if
|
|
455
|
-
|
|
496
|
+
|
|
497
|
+
if (
|
|
498
|
+
"mcpServers" in project_config
|
|
499
|
+
and server_name in project_config["mcpServers"]
|
|
500
|
+
):
|
|
501
|
+
status_lines.append(
|
|
502
|
+
f"✅ Project Config (.mcp.json): Server '{server_name}' installed"
|
|
503
|
+
)
|
|
456
504
|
server_info = project_config["mcpServers"][server_name]
|
|
457
505
|
if "command" in server_info:
|
|
458
506
|
status_lines.append(f" Command: {server_info['command']}")
|
|
459
507
|
if "args" in server_info:
|
|
460
508
|
status_lines.append(f" Args: {' '.join(server_info['args'])}")
|
|
461
509
|
if "env" in server_info:
|
|
462
|
-
file_watching = server_info[
|
|
463
|
-
|
|
510
|
+
file_watching = server_info["env"].get(
|
|
511
|
+
"MCP_ENABLE_FILE_WATCHING", "true"
|
|
512
|
+
)
|
|
513
|
+
if file_watching.lower() in ("true", "1", "yes", "on"):
|
|
464
514
|
status_lines.append(" File Watching: ✅ Enabled")
|
|
465
515
|
else:
|
|
466
516
|
status_lines.append(" File Watching: ❌ Disabled")
|
|
467
517
|
else:
|
|
468
|
-
status_lines.append(
|
|
518
|
+
status_lines.append(
|
|
519
|
+
f"❌ Project Config (.mcp.json): Server '{server_name}' not found"
|
|
520
|
+
)
|
|
469
521
|
else:
|
|
470
|
-
status_lines.append("❌ Project Config (.
|
|
471
|
-
|
|
522
|
+
status_lines.append("❌ Project Config (.mcp.json): Not found")
|
|
523
|
+
|
|
472
524
|
# Check project status
|
|
473
525
|
project_root = ctx.obj.get("project_root") or Path.cwd()
|
|
474
526
|
project_manager = ProjectManager(project_root)
|
|
475
|
-
|
|
527
|
+
|
|
476
528
|
if project_manager.is_initialized():
|
|
477
529
|
status_lines.append(f"✅ Project: Initialized at {project_root}")
|
|
478
530
|
else:
|
|
479
531
|
status_lines.append(f"❌ Project: Not initialized at {project_root}")
|
|
480
|
-
|
|
532
|
+
|
|
481
533
|
# Display status
|
|
482
534
|
panel = Panel(
|
|
483
|
-
"\n".join(status_lines),
|
|
484
|
-
title="MCP Integration Status",
|
|
485
|
-
border_style="blue"
|
|
535
|
+
"\n".join(status_lines), title="MCP Integration Status", border_style="blue"
|
|
486
536
|
)
|
|
487
537
|
console.print(panel)
|
|
488
|
-
|
|
538
|
+
|
|
489
539
|
except Exception as e:
|
|
490
540
|
print_error(f"Status check failed: {e}")
|
|
491
541
|
raise typer.Exit(1)
|