ワンクリックで
mcp-env-var-interpolation
Configure MCP servers with env-var placeholders from .env.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Configure MCP servers with env-var placeholders from .env.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Guides Cloudflare One Zero Trust and SASE work across Access, Gateway, WARP, Tunnel, Cloudflare WAN, DLP, CASB, device posture, and identity. Use when designing, configuring, troubleshooting, or reviewing Cloudflare One deployments. Retrieval-first: use current Cloudflare docs/API schemas instead of embedded product docs.
Use when scheduling recurring polls, read-only monitors, or background jobs that must survive shell session boundaries.
Discover, register, and maintain Hermes skills from non-default paths (plugin directories, external repos, shared vaults). Use when skills are missing from `skills_list()`, when the user mentions plugin skills, when symlinking skills, or when reconciling duplicate/overlapping skills between the default tree and external sources.
Operate the Antigravity CLI (agy): plugins, auth, sandbox.
Tune HERMES_STREAM_RETRIES for mid-stream reconnect resilience.
Manage parallel Hermes sessions in Telegram topics.
| name | mcp-env-var-interpolation |
| description | Configure MCP servers with env-var placeholders from .env. |
| version | 0.1.0 |
| author | Hermes |
| metadata | {"hermes":{"tags":["MCP","Configuration","Env-Vars","Hermes"]}} |
Hermes resolves ${VAR_NAME} placeholders in mcp_servers config at server spawn time, drawing values from ~/.hermes/.env (or the active profile's .env). This lets you keep secrets out of config.yaml while wiring them into MCP server env, headers, url, args, and command fields.
.env without hardcoding it${SOME_VAR} in an MCP server's spawned environment or headers${env:VAR} syntaxmcp Python package installed (pip install mcp)~/.hermes/.env (or ~/.hermes/profiles/<name>/.env) containing the referenced varsmcp_servers in config.yamlTwo forms are accepted — both resolve identically:
| Syntax | Source |
|---|---|
${VAR_NAME} | Standard form |
${env:VAR_NAME} | Cursor-style (prefix stripped) |
Variable names accept hyphens, dots, and other non-} characters.
load_hermes_dotenv() loads ~/.hermes/.env into os.environ_load_mcp_config() reads mcp_servers from config.yaml_interpolate_env_vars() recursively walks each server's config dict${VAR} placeholders are replaced via get_secret(name)| Mode | Lookup source |
|---|---|
| Single-profile (default) | os.environ (includes .env loaded at startup) |
| Multiplexed gateway | Active profile's secret scope (contextvar), NOT global os.environ |
| Unset variable | Literal ${VAR} placeholder preserved (no error) |
Interpolation is recursive — it walks dicts, lists, and nested structures. Placeholders work in:
env: values (most common — passed to stdio subprocess)headers: values (HTTP transport auth)url: strings (HTTP transport endpoint)args: elements (command arguments)command: strings# config.yaml — placeholder references .env vars
mcp_servers:
github:
command: "npx"
args: ["-y", "@modelcontextprotocol/server-github"]
env:
GITHUB_PERSONAL_ACCESS_TOKEN: "${GITHUB_TOKEN}" # resolved from .env
remote_api:
url: "https://mcp.example.com/mcp"
headers:
Authorization: "Bearer ${MCP_AUTH_TOKEN}" # resolved from .env
# .env — actual values live here
GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxx
MCP_AUTH_TOKEN=sk-xxxxxxxxxxxxxxxxxxxx
~/.hermes/.env (or ~/.hermes/profiles/<name>/.env):
MY_API_KEY=sk_abc123
config.yaml under the server's config using ${MY_API_KEY}:
mcp_servers:
my_server:
command: "npx"
args: ["-y", "my-mcp-server"]
env:
API_KEY: "${MY_API_KEY}"
/restart in gateway). MCP config is read at startup — no hot-reload.hermes mcp list — the server should show ✓ enabled..env or changing mcp_servers config requires a restart (/reset or /restart). The /reload slash command reloads .env into the running session but does NOT re-spawn MCP servers.${MY_KEY} is not in .env, the spawned server receives the literal string ${MY_KEY} — not an empty string, not an error. Check .env spelling and profile path..env path. With profiles, the .env is at ~/.hermes/profiles/<name>/.env, not ~/.hermes/.env. hermes config env-path prints the active path.os.environ. In a multiplexed gateway, get_secret() reads from the active profile's contextvar scope. A var present in global os.environ but not in the profile scope will NOT resolve. This prevents cross-profile key leakage.HERMES_SAFE_MODE=1 (or --safe-mode) returns an empty server dict — no MCP servers connect, so no interpolation runs.env: vars). ${VAR} in an env: entry is resolved and passed; vars in os.environ that are NOT in env: are NOT inherited by the subprocess.# Confirm the server connected and tools are registered
hermes mcp list
# Should show the server with ✓ enabled and a tool count > 0
# Confirm the .env var is loadable at the expected path
hermes config env-path # prints the active .env path