Exposes your Nhost GraphQL API as an MCP server to allow AI assistants to query and mutate project data within user-defined permissions.
Also known as nhost/nhost, mcp
- Stars
- 9,386
- Tools
- —
- Downloads, 30 days
- —
- Latest version
- 0.4.0-beta2
- Last commit
- Nov 14, 2026
- License
- MIT
What is Nhost MCP?
Nhost exposes your Nhost GraphQL API as an MCP server to allow AI assistants to query and mutate project data within user-defined permissions.
Summary generated from the project's README
About Nhost MCP server
This service provides an agentic interface for Nhost projects by exposing a GraphQL API through the Model Context Protocol. It is designed for developers building on Nhost who want to allow AI assistants like Claude or Cursor to interact with project data without writing custom integration code. The server acts as a bridge between the AI client and your GraphQL endpoint, ensuring that all interactions remain within your existing security framework.
Users connect via MCP-compatible clients using OAuth2 authentication provided by Nhost Auth. The system utilizes JWT tokens to enforce row-level and column-level permissions, meaning the AI assistant can only access data the authenticated user is permitted to see. You can further restrict access by using the enforce-role flag to limit the server to a specific Hasura role. The server provides three primary tools: get-schema for data model introspection, graphql-query for read-only operations, and graphql-mutation for creating, updating, or deleting data.
What you can do with it
- 1Introspect project data modelsAn AI assistant can examine your GraphQL schema to understand the available data structures.
- 2Perform read-only data queriesA developer can instruct an AI to fetch specific information from the database using GraphQL queries.
- 3Modify database records via AIAn AI agent can create, update, or delete entries in your project through mutations.
- 4Restrict AI access to specific rolesYou can configure the server to only accept tokens that match a designated user role.
Written from the project's README. Every use case is checked against a quote from it.
How to install Nhost MCP
Formats verified 10 Nov 2026Install Nhost MCP in Claude Code
$ 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-beta2Install Nhost MCP in Cursor
~/.cursor/mcp.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>"
}
}
}
}Install Nhost MCP in VS Code
.vscode/mcp.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>"
}
}
}
}Install Nhost MCP in Claude Desktop
claude_desktop_config.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>"
}
}
}
}Install Nhost MCP in Codex
~/.codex/config.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>"
Install Nhost MCP in Gemini CLI
~/.gemini/settings.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>"
}
}
}
}Configuration
MCP_AUTH_URLRequiredNhost Auth URL used as the OAuth2 authorization server, e.g. https://SUBDOMAIN.auth.REGION.nhost.run/v1
MCP_GRAPHQL_ENDPOINTRequiredGraphQL endpoint of the Nhost project the server exposes, e.g. http://hasura-service:8080/v1/graphql
| Name | Description | |
|---|---|---|
| MCP_AUTH_URL | Nhost Auth URL used as the OAuth2 authorization server, e.g. https://SUBDOMAIN.auth.REGION.nhost.run/v1 | Required |
| MCP_GRAPHQL_ENDPOINT | GraphQL endpoint of the Nhost project the server exposes, e.g. http://hasura-service:8080/v1/graphql | Required |
Automated checks
Ran Nov 12, 2026Full report →Not verified yet. A server needs a score of 80, no serious finding, and enough data for us to check. How checks work
- Source repository linked and reachablePass
- Open source license (OSI)Pass
- Commit or release in the last yearPass
- Package name not close to a popular packageNot checked
- Remote endpoint uses HTTPSNot checked
- Destructive tools are labelledNot checked
- No hidden instructions to the modelPass
- No critical advisory in the package or its dependenciesNot checked
README
View on GitHubNhost MCP Service
The Nhost MCP service adds an agentic interface to any Nhost project. It exposes your project's GraphQL API as an MCP (Model Context Protocol) server, allowing AI assistants like Claude, Cursor, or any MCP-compatible client to query and mutate your data.
If you're building on Nhost, this service lets your users interact with their project data through AI assistants — no custom integration code required. Deploy it alongside your project and any MCP-compatible client can connect, authenticate on behalf of your users via your existing Nhost Auth setup, and work with your data within the permissions defined.
How It Works
The MCP server sits between your AI assistant and your Nhost project's GraphQL API. It provides three tools that the assistant can call:
get-schema- Introspects the GraphQL schema so the assistant understands your data model. Returns either a summary of available operations or the full SDL for specific queries/mutations.graphql-query- Executes read-only GraphQL queries against your project.graphql-mutation- Executes GraphQL mutations to create, update, or delete data.
On startup, the server fetches a schema summary from your GraphQL endpoint and includes it in the MCP instructions, giving the AI assistant immediate context about your data model without any additional configuration.
Authentication with OAuth2
The MCP service integrates with Nhost Auth as an OAuth2 authorization server, following the MCP Authorization specification. This means any MCP client that supports OAuth2 can authenticate with your Nhost project automatically.
The flow works as follows:
- The MCP client discovers authentication requirements by fetching
/.well-known/oauth-protected-resourcefrom the MCP server. - The client redirects the user to the Nhost Auth authorization endpoint for login (authorization code flow with PKCE).
- After authentication, the client exchanges the authorization code for a JWT access token.
- All subsequent MCP requests include the JWT as a Bearer token.
- The MCP server validates the JWT signature via JWKS, checks the issuer and expiration, then forwards the token on every GraphQL request.
- The GraphQL service enforces row-level and column-level permissions based on the JWT's claims, so the AI assistant can only access data the authenticated user is allowed to see.
IMPORTANT! CIMD needs to be enabled.
Enforcing a Specific Role
The --enforce-role flag restricts the MCP server to accept only tokens whose x-hasura-default-role claim matches the specified role. Requests with a different default role receive a 403 Forbidden response.
For example, setting --enforce-role=user_mcp means only tokens issued with user_mcp as the default role will be accepted. If you've configured permissions for that role with limited access (e.g., read-only on certain tables), the AI assistant will be restricted to those permissions.
This lets you:
- Create a dedicated role (e.g.,
user_mcp) with restricted permissions for AI access. - Allow AI assistants to read data but not modify it.
- Limit which tables or columns are visible to the assistant.
- Run multiple MCP instances with different role configurations for different use cases.
Configuration
All flags can be set via environment variables.
| Flag | Env Var | Description |
|---|---|---|
--listen-addr |
MCP_LISTEN_ADDR |
HTTP listen address (default: :3000) |
--debug |
MCP_DEBUG |
Enable debug logging |
--log-format-text |
MCP_LOG_FORMAT_TEXT |
Format logs in plain text instead of JSON |
--graphql-endpoint |
MCP_GRAPHQL_ENDPOINT |
GraphQL endpoint URL (required) |
--mcp-instructions |
MCP_INSTRUCTIONS |
Server-level MCP instructions |
--query-instructions |
MCP_QUERY_INSTRUCTIONS |
Instructions for the graphql-query tool |
--mutation-instructions |
MCP_MUTATION_INSTRUCTIONS |
Instructions for the graphql-mutation tool |
--schema-instructions |
MCP_SCHEMA_INSTRUCTIONS |
Instructions for the get-schema tool |
--auth-url |
MCP_AUTH_URL |
OAuth2 authorization server URL (required) |
--realm |
MCP_REALM |
Realm for WWW-Authenticate header |
--enforce-role |
MCP_ENFORCE_ROLE |
Enforce that the JWT's default Hasura role matches this value |
--browser-html |
MCP_BROWSER_HTML |
HTML content to serve when a browser visits the service URL |
Deploying to Nhost
To deploy to Nhost Run you can use the one-click install link below:
And edit as needed. Make sure to set the correct subdomain and region in the MCP_AUTH_URL (or your custom domain if you using one), set the MCP_REALM to the URL you will use for your MCP service, change the MCP_INSTRUCTIONS as needed and change or remove MCP_ENFORCE_ROLE
NOTE: Check the releases page and make sure you are using the most recent version of the service.
Alternatively, add a run-mcp.toml to your project directory:
name = 'mcp'
command = ['mcp']
[image]
image = 'nhost/mcp:0.1.0'
[[environment]]
name = 'MCP_AUTH_URL'
value = 'https://local.auth.local.nhost.run/v1'
[[environment]]
name = 'MCP_REALM'
value = 'https://myapp.example.com'
[[environment]]
name = 'MCP_GRAPHQL_ENDPOINT'
value = 'http://hasura-service:8080/v1/graphql'
[[environment]]
name = 'MCP_INSTRUCTIONS'
value = 'This MCP server interacts with my application'
[[environment]]
name = 'MCP_ENFORCE_ROLE'
value = 'user_mcp'
[[ports]]
port = 3000
type = 'http'
publish = true
[resources]
replicas = 1
[resources.compute]
cpu = 125
memory = 256
Then deploy your project as usual. The MCP server will be available at the published port and any MCP-compatible client can connect to it.
You can also try locally with:
nhost up --run-service run-mcp.toml
Connecting an MCP Client
Point your MCP client to the server URL. For example, in Claude Desktop's configuration:
- Go to customize -> Connectors
- Click on
+and enter any name you want and the url where your MCP server resides, for instance https://mcp.acme.com - Click "Add"
- Once connected you will be redirected to your Oauth2's consent page to authorize the Oauth2 client.
Nhost MCP questions
How do I add Nhost MCP to Claude Code?
Run 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 in your terminal. Add --scope user to make it available in every project.
How do I add Nhost MCP to Cursor?
Open ~/.cursor/mcp.json and add the server under mcpServers, using the Cursor config shown in the install section above.
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.