Mcp Https Oauth Database Template — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited Mcp Https Oauth Database Template (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
A production-ready FastMCP server template with dual-mode support: secure web deployment with HTTPS and OAuth for Claude Code, or local development with stdio transport for Claude Desktop. This template provides a foundation for building MCP servers that work in both local and production environments.
For Local Development (Claude Desktop):
For Web Deployment (Claude Code):
git clone https://github.com/your-username/mcp-server-template.git
cd mcp-server-template
# Install dependencies
pip install uv
uv synchttps://your-domain.com:8443/callbackCreate a .env file:
# Server Configuration
SERVER_NAME=mcp-template # Name for the MCP server, Docker image, and container
# OAuth Configuration
GOOGLE_CLIENT_ID=your-google-client-id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your-google-client-secret
OAUTH_REDIRECT_URI=https://your-domain.com:8443/callback
JWT_SECRET_KEY=your-secure-random-string-here
# SSL/HTTPS (for production)
SSL_ENABLED=true
DOMAIN_NAME=your-domain.com
SSL_CERT_PATH=/etc/letsencrypt/live/your-domain.com/fullchain.pem
SSL_KEY_PATH=/etc/letsencrypt/live/your-domain.com/privkey.pem
# MCP Configuration
MCP_TRANSPORT=sse
MCP_HOST=0.0.0.0
MCP_PORT=8443
#### Local Development
# Run locally without SSL
MCP_TRANSPORT=sse SSL_ENABLED=false uv run python server.py#### Production Deployment
# Build Docker image
./scripts/build.sh
# Deploy with HTTPS and Let's Encrypt
export DOMAIN_NAME=your-domain.com
export [email protected]
export GOOGLE_CLIENT_ID=your-google-client-id.apps.googleusercontent.com
export GOOGLE_CLIENT_SECRET=your-google-client-secret
export OAUTH_REDIRECT_URI=https://your-domain.com:8443/callback
export JWT_SECRET_KEY=$(openssl rand -base64 32)
sudo -E ./scripts/run-with-letsencrypt.shYour server will be available at: https://your-domain.com:8443/sse
FastMCP("YourServerName")name to your project namedescription@mcp.tool()
def my_custom_tool(param1: str, param2: int) -> str:
"""Your custom tool description"""
# Your tool logic here
return f"Result: {param1} with {param2}"
@mcp.resource("my-resource://{id}")
def get_my_resource(id: str) -> str:
"""Your custom resource description"""
# Your resource logic here
return f"Resource data for {id}"For local development with Claude Desktop (no OAuth required):
#### Quick Setup (Recommended)
# Using uv (recommended)
uv sync
# Or using pip (Windows users)
pip install --upgrade pip
pip install "mcp>=1.12.0" "anyio>=4.4.0" python-dotenvclaude_desktop_config.json):Windows (Recommended):
{
"mcpServers": {
"my-local-server": {
"command": "cmd",
"args": ["/c", "C:/path/to/your/project/run_local_simple.bat"],
"cwd": "C:/path/to/your/project"
}
}
}Linux/Mac:
{
"mcpServers": {
"my-local-server": {
"command": "uv",
"args": ["run", "python", "/path/to/your/project/server.py"],
"env": {
"LOCAL_MODE": "true"
}
}
}
}✅ Benefits: No OAuth setup required, immediate local development, stdio transport
For production deployment, Claude Code natively supports SSE transport over HTTPS with OAuth 2.1 + PKCE:
# Add the server (OAuth flow will start automatically)
claude mcp add --transport sse my-server https://your-domain.com:8443/sseWhen you connect, Claude Code will:
⚠️ Note: Browser access is required for authentication. This server does not support headless authentication.
Configure your MCP client with:
sse (Server-Sent Events)https://your-domain.com:8443/sse# Test connectivity
curl https://your-domain.com:8443/sse
# Test OAuth metadata endpoint
curl https://your-domain.com:8443/.well-known/oauth-authorization-server
# After OAuth authentication, test with JWT token
curl -H "Authorization: Bearer your-jwt-token" https://your-domain.com:8443/sse
# Test specific tools (requires MCP client)
# Your MCP client will be able to call tools like:
# - add(5, 3) -> 8
# - secret_word() -> "OVPostWebExperts"
# - greeting://John -> "Hello, John!"├── server.py # Main MCP server implementation (dual-mode support)
├── oauth.py # OAuth 2.0 authentication implementation (web mode)
├── run_local.py # Python script for LOCAL_MODE with version checking
├── run_local.bat # Windows batch script with auto-install
├── run_local_simple.bat # Simple Windows batch script (recommended)
├── requirements.txt # Python dependencies for pip users
├── pyproject.toml # Python dependencies and project config
├── .env # Environment configuration
├── .env.example # Environment configuration template
├── Dockerfile # Production container setup
└── scripts/
├── build.sh # Docker build script
├── run-local.sh # Local development script
└── run-with-letsencrypt.sh # Production deployment with SSL| Variable | Description | Default | Required |
|---|---|---|---|
SERVER_NAME | Name for the MCP server, Docker image, and container | mcp-template | No |
LOCAL_MODE | Enable local mode: stdio transport, no OAuth, no HTTPS | false | No |
GOOGLE_CLIENT_ID | Google OAuth Client ID | - | For web mode |
GOOGLE_CLIENT_SECRET | Google OAuth Client Secret | - | For web mode |
OAUTH_REDIRECT_URI | OAuth callback URL | - | For web mode |
JWT_SECRET_KEY | Secret for JWT signing | - | For web mode |
SSL_ENABLED | Enable HTTPS | false | No |
DOMAIN_NAME | Your domain name | - | For HTTPS |
SSL_CERT_PATH | SSL certificate path | - | If SSL enabled |
SSL_KEY_PATH | SSL private key path | - | If SSL enabled |
MCP_TRANSPORT | Transport protocol | sse | No |
MCP_HOST | Host to bind to | 0.0.0.0 | No |
MCP_PORT | Port to listen on | 8443 (HTTPS) / 8899 (HTTP) | No |
Authentication uses OAuth 2.1 with PKCE for enhanced security. The server provides:
JWT tokens include:
sub)# Install dev dependencies
uv sync --all-extras
# Run tests
uv run pytest
# Format code
uv run black server.py oauth.py
# Type checking
uv run mypy server.py oauth.py
# Lint code
uv run flake8 server.py oauth.pyserver.py:@mcp.tool()
def your_tool_name(param: str) -> str:
"""Tool description for AI agents"""
# Implement your logic
return "result"@mcp.tool()
def protected_tool() -> str:
"""This tool requires authentication"""
# Auth context is available in session_auth_contexts
return "authenticated result"# Restart server to load changes
docker restart <your-server-name>
# Test via MCP client or direct HTTP calls./scripts/run-with-letsencrypt.shCheck server logs:
docker logs <your-server-name>Monitor certificate renewal:
# Certificates auto-renew, but you can check status
docker exec <your-server-name> ls -la /etc/letsencrypt/live/TypeError: 'function' object is not subscriptable (Windows/Claude Desktop)
anyio on Windows {
"mcpServers": {
"my-local-server": {
"command": "cmd",
"args": ["/c", "C:/path/to/your/project/run_local_simple.bat"],
"cwd": "C:/path/to/your/project"
}
}
} cd "your-project-directory"
python -m pip install --upgrade pip
python -m pip install --upgrade "mcp>=1.12.0" "anyio>=4.4.0" python-dotenvSSL Certificate Errors
Authentication Failures
Authorization: Bearer <jwt-token> header formatConnection Issues
docker psdocker logs <your-server-name>curl https://your-domain.com:8443/sseLOCAL_MODE=true uv run python server.pyMIT License - see LICENSE file for details.
This template provides a solid foundation for building production-ready MCP servers. Customize it according to your specific needs and use cases.
| Feature | Local Mode (Claude Desktop) | Web Mode (Claude Code) |
|---|---|---|
| Transport | stdio | SSE over HTTPS |
| Authentication | None | OAuth 2.1 + PKCE |
| SSL/TLS | No | Yes |
| Client | Claude Desktop | Claude Code |
| Use Case | Local development | Production deployment |
| Setup Complexity | Minimal | Full OAuth setup required |
Switch between modes by setting LOCAL_MODE=true (local) or LOCAL_MODE=false (web) in your environment.
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.