contextl 1.2.35 → 1.2.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/python/installer.py +85 -0
- package/python/main.py +9 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contextl",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.37",
|
|
4
4
|
"description": "contextl — finds the most relevant files in your codebase for any change request. MCP server for AI coding agents.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"files": [
|
|
32
32
|
"bin/",
|
|
33
33
|
"python/",
|
|
34
|
-
"README.md",
|
|
34
|
+
"README.md",
|
|
35
|
+
"requirements.txt"
|
|
35
36
|
],
|
|
36
|
-
|
|
37
37
|
"engines": {
|
|
38
38
|
"node": ">=18"
|
|
39
39
|
},
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import json
|
|
3
|
+
import platform
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
def install_mcp():
|
|
7
|
+
home = Path.home()
|
|
8
|
+
system = platform.system()
|
|
9
|
+
|
|
10
|
+
# Define common MCP configuration paths
|
|
11
|
+
targets = []
|
|
12
|
+
|
|
13
|
+
# 1. Antigravity
|
|
14
|
+
targets.append(home / ".gemini" / "antigravity" / "mcp_config.json")
|
|
15
|
+
|
|
16
|
+
# 2. Claude Desktop
|
|
17
|
+
if system == "Darwin":
|
|
18
|
+
targets.append(home / "Library" / "Application Support" / "Claude" / "claude_desktop_config.json")
|
|
19
|
+
elif system == "Windows":
|
|
20
|
+
appdata = os.environ.get("APPDATA", "")
|
|
21
|
+
if appdata:
|
|
22
|
+
targets.append(Path(appdata) / "Claude" / "claude_desktop_config.json")
|
|
23
|
+
else:
|
|
24
|
+
# Linux
|
|
25
|
+
targets.append(home / ".config" / "Claude" / "claude_desktop_config.json")
|
|
26
|
+
|
|
27
|
+
# 3. Cline / Roo (VSCode)
|
|
28
|
+
targets.append(home / "Documents" / "Cline" / "cline_mcp_settings.json")
|
|
29
|
+
if system == "Darwin":
|
|
30
|
+
targets.append(home / "Library" / "Application Support" / "Code" / "User" / "globalStorage" / "rooveterinaryinc.roo-cline" / "settings" / "cline_mcp_settings.json")
|
|
31
|
+
elif system == "Windows":
|
|
32
|
+
appdata = os.environ.get("APPDATA", "")
|
|
33
|
+
if appdata:
|
|
34
|
+
targets.append(Path(appdata) / "Code" / "User" / "globalStorage" / "rooveterinaryinc.roo-cline" / "settings" / "cline_mcp_settings.json")
|
|
35
|
+
else:
|
|
36
|
+
targets.append(home / ".config" / "Code" / "User" / "globalStorage" / "rooveterinaryinc.roo-cline" / "settings" / "cline_mcp_settings.json")
|
|
37
|
+
|
|
38
|
+
# 4. Cursor
|
|
39
|
+
targets.append(home / ".cursor" / "mcp.json")
|
|
40
|
+
|
|
41
|
+
success_count = 0
|
|
42
|
+
|
|
43
|
+
for path in targets:
|
|
44
|
+
if path.exists():
|
|
45
|
+
try:
|
|
46
|
+
# Read config
|
|
47
|
+
with open(path, "r", encoding="utf-8") as f:
|
|
48
|
+
content = f.read()
|
|
49
|
+
if not content.strip():
|
|
50
|
+
config = {}
|
|
51
|
+
else:
|
|
52
|
+
config = json.loads(content)
|
|
53
|
+
|
|
54
|
+
# Ensure mcpServers key exists
|
|
55
|
+
if "mcpServers" not in config:
|
|
56
|
+
config["mcpServers"] = {}
|
|
57
|
+
|
|
58
|
+
# Inject contextl
|
|
59
|
+
config["mcpServers"]["contextl"] = {
|
|
60
|
+
"command": "npx",
|
|
61
|
+
"args": ["-y", "contextl"]
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
# Write config
|
|
65
|
+
with open(path, "w", encoding="utf-8") as f:
|
|
66
|
+
json.dump(config, f, indent=2)
|
|
67
|
+
|
|
68
|
+
print(f"✅ Successfully injected ContextL MCP Server into: {path}")
|
|
69
|
+
success_count += 1
|
|
70
|
+
except Exception as e:
|
|
71
|
+
print(f"❌ Failed to parse or write to {path}: {e}")
|
|
72
|
+
|
|
73
|
+
if success_count > 0:
|
|
74
|
+
print("\nInstallation successful! Please restart your IDE or AI Client (e.g. reload the window) for the changes to take effect.")
|
|
75
|
+
else:
|
|
76
|
+
print("No supported MCP configuration files were found automatically.")
|
|
77
|
+
print("You may need to manually add the following JSON to your MCP configuration:")
|
|
78
|
+
print(json.dumps({
|
|
79
|
+
"mcpServers": {
|
|
80
|
+
"contextl": {
|
|
81
|
+
"command": "npx",
|
|
82
|
+
"args": ["-y", "contextl"]
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}, indent=2))
|
package/python/main.py
CHANGED
|
@@ -219,18 +219,26 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
219
219
|
review_parser.add_argument("--unstaged", action="store_true", help="Only include unstaged changes")
|
|
220
220
|
review_parser.add_argument("--json", action="store_true", help="Output clean JSON instead of human-readable text")
|
|
221
221
|
|
|
222
|
+
# 6. Install MCP Server
|
|
223
|
+
install_parser = subparsers.add_parser("install", help="Automatically install the ContextL MCP server into your AI Client")
|
|
224
|
+
|
|
222
225
|
return parser
|
|
223
226
|
|
|
224
227
|
|
|
225
228
|
def main():
|
|
226
229
|
# To maintain backward compatibility with old `contextl <repo> <query>`
|
|
227
230
|
# we manually inject "search" if the first argument isn't a known command.
|
|
228
|
-
if len(sys.argv) >= 2 and sys.argv[1] not in ["search", "standalone", "impact", "obsidian", "review", "-h", "--help"]:
|
|
231
|
+
if len(sys.argv) >= 2 and sys.argv[1] not in ["search", "standalone", "impact", "obsidian", "review", "install", "-h", "--help"]:
|
|
229
232
|
sys.argv.insert(1, "search")
|
|
230
233
|
|
|
231
234
|
parser = build_parser()
|
|
232
235
|
args = parser.parse_args()
|
|
233
236
|
|
|
237
|
+
if args.command == "install":
|
|
238
|
+
from installer import install_mcp
|
|
239
|
+
install_mcp()
|
|
240
|
+
sys.exit(0)
|
|
241
|
+
|
|
234
242
|
if args.command == "search":
|
|
235
243
|
results, repo_graph, elapsed = run_engine(args.repo_path, args.query, args.top)
|
|
236
244
|
|