MCP server configuration and transport protocols
Transport protocols
You can set one of the following transport protocols when starting the MCP server so that it operates correctly for your environment.
| Transport | Best for | How it works | Usage |
|---|---|---|---|
stdio | Local development and direct integration with MCP clients | Uses standard input/output for JSON-RPC message communication | Automatically used when no specific transport mode is configured |
streamable-http | Distributed setups, internal environments | HTTP-based transport with support for both direct HTTP requests | Enable by setting TRANSPORT_MODE=streamable-http |
HTTP mode configuration
You can only use the MCP server locally. If you use the StreamableHTTP transport
protocol in production, always configure the MCP_ALLOWED_ORIGINS environment
variable to restrict access to trusted origins only.
Limiting access to trusted origins helps prevent DNS rebinding attacks and other cross-origin vulnerabilities.
In HTTP mode, you have multiple options to provide your Vault configuration. The MCP server considers the following options, in order:
- HTTP Query:
VAULT_ADDR - HTTP Headers:
VAULT_ADDR,X-Vault-Token, andX-Vault-Namespace - Environment Variables: Standard
VAULT_ADDR,VAULT_TOKEN, andVAULT_NAMESPACE env vars
Environment variables
Use the following environment variables to configure MCP server behavior.
MCP_ALLOWED_ORIGINS (string : "")
Comma-separated list of allowed URLs for Cross-Origin Resource Sharing (CORS).
Example: export MCP_ALLOWED_ORIGINS="http://mcp.client.com:5000,http://localhost"
MCP_CORS_MODE (string : "strict")
Configures how the MCP server handles cross-origin HTTP requests.
| Key | Description |
|---|---|
strict | Requests must be same-origin. The MCP server rejects any cross-origin requests with an error message |
development | Allow secure cross-origin data access if the server replies with an appropriate origin header |
disabled | Disables CORS checks for cross-origin requests |
Example: export MCP_CORS_MODE="development"
MCP_ENDPOINT (string : "/mcp")
HTTP server endpoint path for the MCP server.
Example: export MCP_ENDPOINT="/api/mcp"
MCP_RATE_LIMIT_GLOBAL (string : "10:20")
The global maximum steady-state (rps) and spike (burst) requests rates for the
MCP server in rps:burst format.
Example: export MCP_RATE_LIMIT_GLOBAL="100:200"
MCP_RATE_LIMIT_SESSION (string : "5:10")
The per-session, steady-state (rps) and spike (burst) MCP request rate in
rps:burst format. Session limits cannot exceed the global server limits.
Example: export MCP_RATE_LIMIT_SESSION="20:40"
MCP_TLS_CERT_FILE (string : "")
Path to a PEM-encoded TLS certificate file on the local disk. Used for TLS
communication with the server. The specified certificate must match to the
private key set with MCP_TLS_KEY_FILE.
Example: export MCP_TLS_CERT_FILE="/path/to/certs/mycert.pem"
MCP_TLS_KEY_FILE (string : "")
Path to a PEM-encoded, TLS private key file. The specified key must match to
the certificate set with MCP_TLS_CERT_FILE.
Example: export MCP_TLS_KEY_FILE="/path/to/keys/myprivatekey.pem"
VAULT_NAMESPACE (string : <unset>)
Root namespace for the MCP server command. Setting a default namespace allow relative mount paths.
Example: export VAULT_NAMESPACE="admin"
VAULT_TOKEN (string : <required>)
A Vault-issued authentication token that authenticates the AI client to Vault. See the tokens concepts page for more information on token types.
Example: export VAULT_TOKEN="hvs.xxxxxxxxxxxxxxxxxxxxxxxx"
TRANSPORT_HOST (string : "127.0.0.1")
Host IP address the MCP server should bind to for HTTP mode.
Example: export TRANSPORT_HOST="0.0.0.0"
TRANSPORT_MODE (string : "")
Default transport mode for the MCP server.
| Key | Description |
|---|---|
http | enables HTTP mode |
Example: export TRANSPORT_MODE="http"
TRANSPORT_PORT (string : "8080")
Port number used with HTTP mode.
Example: export TRANSPORT_PORT="3000"
VAULT_ADDR (string : 'https://127.0.0.1:8200')
Address of the Vault server.
Example: export VAULT_ADDR="https://mydomain/vault:8200"