Interact with a Hasura GraphQL endpoint, enabling schema introspection, queries, mutations, and data aggregation.
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.
This server exposes the following MCP capabilities:
Resources:
hasura:/schema
)
application/json
Tools:
run_graphql_query
query { users { id name } }
{ query: string, variables?: object }
mutation
. Primarily relies on the query itself being read-only.run_graphql_mutation
mutation { insert_users_one(object: {name: "Test"}) { id } }
{ mutation: string, variables?: object }
list_tables
{ schemaName?: string }
(Optional schema name, attempts to infer from field descriptions if possible, defaults to 'public' conceptually)describe_table
{ tableName: string, schemaName?: string }
list_root_fields
{ fieldType?: 'QUERY' | 'MUTATION' | 'SUBSCRIPTION' }
(Optional filter)describe_graphql_type
{ typeName: string }
(Case-sensitive type name)preview_table_data
{ tableName: string, limit?: number }
aggregate_data
{ tableName: string, aggregateFunction: 'count'|'sum'|'avg'|'min'|'max', field?: string, filter?: object }
health_check
{ __typename }
). Can optionally check a specific HTTP health endpoint URL if known.{ healthEndpointUrl?: string }
(Optional specific health URL).nvmrc
or package.json engines
if specified)pnpm
(or npm
/yarn
, adjust commands accordingly)# git clone <repository_url>
# cd mcp-hasura-advanced
pnpm install
pnpm run build
This compiles the TypeScript code into the dist
directory.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 mysecretkey123
or
node dist/index.js https://my-hasura.cloud/v1/graphql mysecretkey123
If no admin secret is needed (using default role permissions):
pnpm start https://my-hasura.cloud/v1/graphql
The 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
.
To connect this server to an MCP client like Cursor:
which node
in your terminal.mcp-hasura-advanced
directory and run pwd
. Append /dist/index.js
to the result.pwd
.settings.json
for Cursor, claude_desktop_config.json
for Claude Desktop).cursor.customMcpServers
array for Cursor, mcpServers
object 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"
}
}
}
/path/to/...
, https://YOUR...
, YOUR_ADMIN_SECRET
) with your actual values.{ products { name price } }
using the Hasura server").pnpm run dev <ENDPOINT> [SECRET]
to run the server directly with ts-node
for faster iteration (no build step needed).pnpm start ...
) and piping JSON-RPC requests to its stdin
.A server for managing PostgreSQL databases, enabling comprehensive database operations.
Provides AI agents with direct access to query, search, and analyze MySQL databases.
Connect AI tools with Pinecone projects to search, configure indexes, generate code, and manage data.
Provides access to supOS open APIs for querying topic structures, real-time and historical data, and executing SQL queries.
Analyze, lint, and convert SQL dialects using SQLGlot.
A comprehensive movie database server supporting advanced search, CRUD operations, and image management via a PostgreSQL database.
A Kotlin-based MCP server for interacting with PostgreSQL databases.
Query the Materials Project database using the mp_api client. Requires an MP_API_KEY environment variable.
Interact with the SingleStore database platform
MCP server for autonomous data exploration on .csv-based datasets, providing intelligent insights with minimal effort.