Hasura GraphQL
Summary
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.
Available Actions(9)
run_graphql_query
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 }`.
run_graphql_mutation
Executes a GraphQL mutation to insert, update, or delete data. Use with caution, ensure the operation is intended and safe. Example: `mutation { insert_users_one(object: {name: 'Test'}) { id } }`. Input: `{ mutation: string, variables?: object }`.
list_tables
Lists available data tables (or collections) managed by Hasura, organized by schema with descriptions. Input: `{ schemaName?: string }`.
describe_table
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_fields
Lists the available top-level query, mutation, or subscription fields from the GraphQL schema. Input: `{ fieldType?: 'QUERY' | 'MUTATION' | 'SUBSCRIPTION' }`.
describe_graphql_type
Provides details about a specific GraphQL type (Object, Input, Scalar, Enum, Interface, Union) using schema introspection. Input: `{ typeName: string }`.
preview_table_data
Fetches a limited sample of rows (default 5) from a specified table to preview its data structure and content. Input: `{ tableName: string, limit?: number }`.
aggregate_data
Performs a simple aggregation (count, sum, avg, min, max) on a specified table, optionally applying a Hasura 'where' filter. Input: `{ tableName: string, aggregateFunction: 'count'|'sum'|'avg'|'min'|'max', field?: string, filter?: object }`.
health_check
Checks if the configured Hasura GraphQL endpoint is reachable and responding to a basic GraphQL query (`{ __typename }`). Input: `{ healthEndpointUrl?: string }`.
社区评论
暂无评论. 成为第一个评论的人!
登录以参与讨论