Secure execution layer for LLM/MCP agents
Project description
๐ก๏ธ Secure-MCP
Secure execution layer for LLM/MCP agents โ safely integrate agents without exposing
.env, secrets, or sensitive system files.
๐ What is Secure-MCP?
Secure-MCP is a security-focused middleware framework that wraps around your MCP (Multi-Component Prompting) or LLM Agent systems to ensure that:
- ๐ซ
.env,API keys, system files, and private configs are not accessible by agent logic. - โ MCP/agent systems can still safely perform operations, such as calling APIs or retrieving tokens, via a secure proxy.
- ๐ง It supports LLM workflows, agent frameworks (like LangChain, AutoGen, CrewAI), and context-based tools โ without compromising security.
๐งฑ Key Features
| Feature | Description |
|---|---|
| ๐ SecureEnvBridge | Only whitelisted env variables can be accessed; .env is not directly exposed |
| ๐ File Access Control | Blocks file reads like .env, secret.pem, key.json, config.yaml etc. |
| ๐ฆ Secure Function Proxy | Sensitive operations are abstracted into secured callable functions |
| ๐ Audit Logging | Logs all attempts to access sensitive resources |
| ๐งช Sandboxed Execution | Optionally runs MCP code in an isolated environment (e.g., Docker, WASM) |
| โ๏ธ Framework Agnostic | Easy to plug into any agent system or LLM pipeline |
๐งฐ Example Use Case
from secure_mcp.secure_env_bridge import secure_get, secure_open
# Only whitelisted environment variables are allowed
api_key = secure_get("SERVICE_AUTH_TOKEN") # โ
allowed
db_pw = secure_get("DB_PASSWORD") # โ blocked
# Safe file open (blocks sensitive files)
with secure_open("safe_data.csv") as f:
content = f.read()
Use SecureEnvBridge instead of os.getenv() and open() to ensure safety.
๐ง Installation
git clone https://github.com/yourname/secure-mcp.git
cd secure-mcp
pip install -e .
You may also package it via setup.py or pyproject.toml for internal PyPI deployment.
๐ ๏ธ Architecture
[ User Input / Agent Task ]
โ
[ SecureContextExecutor ]
โ
[ SecureEnvBridge / FileGuard ]
โ
[ External API, File, or Memory Access ]
โ
[ LLM Agent Response ]
- MCP doesn't need to know the secrets.
- SecureEnvBridge acts like a vault-aware delegate.
- Every access is controlled, logged, and filtered.
๐ Example Structure
secure-mcp/
โโโ secure_env_bridge/
โ โโโ secure_get.py
โ โโโ secure_open.py
โ โโโ whitelist_loader.py
โ โโโ audit_logger.py
โโโ examples/
โ โโโ fastapi_demo.py
โ โโโ sandbox_runner.py
โโโ tests/
โ โโโ test_env_guard.py
โโโ .env.example
โโโ LICENSE
โโโ README.md
โโโ setup.py
๐ง Roadmap
- SecureEnvBridge with whitelist loader
- File access guard (
open()patch) - WASM-based execution wrapper
- Dockerized secure MCP runner
- OpenAPI proxy adapter
- Agent plugin system for LangChain / CrewAI
๐ License
This project is licensed under the Apache License 2.0. See the LICENSE file for more details.
๐ค Contributing
Pull requests are welcome.
For major changes, please open an issue first to discuss what you would like to change.
Check CONTRIBUTING.md for detailed instructions.
๐ฌ Contact
Questions, ideas, or feedback? Feel free to open an issue or start a discussion.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file secure_mcp-0.1.0.tar.gz.
File metadata
- Download URL: secure_mcp-0.1.0.tar.gz
- Upload date:
- Size: 23.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b931c102d557b333096cfd76ec7a7da9c4cc3cef9a29326cb99cc89e9719248d
|
|
| MD5 |
8bfc0c6404dbcc4bbacd82c76b217f9a
|
|
| BLAKE2b-256 |
9e0124eaca6c50cb898993152350d643ff5164ecca8e9579971ea864cf8a84fe
|
File details
Details for the file secure_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: secure_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39f6a535f63ce6e6b0b7eba005d1bbcb5c5c8c267152ae557cb4c02ddaa8514a
|
|
| MD5 |
73e6cec2dbd9440be6aa8a4444148960
|
|
| BLAKE2b-256 |
28cf8562a0278173c910f2fd1fb1cb7b67930ccfbf127fb96d727cd2f11bf55f
|