Configuration
Every flag and environment variable for the Backend MCP Server, including the GraphQL endpoint, optional storage URL and download limit, OAuth2 auth URL, role enforcement, and tool instructions.
MCP configuration environment variables flags MCP_GRAPHQL_ENDPOINT MCP_STORAGE_URL MCP_STORAGE_MAX_TRANSFER_BYTES MCP_AUTH_URL MCP_ENFORCE_ROLE MCP_INSTRUCTIONSEvery setting can be provided either as a command-line flag or as an environment variable. When running on Nhost Run you will typically use the environment variables.
Two settings are required: MCP_GRAPHQL_ENDPOINT and MCP_AUTH_URL.
Server
Section titled “Server”| Flag | Environment variable | Default | Description |
|---|---|---|---|
--listen-addr |
MCP_LISTEN_ADDR |
:3000 |
HTTP listen address. |
--debug |
MCP_DEBUG |
false |
Enable debug logging. |
--log-format-text |
MCP_LOG_FORMAT_TEXT |
false |
Format logs as plain text instead of JSON. |
--browser-html |
MCP_BROWSER_HTML |
built-in page | HTML to serve when a browser (a GET request that accepts text/html) visits the service URL. Useful for showing a friendly landing page instead of an MCP error. |
GraphQL
Section titled “GraphQL”| Flag | Environment variable | Description |
|---|---|---|
--graphql-endpoint |
MCP_GRAPHQL_ENDPOINT |
Required. The GraphQL endpoint the server forwards queries and mutations to. On Nhost Run this is usually the internal endpoint, for example http://hasura-service:8080/v1/graphql. |
Storage
Section titled “Storage”| Flag | Environment variable | Description |
|---|---|---|
--storage-url |
MCP_STORAGE_URL |
Optional. The storage service URL for the same backend as the GraphQL and Auth endpoints, including its API prefix (normally /v1), for example https://SUBDOMAIN.storage.REGION.nhost.run/v1. Enables the read-only storage-download tool when set. |
On Nhost Run, use http://hasura-storage-service:5000/v1. For other deployments, use an absolute HTTP or HTTPS URL reachable from the MCP server. Do not include credentials, a query string, or a fragment. The server rejects invalid URLs at startup. Leave this setting unset to disable the tool.
Setting the URL does not grant Storage permissions. Downloads run with the signed-in user’s role.
Transfer limits
Section titled “Transfer limits”| Flag | Environment variable | Default | Description |
|---|---|---|---|
--storage-max-transfer-bytes |
MCP_STORAGE_MAX_TRANSFER_BYTES |
50000000 (50 MB) |
Maximum upstream storage download response in bytes, including error bodies. |
The limit must be a positive integer below 9223372036854775807; invalid values make startup fail when storage is enabled. Storage still enforces bucket limits and permissions.
This limit is per download, not a cap on server memory. The server buffers and encodes each response, so large or concurrent downloads can use much more memory than the file size suggests. The Nhost Run examples set a 10 MB limit for a 256 MiB service. Test with your expected file sizes and concurrency before raising the limit. Your MCP client, model provider, or proxy may impose a smaller limit.
If a file exceeds the limit, retry with smaller byte ranges or request a smaller image. Storage ignores byte ranges when you request an image transformation.
Authentication
Section titled “Authentication”| Flag | Environment variable | Description |
|---|---|---|
--auth-url |
MCP_AUTH_URL |
Required. The OAuth2 authorization server URL — your Nhost Auth URL, for example https://SUBDOMAIN.auth.REGION.nhost.run/v1. Used for JWKS validation and discovery metadata. |
--realm |
MCP_REALM |
The realm reported in the WWW-Authenticate header. Set it to the public URL of your Backend MCP Server. |
--enforce-role |
MCP_ENFORCE_ROLE |
Require that the JWT’s default Hasura role matches this value. Tokens with a different default role receive 403 Forbidden. See Roles & permissions. |
MCP instructions
Section titled “MCP instructions”Instructions are free-form text passed to the assistant to describe your application and guide how it uses each tool. All are optional.
| Flag | Environment variable | Description |
|---|---|---|
--mcp-instructions |
MCP_INSTRUCTIONS |
Server-level instructions describing your application, surfaced to the client on connect. |
--query-instructions |
MCP_QUERY_INSTRUCTIONS |
Overrides the description of the graphql-query tool. |
--mutation-instructions |
MCP_MUTATION_INSTRUCTIONS |
Overrides the description of the graphql-mutation tool. |
--schema-instructions |
MCP_SCHEMA_INSTRUCTIONS |
Overrides the description of the get-schema tool. |
Endpoints
Section titled “Endpoints”The server exposes the MCP endpoint at the root path over a streamable HTTP transport, plus the OAuth2 discovery documents:
| Method | Path | Purpose |
|---|---|---|
POST |
/ |
MCP requests (requires a valid bearer token). |
GET |
/ |
MCP requests, or the browser landing page for text/html requests. |
DELETE |
/ |
MCP session teardown (requires a valid bearer token). |
GET |
/.well-known/oauth-protected-resource |
Protected-resource metadata. |
GET |
/.well-known/oauth-authorization-server |
Authorization-server metadata. |
See Authentication for what the discovery documents contain.