GR

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.

Quick Install
npx -y @davidf9999/gx-mcp-server

Overview

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

git clone https://github.com/davidf9999/gx-mcp-server.git
cd gx-mcp-server
pip install -e .

Run with environment variables (basic)

export GE_ROOT_DIR="/path/to/great_expectations"
export MCP_HOST="0.0.0.0"
export MCP_PORT="8088"
python -m gx_mcp_server.app

Run with Docker

docker build -t gx-mcp-server .
docker run -e GE_ROOT_DIR="/ge" -p 8088:8088 \
  -v /local/ge:/ge gx-mcp-server

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 nameDescriptionInputsOutputs
run_validationRun a validation run for an expectation suite or checkpointsuite_name / checkpoint_name, batch_kwargs optionalvalidation_result (success, statistics, failing_expectations)
list_expectation_suitesEnumerate available expectation suites in the GE projectnonelist of suite names
list_checkpointsList configured checkpointsnonelist of checkpoint names
get_validation_resultFetch a previous validation result by run_idrun_idvalidation_result JSON
list_data_assetsShow available datasources/assetsnonelist of assets and sample batch_kwargs

Example: run a checkpoint via HTTP (curl)

curl -X POST "http://localhost:8088/tools/run_validation" \
  -H "Content-Type: application/json" \
  -d '{
    "checkpoint_name": "my_checkpoint"
  }'

Example response

{
  "success": false,
  "statistics": {
    "evaluated_expectations": 12,
    "successful_expectations": 10
  },
  "failing_expectations": [
    {
      "expectation_type": "expect_column_values_to_not_be_null",
      "column": "user_id",
      "result": {"unexpected_count": 5, "unexpected_percent": 0.5}
    }
  ],
  "run_id": "2026-04-09T12:34:56"
}

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.