Advanced Hasura GraphQL MCP Server
Enables execution of GraphQL queries and mutations against a Hasura endpoint, with support for introspection, type exploration, and schema analysis.
Provides tools for interacting with a Hasura GraphQL endpoint, enabling access to schema information, executing queries and mutations, managing tables, previewing data, and performing aggregations.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Advanced Hasura GraphQL MCP Server show me the structure of the users table"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Advanced Hasura GraphQL MCP Server
Version: 1.1.0
This Model Context Protocol (MCP) server provides an advanced interface for AI agents (like those in Cursor or Claude Desktop) to interact with a Hasura GraphQL endpoint. It enables agents to discover the API structure, execute both read-only queries and mutations (with caution), preview data, perform aggregations, and check service health.
This server enhances LLM capabilities by allowing them to leverage your Hasura API dynamically based on natural language requests.
Features
This server exposes the following MCP capabilities:
Resources:
Hasura GraphQL Schema (
hasura:/schema)Provides the full GraphQL schema definition obtained via standard introspection.
MIME Type:
application/jsonAgents can read this resource to understand the complete structure of the API, including types, fields, arguments, directives, etc.
Tools:
run_graphql_queryDescription: Executes a read-only GraphQL query against the Hasura endpoint. Use this for fetching data when a specific tool isn't available. Ensure the query does not modify data. Example:
query { users { id name } }Input:
{ query: string, variables?: object }Note: Performs a basic check to prevent execution of strings starting with
mutation. Primarily relies on the query itself being read-only.
run_graphql_mutationDescription: Executes a GraphQL mutation to insert, update, or delete data. Use with caution, ensure the operation is intended and safe. Relies on Hasura permissions configured for the provided Admin Secret or default role. Example:
mutation { insert_users_one(object: {name: "Test"}) { id } }Input:
{ mutation: string, variables?: object }Security: Allows any mutation permitted by the Hasura role. Ensure appropriate Hasura permissions are configured.
list_tablesDescription: Lists available data tables (or collections) managed by Hasura, organized by schema with descriptions, based on introspection heuristics (looks for object types with an 'id' field, excluding internal/aggregate types). Useful for discovering available data sources.
Input:
{ schemaName?: string }(Optional schema name, attempts to infer from field descriptions if possible, defaults to 'public' conceptually)
describe_tableDescription: Shows the structure of a specific table including all its columns (fields) with their GraphQL types and descriptions.
Input:
{ tableName: string, schemaName?: string }
list_root_fieldsDescription: Lists the available top-level query, mutation, or subscription fields from the GraphQL schema. Useful for understanding the primary entry points for operations.
Input:
{ fieldType?: 'QUERY' | 'MUTATION' | 'SUBSCRIPTION' }(Optional filter)
describe_graphql_typeDescription: Provides details about a specific GraphQL type (Object, Input, Scalar, Enum, Interface, Union) using schema introspection. Essential for understanding how to structure queries or mutations involving specific types.
Input:
{ typeName: string }(Case-sensitive type name)
preview_table_dataDescription: Fetches a limited sample of rows (default 5) from a specified table to preview its data structure and content. Selects common scalar and enum fields automatically.
Input:
{ tableName: string, limit?: number }
aggregate_dataDescription: Performs a simple aggregation (count, sum, avg, min, max) on a specified table, optionally applying a Hasura 'where' filter. Use 'list_tables' to find table names. Requires 'field' for non-count aggregations.
Input:
{ tableName: string, aggregateFunction: 'count'|'sum'|'avg'|'min'|'max', field?: string, filter?: object }
health_checkDescription: Checks if the configured Hasura GraphQL endpoint is reachable and responding to a basic GraphQL query (
{ __typename }). Can optionally check a specific HTTP health endpoint URL if known.Input:
{ healthEndpointUrl?: string }(Optional specific health URL)
Related MCP server: GraphQL MCP Toolkit
Requirements
Node.js (v18 or higher recommended, check
.nvmrcorpackage.json enginesif specified)pnpm(ornpm/yarn, adjust commands accordingly)Access to a running Hasura GraphQL endpoint.
(Optional but recommended) Hasura Admin Secret for privileged access, or properly configured default role permissions.
Setup and Installation
Clone the Repository (if applicable):
# git clone <repository_url> # cd mcp-hasura-advancedInstall Dependencies:
pnpm installBuild the Server:
pnpm run buildThis compiles the TypeScript code into the
distdirectory.
Running the Server
Execute the compiled script from your terminal, providing the Hasura endpoint URL and optionally the admin secret:
# Using pnpm start script (defined in package.json)
pnpm start <HASURA_GRAPHQL_ENDPOINT> [ADMIN_SECRET]
# Or using Node directly
node dist/index.js <HASURA_GRAPHQL_ENDPOINT> [ADMIN_SECRET]Example:
pnpm start https://my-hasura.cloud/v1/graphql mysecretkey123or
node dist/index.js https://my-hasura.cloud/v1/graphql mysecretkey123If no admin secret is needed (using default role permissions):
pnpm start https://my-hasura.cloud/v1/graphqlThe server will start, attempt an initial schema introspection, connect to the STDIO transport, and log status messages to stderr. It listens for MCP JSON-RPC requests on stdin and sends responses to stdout.
Usage with MCP Clients (e.g., Cursor, Claude Desktop)
To connect this server to an MCP client like Cursor:
Find Absolute Paths:
Node executable: Run
which nodein your terminal.Server script: Navigate to the
mcp-hasura-advanceddirectory and runpwd. Append/dist/index.jsto the result.Project directory: The output of
pwd.
Configure the Client: Open your client's configuration file (e.g.,
settings.jsonfor Cursor,claude_desktop_config.jsonfor Claude Desktop).Add Server Entry: Add an entry under the appropriate key (e.g.,
cursor.customMcpServersarray for Cursor,mcpServersobject for Claude Desktop).
Example Cursor settings.json:
{
// ... other settings ...
"cursor.customMcpServers": [
// ... other servers ...
{
"name": "My Advanced Hasura Server", // Name shown in Cursor UI
"command": "/path/to/your/node", // <<< Absolute path from 'which node'
"args": [
"/absolute/path/to/mcp-hasura-advanced/dist/index.js", // <<< Absolute path to compiled script
"https://YOUR_HASURA_ENDPOINT.com/v1/graphql", // <<< Your endpoint
"YOUR_ADMIN_SECRET" // <<< Your secret (REMOVE if no secret)
],
// Optional but recommended for module resolution consistency:
"cwd": "/absolute/path/to/mcp-hasura-advanced" // <<< Absolute path to project root
}
]
}Example Claude Desktop claude_desktop_config.json:
{
"mcpServers": {
// ... other servers ...
"hasura-advanced": { // Key used internally by Claude
"command": "/path/to/your/node", // <<< Absolute path from 'which node'
"args": [
"/absolute/path/to/mcp-hasura-advanced/dist/index.js", // <<< Absolute path to compiled script
"https://YOUR_HASURA_ENDPOINT.com/v1/graphql", // <<< Your endpoint
"YOUR_ADMIN_SECRET" // <<< Your secret (REMOVE if no secret)
],
// Optional:
// "cwd": "/absolute/path/to/mcp-hasura-advanced"
}
}
}Replace Placeholders: Update all placeholders (
/path/to/...,https://YOUR...,YOUR_ADMIN_SECRET) with your actual values.Restart/Reload Client: Save the configuration and restart or reload your MCP client application.
Select Server: Choose "My Advanced Hasura Server" (or the name you specified) in the client's UI.
Interact: Use natural language prompts in your client's chat to leverage the server's tools (e.g., "List tables using the Hasura server", "Describe the 'users' table", "Preview data from the 'orders' table", "Run the query
{ products { name price } }using the Hasura server").
Development
Run in Dev Mode: Use
pnpm run dev <ENDPOINT> [SECRET]to run the server directly withts-nodefor faster iteration (no build step needed).Testing: Test individual tools by running the server manually (
pnpm start ...) and piping JSON-RPC requests to itsstdin.
Available Tools
9 toolsaggregate_dataC
Performs a simple aggregation (count, sum, avg, min, max)...
Inputs: aggregateFunction (required), tableName (required), field, filter.
describe_graphql_typeC
Provides details about a specific GraphQL type (Object, Input, Scalar, Enum, Interface, Union)...
Inputs: typeName (required).
describe_tableB
Shows the structure of a table including all columns with their types and descriptions
Inputs: tableName (required), schemaName.
health_checkC
Checks if the configured Hasura GraphQL endpoint is reachable...
Inputs: healthEndpointUrl.
list_root_fieldsC
Lists the available top-level query, mutation, or subscription fields...
Inputs: fieldType.
list_tablesA
Lists available data tables (or collections) managed by Hasura, organized by schema with descriptions
Inputs: schemaName.
preview_table_dataB
Fetch esa limited sample of rows (default 5) from a specified table...
Inputs: tableName (required), limit.
run_graphql_mutationC
Executes a GraphQL mutation to insert, update, or delete data...
Inputs: mutation (required), variables.
run_graphql_queryA
Executes a read-only GraphQL query against the Hasura endpoint...
Inputs: query (required), variables.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each tool has a clearly distinct purpose with no ambiguity. Tools like 'list_tables', 'describe_table', and 'preview_table_data' form a logical progression for table exploration, while 'run_graphql_query' and 'run_graphql_mutation' handle different operation types. The 'aggregate_data' tool provides specific functionality separate from general queries.
All tools follow a consistent verb_noun naming pattern throughout. Examples include 'list_tables', 'describe_table', 'run_graphql_query', and 'preview_table_data'. This consistency makes the tool set predictable and easy for agents to understand and navigate.
With 9 tools, this server is well-scoped for its purpose of interacting with Hasura GraphQL. Each tool earns its place by covering distinct aspects like schema exploration, data operations, and system health. The count is neither too sparse nor overwhelming for the domain.
The tool surface provides complete coverage for Hasura GraphQL interaction. It includes schema discovery ('list_root_fields', 'describe_graphql_type'), data exploration ('list_tables', 'describe_table', 'preview_table_data'), CRUD operations ('run_graphql_query', 'run_graphql_mutation', 'aggregate_data'), and system monitoring ('health_check'). No obvious gaps exist for core workflows.
Maintenance
Related MCP Connectors
The Grafbase MCP server sits in front of a GraphQL API and exposes an MCP protocol-compliant interface that allows AI agents and LLMs to explore and query GraphQL APIs using natural language. It provides tools to search schemas, introspect types and fields, and execute GraphQL queries while minimizing context bloat by returning only relevant schema subsets, with built-in support for authentication, authorization, and configurable access control.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables LLMs to interact with GraphQL APIs by providing schema introspection and query execution capabilities.995 npm3MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables LLMs to interact with GraphQL APIs by providing schema introspection and query execution capabilities.11 npmMIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server providing dual transport (HTTP and Stdio) access to PostgreSQL databases, allowing AI assistants to query databases and fetch schema information through natural language.49 npm31MIT
- AlicenseCqualityDmaintenanceA Model Context Protocol server for executing GraphQL queries, allowing AI models to interact with GraphQL APIs through introspection and query execution.3995 npmMIT