langprotect-mcp-gateway 1.1.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.
- langprotect_mcp_gateway/__init__.py +1 -1
- langprotect_mcp_gateway/gateway.py +67 -5
- langprotect_mcp_gateway-1.2.0.dist-info/METADATA +333 -0
- langprotect_mcp_gateway-1.2.0.dist-info/RECORD +8 -0
- langprotect_mcp_gateway-1.1.0.dist-info/METADATA +0 -215
- langprotect_mcp_gateway-1.1.0.dist-info/RECORD +0 -8
- {langprotect_mcp_gateway-1.1.0.dist-info → langprotect_mcp_gateway-1.2.0.dist-info}/WHEEL +0 -0
- {langprotect_mcp_gateway-1.1.0.dist-info → langprotect_mcp_gateway-1.2.0.dist-info}/entry_points.txt +0 -0
- {langprotect_mcp_gateway-1.1.0.dist-info → langprotect_mcp_gateway-1.2.0.dist-info}/licenses/LICENSE +0 -0
- {langprotect_mcp_gateway-1.1.0.dist-info → langprotect_mcp_gateway-1.2.0.dist-info}/top_level.txt +0 -0
|
@@ -150,10 +150,17 @@ class LangProtectAuth:
|
|
|
150
150
|
|
|
151
151
|
class LangProtectGateway:
|
|
152
152
|
def __init__(self, mcp_json_path: Optional[str] = None):
|
|
153
|
+
self.mcp_json_path = mcp_json_path
|
|
154
|
+
|
|
155
|
+
# Load credentials from env vars first, then potentially from config
|
|
153
156
|
self.langprotect_url = os.getenv('LANGPROTECT_URL', 'http://localhost:8000')
|
|
154
157
|
self.email = os.getenv('LANGPROTECT_EMAIL')
|
|
155
158
|
self.password = os.getenv('LANGPROTECT_PASSWORD')
|
|
156
|
-
|
|
159
|
+
|
|
160
|
+
# Try to load credentials from mcp.json env section (like Lasso)
|
|
161
|
+
if mcp_json_path and (not self.email or not self.password):
|
|
162
|
+
self._load_env_from_config(mcp_json_path)
|
|
163
|
+
|
|
157
164
|
self.auth: Optional[LangProtectAuth] = None
|
|
158
165
|
self.mcp_servers: Dict[str, MCPServer] = {}
|
|
159
166
|
self.tool_to_server: Dict[str, str] = {}
|
|
@@ -161,6 +168,30 @@ class LangProtectGateway:
|
|
|
161
168
|
logger.debug(f"LANGPROTECT_URL: {self.langprotect_url}")
|
|
162
169
|
logger.debug(f"LANGPROTECT_EMAIL: {self.email}")
|
|
163
170
|
|
|
171
|
+
def _load_env_from_config(self, path: str):
|
|
172
|
+
"""Load credentials from mcp.json env section (Lasso-style)"""
|
|
173
|
+
try:
|
|
174
|
+
expanded_path = os.path.expanduser(path)
|
|
175
|
+
with open(expanded_path, 'r') as f:
|
|
176
|
+
config = json.load(f)
|
|
177
|
+
|
|
178
|
+
# Look for env vars in the gateway's config section
|
|
179
|
+
mcp_servers = config.get('mcpServers', {})
|
|
180
|
+
for gateway_name in ['langprotect-gateway', 'langprotect', 'mcp-gateway']:
|
|
181
|
+
gateway_config = mcp_servers.get(gateway_name, {})
|
|
182
|
+
env_section = gateway_config.get('env', {})
|
|
183
|
+
if env_section:
|
|
184
|
+
if not self.langprotect_url or self.langprotect_url == 'http://localhost:8000':
|
|
185
|
+
self.langprotect_url = env_section.get('LANGPROTECT_URL', self.langprotect_url)
|
|
186
|
+
if not self.email:
|
|
187
|
+
self.email = env_section.get('LANGPROTECT_EMAIL')
|
|
188
|
+
if not self.password:
|
|
189
|
+
self.password = env_section.get('LANGPROTECT_PASSWORD')
|
|
190
|
+
logger.info(f"Loaded credentials from config env section")
|
|
191
|
+
break
|
|
192
|
+
except Exception as e:
|
|
193
|
+
logger.debug(f"Could not load env from config: {e}")
|
|
194
|
+
|
|
164
195
|
def initialize(self) -> bool:
|
|
165
196
|
if self.email and self.password:
|
|
166
197
|
self.auth = LangProtectAuth(self.langprotect_url, self.email, self.password)
|
|
@@ -182,6 +213,7 @@ class LangProtectGateway:
|
|
|
182
213
|
return True
|
|
183
214
|
|
|
184
215
|
def load_servers(self) -> bool:
|
|
216
|
+
# Mode 1: Single server via environment variables (for wrapper scripts)
|
|
185
217
|
mcp_command = os.getenv('MCP_SERVER_COMMAND')
|
|
186
218
|
mcp_args = os.getenv('MCP_SERVER_ARGS')
|
|
187
219
|
if mcp_command:
|
|
@@ -190,21 +222,51 @@ class LangProtectGateway:
|
|
|
190
222
|
server_name = os.getenv('MCP_SERVER_NAME', 'proxied-server')
|
|
191
223
|
self.mcp_servers[server_name] = MCPServer(server_name, {'command': mcp_command, 'args': args_list, 'env': {}})
|
|
192
224
|
return True
|
|
225
|
+
|
|
226
|
+
# Mode 2: Config file (mcp.json)
|
|
193
227
|
if self.mcp_json_path:
|
|
194
228
|
return self.load_from_mcp_json(self.mcp_json_path)
|
|
229
|
+
|
|
195
230
|
logger.warning("No MCP servers configured")
|
|
196
231
|
return False
|
|
197
232
|
|
|
198
233
|
def load_from_mcp_json(self, path: str) -> bool:
|
|
199
234
|
try:
|
|
200
|
-
|
|
235
|
+
expanded_path = os.path.expanduser(path)
|
|
236
|
+
with open(expanded_path, 'r') as f:
|
|
201
237
|
config = json.load(f)
|
|
202
|
-
|
|
238
|
+
|
|
239
|
+
# Try multiple config structures:
|
|
240
|
+
# 1. Lasso-style: mcpServers.langprotect-gateway.servers (nested)
|
|
241
|
+
# 2. VS Code style: servers (direct)
|
|
242
|
+
# 3. Claude Desktop style: mcpServers (direct)
|
|
243
|
+
|
|
244
|
+
servers = {}
|
|
245
|
+
|
|
246
|
+
# Check for Lasso-style nested config
|
|
247
|
+
mcp_servers = config.get('mcpServers', {})
|
|
248
|
+
for gateway_name in ['langprotect-gateway', 'langprotect', 'mcp-gateway']:
|
|
249
|
+
gateway_config = mcp_servers.get(gateway_name, {})
|
|
250
|
+
if 'servers' in gateway_config:
|
|
251
|
+
servers = gateway_config['servers']
|
|
252
|
+
logger.info(f"Found nested servers config under mcpServers.{gateway_name}.servers")
|
|
253
|
+
break
|
|
254
|
+
|
|
255
|
+
# Fallback to direct config
|
|
203
256
|
if not servers:
|
|
257
|
+
servers = config.get('servers', config.get('mcpServers', {}))
|
|
258
|
+
|
|
259
|
+
if not servers:
|
|
260
|
+
logger.error("No servers found in config file")
|
|
204
261
|
return False
|
|
262
|
+
|
|
205
263
|
for name, cfg in servers.items():
|
|
206
|
-
|
|
207
|
-
|
|
264
|
+
# Skip gateway self-references
|
|
265
|
+
if name in ['langprotect-gateway', 'langprotect', 'mcp-gateway']:
|
|
266
|
+
continue
|
|
267
|
+
self.mcp_servers[name] = MCPServer(name, cfg)
|
|
268
|
+
|
|
269
|
+
logger.info(f"Loaded {len(self.mcp_servers)} servers from config")
|
|
208
270
|
return len(self.mcp_servers) > 0
|
|
209
271
|
except Exception as e:
|
|
210
272
|
logger.error(f"Error loading {path}: {e}")
|
|
@@ -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
|
+
[](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.1.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=tRGe-nBw57h5EtB27h7RrUPcZTzuLylVzl8-REZzzDU,510
|
|
2
|
-
langprotect_mcp_gateway/gateway.py,sha256=Xw88Zo7EXDPyTjX0FJ-txeFqQLlCHmG2lwdSBiYRoIg,14727
|
|
3
|
-
langprotect_mcp_gateway-1.1.0.dist-info/licenses/LICENSE,sha256=aoVP65gKtirVmFPToow5L9IKN4FNjfM6Sejq_5b4cbM,1082
|
|
4
|
-
langprotect_mcp_gateway-1.1.0.dist-info/METADATA,sha256=XtdiT6OJnC_U-6bZ53NoNug3F21FJgRW_IZd7oQopJk,6152
|
|
5
|
-
langprotect_mcp_gateway-1.1.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
6
|
-
langprotect_mcp_gateway-1.1.0.dist-info/entry_points.txt,sha256=iM5-7ReYo6_nFF-2DHK1cSi1Nj6wGsG4QqJgcNZ7_GE,69
|
|
7
|
-
langprotect_mcp_gateway-1.1.0.dist-info/top_level.txt,sha256=UjNlX13ma4nwJXuEyi9eMX251c5rooeEao4zajX6ZHk,24
|
|
8
|
-
langprotect_mcp_gateway-1.1.0.dist-info/RECORD,,
|
|
File without changes
|
{langprotect_mcp_gateway-1.1.0.dist-info → langprotect_mcp_gateway-1.2.0.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{langprotect_mcp_gateway-1.1.0.dist-info → langprotect_mcp_gateway-1.2.0.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{langprotect_mcp_gateway-1.1.0.dist-info → langprotect_mcp_gateway-1.2.0.dist-info}/top_level.txt
RENAMED
|
File without changes
|