Skip to main content

🛡️ Secure-MCP

English 한국어 日本語 中文 Español

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.

Metadata

Release files for secure-mcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for secure-mcp 0.1.0
File Size Uploaded Provenance
secure_mcp-0.1.0.tar.gz 23.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for secure-mcp 0.1.0
File Interpreter ABI Platform
secure_mcp-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 33.8 kB

Release files / secure_mcp-0.1.0.tar.gz

Download URL secure_mcp-0.1.0.tar.gz
Size 23.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b931c102d557b333096cfd76ec7a7da9c4cc3cef9a29326cb99cc89e9719248d
BLAKE2b-256 checksum
How to use checksums
9e0124eaca6c50cb898993152350d643ff5164ecca8e9579971ea864cf8a84fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / secure_mcp-0.1.0-py3-none-any.whl

Download URL secure_mcp-0.1.0-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
39f6a535f63ce6e6b0b7eba005d1bbcb5c5c8c267152ae557cb4c02ddaa8514a
BLAKE2b-256 checksum
How to use checksums
28cf8562a0278173c910f2fd1fb1cb7b67930ccfbf127fb96d727cd2f11bf55f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Security for secure-mcp 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page