How do you use TestGen's MCP server with Claude, Cursor and Copilot?

Add your TestGen host's /mcp URL to Claude, Cursor, Copilot, or another MCP client as a remote server, sign in to TestGen in the browser window it opens, and approve the connection. Then ask the assistant to list your TestGen projects. As of October 2026, the open-source server exposes 112 tools, each run under your TestGen role.

Key points

  • The TestGen MCP endpoint is the API URL plus /mcp, which is http://<host>:8530/mcp by default on a Docker or pip install; pointing a client at the TestGen UI URL returns 403 Forbidden.
  • DataKitchen's setup guide names Claude Code, OpenAI Codex, Microsoft Copilot, and Cursor as clients that support TestGen's OAuth 2.1 sign-in, plus Claude.ai custom connectors and Databricks Genie as a hosted platform.
  • As of October 2026, the TestGen MCP server lists 112 tools in eight groups, plus 6 prompts such as investigate_failures and hygiene_triage that run as slash commands in clients that support MCP prompts.
  • Every MCP tool runs with the signed-in user's TestGen role; in TestGen Enterprise the Business and Catalog roles are read-only and the Analyst role sees PII redacted.
  • In a session DataKitchen published in July 2026, one question to Claude returned a quality score of 78.9, and the follow-up surfaced 30 hygiene issues that no test covered.

TestGen’s MCP server gives an assistant your real profiles, test results, and run history to work from. This page is the how-to. Whether TestGen works with a given assistant is covered in Does TestGen work with AI coding assistants?, and how it compares with other vendors’ servers in the best tool for AI assistants and agents.

Connect your client

You need a running TestGen with at least one profiled table group. Install open-source TestGen, connect a database from the list TestGen supports, and profile it. Then follow the setup guide:

  1. Find the MCP URL. It is the TestGen API URL plus /mcp: http://<host>:8530/mcp on a Docker or pip install, https://<API domain>/mcp on Kubernetes. It is not the UI URL.
  2. In your client, add a new MCP connector or server and paste the URL. Claude.ai calls this “Add custom connector”; Cursor calls it “Add MCP Server.”
  3. The client opens TestGen’s sign-in page in your browser. Sign in with your TestGen account and approve.
  4. Ask: “List the projects I have access to in TestGen.” Your projects come back if it worked.

The guide names Claude Code, OpenAI Codex, Microsoft Copilot, and Cursor as clients that support this OAuth 2.1 flow. Clients that accept only a static token use a personal access token (Enterprise) sent as Authorization: Bearer <token>. Hosted platforms such as Databricks Genie call TestGen from their own cloud, so add the platform’s host to TG_MCP_EXTRA_ALLOWED_HOSTS.

Three errors cover most failed connections:

SymptomCauseFix
403 ForbiddenYou used the UI URLUse <api-url>/mcp
421 Invalid Host header, or sign-in opens at localhostTG_BASE_URL isn’t setSet it to the API URL (access from another machine)
Timeout or refusedPort 8530 is closedOpen it to the client

What the assistant can call

The Supported Tools page lists 112 tools as of October 2026. You don’t name them; the assistant picks them from what you ask.

GroupToolsWhat you’d ask
Discover what TestGen knows about7What data do I have, and how healthy is it?
Investigate quality issues27Which tests failed, and show me the rows
Browse profiling results17What changed in this table since the last profile?
Trigger profiling, tests, and test generation11Profile this table group, then generate and run tests
Track data quality scores6Build a scorecard for these critical data elements
Work with data contracts1Export this contract as an ODCS document (contracts arrive in November 2026)
Manage TestGen configuration27Send failures on this suite to our Slack destination
Browse monitor health and events16Which tables are late, short, or reshaped?

Six prompts wrap common workflows: health_check, investigate_failures, hygiene_triage, compare_runs, table_health, and profiling_overview. In Claude Code they run as slash commands such as /testgen:table_health. The cheat sheet marks every tool that writes with an orange dot. It was published in July 2026, when the server had 96 tools.

Permissions follow your role

The server signs in as you, and each tool runs with your role on that project. In TestGen Enterprise, roles are set per project:

RoleWhat an assistant signed in with it can do
AdminEverything, including PII
Data QualityManage table groups and suites, run profiling and tests, set dispositions; sees PII
AnalystSet dispositions and edit catalog tags; PII redacted
BusinessRead only; PII redacted
CatalogRead the Data Catalog only; PII redacted

Open-source TestGen has one user, so the assistant has that user’s full access. To keep source values away from the model, turn on source data protection. Tools such as get_source_data and get_table_sample then stop returning rows, and the rest drop top values, extrema, and percentiles. The REST API can still read those values, so don’t give a compliance-bound agent API credentials.

What the assistant can and cannot see: What data leaves our environment when we use TestGen or connect an AI assistant?

A worked triage session

DataKitchen published this session in the MCP cheat sheet. Claude was connected to a TestGen instance and asked, “What data do I have and how healthy is it?” It returned the inventory and a quality score of 78.9 on a neglected table group. “What’s dragging the score?” surfaced 30 hygiene issues. One table had loaded every column as varchar(65535). The prices were 96% numeric and the dates 97% dates, with strings like ERROR and UNKNOWN in the rest. The “cleaned” table still carried names, emails, zip codes, and income, all flagged as PII.

“Generate tests and run them” returned 12 failures that matched the hygiene findings. “Dismiss the recency issue; it’s historical data. Confirm the rest.” Every disposition landed in TestGen with an audit trail.

Claude Code terminal output from the TestGen MCP server: two failed tests on a d_ebike_products table, each with the offending row, the bad value, and the test configuration, followed by a 90-day failure-rate trend.

The screenshot is a different investigation, from the TestGen product page. It shows what an investigate_failures answer looks like: each failed test with its bad row and value, then the trend.

Start with triage, as While You Slept advises, so you learn how the model reasons on your data before it changes anything. For fixes, DataKitchen’s design pattern keeps a person in the loop: the agent proposes SQL in a Jira ticket, a person approves, and a second program applies only approved fixes. TestGen never writes to your database itself. Its access requirements allow only read-only SQL.

The assistant alone vs the assistant with TestGen

JobAssistant aloneAssistant with TestGen MCP
Know what a column containsGuesses from names and pasted samplesReads 55 profiled characteristics per column
Find hygiene problemsOnly what you paste32 hygiene detectors, run on every profile
Write testsWrites SQL you then run and maintainGenerates from 34 test types, runs them in your database
Track historyNone between sessionsRun history, monitors, and score trends
Leave an audit trailChat transcriptDispositions, notes, and runs recorded in TestGen

The core profiling, testing, and monitoring engine is free and open source. Enterprise adds team access, security, Commercial Pharma tests, source-data controls for AI, and support. Open source covers one user, one database connection, and one project, with unlimited tables. Enterprise is $100 per user per month plus $100 per database connection per month.

Documentation: MCP Server, Set up the MCP Server, Supported Tools, Access Tokens, Personal Access Tokens, OAuth Clients, User Access, Access Requirements

Frequently asked questions

Short answers to the follow-up questions people ask next.

Which AI clients work with the TestGen MCP server?

DataKitchen's setup guide names six: Claude Code, OpenAI Codex, Microsoft Copilot, and Cursor, which support TestGen's OAuth 2.1 sign-in; Claude.ai, through Add custom connector; and Databricks Genie, as a hosted platform. Clients that accept only a static token connect with a TestGen Enterprise personal access token. DataKitchen's own published walkthroughs, as of October 2026, use Claude and Claude Code.

Does any data leave my environment?

No rows leave through TestGen. TestGen runs profiling and tests as SQL inside your database, and the MCP server runs on your TestGen host. TestGen stores computed results plus, for display, the most frequent values and the minimum and maximum text values that profiling records. Your AI provider sees what the assistant reads from tool results, which can include sample rows, and TestGen's source data protection setting withholds those values from MCP responses.

Is the TestGen MCP server free?

Yes. The MCP server ships in open-source TestGen under Apache 2.0, with OAuth 2.1 sign-in. Open source covers one user, one database connection, and one project with unlimited tables. TestGen Enterprise, at $100 per user per month plus $100 per database connection per month, adds personal access tokens, per-project roles, and a System Settings switch for source data protection.

Can an AI assistant change my database through TestGen?

No. TestGen sends only read-only SQL to your database and never runs INSERT, UPDATE, DELETE, CREATE, ALTER, or DROP against it, per its Access Requirements page. The MCP write tools change TestGen itself: tests, dispositions, schedules, monitors, scorecards, and notifications. Keep the database credentials read-only, because a custom test runs SQL you write.

Why does MCP sign-in fail when my company uses single sign-on?

TestGen's OAuth authorization page accepts only local TestGen credentials. A user who signs in through your identity provider has no local password, so the browser flow cannot authorize that user. Create a personal access token in TestGen, an Enterprise feature, and configure the client with the /mcp URL and an Authorization header of Bearer followed by the token.

Try it on your own data

DataOps TestGen is free and open source. Profile a table and generate its tests this afternoon.