langprotect-mcp-gateway 1.0.0__py3-none-any.whl → 1.2.0__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,333 @@
1
+ Metadata-Version: 2.4
2
+ Name: langprotect-mcp-gateway
3
+ Version: 1.2.0
4
+ Summary: Security gateway for Model Context Protocol (MCP) to protect AI tool interactions
5
+ Author-email: LangProtect Security Team <security@langprotect.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://langprotect.com
8
+ Project-URL: Documentation, https://docs.langprotect.com
9
+ Project-URL: Repository, https://github.com/langprotect/mcp-gateway
10
+ Project-URL: Issues, https://github.com/langprotect/mcp-gateway/issues
11
+ Keywords: mcp,security,ai-security,langprotect,model-context-protocol
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Topic :: Security
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Requires-Python: >=3.8
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: requests>=2.31.0
23
+ Provides-Extra: dev
24
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
25
+ Requires-Dist: black>=23.0.0; extra == "dev"
26
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
27
+ Dynamic: license-file
28
+
29
+ # LangProtect MCP Gateway
30
+
31
+ 🛡️ **Security gateway for Model Context Protocol (MCP)** - Protect your AI tool interactions from security threats.
32
+
33
+ [![PyPI version](https://badge.fury.io/py/langprotect-mcp-gateway.svg)](https://pypi.org/project/langprotect-mcp-gateway/)
34
+
35
+ ## Features
36
+
37
+ ✅ **Automatic Threat Detection** - Scans all MCP requests for security risks
38
+ ✅ **Access Control** - Whitelist/blacklist MCP servers and tools
39
+ ✅ **Full Audit Trail** - Logs all AI interactions for compliance
40
+ ✅ **IDE Support** - Works with VS Code, Cursor, and all MCP-compatible IDEs
41
+ ✅ **Easy Setup** - 30-second installation
42
+ ✅ **Fail-Open Design** - Won't block your workflow if backend is unavailable
43
+
44
+ ## Quick Start
45
+
46
+ ### Installation
47
+
48
+ The gateway runs as a global CLI tool. Choose your platform:
49
+
50
+ #### Linux (Debian/Ubuntu) - Recommended: pipx
51
+
52
+ ```bash
53
+ # Install pipx (one time)
54
+ sudo apt install pipx -y
55
+ pipx ensurepath
56
+
57
+ # Install the gateway
58
+ pipx install langprotect-mcp-gateway
59
+ ```
60
+
61
+ #### macOS - Recommended: pipx
62
+
63
+ ```bash
64
+ # Install pipx via Homebrew
65
+ brew install pipx
66
+ pipx ensurepath
67
+
68
+ # Install the gateway
69
+ pipx install langprotect-mcp-gateway
70
+ ```
71
+
72
+ #### Windows
73
+
74
+ ```bash
75
+ # Option 1: pipx (recommended)
76
+ pip install pipx
77
+ pipx install langprotect-mcp-gateway
78
+
79
+ # Option 2: User install
80
+ pip install --user langprotect-mcp-gateway
81
+ ```
82
+
83
+ #### Verify Installation
84
+
85
+ ```bash
86
+ which langprotect-gateway # Should show: ~/.local/bin/langprotect-gateway
87
+ langprotect-gateway --help # Should show usage info
88
+ ```
89
+
90
+ ### VS Code Setup (Recommended - No Wrapper Script!)
91
+
92
+ Just add this to your `.vscode/mcp.json`:
93
+
94
+ ```json
95
+ {
96
+ "mcpServers": {
97
+ "langprotect-gateway": {
98
+ "command": "langprotect-gateway",
99
+ "args": ["--mcp-json-path", "${workspaceFolder}/.vscode/mcp.json"],
100
+ "env": {
101
+ "LANGPROTECT_URL": "http://localhost:8000",
102
+ "LANGPROTECT_EMAIL": "your.email@company.com",
103
+ "LANGPROTECT_PASSWORD": "your-password"
104
+ },
105
+ "servers": {
106
+ "filesystem": {
107
+ "command": "npx",
108
+ "args": ["-y", "@modelcontextprotocol/server-filesystem", "."]
109
+ }
110
+ }
111
+ }
112
+ }
113
+ }
114
+ ```
115
+
116
+ That's it! VS Code will:
117
+ 1. Start the gateway with your credentials
118
+ 2. Gateway reads the `servers` section and proxies those MCP servers
119
+ 3. All tool calls get logged to LangProtect
120
+
121
+ ### Alternative: Wrapper Script Setup
122
+
123
+ If you prefer using a wrapper script (useful for shared configs):
124
+
125
+ 1. Create a wrapper script (e.g., `langprotect-wrapper.sh`):
126
+
127
+ ```bash
128
+ #!/bin/bash
129
+ export LANGPROTECT_URL="http://localhost:8000" # Your LangProtect backend
130
+ export LANGPROTECT_EMAIL="your.email@company.com"
131
+ export LANGPROTECT_PASSWORD="your-password"
132
+ export MCP_SERVER_COMMAND="npx"
133
+ export MCP_SERVER_ARGS="-y,@modelcontextprotocol/server-filesystem,/path/to/allowed/dir"
134
+
135
+ exec langprotect-gateway "$@"
136
+ ```
137
+
138
+ 2. Make it executable: `chmod +x langprotect-wrapper.sh`
139
+
140
+ 3. Create `.vscode/mcp.json`:
141
+
142
+ ```json
143
+ {
144
+ "servers": {
145
+ "langprotect-filesystem": {
146
+ "type": "stdio",
147
+ "command": "/path/to/langprotect-wrapper.sh",
148
+ "args": []
149
+ }
150
+ }
151
+ }
152
+ ```
153
+
154
+ 4. Reload VS Code: `Ctrl+Shift+P` → "Developer: Reload Window"
155
+
156
+ 5. Start the server: `Ctrl+Shift+P` → "MCP: List Servers" → Click "Start"
157
+
158
+ ### Cursor Setup
159
+
160
+ ```json
161
+ {
162
+ "mcpServers": {
163
+ "langprotect-gateway": {
164
+ "command": "langprotect-gateway",
165
+ "args": ["--mcp-json-path", "~/.cursor/mcp.json"],
166
+ "env": {
167
+ "LANGPROTECT_URL": "http://localhost:8000",
168
+ "LANGPROTECT_EMAIL": "your.email@company.com",
169
+ "LANGPROTECT_PASSWORD": "your-password"
170
+ },
171
+ "servers": {
172
+ "filesystem": {
173
+ "command": "npx",
174
+ "args": ["-y", "@modelcontextprotocol/server-filesystem", "."]
175
+ }
176
+ }
177
+ }
178
+ }
179
+ }
180
+ ```
181
+
182
+ ### Claude Desktop Setup
183
+
184
+ Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
185
+
186
+ ```json
187
+ {
188
+ "mcpServers": {
189
+ "langprotect-gateway": {
190
+ "command": "langprotect-gateway",
191
+ "args": ["--mcp-json-path", "~/Library/Application Support/Claude/claude_desktop_config.json"],
192
+ "env": {
193
+ "LANGPROTECT_URL": "http://localhost:8000",
194
+ "LANGPROTECT_EMAIL": "your.email@company.com",
195
+ "LANGPROTECT_PASSWORD": "your-password"
196
+ },
197
+ "servers": {
198
+ "filesystem": {
199
+ "command": "npx",
200
+ "args": ["-y", "@modelcontextprotocol/server-filesystem", "."]
201
+ }
202
+ }
203
+ }
204
+ }
205
+ }
206
+ ```
207
+
208
+ ## How It Works
209
+
210
+ ```
211
+ ┌─────────────┐ ┌────────────────────┐ ┌──────────────────┐
212
+ │ VS Code │────▶│ LangProtect Gateway│────▶│ Filesystem MCP │
213
+ │ (Copilot) │ │ (Security Scan) │ │ Server │
214
+ └─────────────┘ └────────────────────┘ └──────────────────┘
215
+
216
+
217
+ ┌────────────────────┐
218
+ │ LangProtect Backend│
219
+ │ (Policy Check) │
220
+ └────────────────────┘
221
+ ```
222
+
223
+ 1. **Intercepts** all MCP tool calls from your AI assistant
224
+ 2. **Sends** each request to LangProtect backend for security scanning
225
+ 3. **Blocks** requests that violate your security policies
226
+ 4. **Forwards** allowed requests to the actual MCP server
227
+ 5. **Logs** everything for audit trail
228
+
229
+ LangProtect Gateway (this package)
230
+
231
+ [Security Scan]
232
+
233
+ MCP Servers (filesystem, github, etc.)
234
+ ```
235
+
236
+ Every request is:
237
+ 1. Intercepted by the gateway
238
+ 2. Scanned for security threats
239
+ 3. Logged to LangProtect backend
240
+ 4. Forwarded to actual MCP server (if safe)
241
+ 5. Response returned to AI
242
+
243
+ ## Dashboard
244
+
245
+ Monitor all activity at your LangProtect dashboard:
246
+ - View all AI interactions
247
+ - See security threats blocked
248
+ - Track IDE usage
249
+ - Generate compliance reports
250
+
251
+ ## Security
252
+
253
+ The gateway protects against:
254
+ - 🚫 Sensitive file access (`.env`, SSH keys, etc.)
255
+ - 🚫 Dangerous commands (`rm -rf`, data exfiltration)
256
+ - 🚫 SQL injection patterns
257
+ - 🚫 Hardcoded credentials in suggestions
258
+ - 🚫 Prompt injection attacks
259
+
260
+ ## Troubleshooting
261
+
262
+ **"externally-managed-environment" error on Linux:**
263
+ - Modern Linux systems protect system Python. Use `pipx` instead:
264
+ ```bash
265
+ sudo apt install pipx -y
266
+ pipx install langprotect-mcp-gateway
267
+ ```
268
+
269
+ **Authentication failed:**
270
+ - Check `LANGPROTECT_URL`, `LANGPROTECT_EMAIL`, `LANGPROTECT_PASSWORD` are correct
271
+ - Ensure LangProtect backend is accessible
272
+
273
+ **Gateway not starting:**
274
+ - Check Python version: `python3 --version` (need 3.8+)
275
+ - Check package installed: `pipx list | grep langprotect`
276
+ - Verify path: `which langprotect-gateway`
277
+
278
+ **Tools not working:**
279
+ - Check MCP servers are configured under `"servers"` section
280
+ - Restart IDE completely
281
+
282
+ **Command not found after install:**
283
+ - Run `pipx ensurepath` and restart your terminal
284
+ - Or add `~/.local/bin` to your PATH manually
285
+
286
+ ## For Team Leads
287
+
288
+ ### Quick Team Rollout:
289
+
290
+ 1. **Share credentials** with each team member:
291
+ ```
292
+ Email: user@company.com
293
+ Password: secure-password
294
+ Server: http://langprotect.company.com:8000
295
+ ```
296
+
297
+ 2. **Team members install:**
298
+ ```bash
299
+ # Linux/macOS
300
+ sudo apt install pipx -y # or: brew install pipx
301
+ pipx install langprotect-mcp-gateway
302
+
303
+ # Configure mcp.json with credentials
304
+ # Restart IDE
305
+ ```
306
+
307
+ 3. **Monitor dashboard:** See all team activity in real-time
308
+
309
+ ## Updates
310
+
311
+ ```bash
312
+ # Upgrade with pipx
313
+ pipx upgrade langprotect-mcp-gateway
314
+
315
+ # Or reinstall specific version
316
+ pipx install langprotect-mcp-gateway==1.1.0 --force
317
+ ```
318
+
319
+ ## Support
320
+
321
+ - **Documentation:** https://docs.langprotect.com
322
+ - **Issues:** https://github.com/langprotect/mcp-gateway/issues
323
+ - **Security:** security@langprotect.com
324
+
325
+ ## License
326
+
327
+ MIT License - see LICENSE file for details
328
+
329
+ ## Links
330
+
331
+ - **Homepage:** https://langprotect.com
332
+ - **GitHub:** https://github.com/langprotect/mcp-gateway
333
+ - **Documentation:** https://docs.langprotect.com
@@ -0,0 +1,8 @@
1
+ langprotect_mcp_gateway/__init__.py,sha256=zci-MauGyCKv6bMWizCKd-CkrVaAft57ia8kzdTflEY,510
2
+ langprotect_mcp_gateway/gateway.py,sha256=fFliQVSxV8ZCOO4vg0Y466BYlRnKKI1XQlT6P_VHmQ4,17660
3
+ langprotect_mcp_gateway-1.2.0.dist-info/licenses/LICENSE,sha256=aoVP65gKtirVmFPToow5L9IKN4FNjfM6Sejq_5b4cbM,1082
4
+ langprotect_mcp_gateway-1.2.0.dist-info/METADATA,sha256=Nno8XPMpwwvJn7HoQKd27EDxXzXQyaj6by4gxpd_Y7M,9452
5
+ langprotect_mcp_gateway-1.2.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
6
+ langprotect_mcp_gateway-1.2.0.dist-info/entry_points.txt,sha256=iM5-7ReYo6_nFF-2DHK1cSi1Nj6wGsG4QqJgcNZ7_GE,69
7
+ langprotect_mcp_gateway-1.2.0.dist-info/top_level.txt,sha256=UjNlX13ma4nwJXuEyi9eMX251c5rooeEao4zajX6ZHk,24
8
+ langprotect_mcp_gateway-1.2.0.dist-info/RECORD,,
@@ -1,215 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: langprotect-mcp-gateway
3
- Version: 1.0.0
4
- Summary: Security gateway for Model Context Protocol (MCP) to protect AI tool interactions
5
- Author-email: LangProtect Security Team <security@langprotect.com>
6
- License: MIT
7
- Project-URL: Homepage, https://langprotect.com
8
- Project-URL: Documentation, https://docs.langprotect.com
9
- Project-URL: Repository, https://github.com/langprotect/mcp-gateway
10
- Project-URL: Issues, https://github.com/langprotect/mcp-gateway/issues
11
- Keywords: mcp,security,ai-security,langprotect,model-context-protocol
12
- Classifier: Development Status :: 5 - Production/Stable
13
- Classifier: Intended Audience :: Developers
14
- Classifier: Topic :: Security
15
- Classifier: License :: OSI Approved :: MIT License
16
- Classifier: Programming Language :: Python :: 3
17
- Classifier: Programming Language :: Python :: 3.11
18
- Classifier: Programming Language :: Python :: 3.12
19
- Requires-Python: >=3.11
20
- Description-Content-Type: text/markdown
21
- License-File: LICENSE
22
- Requires-Dist: requests>=2.31.0
23
- Provides-Extra: dev
24
- Requires-Dist: pytest>=7.0.0; extra == "dev"
25
- Requires-Dist: black>=23.0.0; extra == "dev"
26
- Requires-Dist: mypy>=1.0.0; extra == "dev"
27
- Dynamic: license-file
28
-
29
- # LangProtect MCP Gateway
30
-
31
- 🛡️ **Security gateway for Model Context Protocol (MCP)** - Protect your AI tool interactions from security threats.
32
-
33
- ## Features
34
-
35
- ✅ **Automatic Threat Detection** - Scans all MCP requests for security risks
36
- ✅ **Access Control** - Whitelist/blacklist MCP servers and tools
37
- ✅ **Full Audit Trail** - Logs all AI interactions for compliance
38
- ✅ **IDE Support** - Works with VS Code, Cursor, and all MCP-compatible IDEs
39
- ✅ **Easy Setup** - 30-second installation
40
-
41
- ## Quick Start
42
-
43
- ### Installation
44
-
45
- ```bash
46
- pip install langprotect-mcp-gateway
47
- ```
48
-
49
- ### Configuration
50
-
51
- Create your MCP config file:
52
-
53
- **VS Code:** `~/.config/Code/User/mcp.json`
54
- **Cursor:** `~/.cursor/mcp.json`
55
-
56
- ```json
57
- {
58
- "mcpServers": {
59
- "langprotect-gateway": {
60
- "command": "langprotect-gateway",
61
- "env": {
62
- "LANGPROTECT_URL": "https://your-langprotect-server.com",
63
- "LANGPROTECT_EMAIL": "your.email@company.com",
64
- "LANGPROTECT_PASSWORD": "your-password"
65
- },
66
- "servers": {
67
- "filesystem": {
68
- "command": "npx",
69
- "args": ["-y", "@modelcontextprotocol/server-filesystem", "."]
70
- }
71
- }
72
- }
73
- }
74
- }
75
- ```
76
-
77
- 📝 **Note:** Replace `LANGPROTECT_URL` with your actual server URL (e.g., `https://langprotect.yourcompany.com` or `http://localhost:8000` for local testing).
78
-
79
- ### Restart Your IDE
80
-
81
- **VS Code:** `Ctrl+Shift+P` → "Reload Window"
82
- **Cursor:** Close and reopen
83
-
84
- Done! 🎉 All your AI tool interactions are now protected.
85
-
86
- ## What It Does
87
-
88
- The LangProtect MCP Gateway intercepts all AI tool interactions and:
89
-
90
- 1. **Scans for threats** - Detects malicious commands, data exfiltration attempts
91
- 2. **Enforces policies** - Blocks access to sensitive files and dangerous operations
92
- 3. **Logs everything** - Complete audit trail for compliance
93
- 4. **Auto-detects IDE** - Tracks which IDE/tool made each request
94
-
95
- ## Supported IDEs
96
-
97
- - ✅ VS Code (with GitHub Copilot, Codeium, etc.)
98
- - ✅ Cursor IDE
99
- - ✅ Windsurf
100
- - ✅ Zed Editor
101
- - ✅ Any MCP-compatible IDE
102
-
103
- ## Environment Variables
104
-
105
- | Variable | Required | Default | Description |
106
- |----------|----------|---------|-------------|
107
- | `LANGPROTECT_URL` | No | `http://localhost:8000` | Your LangProtect server URL |
108
- | `LANGPROTECT_EMAIL` | **Yes** | - | Your email address |
109
- | `LANGPROTECT_PASSWORD` | **Yes** | - | Your password |
110
- | `DEBUG` | No | `false` | Enable debug logging (true/false) |
111
- | `MCP_CONFIG_PATH` | No | Auto-detected | Path to servers config (Cursor only) |
112
-
113
- ⚠️ **Production Setup:** For production deployments, always set `LANGPROTECT_URL` to your actual server:
114
-
115
- ```json
116
- "env": {
117
- "LANGPROTECT_URL": "https://langprotect.yourcompany.com",
118
- "LANGPROTECT_EMAIL": "your.email@company.com",
119
- "LANGPROTECT_PASSWORD": "your-password"
120
- }
121
- ```
122
-
123
- The default `http://localhost:8000` is only for local development/testing.
124
-
125
- ## Architecture
126
-
127
- ```
128
- AI Assistant (Copilot, etc.)
129
-
130
- LangProtect Gateway (this package)
131
-
132
- [Security Scan]
133
-
134
- MCP Servers (filesystem, github, etc.)
135
- ```
136
-
137
- Every request is:
138
- 1. Intercepted by the gateway
139
- 2. Scanned for security threats
140
- 3. Logged to LangProtect backend
141
- 4. Forwarded to actual MCP server (if safe)
142
- 5. Response returned to AI
143
-
144
- ## Dashboard
145
-
146
- Monitor all activity at your LangProtect dashboard:
147
- - View all AI interactions
148
- - See security threats blocked
149
- - Track IDE usage
150
- - Generate compliance reports
151
-
152
- ## Security
153
-
154
- The gateway protects against:
155
- - 🚫 Sensitive file access (`.env`, SSH keys, etc.)
156
- - 🚫 Dangerous commands (`rm -rf`, data exfiltration)
157
- - 🚫 SQL injection patterns
158
- - 🚫 Hardcoded credentials in suggestions
159
- - 🚫 Prompt injection attacks
160
-
161
- ## Troubleshooting
162
-
163
- **Authentication failed:**
164
- - Check `LANGPROTECT_URL`, `LANGPROTECT_EMAIL`, `LANGPROTECT_PASSWORD` are correct
165
- - Ensure LangProtect backend is accessible
166
-
167
- **Gateway not starting:**
168
- - Check Python version: `python3 --version` (need 3.11+)
169
- - Check package installed: `pip show langprotect-mcp-gateway`
170
-
171
- **Tools not working:**
172
- - Check MCP servers are configured under `"servers"` section
173
- - Restart IDE completely
174
-
175
- ## For Team Leads
176
-
177
- ### Quick Team Rollout:
178
-
179
- 1. **Share credentials** with each team member:
180
- ```
181
- Email: user@company.com
182
- Password: secure-password
183
- Server: http://langprotect.company.com:8000
184
- ```
185
-
186
- 2. **Team members install:**
187
- ```bash
188
- pip install langprotect-mcp-gateway
189
- # Configure mcp.json with credentials
190
- # Restart IDE
191
- ```
192
-
193
- 3. **Monitor dashboard:** See all team activity in real-time
194
-
195
- ## Updates
196
-
197
- ```bash
198
- pip install --upgrade langprotect-mcp-gateway
199
- ```
200
-
201
- ## Support
202
-
203
- - **Documentation:** https://docs.langprotect.com
204
- - **Issues:** https://github.com/langprotect/mcp-gateway/issues
205
- - **Security:** security@langprotect.com
206
-
207
- ## License
208
-
209
- MIT License - see LICENSE file for details
210
-
211
- ## Links
212
-
213
- - **Homepage:** https://langprotect.com
214
- - **GitHub:** https://github.com/langprotect/mcp-gateway
215
- - **Documentation:** https://docs.langprotect.com
@@ -1,8 +0,0 @@
1
- langprotect_mcp_gateway/__init__.py,sha256=RAVgb8Z_PR2GkmgpAok9G1LCtcSsOarmb01j1pO6asc,510
2
- langprotect_mcp_gateway/gateway.py,sha256=72D-rGfOU-BRzSGdEnCjVGNP1OoSr9wBCFx7Kjzq1_c,19901
3
- langprotect_mcp_gateway-1.0.0.dist-info/licenses/LICENSE,sha256=aoVP65gKtirVmFPToow5L9IKN4FNjfM6Sejq_5b4cbM,1082
4
- langprotect_mcp_gateway-1.0.0.dist-info/METADATA,sha256=s97MVu9Zj70QhxXH-sszyxyvSeYkXdc_ICa9cN4xyw4,6152
5
- langprotect_mcp_gateway-1.0.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
6
- langprotect_mcp_gateway-1.0.0.dist-info/entry_points.txt,sha256=iM5-7ReYo6_nFF-2DHK1cSi1Nj6wGsG4QqJgcNZ7_GE,69
7
- langprotect_mcp_gateway-1.0.0.dist-info/top_level.txt,sha256=UjNlX13ma4nwJXuEyi9eMX251c5rooeEao4zajX6ZHk,24
8
- langprotect_mcp_gateway-1.0.0.dist-info/RECORD,,