Great Expectations MCP Server for Data Validation
Expose Great Expectations data validation via an MCP server so AI agents can automate data quality checks and enforce reliable pipelines.
npx -y @davidf9999/gx-mcp-serverOverview
This MCP (Model Context Protocol) server exposes Great Expectations (GE) validation functionality over a simple HTTP/MCP interface so AI agents and automation workflows can run, inspect, and act on data quality checks programmatically. Instead of embedding GE logic into every orchestration pipeline, the server centralizes GE as an agent-callable service that returns structured validation results and metadata suitable for automated decision-making.
The server is useful when you want AI-driven agents (chatbots, planners, RAG agents) to enforce data quality, gate downstream processing, or automatically remediate issues. It converts GE validations, expectations, and checkpoints into a set of discrete, discoverable tools that follow the MCP pattern, making validations callable, idempotent, and observable in multi-agent or pipeline contexts.
Features
- Expose Great Expectations project as MCP tools (run validation, list expectations, check checkpoint status)
- Return structured, machine-friendly validation results (success/failure, statistics, failing expectation details)
- Support for GE Data Context and checkpoints (local filesystem or cloud-backed)
- Simple HTTP API with JSON payloads for agent integration
- Authentication options via environment variables or reverse proxy
- Docker-friendly: run as container in CI/CD or orchestration systems
Installation / Configuration
Install from GitHub and set up a GE project or point the server at an existing one:
Clone and install
Run with environment variables (basic)
Run with Docker
Example configuration file (mcp_config.yaml)
server:
host: "0.0.0.0"
port: 8088
great_expectations:
data_context_root_dir: "/ge"
default_checkpoint: "default_checkpoint"
auth:
enabled: false
token_env_var: "MCP_API_TOKEN"
Set GE project path and optional checkpoint via the config or environment variables. The server reads your Great Expectations Data Context to discover datasources, expectation suites, and checkpoints.
Available Tools / Resources
The server exposes a small set of tools that agents can discover and invoke. Each tool returns JSON with metadata and standard GE validation_output.
| Tool name | Description | Inputs | Outputs |
|---|---|---|---|
| run_validation | Run a validation run for an expectation suite or checkpoint | suite_name / checkpoint_name, batch_kwargs optional | validation_result (success, statistics, failing_expectations) |
| list_expectation_suites | Enumerate available expectation suites in the GE project | none | list of suite names |
| list_checkpoints | List configured checkpoints | none | list of checkpoint names |
| get_validation_result | Fetch a previous validation result by run_id | run_id | validation_result JSON |
| list_data_assets | Show available datasources/assets | none | list of assets and sample batch_kwargs |
Example: run a checkpoint via HTTP (curl)
Example response
Use Cases
- Automated pipeline gating: An agent calls run_validation on a checkpoint before promoting a dataset to production. If validation fails, the agent can stop the deployment or trigger a remediation job.
- Data monitoring and alerting: Periodic agents poll list_data_assets and run validations on new partitions, sending alerts or rollback requests when thresholds are breached.
- Self-healing workflows: When an agent detects a failed expectation, it can invoke domain-specific remediation (re-run ingestion, drop bad rows, notify owners) based on the failing_expectations payload.
- Exploratory QA by assistants: A data assistant can list expectation suites, run them on sample batches, and describe failing checks to a human analyst or create an issue with precise error context.
Getting Started Tips
- Ensure your Great Expectations project is initialized and accessible by the server (GE_ROOT_DIR).
- Start by exposing a single checkpoint you trust and verify the server can run it via curl.
- Integrate with your orchestration platform (Airflow, Prefect, Dagster) by calling the run_validation endpoint as a task.
- Use stable run IDs from responses to correlate logs and dashboards.
This server makes Great Expectations approachable to agent-based automation, turning passive data quality definitions into active, callable services for reliable pipelines.