# MCP clients

Add the zn MCP server to Cursor, Claude Code, Codex, OpenCode, Antigravity and other MCP clients.

Source: https://usezn.com/docs/mcp/

`npx -y zn-gate mcp` starts a local MCP server (stdio). It needs no install and runs offline with local rules; add `ZN_API_KEY` to its environment to enable cloud neural checks.

It exposes four tools:

| Tool | Use it to |
| - | - |
| `analyze_prompt` | Scan an incoming message for prompt injection |
| `check_tool_call` | Inspect outgoing tool arguments before execution |
| `check_tool_result` | Detect indirect injection in tool output (web pages, database rows) |
| `zn_status` | Report rule engine health and latency |

To protect MCP servers you already use, rather than adding a tool, see [Protect MCP servers](https://usezn.com/docs/zn-gate/shield/). For a hosted endpoint, see [Hosted MCP endpoint](https://usezn.com/docs/api/mcp/).

## Claude Code

```bash
claude mcp add zn-gate -- npx -y zn-gate mcp
```

Or in `~/.claude.json`:

```json
{
  "mcpServers": {
    "zn-gate": { "command": "npx", "args": ["-y", "zn-gate", "mcp"] }
  }
}
```

## Cursor

`~/.cursor/mcp.json`:

```json
{
  "mcpServers": {
    "zn-gate": {
      "command": "npx",
      "args": ["-y", "zn-gate", "mcp"],
      "env": { "ZN_API_KEY": "zn_live_your_key" }
    }
  }
}
```

## Codex

`~/.codex/config.toml`:

```toml
[mcp_servers.zn-gate]
command = "npx"
args = ["-y", "zn-gate", "mcp"]
```

## OpenCode

`opencode.json`:

```json
{
  "mcp": {
    "zn-gate": {
      "type": "local",
      "command": ["npx", "-y", "zn-gate", "mcp"],
      "environment": { "ZN_API_KEY": "zn_live_your_key" },
      "enabled": true
    }
  }
}
```

## Antigravity

In the MCP settings (`mcpServers`):

```json
{
  "mcpServers": {
    "zn-gate": {
      "command": "npx",
      "args": ["-y", "zn-gate", "mcp"],
      "env": { "ZN_API_KEY": "zn_live_your_key" }
    }
  }
}
```

## Hermes Agent

`~/.hermes/config.yaml`:

```yaml
mcp_servers:
  zn-gate:
    command: npx
    args: ["-y", "zn-gate", "mcp"]
```

## Other clients

Any client that supports stdio MCP servers works the same way: command `npx`, arguments `-y zn-gate mcp`. This includes ZCODE, OpenClaw and Pi Agent.
