Deployment
Deploy the Backend MCP Server to Nhost Run with the one-click installer or a run-mcp.toml file, and run it locally with the Nhost CLI.
MCP deployment Nhost Run run-mcp.toml one-click install config-deploy Docker self-hostThe Backend MCP Server is a container image (nhost/mcp) that you deploy alongside your project on Nhost Run. It connects to your project’s GraphQL and Storage APIs over the internal network.
Before you deploy
Section titled “Before you deploy”Backend MCP relies on your Nhost Auth project being set up as an OAuth2 provider. Complete the authentication prerequisites — the OAuth2 provider, CIMD, and a consent page — before you deploy.
Deploy to Nhost Run
Section titled “Deploy to Nhost Run”Open the installer and select your Nhost project:
Review these environment variables before deploying:
MCP_AUTH_URL— set it to your project’s Auth URL, for examplehttps://SUBDOMAIN.auth.REGION.nhost.run/v1.MCP_REALM— set it to the public URL of your MCP service.MCP_INSTRUCTIONS— replace the sample text with a description of your application.MCP_ENFORCE_ROLE— set it to your dedicated MCP role, or remove it to use each signed-in user’s default role.
The installer preconfigures MCP_GRAPHQL_ENDPOINT and MCP_STORAGE_URL to use your project’s internal endpoints.
Add a run-mcp.toml file to your project directory:
name = 'mcp'command = ['mcp']
[image]image = 'nhost/mcp:0.4.0'
[[environment]]name = 'MCP_AUTH_URL'value = 'https://SUBDOMAIN.auth.REGION.nhost.run/v1'
[[environment]]name = 'MCP_REALM'value = 'https://mcp.acme.com'
[[environment]]name = 'MCP_GRAPHQL_ENDPOINT'value = 'http://hasura-service:8080/v1/graphql'
[[environment]]name = 'MCP_STORAGE_URL'value = 'http://hasura-storage-service:5000/v1'
[[environment]]name = 'MCP_STORAGE_MAX_TRANSFER_BYTES'value = '10000000'
[[environment]]name = 'MCP_INSTRUCTIONS'value = 'This MCP server interacts with my application'
[[environment]]name = 'MCP_ENFORCE_ROLE'value = 'user_mcp'
[[ports]]port = 3000type = 'http'publish = true
[resources]replicas = 1
[resources.compute]cpu = 125memory = 256Replace the sample Auth URL, realm, instructions, and role with values for your project. Set SERVICE_ID to your Nhost Run service ID, then deploy Backend MCP:
nhost run config-deploy \ --config run-mcp.toml \ --service-id $SERVICE_IDFile downloads
Section titled “File downloads”Both deployment options enable the storage-download tool. It can only read files allowed by the signed-in user’s Download permissions. If your assistant doesn’t need to download files, remove MCP_STORAGE_URL to disable the tool.
Connect your client
Section titled “Connect your client”Once the service is running, connect your MCP client using the service’s public URL.
Run locally
Section titled “Run locally”To run Backend MCP in your local Nhost stack, set MCP_AUTH_URL in run-mcp.toml to your local Auth URL, for example https://local.auth.local.nhost.run/v1. Keep the internal GraphQL and Storage URLs. Then start the stack:
nhost up --run-service run-mcp.tomlConfiguration reference
Section titled “Configuration reference”Every setting can be supplied as a flag or an environment variable. MCP_GRAPHQL_ENDPOINT and MCP_AUTH_URL are required. See Configuration for the full list.