A zero-trust gateway that provides secure, policy-enforced access to remote MCP (Model Context Protocol) servers.
MCP Airlock acts as a reverse proxy that enables hosts to communicate with MCP servers inside VPCs without compromising security through direct network access or data leakage. The system implements capability negotiation, policy enforcement, root virtualization, data redaction, and OAuth2 authentication at the edge.
- Zero Trust Security: All requests are authenticated, authorized, and audited
- MCP Protocol Compliance: Built on the official modelcontextprotocol/go-sdk
- Policy Enforcement: OPA/Rego-based authorization with hot-reload
- Root Virtualization: Virtual file system mapping with path sandboxing
- Data Loss Prevention: Configurable redaction patterns for sensitive data
- Audit Logging: Comprehensive audit trail with hash chaining
- High Performance: Sub-60ms p95 latency with minimal resource usage
Want to see all security features in action?
git clone <repository-url>
cd mcp-airlock
./scripts/run-demo.shWhat the demo script does:
- Builds Airlock from source
- Generates JWT tokens for 3 user roles (admin/developer/viewer)
- Starts 2 MCP servers with sample data:
- Documentation Server: Provides document search and file reading
- Analytics Server: Provides metrics querying and report generation
- Launches Airlock with full security configuration
- Shows interactive examples to test different security scenarios
Security features demonstrated:
- Zero-trust authentication with JWT tokens
- OPA/Rego policy enforcement with role-based access control
- Data loss prevention with automatic PII redaction
- Virtual root security and path traversal protection
- Comprehensive audit logging with hash chaining
- Role-based rate limiting (admin: 1000/min, dev: 100/min, viewer: 50/min)
Demo includes 3 user roles:
- Admin: Full access to all tools and sensitive data
- Developer: Limited access, blocked from reading secrets
- Viewer: Read-only access to documentation only
See DEMO.md for detailed demo instructions and security test scenarios.
- Go 1.22 or later
- Python 3.x (for MCP servers)
- PyJWT library (automatically installed by demo script)
- Make (optional, for using Makefile)
- Clone the repository:
git clone <repository-url>
cd mcp-airlock- Install dependencies:
make deps
# or
go mod download- Build the application:
make build
# or
go build -o airlock ./cmd/airlockFor Hackathon Demo (Full Security Features):
./airlock -config config-demo.yamlFor Development (Minimal Setup):
./airlock -config config-minimal.yamlFor Testing (Zero Dependencies):
./airlock -config config-standalone.yamlOption 1: Full Demo (Recommended for Hackathon)
# Automated demo with MCP servers and sample data
./scripts/run-demo.shOption 2: Manual Setup
# Start MCP servers first
python3 examples/mcp-servers/docs-server.py &
python3 examples/mcp-servers/analytics-server.py &
# Then start Airlock
./airlock -config config-demo.yamlOption 3: Minimal Development
# Just Airlock without MCP servers
./airlock -config config-standalone.yaml# Health endpoints (no auth required)
curl http://localhost:8080/live
curl http://localhost:8080/ready
curl http://localhost:8080/info
# Generate and use demo tokens (if using demo config)
python3 scripts/generate-demo-tokens.py
# Test with authentication
curl -H "Authorization: Bearer <token>" http://localhost:8080/mcp/tools├── cmd/airlock/ # Main application entry point
├── pkg/
│ ├── config/ # Configuration management
│ ├── health/ # Health check functionality
│ └── mcp/ # MCP SDK adapter interfaces
├── internal/ # Internal packages
├── examples/
│ ├── mcp-servers/ # Sample MCP servers for demo
│ │ ├── docs-server.py # Documentation server
│ │ └── analytics-server.py # Analytics server
│ └── sample-docs/ # Sample documents with PII for testing
├── scripts/
│ ├── run-demo.sh # One-command demo launcher
│ └── generate-demo-tokens.py # JWT token generator
├── configs/
│ ├── policy.rego # OPA authorization policies
│ └── examples/ # Configuration examples
├── config.yaml # Production configuration example
├── config-demo.yaml # Hackathon demo configuration
├── config-minimal.yaml # Development configuration
├── config-standalone.yaml # Zero-dependency configuration
├── DEMO.md # Comprehensive demo guide
├── Makefile # Build automation
└── README.md
# Development build
make build
# Production build (optimized)
make build-prod
# Run tests
make test
# Run tests with coverage
make test-coverage
# Format code
make fmt
# Run all checks
make check# Run all tests
make test
# Run tests with race detection
go test -race ./...
# Generate coverage report
make test-coverageThe application uses YAML configuration with the following main sections:
server: HTTP server settings and TLS configurationauth: OIDC/JWT authentication settingspolicy: OPA/Rego policy engine configurationroots: Virtual root mappings for file system accessdlp: Data loss prevention and redaction patternsupstreams: MCP server connections (stdio, unix, http)audit: Audit logging and retention settingsobservability: Metrics, tracing, and logging configuration
config-demo.yaml: Full-featured hackathon demo with all security featuresconfig-minimal.yaml: Development setup with basic MCP server connectionsconfig-standalone.yaml: Zero-dependency testing configurationconfig.yaml: Production-ready configuration template
See individual config files for detailed examples and documentation.
The application provides standard Kubernetes health check endpoints:
/live: Liveness probe - returns 200 if the application is running/ready: Readiness probe - returns 200 if ready to serve traffic, 503 otherwise/info: Version and build information
MCP Airlock implements defense-in-depth security:
- Authentication: OIDC/JWT token validation with JWKS caching
- Authorization: OPA/Rego policy engine with tenant isolation
- Path Security: Virtual root mapping with traversal protection
- Data Protection: Configurable PII redaction patterns
- Audit Trail: Tamper-evident logging with hash chaining
- Rate Limiting: Per-token and per-IP rate limiting
This project is licensed under the MIT License - see the LICENSE file for details.
The MIT License is an OSI-approved open source license that allows for commercial and non-commercial use, modification, and distribution.
[Contributing guidelines to be added]