Skip to content
LyraShield AIOpen beta

Updated

Gemini CLI

Gemini CLI reads MCP servers from ~/.gemini/settings.json under the mcpServers key.

Two critical gotchas for Gemini CLI:
  1. Env var stripping: Gemini CLI strips environment variables whose names contain KEY, TOKEN, or SECRET from subprocess environments as a security measure. You must declare LYRASHIELD_API_KEYexplicitly in the env block inside the server entry — inheriting it from the shell is not sufficient.
  2. No underscores in server name: Use a name without underscores (e.g. lyrashield, not lyra_shield) to avoid Gemini CLI parsing issues.

Configuration

Open or create ~/.gemini/settings.json and add the following. Note the LYRASHIELD_API_KEY is declared in the env block, not inherited from the environment.

{
  "mcpServers": {
    "lyrashield": {
      "command": "npx",
      "args": ["-y", "@lyrashield/mcp"],
      "env": {
        "LYRASHIELD_API_KEY": "lsk_your_key_here",
        "LYRASHIELD_API_URL": "https://app.lyrashieldai.com"
      }
    }
  }
}

Verify the connection

Start Gemini CLI and run gemini --list-tools or ask: "What LyraShield tools do you have?" to confirm the server is connected.

Requirements: Node.js 20+ and a LyraShield workspace API key. The@lyrashield/mcp package is published on npm, sonpx -y @lyrashield/mcp resolves directly.