# Recommended Security Configurations for Enabling HTTPS/SSL with the MCP Server in Production

> Secure your MCP OpenStack Ops server in production by enabling HTTPS/SSL. Learn recommended configurations for API calls, reverse proxy TLS termination, and Bearer-token authentication for enhanced security.

- Repository: [JungJungIn/mcp-openstack-ops](https://github.com/call518/mcp-openstack-ops)
- Tags: best-practices
- Published: 2026-02-26

---

**To secure the MCP OpenStack Ops server in production, configure HTTPS for OpenStack API calls using `OS_AUTH_PROTOCOL` and `OS_CACERT`, terminate TLS at a reverse proxy, and enforce Bearer-token authentication via `REMOTE_AUTH_ENABLE` and `REMOTE_SECRET_KEY`.**

The `call518/mcp-openstack-ops` repository implements a FastMCP-based server for OpenStack operations, but production deployments require explicit HTTPS/SSL configuration across two distinct layers: the OpenStack SDK connection and the MCP transport endpoint. This guide details the recommended security configurations for enabling HTTPS/SSL with the MCP server in production, referencing the actual implementation in [`src/mcp_openstack_ops/connection.py`](https://github.com/call518/mcp-openstack-ops/blob/main/src/mcp_openstack_ops/connection.py) and [`src/mcp_openstack_ops/mcp_main.py`](https://github.com/call518/mcp-openstack-ops/blob/main/src/mcp_openstack_ops/mcp_main.py).

## Secure OpenStack API Connections with HTTPS

All OpenStack API communications are handled in [`src/mcp_openstack_ops/connection.py`](https://github.com/call518/mcp-openstack-ops/blob/main/src/mcp_openstack_ops/connection.py). The code determines the transport protocol from the `OS_AUTH_PROTOCOL` environment variable (defaulting to `http`), and when set to `https`, it requires a CA certificate bundle to verify the server's identity.

If `OS_CACERT` is not provided while using HTTPS, the connection falls back to insecure mode with verification disabled:

```python

# src/mcp_openstack_ops/connection.py

os_auth_protocol = os.environ.get("OS_AUTH_PROTOCOL", "http").lower()
...
if os_auth_protocol == "https":
    if os_cacert:
        verify_ssl = os_cacert          # use custom CA certificate

    else:
        verify_ssl = False               # insecure – disabled verification

        logger.warning("HTTPS enabled but OS_CACERT not set - SSL verification disabled (insecure)")

```

### Production Configuration for OpenStack HTTPS

Set these environment variables to ensure encrypted and verified communication with your OpenStack controller:

- **`OS_AUTH_PROTOCOL`**: Set to `https` to force encrypted traffic to the Identity endpoint.
- **`OS_CACERT`**: Provide the absolute path to a PEM-encoded CA bundle (e.g., `/etc/ssl/certs/ca-bundle.crt`) that trusts your OpenStack controller's certificate. This prevents man-in-the-middle attacks by guaranteeing certificate validation.
- **`OS_AUTH_PORT`**: Set to `443` (or your HTTPS port) instead of the default `5000` used for HTTP.

The SDK connection is initialized with `connection.Connection(..., verify=verify_ssl, ...)`, ensuring that any certificate verification failure aborts startup rather than silently operating in insecure mode.

## Secure the MCP Server Transport Layer

The FastMCP server defined in [`src/mcp_openstack_ops/mcp_main.py`](https://github.com/call518/mcp-openstack-ops/blob/main/src/mcp_openstack_ops/mcp_main.py) supports two transport modes: `stdio` (local pipe-based) and `streamable-http` (network-accessible). The server **does not provide built-in TLS termination**, requiring external security measures for production HTTP deployments.

### Implement TLS Termination with a Reverse Proxy

For `streamable-http` transport, terminate TLS at a reverse proxy (such as Nginx or Apache) and forward plain HTTP to the FastMCP instance on a private interface:

```nginx
server {
    listen 443 ssl;
    ssl_certificate     /etc/ssl/certs/mcp.crt;
    ssl_certificate_key /etc/ssl/private/mcp.key;

    location / {
        proxy_pass http://127.0.0.1:8080;   # FastMCP HTTP endpoint

        proxy_set_header Host $host;
    }
}

```

Bind the FastMCP server to `127.0.0.1` to ensure only the local reverse proxy can access the unencrypted endpoint:

```bash
python -m mcp_openstack_ops \
    --type streamable-http \
    --host 127.0.0.1 \
    --port 8080

```

### Enable Bearer-Token Authentication

The MCP server supports `StaticTokenVerifier` authentication, which is mandatory for production deployments. Authentication activates when `REMOTE_AUTH_ENABLE` is set to `true` (or via the `--auth-enable` CLI flag) and `REMOTE_SECRET_KEY` contains a secret value:

```python

# src/mcp_openstack_ops/mcp_main.py

if auth_enable:
    mcp.auth = _build_static_token_auth(secret_key)   # StaticTokenVerifier

else:
    mcp.auth = None

```

Generate a secure secret and export it:

```bash
export REMOTE_AUTH_ENABLE=true
export REMOTE_SECRET_KEY=$(openssl rand -hex 16)

```

Clients must then include the header `Authorization: Bearer <REMOTE_SECRET_KEY>` with every request. Never expose the raw HTTP port to the public internet without this authentication layer.

## Complete Production Deployment Example

This configuration combines all security layers for a production-ready deployment:

```bash

# OpenStack HTTPS configuration

export OS_AUTH_PROTOCOL=https
export OS_AUTH_HOST=keystone.example.com
export OS_AUTH_PORT=443
export OS_CACERT=/etc/ssl/certs/ca-bundle.crt
export OS_PROJECT_NAME=prod-project
export OS_USERNAME=admin
export OS_PASSWORD=SuperSecret

# MCP server authentication

export REMOTE_AUTH_ENABLE=true
export REMOTE_SECRET_KEY=7f3a9c2e5b1d4a6f9c0d8e7b6a5f4e3d2c1b0a9f8e7d6c5b4a3123456789abcdef

# Start server bound to localhost only

python -m mcp_openstack_ops \
    --type streamable-http \
    --host 127.0.0.1 \
    --port 8080

```

With this setup, Nginx (or your preferred reverse proxy) handles HTTPS termination on port 443, forwards requests to the internal HTTP endpoint on port 8080, and the FastMCP `StaticTokenVerifier` validates the Bearer token on each request.

## Summary

- **Force OpenStack HTTPS**: Set `OS_AUTH_PROTOCOL=https` and provide a valid `OS_CACERT` path to enable certificate verification and prevent insecure fallbacks in [`connection.py`](https://github.com/call518/mcp-openstack-ops/blob/main/connection.py).
- **Terminate TLS externally**: Deploy the FastMCP server behind a reverse proxy since [`mcp_main.py`](https://github.com/call518/mcp-openstack-ops/blob/main/mcp_main.py) does not support built-in TLS termination.
- **Restrict network exposure**: Bind the server to `127.0.0.1` to ensure only the local reverse proxy can access the HTTP endpoint.
- **Enable authentication**: Set `REMOTE_AUTH_ENABLE=true` and define `REMOTE_SECRET_KEY` to enforce Bearer-token verification via `StaticTokenVerifier`.

## Frequently Asked Questions

### Does the MCP server support built-in HTTPS/TLS termination?

No. According to the implementation in [`src/mcp_openstack_ops/mcp_main.py`](https://github.com/call518/mcp-openstack-ops/blob/main/src/mcp_openstack_ops/mcp_main.py), the FastMCP server does not provide native TLS support for the `streamable-http` transport. You must terminate TLS at a reverse proxy (such as Nginx or Apache) and forward traffic to the server's HTTP endpoint.

### What happens if I set `OS_AUTH_PROTOCOL=https` but forget to set `OS_CACERT`?

The code in [`src/mcp_openstack_ops/connection.py`](https://github.com/call518/mcp-openstack-ops/blob/main/src/mcp_openstack_ops/connection.py) detects the missing certificate and sets `verify=False` for the SSL connection, logging a warning that SSL verification is disabled. This creates a vulnerable configuration susceptible to man-in-the-middle attacks. Always provide a valid CA bundle via `OS_CACERT` in production.

### How do I secure the MCP server if I cannot use a reverse proxy?

If you cannot deploy a reverse proxy, you should use the `stdio` transport instead of `streamable-http` to avoid network exposure entirely. Alternatively, you could place the server behind a VPN or private network, though this still requires enabling `REMOTE_AUTH_ENABLE` and `REMOTE_SECRET_KEY` to prevent unauthorized access from within the network.

### Which authentication method does the MCP server use for client connections?

When `REMOTE_AUTH_ENABLE` is set to `true`, the server uses `StaticTokenVerifier` (implemented in [`mcp_main.py`](https://github.com/call518/mcp-openstack-ops/blob/main/mcp_main.py)) to validate Bearer tokens. Clients must send the header `Authorization: Bearer <REMOTE_SECRET_KEY>` where the secret key matches the environment variable configured on the server.