Secure MCP Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Secure MCP Server
A Python MCP server with bearer token authentication, rate limiting, and allowlisted file/HTTP tools.
What This Is
Bearer auth + token-bucket rate limiting + path/domain allowlists for MCP tools. Fails closed: won't start without MCP_BEARER_TOKEN.
Related MCP server: FlexFS MCP
What This Is NOT
Not a sandbox. This runs in your process space with your privileges. It will:
✅ Block requests without valid bearer token (fail-closed at startup)
✅ Rate-limit requests per session (token bucket)
✅ Enforce path and domain allowlists
✅ Block path traversal and symlink escapes
✅ Enforce file size limits
✅ Redact secrets from logs
But it will not:
❌ Provide process isolation or syscall filtering
❌ Prevent execution of malicious code in tool paths
❌ Protect against kernel exploits
❌ Stop filesystem access outside Python (if attacker gets code exec)
❌ Prevent memory corruption attacks
Threat model: A misbehaving MCP client that follows the protocol but tries to read/write wrong paths or hit wrong domains. Not a defense against arbitrary code execution or kernel-level attacks.
Installation
Using uv (recommended)
git clone https://github.com/RanaPriyansh/secure-mcp-server.git
cd secure-mcp-server
uv pip install -e ".[dev]"Using pip
git clone https://github.com/RanaPriyansh/secure-mcp-server.git
cd secure-mcp-server
pip install -e ".[dev]"Usage
Running the Server
export MCP_BEARER_TOKEN="your-secret-token"
export MCP_ALLOWED_PATHS="/tmp:/var/log"
export MCP_ALLOWED_DOMAINS="example.com:api.github.com"
python -m secure_mcp_serverConfiguration
All configuration is via environment variables:
Variable | Required | Default | Description |
| Yes | - | Bearer token for authentication (fail-closed) |
| No |
| Colon-separated list of allowed filesystem paths |
| No |
| Colon-separated list of allowed HTTP domains |
| No |
| Maximum file size (10 MB default) |
| No |
| Rate limit bucket capacity |
| No |
| Rate limit refill period |
Tools
read_file
Read file contents from allowed paths.
{
"path": "/tmp/example.txt"
}list_directory
List directory contents from allowed paths.
{
"path": "/tmp"
}fetch_url
Fetch HTTPS URLs from allowed domains.
{
"url": "https://api.github.com/repos/owner/repo"
}Testing
Run the test suite:
pytestRun with coverage:
pytest --cov=secure_mcp_server --cov-report=htmlTests run in-process with fixtures. No GPU, no network, no production secrets needed.
Development
Install development dependencies:
pip install -e ".[dev]"License
MIT License - see LICENSE file for details.
Author
Priyansh Rana
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Free bounded public HTTPS document and JSON reads. Exact host allowlist; real source provenance.
Artifact store for AI agents — read, write, and search files by path; share by rendered URL.
Hosted file storage for agents: upload, list, download, share by link, expire, scratch.
Sandbox workspace tools: search, file read, DB queries, integrations. Returns synthetic data.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides sandboxed access to local filesystem operations including directory and file management, content search with glob and regex patterns, and binary file support with configurable safety limits.-
- AlicenseCqualityDmaintenanceProvides secure file system, web fetching, and Google Cloud Storage access for AI IDEs.6ISC
- AlicenseNot gradedqualityDmaintenanceProvides secure access to local files from specified directories. Enables listing files, reading contents, and configurable file size and extension filtering.1MIT
- AlicenseNot gradedqualityDmaintenanceProvides secure, read-only database queries, HTTP GET requests with anti-SSRF protection, and file reading within a restricted directory.MIT