langprotect-mcp-gateway 1.0.0__tar.gz → 1.2.0__tar.gz

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,305 @@
1
+ # LangProtect MCP Gateway
2
+
3
+ 🛡️ **Security gateway for Model Context Protocol (MCP)** - Protect your AI tool interactions from security threats.
4
+
5
+ [![PyPI version](https://badge.fury.io/py/langprotect-mcp-gateway.svg)](https://pypi.org/project/langprotect-mcp-gateway/)
6
+
7
+ ## Features
8
+
9
+ ✅ **Automatic Threat Detection** - Scans all MCP requests for security risks
10
+ ✅ **Access Control** - Whitelist/blacklist MCP servers and tools
11
+ ✅ **Full Audit Trail** - Logs all AI interactions for compliance
12
+ ✅ **IDE Support** - Works with VS Code, Cursor, and all MCP-compatible IDEs
13
+ ✅ **Easy Setup** - 30-second installation
14
+ ✅ **Fail-Open Design** - Won't block your workflow if backend is unavailable
15
+
16
+ ## Quick Start
17
+
18
+ ### Installation
19
+
20
+ The gateway runs as a global CLI tool. Choose your platform:
21
+
22
+ #### Linux (Debian/Ubuntu) - Recommended: pipx
23
+
24
+ ```bash
25
+ # Install pipx (one time)
26
+ sudo apt install pipx -y
27
+ pipx ensurepath
28
+
29
+ # Install the gateway
30
+ pipx install langprotect-mcp-gateway
31
+ ```
32
+
33
+ #### macOS - Recommended: pipx
34
+
35
+ ```bash
36
+ # Install pipx via Homebrew
37
+ brew install pipx
38
+ pipx ensurepath
39
+
40
+ # Install the gateway
41
+ pipx install langprotect-mcp-gateway
42
+ ```
43
+
44
+ #### Windows
45
+
46
+ ```bash
47
+ # Option 1: pipx (recommended)
48
+ pip install pipx
49
+ pipx install langprotect-mcp-gateway
50
+
51
+ # Option 2: User install
52
+ pip install --user langprotect-mcp-gateway
53
+ ```
54
+
55
+ #### Verify Installation
56
+
57
+ ```bash
58
+ which langprotect-gateway # Should show: ~/.local/bin/langprotect-gateway
59
+ langprotect-gateway --help # Should show usage info
60
+ ```
61
+
62
+ ### VS Code Setup (Recommended - No Wrapper Script!)
63
+
64
+ Just add this to your `.vscode/mcp.json`:
65
+
66
+ ```json
67
+ {
68
+ "mcpServers": {
69
+ "langprotect-gateway": {
70
+ "command": "langprotect-gateway",
71
+ "args": ["--mcp-json-path", "${workspaceFolder}/.vscode/mcp.json"],
72
+ "env": {
73
+ "LANGPROTECT_URL": "http://localhost:8000",
74
+ "LANGPROTECT_EMAIL": "your.email@company.com",
75
+ "LANGPROTECT_PASSWORD": "your-password"
76
+ },
77
+ "servers": {
78
+ "filesystem": {
79
+ "command": "npx",
80
+ "args": ["-y", "@modelcontextprotocol/server-filesystem", "."]
81
+ }
82
+ }
83
+ }
84
+ }
85
+ }
86
+ ```
87
+
88
+ That's it! VS Code will:
89
+ 1. Start the gateway with your credentials
90
+ 2. Gateway reads the `servers` section and proxies those MCP servers
91
+ 3. All tool calls get logged to LangProtect
92
+
93
+ ### Alternative: Wrapper Script Setup
94
+
95
+ If you prefer using a wrapper script (useful for shared configs):
96
+
97
+ 1. Create a wrapper script (e.g., `langprotect-wrapper.sh`):
98
+
99
+ ```bash
100
+ #!/bin/bash
101
+ export LANGPROTECT_URL="http://localhost:8000" # Your LangProtect backend
102
+ export LANGPROTECT_EMAIL="your.email@company.com"
103
+ export LANGPROTECT_PASSWORD="your-password"
104
+ export MCP_SERVER_COMMAND="npx"
105
+ export MCP_SERVER_ARGS="-y,@modelcontextprotocol/server-filesystem,/path/to/allowed/dir"
106
+
107
+ exec langprotect-gateway "$@"
108
+ ```
109
+
110
+ 2. Make it executable: `chmod +x langprotect-wrapper.sh`
111
+
112
+ 3. Create `.vscode/mcp.json`:
113
+
114
+ ```json
115
+ {
116
+ "servers": {
117
+ "langprotect-filesystem": {
118
+ "type": "stdio",
119
+ "command": "/path/to/langprotect-wrapper.sh",
120
+ "args": []
121
+ }
122
+ }
123
+ }
124
+ ```
125
+
126
+ 4. Reload VS Code: `Ctrl+Shift+P` → "Developer: Reload Window"
127
+
128
+ 5. Start the server: `Ctrl+Shift+P` → "MCP: List Servers" → Click "Start"
129
+
130
+ ### Cursor Setup
131
+
132
+ ```json
133
+ {
134
+ "mcpServers": {
135
+ "langprotect-gateway": {
136
+ "command": "langprotect-gateway",
137
+ "args": ["--mcp-json-path", "~/.cursor/mcp.json"],
138
+ "env": {
139
+ "LANGPROTECT_URL": "http://localhost:8000",
140
+ "LANGPROTECT_EMAIL": "your.email@company.com",
141
+ "LANGPROTECT_PASSWORD": "your-password"
142
+ },
143
+ "servers": {
144
+ "filesystem": {
145
+ "command": "npx",
146
+ "args": ["-y", "@modelcontextprotocol/server-filesystem", "."]
147
+ }
148
+ }
149
+ }
150
+ }
151
+ }
152
+ ```
153
+
154
+ ### Claude Desktop Setup
155
+
156
+ Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
157
+
158
+ ```json
159
+ {
160
+ "mcpServers": {
161
+ "langprotect-gateway": {
162
+ "command": "langprotect-gateway",
163
+ "args": ["--mcp-json-path", "~/Library/Application Support/Claude/claude_desktop_config.json"],
164
+ "env": {
165
+ "LANGPROTECT_URL": "http://localhost:8000",
166
+ "LANGPROTECT_EMAIL": "your.email@company.com",
167
+ "LANGPROTECT_PASSWORD": "your-password"
168
+ },
169
+ "servers": {
170
+ "filesystem": {
171
+ "command": "npx",
172
+ "args": ["-y", "@modelcontextprotocol/server-filesystem", "."]
173
+ }
174
+ }
175
+ }
176
+ }
177
+ }
178
+ ```
179
+
180
+ ## How It Works
181
+
182
+ ```
183
+ ┌─────────────┐ ┌────────────────────┐ ┌──────────────────┐
184
+ │ VS Code │────▶│ LangProtect Gateway│────▶│ Filesystem MCP │
185
+ │ (Copilot) │ │ (Security Scan) │ │ Server │
186
+ └─────────────┘ └────────────────────┘ └──────────────────┘
187
+
188
+
189
+ ┌────────────────────┐
190
+ │ LangProtect Backend│
191
+ │ (Policy Check) │
192
+ └────────────────────┘
193
+ ```
194
+
195
+ 1. **Intercepts** all MCP tool calls from your AI assistant
196
+ 2. **Sends** each request to LangProtect backend for security scanning
197
+ 3. **Blocks** requests that violate your security policies
198
+ 4. **Forwards** allowed requests to the actual MCP server
199
+ 5. **Logs** everything for audit trail
200
+
201
+ LangProtect Gateway (this package)
202
+
203
+ [Security Scan]
204
+
205
+ MCP Servers (filesystem, github, etc.)
206
+ ```
207
+
208
+ Every request is:
209
+ 1. Intercepted by the gateway
210
+ 2. Scanned for security threats
211
+ 3. Logged to LangProtect backend
212
+ 4. Forwarded to actual MCP server (if safe)
213
+ 5. Response returned to AI
214
+
215
+ ## Dashboard
216
+
217
+ Monitor all activity at your LangProtect dashboard:
218
+ - View all AI interactions
219
+ - See security threats blocked
220
+ - Track IDE usage
221
+ - Generate compliance reports
222
+
223
+ ## Security
224
+
225
+ The gateway protects against:
226
+ - 🚫 Sensitive file access (`.env`, SSH keys, etc.)
227
+ - 🚫 Dangerous commands (`rm -rf`, data exfiltration)
228
+ - 🚫 SQL injection patterns
229
+ - 🚫 Hardcoded credentials in suggestions
230
+ - 🚫 Prompt injection attacks
231
+
232
+ ## Troubleshooting
233
+
234
+ **"externally-managed-environment" error on Linux:**
235
+ - Modern Linux systems protect system Python. Use `pipx` instead:
236
+ ```bash
237
+ sudo apt install pipx -y
238
+ pipx install langprotect-mcp-gateway
239
+ ```
240
+
241
+ **Authentication failed:**
242
+ - Check `LANGPROTECT_URL`, `LANGPROTECT_EMAIL`, `LANGPROTECT_PASSWORD` are correct
243
+ - Ensure LangProtect backend is accessible
244
+
245
+ **Gateway not starting:**
246
+ - Check Python version: `python3 --version` (need 3.8+)
247
+ - Check package installed: `pipx list | grep langprotect`
248
+ - Verify path: `which langprotect-gateway`
249
+
250
+ **Tools not working:**
251
+ - Check MCP servers are configured under `"servers"` section
252
+ - Restart IDE completely
253
+
254
+ **Command not found after install:**
255
+ - Run `pipx ensurepath` and restart your terminal
256
+ - Or add `~/.local/bin` to your PATH manually
257
+
258
+ ## For Team Leads
259
+
260
+ ### Quick Team Rollout:
261
+
262
+ 1. **Share credentials** with each team member:
263
+ ```
264
+ Email: user@company.com
265
+ Password: secure-password
266
+ Server: http://langprotect.company.com:8000
267
+ ```
268
+
269
+ 2. **Team members install:**
270
+ ```bash
271
+ # Linux/macOS
272
+ sudo apt install pipx -y # or: brew install pipx
273
+ pipx install langprotect-mcp-gateway
274
+
275
+ # Configure mcp.json with credentials
276
+ # Restart IDE
277
+ ```
278
+
279
+ 3. **Monitor dashboard:** See all team activity in real-time
280
+
281
+ ## Updates
282
+
283
+ ```bash
284
+ # Upgrade with pipx
285
+ pipx upgrade langprotect-mcp-gateway
286
+
287
+ # Or reinstall specific version
288
+ pipx install langprotect-mcp-gateway==1.1.0 --force
289
+ ```
290
+
291
+ ## Support
292
+
293
+ - **Documentation:** https://docs.langprotect.com
294
+ - **Issues:** https://github.com/langprotect/mcp-gateway/issues
295
+ - **Security:** security@langprotect.com
296
+
297
+ ## License
298
+
299
+ MIT License - see LICENSE file for details
300
+
301
+ ## Links
302
+
303
+ - **Homepage:** https://langprotect.com
304
+ - **GitHub:** https://github.com/langprotect/mcp-gateway
305
+ - **Documentation:** https://docs.langprotect.com
@@ -14,7 +14,7 @@ Or via command line:
14
14
  langprotect-gateway
15
15
  """
16
16
 
17
- __version__ = '1.0.0'
17
+ __version__ = '1.2.0'
18
18
  __author__ = 'LangProtect Security Team'
19
19
  __license__ = 'MIT'
20
20