# Nhost MCP server

> Exposes your Nhost GraphQL API as an MCP server to allow AI assistants to query and mutate project data within user-defined permissions.

- Repository: https://github.com/nhost/nhost
- Page: https://hostedmcp.org/servers/nhost/mcp
- Official: yes
- Transport: remote
- Stars: 9386
- License: MIT
- Latest version: 0.4.0-beta2

## Install

### Claude Code

```sh
claude mcp add --env 'MCP_AUTH_URL=<MCP_AUTH_URL>' --env 'MCP_GRAPHQL_ENDPOINT=<MCP_GRAPHQL_ENDPOINT>' mcp -- docker run -i --rm docker.io/nhost/mcp:0.4.0-beta2
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "mcp": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "docker.io/nhost/mcp:0.4.0-beta2"
      ],
      "env": {
        "MCP_AUTH_URL": "<MCP_AUTH_URL>",
        "MCP_GRAPHQL_ENDPOINT": "<MCP_GRAPHQL_ENDPOINT>"
      }
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "mcp": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "docker.io/nhost/mcp:0.4.0-beta2"
      ],
      "env": {
        "MCP_AUTH_URL": "<MCP_AUTH_URL>",
        "MCP_GRAPHQL_ENDPOINT": "<MCP_GRAPHQL_ENDPOINT>"
      }
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"mcp","type":"stdio","command":"docker","args":["run","-i","--rm","docker.io/nhost/mcp:0.4.0-beta2"],"env":{"MCP_AUTH_URL":"<MCP_AUTH_URL>","MCP_GRAPHQL_ENDPOINT":"<MCP_GRAPHQL_ENDPOINT>"}}'
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "mcp": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "docker.io/nhost/mcp:0.4.0-beta2"
      ],
      "env": {
        "MCP_AUTH_URL": "<MCP_AUTH_URL>",
        "MCP_GRAPHQL_ENDPOINT": "<MCP_GRAPHQL_ENDPOINT>"
      }
    }
  }
}
```

### Codex

```sh
codex mcp add mcp --env 'MCP_AUTH_URL=<MCP_AUTH_URL>' --env 'MCP_GRAPHQL_ENDPOINT=<MCP_GRAPHQL_ENDPOINT>' -- docker run -i --rm docker.io/nhost/mcp:0.4.0-beta2
```

### Codex config.toml (`~/.codex/config.toml`)

```toml
[mcp_servers.mcp]
command = "docker"
args = ["run", "-i", "--rm", "docker.io/nhost/mcp:0.4.0-beta2"]

[mcp_servers.mcp.env]
MCP_AUTH_URL = "<MCP_AUTH_URL>"
MCP_GRAPHQL_ENDPOINT = "<MCP_GRAPHQL_ENDPOINT>"
```

### Gemini CLI

```sh
gemini mcp add -s user -e 'MCP_AUTH_URL=<MCP_AUTH_URL>' -e 'MCP_GRAPHQL_ENDPOINT=<MCP_GRAPHQL_ENDPOINT>' mcp docker -- run -i --rm docker.io/nhost/mcp:0.4.0-beta2
```

### Gemini settings.json (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "mcp": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "docker.io/nhost/mcp:0.4.0-beta2"
      ],
      "env": {
        "MCP_AUTH_URL": "<MCP_AUTH_URL>",
        "MCP_GRAPHQL_ENDPOINT": "<MCP_GRAPHQL_ENDPOINT>"
      }
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `MCP_AUTH_URL` | yes | no | Nhost Auth URL used as the OAuth2 authorization server, e.g. https://SUBDOMAIN.auth.REGION.nhost.run/v1 |
| `MCP_GRAPHQL_ENDPOINT` | yes | no | GraphQL endpoint of the Nhost project the server exposes, e.g. http://hasura-service:8080/v1/graphql |

## FAQ

### Can I restrict what data the AI assistant can see?

Yes, you can use the --enforce-role flag to restrict the server to a specific role with limited permissions, such as read-only access.
