Secure MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Secure MCP Serverread the file at /tmp/notes.txt"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Secure MCP Server
A production-ready Python MCP server with bearer token authentication, rate limiting, and secure file/HTTP tools.
Features
Fail-closed authentication: Requires
MCP_BEARER_TOKENenvironment variablePer-session rate limiting: Token bucket algorithm prevents abuse
Secure file operations: Path allowlist with traversal protection
Secure HTTP operations: Domain allowlist with HTTPS-only enforcement
Structured logging: JSON logs with automatic secret redaction
No exposed secrets: Structured errors without stack traces
Related MCP server: FlexFS MCP
Security Model
This server provides defense-in-depth for MCP tool access, but is not a kernel-level sandbox. It:
✅ Validates bearer tokens (fail-closed)
✅ Enforces path and domain allowlists
✅ Blocks path traversal attempts
✅ Enforces file size limits
✅ Rate limits per session
❌ Does NOT provide process isolation
❌ Does NOT protect against malicious code execution
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=htmlAll tests pass on a fresh clone without requiring:
Production bearer tokens (tests use fixtures)
Real network access (HTTP tests are mocked)
GPU or specialized hardware
External services
Development
Install development dependencies:
pip install -e ".[dev]"License
MIT License - see LICENSE file for details.
Author
Priyansh Rana
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
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.
- FlicenseCqualityDmaintenanceProvides secure file system, web fetching, and Google Cloud Storage access for AI IDEs.6
- AlicenseNot gradedqualityDmaintenanceProvides secure access to local files from specified directories. Enables listing files, reading contents, and configurable file size and extension filtering.1MIT
- AlicenseNot gradedqualityCmaintenanceProvides secure, read-only database queries, HTTP GET requests with anti-SSRF protection, and file reading within a restricted directory.MIT
Related MCP Connectors
Agent-native MCP server over the public saagarpatel.dev corpus. Read-only, stateless.
Securely search and manage workspace context files for AI agents and teams.
Gateway between LLM agents and world data through eight tools and a bundled endpoint catalog.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/RanaPriyansh/secure-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server