This advanced Hasura GraphQL MCP server enables AI agents to interact with Hasura GraphQL endpoints through a rich set of tools. It provides capabilities for schema introspection, executing read-only queries and mutations, listing tables and their structures, previewing data samples, performing aggregations, and checking service health. The implementation handles authentication via admin secrets, performs basic security checks on operations, and exposes the complete GraphQL schema as a resource, making it ideal for AI assistants that need to dynamically discover and leverage database structures based on natural language requests.
暂无评论. 成为第一个评论的人!
登录以参与讨论
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 }`
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 }`
Lists available data tables (or collections) managed by Hasura, organized by schema with descriptions, based on introspection heuristics. Useful for discovering available data sources. Input: `{ schemaName?: string }` (Optional schema name)
Shows the structure of a specific table including all its columns (fields) with their GraphQL types and descriptions. Input: `{ tableName: string, schemaName?: string }`
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)
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 }`
Fetches a limited sample of rows (default 5) from a specified table to preview its data structure and content. Input: `{ tableName: string, limit?: number }`
Performs a simple aggregation (count, sum, avg, min, max) on a specified table, optionally applying a Hasura 'where' filter. Requires 'field' for non-count aggregations. Input: `{ tableName: string, aggregateFunction: 'count'|'sum'|'avg'|'min'|'max', field?: string, filter?: object }`
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 }`