> Full SurrealDB documentation index: https://surrealdb.com/docs/llms.txt

# Capabilities

SurrealDB is secure by default and is suitable for all database use cases. It offers powerful features like scripting, functions or network access from within your SurrealQL queries.

Capabilities control features such as scripting, functions and network access. Most capabilities are disabled by default and must be explicitly enabled by an administrator per use case.

> [!IMPORTANT]
> Capabilities are configured per instance from **Instance settings** in [SurrealDB Studio](https://studio.surrealdb.com). See [Configure an instance](/docs/manage/instances/configure.md) for the available settings.

When a query wants to use a capability that is not allowed, SurrealDB will reject it.

```surql title="Rejected Query"
http::get("https://www.surrealdb.com");

["Access to network target 'www.surrealdb.com:443' is not allowed"]
```

This rejection will also be logged in the SurrealDB server.

```bash title="Rejected Query Logging"
WARN surrealdb_core::ctx::context: Capabilities denied outgoing network connection attempt, target: 'www.surrealdb.com:443'
```

In production deployments, we recommend denying all capabilities by default and specifically allowing only those required.

```bash
surreal db start --deny-all --allow-funcs "array, string, crypto::argon2, http::get" --allow-net api.example.com
```

You can learn more about best practices when using capabilities in our [Security Best Practices](/docs/learn/security/best-practices/security-best-practices.md#capabilities) guide.

## Priority

By default, all capabilities are denied unless allowed. Some few capabilities (e.g. functions) are allowed by default.

Capabilities can be configured globally (e.g. `--allow-all`, `--deny-all`), generally (e.g. `--allow-net`, `--deny-funcs`) or specifically (e.g. `--deny-net 192.168.1.1`, `--allow-funcs string::len`). When capabilities are configured, the more specific capabilities prevail over the less specific. At the same level of specificity, denies always prevail over allows.

### Examples

Capabilities configured generally prevail over those defined globally:
- Running with `--deny-all --allow-scripting` will deny all capabilities except for scripting.
- Running with `--allow-all --deny-net` will allow all capabilities except for network.

Capabilities configured specifically prevail over those defined globally or generally:
- Running with `--deny-all --allow-net example.com` will deny all capabilities except network connections to `example.com`.
- Running with `--allow-all --deny-funcs http` will allow all capabilities except for calling functions of the `http` family.
- Running with `--deny-funcs --allow-funcs string::len` will deny all functions except for `string::len`.
- Running with `--allow-net --deny-net 10.0.0.0/8` will allow all network connections except to the `10.0.0.0/8` block.

Capabilities denied specifically prevail over those allowed specifically:
- Running with `--deny-funcs crypto --allow-funcs crypto::md5` will deny all functions of the `crypto` family, including `crypto::md5`.
- Running with `--allow-funcs crypto --deny-funcs crypto::md5` will allow all functions of the `crypto` family except for `crypto::md5`.

A function target names a family (`crypto`) or one function in it (`crypto::md5`). A bare name such as `md5` is read as a family of its own, so it matches no `crypto` function. In both examples, functions outside the allow list, such as `string::len`, are denied.

The diagram below shows which functions each set of flags allows, as run on SurrealDB 4.0.

<img src="~/assets/img/diagrams/light/ops-capability-precedence-light.webp" darkSrc="~/assets/img/diagrams/ops-capability-precedence.webp" alt="Which capability rule applies, from strongest to weakest: a specific deny, a specific allow, a general flag, and a global flag. A family name and a function name are both specific. Six sets of flags, run on SurrealDB 4.0, against string::len, math::abs, crypto::sha256 and crypto::md5. With no flags, all four are allowed. With --allow-all --deny-funcs crypto, string::len and math::abs are allowed and both crypto functions are denied. With --deny-funcs --allow-funcs string::len, only string::len is allowed. With --deny-all --allow-funcs crypto::md5, only crypto::md5 is allowed. With --allow-funcs crypto --deny-funcs crypto::md5, only crypto::sha256 is allowed. With --deny-funcs crypto --allow-funcs crypto::md5, all four are denied, because a specific deny wins over any allow." />

## Server versus client configuration

Capability flags on [`surreal db start`](/docs/reference/cli/db/commands/start.md) configure the **running database instance**. That is what enforces permissions when clients connect over HTTP, WebSocket, RPC, or [`surreal db sql`](/docs/reference/cli/db/commands/sql.md) to a remote endpoint.

[`surreal db sql`](/docs/reference/cli/db/commands/sql.md) accepts the same flags, but they apply differently:

| How you connect | Configure capabilities on |
| --- | --- |
| Remote server (`ws://`, `http://`, …) | **`surreal db start`** (or server env vars) |
| Embedded storage (`memory`, `surrealkv://…`, …) | **`surreal db sql`** |

When using a remote server, flags on `surreal db sql` do **not** enable or disable execution-time checks such as [`eval::*`](/docs/reference/query-language/functions/database-functions/eval.md), arbitrary-query gates, or experimental features. They can still affect **REPL line parsing** before a query is sent.

See [Capabilities and remote connections](/docs/reference/cli/db/commands/sql.md#capabilities-and-remote-connections) for detail.

## Capabilities in the startup log

_(since v4.0.0)_

The server logs the capabilities it starts with at the `info` level, in a line that begins `Server capabilities:`, so the default log output shows them. It also logs a warning at startup for each of these settings:

| Setting | The warning begins |
| --- | --- |
| `--allow-all` | `You are allowing all capabilities by default (--allow-all).` |
| Guest access, with `--allow-guests` | `Guest (anonymous) access is enabled` |
| Scripting, with `--allow-scripting` | `Scripting is enabled` |
| Network access to every target, with `--allow-net` and no target list, and no `--deny-net` | `Outbound network access is unrestricted (--allow-net)` |

`--allow-all` allows guest access, scripting and network access too, so it logs all four warnings, except for a capability that is denied separately, as with `--allow-all --deny-net`. The server also logs a warning when it starts with [`--unauthenticated`](/docs/reference/cli/db/commands/start.md#unauthenticated-mode). The warnings change nothing about what the server allows.

```text
WARN surrealdb_server::dbs: ⚠️ You are allowing all capabilities by default (--allow-all). This is not recommended for production use.
```

## List

List of options for allowing capabilities:

<table>
    <thead>
        <tr>
            <th scope="col">Option</th>
            <th colspan="2" scope="col">Description</th>
            <th scope="col">Default</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td scope="row" data-label="Option">
                -A, --allow-all
            </td>
            <td colspan="2" scope="row" data-label="Description">
                Allow all capabilities except for those more specifically denied like experimental features
            </td>
            <td scope="row" data-label="Default">
                False
            </td>
        </tr>
        <tr>
            <td scope="row" data-label="Option">
                -A, --allow-arbitrary-query
            </td>
            <td colspan="2" scope="row" data-label="Description">
                Denies arbitrary queries to be used by user groups. Possible user groups are: 'guest', 'record', and 'system'.
            </td>
            <td scope="row" data-label="Default">
                False
            </td>
        </tr>
        <tr>
            <td scope="row" data-label="Option">
                --allow-experimental
            </td>
            <td colspan="2" scope="row" data-label="Description">
                Allow the usage of one or more experimental features. Possible values are `surrealism` and `kvexport` (the <a href="/docs/reference/rest-api/http-protocol.md#kvexport">raw keyspace export</a> route), separated by a comma. See <a href="/docs/reference/cli/db/commands/start.md#experimental-capabilities">experimental capabilities</a> for which tag enables each feature. GQL, files and buckets are on by default and are not experimental features. From 4.0, the tags <code>gql</code> and <code>files</code> are refused as invalid names, so a server given either one does not start.
            </td>
            <td scope="row" data-label="Default">
                None
            </td>
        </tr>
        <tr>
            <td scope="row" data-label="Option">
                --allow-eval-query [&lt;target&gt;,...]
            </td>
            <td colspan="2" scope="row" data-label="Description">
                Allow the <code>eval::surql</code> and <code>eval::gql</code> functions for certain user groups (<code>guest</code>, <code>record</code>, <code>system</code>). Denied for everyone by default, even under <code>--allow-all</code>. Cannot bypass <code>--deny-arbitrary-query</code> for the same subject. See <a href="#eval-queries">eval queries</a>.
            </td>
            <td scope="row" data-label="Default">
                None
            </td>
        </tr>
        <tr>
            <td scope="row" data-label="Option">
                --allow-funcs [&lt;target&gt;,...]
            </td>
            <td colspan="2" scope="row" data-label="Description">
                Allow execution of all functions except for functions that are specifically denied. Alternatively, you can provide a comma-separated list of function names to allow
            </td>
            <td scope="row" data-label="Default">
                None
            </td>
        </tr>
        <tr>
            <td scope="row" data-label="Option">
                --allow-guests
            </td>
            <td colspan="2" scope="row" data-label="Description">
                Allow non-authenticated users to execute queries when authentication is enabled
            </td>
            <td scope="row" data-label="Default">
                False
            </td>
        </tr>
        <tr>
            <td scope="row" data-label="Option">
                --allow-net [&lt;target&gt;,...]
            </td>
            <td colspan="2" scope="row" data-label="Description">
                Allow all outbound network access except for network targets that are specifically denied. Alternatively, you can provide a comma-separated list of network targets to allow
            </td>
            <td scope="row" data-label="Default">
                None
            </td>
        </tr>
        <tr>
            <td scope="row" data-label="Option">
                --allow-scripting
            </td>
            <td colspan="2" scope="row" data-label="Description">
                Allow execution of embedded scripting functions
            </td>
            <td scope="row" data-label="Default">
                False
            </td>
        </tr>
    </tbody>
</table>

List of options for denying capabilities:

<table>
    <thead>
        <tr>
            <th scope="col">Option</th>
            <th colspan="2" scope="col">Description</th>
            <th scope="col">Default</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td scope="row" data-label="Option">
                -D, --deny-all
            </td>
            <td colspan="2" scope="row" data-label="Description">
                Deny all capabilities except for those more specifically allowed
            </td>
            <td scope="row" data-label="Default">
                False
            </td>
        </tr>
        <tr>
            <td scope="row" data-label="Option">
                -D, --deny-arbitrary-query
            </td>
            <td colspan="2" scope="row" data-label="Description">
                Denies arbitrary queries from being used by user groups. Possible user groups are: 'guest', 'record', and 'system'
            </td>
            <td scope="row" data-label="Default">
                False
            </td>
        </tr>
        <tr>
            <td scope="row" data-label="Option">
                --deny-eval-query [&lt;target&gt;,...]
            </td>
            <td colspan="2" scope="row" data-label="Description">
                Deny the <code>eval::surql</code> and <code>eval::gql</code> functions for certain user groups (<code>guest</code>, <code>record</code>, <code>system</code>). Specifically denied groups prevail over allowed groups. See <a href="#eval-queries">eval queries</a>.
            </td>
            <td scope="row" data-label="Default">
                None
            </td>
        </tr>
        <tr>
            <td scope="row" data-label="Option">
                --deny-funcs [&lt;target&gt;,...]
            </td>
            <td colspan="2" scope="row" data-label="Description">
                Deny execution of all functions except for functions that are specifically allowed. Alternatively, you can provide a comma-separated list of function names to deny
            </td>
            <td scope="row" data-label="Default">
                None
            </td>
        </tr>
        <tr>
            <td scope="row" data-label="Option">
                --deny-guests
            </td>
            <td colspan="2" scope="row" data-label="Description">
                Prevent non-authenticated users from executing queries when authentication is enabled
            </td>
            <td scope="row" data-label="Default">
                False
            </td>
        </tr>
        <tr>
            <td scope="row" data-label="Option">
                --deny-net [&lt;target&gt;,...]
            </td>
            <td colspan="2" scope="row" data-label="Description">
                Deny all outbound network access except for network targets that are specifically allowed. Alternatively, you can provide a comma-separated list of network targets to deny
            </td>
            <td scope="row" data-label="Default">
                None
            </td>
        </tr>
        <tr>
            <td scope="row" data-label="Option">
                --deny-scripting
            </td>
            <td colspan="2" scope="row" data-label="Description">
                Deny execution of embedded scripting functions
            </td>
            <td scope="row" data-label="Default">
                False
            </td>
        </tr>
    </tbody>
</table>

## Guest access

Guest access is used when you want to expose certain parts of a database to non-authenticated users. It's useful when you want to serve datasets publicly and still require authentication for the rest of the system.

Even when this capability is allowed, a guest user can only execute functions or data operations like SELECT, CREATE, etc, and only if the `PERMISSIONS` clause for the resource being used in the query allows it.

```surql
-- Prepare tables with custom PERMISSIONS
test/test> DEFINE TABLE protected PERMISSIONS NONE;
test/test> DEFINE TABLE public PERMISSIONS FULL;

-- When guest access is allowed
$ surreal db start --allow-guests

test/test> CREATE public;
[{ id: public:uy0qzy31v4xox8vivrd4 }]

test/test> SELECT * FROM public;
[{ id: public:uy0qzy31v4xox8vivrd4 }]

test/test> CREATE protected;
[]

test/test> SELECT * FROM protected;
[]

-- When guest access is denied
$ surreal db start --deny-guests

test/test> CREATE public;
Anonymous access not allowed: Not enough permissions to perform this action

test/test> SELECT * FROM public;
Anonymous access not allowed: Not enough permissions to perform this action

test/test> CREATE protected;
Anonymous access not allowed: Not enough permissions to perform this action

test/test> SELECT * FROM protected;
Anonymous access not allowed: Not enough permissions to perform this action
```

## Functions

SurrealDB offers [built-in functions](/docs/reference/query-language/functions/database-functions/array.md) to perform common operations like string manipulation, math, etc. Users can also define [their own functions](/docs/reference/query-language/statements/define/function.md) with custom logic.

In certain environments, you may not want users to use specific functions (i.e. `http::*`) or execute any custom function at all. You can use the allow/deny lists to configure what functions are allowed and what functions are denied.

```bash
// Allow all functions except the http family and crypto::md5()
surreal db start --allow-funcs --deny-funcs "http","crypto::md5"

// Allow certain custom functions only (all custom functions start with "fn::")
surreal db start --allow-funcs "fn::shared_fn"
```

A denied function is refused however a query calls it, including through method syntax. With `--deny-funcs string::len`, both `string::len('abcd')` and `'abcd'.len()` return the error `Function 'string::len' is not allowed to be executed`. From SurrealDB 4.0, this also applies to a call from an [embedded script](/docs/reference/query-language/scripting/surrealql-functions.md) through `surrealdb.functions`, such as `surrealdb.functions.string.len('abcd')`.

> [!WARNING]
> Before SurrealDB 3.3.1, method syntax was able to call some denied functions: `'abcd'.len()` returned `4` while `string::len('abcd')` was refused. SurrealDB 3.3.1 fixes this.

## Network

SurrealDB can make outbound network connections from [`http::*`](/docs/reference/query-language/functions/database-functions/http.md) functions and from JWKS fetches used by [JWT access methods](/docs/reference/query-language/statements/define/access/jwt.md#json-web-key-set-jwks). Use `--allow-net` and `--deny-net` to control which targets those connections may reach.

```bash
# Deny network access to localhost and private IPv4 ranges
surreal db start --allow-net --deny-net "127.0.0.1","localhost","10.0.0.0/8","192.168.0.0/16","172.16.0.0/12"

# Allow access to one host, on any port
surreal db start --allow-net internal.example.com

# Allow access to one IP address on port 443 only
surreal db start --allow-net 10.1.2.3:443

# Allow access to some private networks but not to others
surreal db start --allow-net 10.0.0.0/16 --deny-net 10.10.0.0/24
```

A target without a port, such as `internal.example.com`, allows or denies every port of that host. A target with a port allows or denies only that port. A port wildcard such as `internal.example.com:*` is not accepted, and the server refuses to start with `The provided network target is not a valid host name, IP address or CIDR block`, so leave the port out to cover every port.

> [!WARNING]
> An allow rule that names a host with a port, such as `internal.example.com:443`, currently refuses every request to that host. The host name is checked again without a port when it is resolved, and the rule does not match it, so the request fails with `There was an error processing a remote HTTP request: error sending request for url` rather than a capability error. Allow the host without a port. A port in an allow rule works only for a request whose URL names an IP address, such as `https://10.1.2.3:443`, and a deny rule with a port works in both cases.

From SurrealDB 4.0, a target can name every subdomain of a domain with `*.` as its leftmost label. `*.example.com` matches `api.example.com` and `a.b.example.com`, but not `example.com` itself, so list both to include the domain. A wildcard never matches an IP address, and a deny rule with a wildcard wins over an allow rule in the same way as any other.

```bash
# Allow any subdomain of example.com
surreal db start --allow-net "*.example.com"

# Allow all network access except to one domain and its subdomains
surreal db start --allow-net --deny-net "tracker.example","*.tracker.example"
```

A wildcard must be the whole leftmost label and be followed by at least two labels, so `*.com`, `a.*.example.com` and `*example.com` are refused when the server starts. Before 4.0, a target such as `*.example.com` was read as an exact host name, which matches nothing.

SurrealDB resolves hostnames with DNS, then checks every resulting IP address against `--allow-net` and `--deny-net`. A hostname that resolves to an address listed in `--deny-net` is blocked.

Note that allowlisting a hostname alone is not enough when that name resolves to a private or special-use address (loopback, link-local, RFC1918 ranges, cloud metadata endpoints, etc.). SurrealDB blocks those addresses unless you also list the IP or CIDR in `--allow-net`, or you pass `--allow-net` with no target filter. This reduces SSRF risk from DNS rebinding or HTTP redirects into the local network.

Example for an in-cluster JWKS issuer whose service name resolves inside `10.0.0.0/8`:

```bash
surreal db start --deny-all --allow-net idp.namespace.svc,10.0.0.0/8
```

> [!WARNING]
> SurrealDB does not perform reverse DNS lookups. A client can still reach an IP address directly even when a hostname that resolves to that IP is listed in `--deny-net`. This matters when network access is allowed by default (for example `--allow-net --deny-net www.example.com`) or when an IP is allowlisted while its hostname is denylisted (for example `--allow-net 203.0.113.10 --deny-net www.example.com`).

Deny by default: list only the `--allow-net` targets you need, and keep additional network controls in your infrastructure.

## Arbitrary queries

The `--allow-arbitrary-query` and `--deny-arbitrary-query` allow database administrators to allow or deny arbitrary querying by either guest, record or system users, or a combination of those. This capability setting affects the following: [/sql endpoint](/docs/reference/rest-api/http-protocol.md#sql), [/key endpoints](/docs/reference/rest-api/http-protocol.md#get-table), [/graphql endpoint](/docs/reference/rest-api/http-protocol.md#graphql), [/gql endpoint](/docs/reference/rest-api/http-protocol.md#gql), the [Postgres wire protocol](/docs/reference/rest-api/postgres-protocol.md) listener, [RPC methods](/docs/reference/rest-api/rpc-protocol.md) `use`, `select`, `create`, `update`, `merge`, `patch`, `delete`, `relate`, `insert`, `insert_relation`, `query`, `gql`, `graphql`, `pgsql` and `mysql`, and the [`eval::*`](/docs/reference/query-language/functions/database-functions/eval.md) functions. From SurrealDB 4.0, it also affects the `surrealdb.query()` and `surrealdb.value()` functions inside an [embedded script](/docs/reference/query-language/scripting/built-in-functions.md), so a script that a record user runs through a defined function or a `DEFINE API` endpoint fails with `Function 'surrealdb.query' is not allowed to be executed` when arbitrary queries are denied for record users.

Endpoints that do not accept arbitrary queries such as [`/version`](/docs/reference/rest-api/http-protocol.md#version) and [authentication endpoints](/docs/reference/rest-api/http-protocol.md#signin) are not affected.

The `--deny-arbitrary-query` flag is often preceded with a [`DEFINE API`](/docs/reference/query-language/statements/define/api.md) statement to set up certain endpoints that users can use to access database resources in place of arbitrary queries.

## Eval queries

_(since v3.2.0)_

The [`eval::surql`](/docs/reference/query-language/functions/database-functions/eval.md) and [`eval::gql`](/docs/reference/query-language/functions/database-functions/eval.md) functions evaluate query strings at runtime. They are controlled by **`--allow-eval-query`** and **`--deny-eval-query`**, with subject groups `guest`, `record`, and `system`.

Unlike most capabilities, **eval is denied for every subject by default**, including when you pass `--allow-all`. You must opt in explicitly:

```bash
surreal db start --allow-eval-query
```

Arbitrary queries are **allowed by default** on the server, so you do not need `--allow-arbitrary-query` for eval unless you have restricted arbitrary queries (for example with `--deny-arbitrary-query` or `--deny-all`). If a subject is denied arbitrary queries - a common pattern alongside [`DEFINE API`](/docs/reference/query-language/statements/define/api.md) - **`eval` is denied for that subject too**, even when `--allow-eval-query` includes them. `eval` cannot bypass arbitrary-query lockdown.

Deny rules at the same specificity prevail over allow rules. A record user calling an owner-defined function that invokes `eval` is still checked as `record` - auth limiting never escalates the subject.

Configure `--allow-eval-query` on **`surreal db start`** when clients connect to a remote instance. It is not required on `surreal db sql` for remote connections - only for [embedded REPL sessions](/docs/reference/cli/db/commands/sql.md#capabilities-and-remote-connections).

`eval::gql` does not need an experimental capability from **3.3.0** (on **3.2.x**, also allow `gql`). See [Eval functions](/docs/reference/query-language/functions/database-functions/eval.md) and [Representations and codecs](/docs/learn/querying/concepts-and-guides/representations-and-codecs.md).

## HTTP routes and RPC methods

Two capabilities switch individual entry points off rather than whole classes of behaviour. `--allow-http` and `--deny-http` take HTTP route names, and `--allow-rpc` and `--deny-rpc` take RPC method names. Each takes a comma-separated list, or no value at all to mean every route or every method.

```bash
# Close the SQL and import endpoints, leave the rest open
surreal db start --deny-http sql,import

# Open only the RPC methods a read-only client needs
surreal db start --deny-rpc --allow-rpc use,select,query
```

These follow the same [priority rules](#priority) as every other capability, so a specific deny beats a specific allow, and both beat the blanket form.

### HTTP route names

A route name covers every method and path under it, so `key` covers all ten [`/key`](/docs/reference/rest-api/http-protocol.md#get-table) endpoints.

| Name | Covers |
| --- | --- |
| `health` | [`GET /health`](/docs/reference/rest-api/http-protocol.md#health) and the gRPC [`Health`](/docs/reference/rest-api/rpc-protocol.md#grpc-transport) call, but not the `/status` and `/ready` probes |
| `version` | [`GET /version`](/docs/reference/rest-api/http-protocol.md#version) |
| `import` | [`POST /import`](/docs/reference/rest-api/http-protocol.md#import) |
| `export` | [`POST /export`](/docs/reference/rest-api/http-protocol.md#export) |
| `signin` | [`POST /signin`](/docs/reference/rest-api/http-protocol.md#signin) |
| `signup` | [`POST /signup`](/docs/reference/rest-api/http-protocol.md#signup) |
| `key` | The [`/key`](/docs/reference/rest-api/http-protocol.md#get-table) table and record endpoints |
| `sql` | [`POST /sql`](/docs/reference/rest-api/http-protocol.md#sql) |
| `gql` | [`POST /gql`](/docs/reference/rest-api/http-protocol.md#gql), and the `gql` dialect on the Postgres and MySQL listeners |
| `graphql` | [`POST /graphql`](/docs/reference/rest-api/http-protocol.md#graphql) |
| `api` | Endpoints defined with [`DEFINE API`](/docs/reference/query-language/statements/define/api.md) |
| `bucket` _(since v4.0.0)_ | The [`/bucket`](/docs/reference/rest-api/http-protocol.md#bucket) file routes, including requests with a presigned URL |
| `mcp` | The [MCP server](/docs/reference/cli/db/commands/mcp.md) endpoint |
| `rpc` | The HTTP [`/rpc`](/docs/reference/rest-api/rpc-protocol.md) endpoint |
| `sync` | The internal sync endpoint |
| `postgres` _(since v3.3.0)_ | The [Postgres wire protocol](/docs/reference/rest-api/postgres-protocol.md) listener, and the PostgreSQL dialect on the MySQL listener |
| `mysql` _(since v4.0.0)_ | The [MySQL wire protocol](/docs/reference/rest-api/mysql-protocol.md) listener |

`rpc` closes the HTTP `/rpc` endpoint as a whole. To leave it open and restrict what can be called through it, use the RPC method names below, which apply to the WebSocket and gRPC transports as well.

### RPC method names

| Group | Names |
| --- | --- |
| Session | `use`, `info`, `ping`, `version`, `reset` |
| Authentication | `signup`, `signin`, `authenticate`, `invalidate`, `refresh`, `revoke` |
| Querying | `query`, `run`, `gql`, `graphql`, `pgsql`, `mysql` |
| Reading and writing | `select`, `create`, `insert`, `insert_relation`, `relate`, `update`, `upsert`, `merge`, `patch`, `delete` |
| Parameters | `set`, `unset` |
| Live queries | `live`, `kill` |
| Transactions | `begin`, `commit`, `cancel` |
| Streaming | `query_stream`, `query_cancel` |
| Attached sessions | `attach`, `detach`, `sessions` |

Names are matched case-insensitively, so `--deny-rpc GraphQL` and `--deny-rpc graphql` are the same. `gql` and `graphql` are separate methods.

### MCP tools

_(since v4.0.0)_

`--allow-mcp` and `--deny-mcp` allow or deny individual tools of the [built-in MCP server](/docs/build/ai-agents/mcp/embedded.md) that `surreal db start` serves at `/mcp`. They take tool names in the same way as the HTTP and RPC flags, and follow the same priority rules. Every tool is allowed by default.

```bash
# Leave the MCP server open, without its GraphQL tools
surreal db start --deny-mcp graphql,gql

# Allow only the tools that read
surreal db start --deny-mcp --allow-mcp use,info,list,select
```

The tool names are `query`, `select`, `create`, `insert`, `upsert`, `update`, `delete`, `relate`, `info`, `list`, `use`, `run`, `gql` and `graphql`, matched case-insensitively. A call to a denied tool runs nothing, and the client receives a tool error that says the tool is denied by the server's capability configuration. The flags apply to tool calls only, and do not affect the server's resources and prompts. To close the MCP server as a whole, deny the `mcp` [HTTP route](#http-route-names) instead.

## GQL entry surfaces

ISO GQL is on by default from **3.3.0**, and the GQL executor is reachable from four entry surfaces. Each has its own switch, so a deployment that serves no GQL closes each surface it exposes:

| Entry surface | Switch |
| --- | --- |
| The `/gql` endpoint | `--deny-http gql` |
| The `gql` [RPC method](/docs/reference/rest-api/rpc-protocol.md), over WebSocket, HTTP `/rpc` and gRPC | `--deny-rpc gql` |
| [`eval::gql()`](/docs/reference/query-language/functions/database-functions/eval.md) inside any SurrealQL | `--deny-eval-query`, which is also the default state. `--deny-funcs` reaches it as well. |
| The [Postgres wire protocol](/docs/reference/rest-api/postgres-protocol.md) `dialect=gql` _(since v3.3.0)_ | `--deny-http gql` |

`--deny-http gql` covers the `/gql` endpoint and the Postgres dialect together, because both are checked against the same `gql` route target. The `gql` RPC method answers to `--deny-rpc gql` instead, so the HTTP route and the RPC method are closed separately. The Postgres listener has a route name of its own, so `--deny-http postgres` closes the port whatever dialect a client asks for, and `--deny-http gql` leaves the port open while refusing the GQL dialect on it.

### Selecting the Postgres dialect

_(since v3.3.0)_

A Postgres client selects the dialect in two places, and both are checked from 3.3.0. A connection that asks for GQL at connect time with `options=-c dialect=gql` is refused and closed. A session that runs `SET dialect = 'gql'` receives `42501 insufficient_privilege` and stays usable for SurrealQL.

The check runs where the dialect is selected rather than where a query runs, so a client learns the reason at that point instead of receiving parse errors from a connection left in SurrealQL.

[`--deny-arbitrary-query`](#arbitrary-queries) reaches all four surfaces as well, since each of them accepts a query string.

## Learn more about this topic

- [Query capabilities](https://surrealdb.com/learn/fundamentals/security/query-capabilities#guest-access) (SurrealDB University, section "Guest access")
