Labsco
MCP SERVER

Hasura GraphQL

by husamabusafa

Discover a Hasura GraphQL API and query it — table listings, type introspection, data previews and aggregations — with reads and writes as separate tools.

Relational SQL Databases
Summary
Discovery tools first, because a model that guesses at a GraphQL schema wastes the call.

Half the tool set exists so the model can find out what is queryable before it writes a query — tables, columns, root fields, type definitions, and a five-row preview of real data. Mutations are deliberately a separate tool from queries, and the query tool rejects strings starting with mutation. Worth being deliberate about the admin secret: with it supplied, any mutation your Hasura permissions allow is available to the agent.

What it is

An MCP server for a Hasura GraphQL endpoint. It publishes the full introspected schema as a resource, and wraps discovery, reads, writes and aggregation as distinct tools so an agent can learn the API before calling it.

What you get
  • The complete GraphQL schema is exposed as a readable resource at hasura:/schema, as JSON
  • list_tables discovers available data sources, organised by schema with descriptions; describe_table returns one table's columns with their GraphQL types
  • list_root_fields shows the top-level query, mutation and subscription entry points, optionally filtered by type; describe_graphql_type explains a specific object, input, scalar, enum, interface or union
  • preview_table_data pulls a small sample — five rows by default — selecting the scalar and enum fields automatically
  • aggregate_data runs count, sum, avg, min or max on a table, with an optional Hasura where filter
  • run_graphql_query executes a read-only query; run_graphql_mutation is a separate tool for inserts, updates and deletes
  • health_check confirms the endpoint answers a basic query, and can check a specific health URL if you have one
Requirements

Node.js v18 or higher and a reachable Hasura GraphQL endpoint. Build from a checkout with pnpm install and pnpm run build, then run `node dist/index.js <HASURA_GRAPHQL_ENDPOINT> [ADMIN_SECRET]` — the endpoint and optional admin secret are positional arguments, not environment variables. Without a secret it runs under Hasura's default role permissions.