langprotect-mcp-gateway 1.2.2__py3-none-any.whl → 1.2.4__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.
@@ -0,0 +1,182 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ LangProtect MCP Gateway Setup Helper
4
+ Automatically configures VS Code for global MCP gateway usage
5
+ """
6
+
7
+ import os
8
+ import json
9
+ import sys
10
+ from pathlib import Path
11
+
12
+
13
+ def get_vscode_settings_path():
14
+ """Get the VS Code user settings path based on OS"""
15
+ home = Path.home()
16
+
17
+ if sys.platform == "darwin": # macOS
18
+ return home / "Library/Application Support/Code/User/settings.json"
19
+ elif sys.platform == "win32": # Windows
20
+ return home / "AppData/Roaming/Code/User/settings.json"
21
+ else: # Linux
22
+ return home / ".config/Code/User/settings.json"
23
+
24
+
25
+ def create_wrapper_script():
26
+ """Create the global wrapper script"""
27
+ wrapper_dir = Path.home() / ".local/bin"
28
+ wrapper_dir.mkdir(parents=True, exist_ok=True)
29
+
30
+ wrapper_path = wrapper_dir / "langprotect-mcp-wrapper.sh"
31
+
32
+ wrapper_content = """#!/bin/bash
33
+ # LangProtect MCP Gateway Wrapper
34
+ # This wrapper allows global configuration for all VS Code workspaces
35
+
36
+ # Configure these environment variables with your LangProtect credentials
37
+ export LANGPROTECT_URL="${LANGPROTECT_URL:-http://localhost:8000}"
38
+ export LANGPROTECT_EMAIL="${LANGPROTECT_EMAIL:-your.email@company.com}"
39
+ export LANGPROTECT_PASSWORD="${LANGPROTECT_PASSWORD:-your-password}"
40
+ export MCP_SERVER_COMMAND="${MCP_SERVER_COMMAND:-npx}"
41
+ export MCP_SERVER_ARGS="${MCP_SERVER_ARGS:--y,@modelcontextprotocol/server-filesystem,.}"
42
+
43
+ exec langprotect-gateway "$@"
44
+ """
45
+
46
+ wrapper_path.write_text(wrapper_content)
47
+ wrapper_path.chmod(0o755)
48
+
49
+ return wrapper_path
50
+
51
+
52
+ def update_vscode_settings(wrapper_path):
53
+ """Update VS Code settings to use the wrapper"""
54
+ settings_path = get_vscode_settings_path()
55
+
56
+ # Create directory if it doesn't exist
57
+ settings_path.parent.mkdir(parents=True, exist_ok=True)
58
+
59
+ # Read existing settings or create new
60
+ if settings_path.exists():
61
+ with open(settings_path, 'r') as f:
62
+ try:
63
+ settings = json.load(f)
64
+ except json.JSONDecodeError:
65
+ settings = {}
66
+ else:
67
+ settings = {}
68
+
69
+ # Add MCP configuration
70
+ if "chat.mcp.servers" not in settings:
71
+ settings["chat.mcp.servers"] = {}
72
+
73
+ settings["chat.mcp.servers"]["langprotect-gateway"] = {
74
+ "type": "stdio",
75
+ "command": str(wrapper_path),
76
+ "args": []
77
+ }
78
+
79
+ # Enable auto-start
80
+ settings["chat.mcp.autostart"] = "newAndOutdated"
81
+
82
+ # Write back
83
+ with open(settings_path, 'w') as f:
84
+ json.dump(settings, f, indent=2)
85
+
86
+ return settings_path
87
+
88
+
89
+ def get_claude_config_path():
90
+ """Get the Claude Desktop config path based on OS"""
91
+ home = Path.home()
92
+ if sys.platform == "darwin":
93
+ return home / "Library/Application Support/Claude/claude_desktop_config.json"
94
+ elif sys.platform == "win32":
95
+ return home / "AppData/Roaming/Claude/claude_desktop_config.json"
96
+ else:
97
+ return home / ".config/Claude/claude_desktop_config.json"
98
+
99
+
100
+ def update_claude_config(wrapper_path):
101
+ """Update Claude Desktop config to use the wrapper"""
102
+ config_path = get_claude_config_path()
103
+ config_path.parent.mkdir(parents=True, exist_ok=True)
104
+
105
+ if config_path.exists():
106
+ with open(config_path, 'r') as f:
107
+ try:
108
+ config = json.load(f)
109
+ except json.JSONDecodeError:
110
+ config = {}
111
+ else:
112
+ config = {}
113
+
114
+ if "mcpServers" not in config:
115
+ config["mcpServers"] = {}
116
+
117
+ config["mcpServers"]["langprotect-gateway"] = {
118
+ "command": str(wrapper_path),
119
+ "args": []
120
+ }
121
+
122
+ with open(config_path, 'w') as f:
123
+ json.dump(config, f, indent=2)
124
+
125
+ return config_path
126
+
127
+
128
+ def setup():
129
+ """Main setup function"""
130
+ print("🚀 Setting up LangProtect MCP Gateway...")
131
+ print()
132
+
133
+ # Create wrapper script
134
+ print("📝 Creating global wrapper script...")
135
+ wrapper_path = create_wrapper_script()
136
+ print(f" ✅ Created: {wrapper_path}")
137
+ print()
138
+
139
+ # Update VS Code settings
140
+ print("⚙️ Configuring VS Code...")
141
+ try:
142
+ settings_path = update_vscode_settings(wrapper_path)
143
+ print(f" ✅ Updated: {settings_path}")
144
+ except Exception as e:
145
+ print(f" ⚠️ Could not update VS Code settings: {e}")
146
+
147
+ # Update Claude Desktop config
148
+ print("🍏 Configuring Claude Desktop (for high compatibility)...")
149
+ try:
150
+ claude_path = update_claude_config(wrapper_path)
151
+ print(f" ✅ Updated: {claude_path}")
152
+ except Exception as e:
153
+ print(f" ⚠️ Could not update Claude Desktop config: {e}")
154
+ print()
155
+
156
+ # Print next steps
157
+ print("✅ Setup complete!")
158
+ print()
159
+ print("📋 Next steps:")
160
+ print()
161
+ print("1. Configure your credentials:")
162
+ print(f" Edit: {wrapper_path}")
163
+ print(" Set LANGPROTECT_URL, LANGPROTECT_EMAIL, and LANGPROTECT_PASSWORD")
164
+ print()
165
+ print("2. Reload VS Code:")
166
+ print(" Press Ctrl+Shift+P → 'Developer: Reload Window'")
167
+ print()
168
+ print("3. Verify it's working:")
169
+ print(" Press Ctrl+Shift+P → 'MCP: List Servers'")
170
+ print(" You should see 'langprotect-gateway' listed")
171
+ print()
172
+ print("🎉 LangProtect will now protect ALL your VS Code workspaces!")
173
+ print()
174
+ print("💡 Tip: You can also set credentials via environment variables:")
175
+ print(" export LANGPROTECT_URL=http://localhost:8000")
176
+ print(" export LANGPROTECT_EMAIL=your.email@company.com")
177
+ print(" export LANGPROTECT_PASSWORD=your-password")
178
+ print()
179
+
180
+
181
+ if __name__ == "__main__":
182
+ setup()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langprotect-mcp-gateway
3
- Version: 1.2.2
3
+ Version: 1.2.4
4
4
  Summary: Security gateway for Model Context Protocol (MCP) to protect AI tool interactions
5
5
  Author-email: LangProtect Security Team <security@langprotect.com>
6
6
  License: MIT
@@ -87,6 +87,33 @@ which langprotect-gateway # Should show: ~/.local/bin/langprotect-gateway
87
87
  langprotect-gateway --help # Should show usage info
88
88
  ```
89
89
 
90
+ #### Automatic Setup (Recommended)
91
+
92
+ Run the setup command to automatically configure VS Code:
93
+
94
+ ```bash
95
+ langprotect-gateway-setup
96
+ ```
97
+
98
+ This will:
99
+ - ✅ Create a global wrapper script
100
+ - ✅ Configure VS Code to use LangProtect in ALL workspaces
101
+ - ✅ Enable auto-start
102
+
103
+ Then edit the wrapper script to add your credentials:
104
+
105
+ ```bash
106
+ # Linux/macOS
107
+ nano ~/.local/bin/langprotect-mcp-wrapper.sh
108
+
109
+ # Update these lines:
110
+ export LANGPROTECT_URL="http://localhost:8000"
111
+ export LANGPROTECT_EMAIL="your.email@company.com"
112
+ export LANGPROTECT_PASSWORD="your-password"
113
+ ```
114
+
115
+ Reload VS Code and you're done! LangProtect will protect all your workspaces.
116
+
90
117
  ### VS Code Setup (Recommended - No Wrapper Script!)
91
118
 
92
119
  **Step 1:** Add this to your `.vscode/mcp.json`:
@@ -0,0 +1,9 @@
1
+ langprotect_mcp_gateway/__init__.py,sha256=PedabfF6wZ_6KxuN60A4qz8T1gD9MszuXwhmrHlGH7I,510
2
+ langprotect_mcp_gateway/gateway.py,sha256=yViBgOivHJQx99JiTB1O-Q3zHTkDkn7ldzTw7x-BpMQ,18508
3
+ langprotect_mcp_gateway/setup_helper.py,sha256=ghErneMTua9wPATMq8eatnviVAYJMi2bf2UUt8fnXE8,5639
4
+ langprotect_mcp_gateway-1.2.4.dist-info/licenses/LICENSE,sha256=aoVP65gKtirVmFPToow5L9IKN4FNjfM6Sejq_5b4cbM,1082
5
+ langprotect_mcp_gateway-1.2.4.dist-info/METADATA,sha256=CTrmPgGbJC42Wmtzx2iMv4_Nm7nBDsXdHqz2n2y37Fs,10388
6
+ langprotect_mcp_gateway-1.2.4.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
7
+ langprotect_mcp_gateway-1.2.4.dist-info/entry_points.txt,sha256=HpnUUuYLQva8b6gazUX0UJO9dFHq86e9gifQfLKpyWc,140
8
+ langprotect_mcp_gateway-1.2.4.dist-info/top_level.txt,sha256=UjNlX13ma4nwJXuEyi9eMX251c5rooeEao4zajX6ZHk,24
9
+ langprotect_mcp_gateway-1.2.4.dist-info/RECORD,,
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ langprotect-gateway = langprotect_mcp_gateway:main
3
+ langprotect-gateway-setup = langprotect_mcp_gateway.setup_helper:setup
@@ -1,8 +0,0 @@
1
- langprotect_mcp_gateway/__init__.py,sha256=PedabfF6wZ_6KxuN60A4qz8T1gD9MszuXwhmrHlGH7I,510
2
- langprotect_mcp_gateway/gateway.py,sha256=yViBgOivHJQx99JiTB1O-Q3zHTkDkn7ldzTw7x-BpMQ,18508
3
- langprotect_mcp_gateway-1.2.2.dist-info/licenses/LICENSE,sha256=aoVP65gKtirVmFPToow5L9IKN4FNjfM6Sejq_5b4cbM,1082
4
- langprotect_mcp_gateway-1.2.2.dist-info/METADATA,sha256=14NRx8ISFI_RTrak2mUsywtj0LYn87TtgQxPtJSCTZI,9750
5
- langprotect_mcp_gateway-1.2.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
6
- langprotect_mcp_gateway-1.2.2.dist-info/entry_points.txt,sha256=iM5-7ReYo6_nFF-2DHK1cSi1Nj6wGsG4QqJgcNZ7_GE,69
7
- langprotect_mcp_gateway-1.2.2.dist-info/top_level.txt,sha256=UjNlX13ma4nwJXuEyi9eMX251c5rooeEao4zajX6ZHk,24
8
- langprotect_mcp_gateway-1.2.2.dist-info/RECORD,,
@@ -1,2 +0,0 @@
1
- [console_scripts]
2
- langprotect-gateway = langprotect_mcp_gateway:main