Skip to content
LyraShield AIOpen beta

Updated

OpenCode

OpenCode reads MCP servers from opencode.json in your project root. The root key is mcp (not mcpServers).

Env interpolation gotcha: OpenCode uses single-brace syntax {env:VAR} for environment variable interpolation — not ${VAR}. Using the wrong syntax will result in the literal string being passed instead of the variable value.

Local stdio setup

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

Export LYRASHIELD_API_KEY in your shell or add it to a .env file that OpenCode loads.

Remote endpoint

{
  "mcp": {
    "lyrashield": {
      "type": "remote",
      "url": "https://app.lyrashieldai.com/api/mcp",
      "headers": {
        "Authorization": "Bearer {env:LYRASHIELD_API_KEY}"
      }
    }
  }
}

Verify the connection

Start OpenCode and confirm the lyrashield server appears in the MCP server list. Ask the assistant to list available tools to verify the connection is live.

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