Set up the MCP Server¶
Connect an AI client to the TestGen MCP server. The server uses OAuth 2.1 for authentication, supporting two flows depending on what your client supports — automatic registration for modern AI clients, or static API tokens for everything else.
Note
AI clients run with the permissions of the authenticated TestGen user. The actions available through the MCP server are governed by the user's role on each project. See User Access for role details.
Prerequisites¶
- A TestGen user account with appropriate project permissions.
- The TestGen MCP endpoint URL:
https://<your-testgen-host>/mcp. This is the URL you give to your AI client.
Connect an AI client¶
The TestGen MCP Server supports two methods of authentication:
- Use OAuth 2.1 if your AI client supports Streamable HTTP transport for a simpler, browser-based flow.
- Use API tokens for clients that do not support OAuth 2.1, or for headless integrations where there is no browser to sign in.
Option 1: OAuth 2.1 (recommended)¶
Most modern AI assistants — including Claude Code, OpenAI Codex, Microsoft Copilot, and Cursor — support OAuth 2.1 authorization. With these clients, you only need to provide the MCP URL; the client discovers TestGen's OAuth endpoints, registers itself, and walks you through sign-in in your browser.
- In your AI client, add a new MCP connector or server.
- Enter the MCP URL:
https://<your-testgen-host>/mcp. - The client opens TestGen's authorization page in your browser. Sign in with your TestGen account and approve the connection.
Note
Exact menu names vary by client (for example, "Add custom connector" in Claude.ai, "Add MCP Server" in Cursor). Refer to your client's documentation for the precise UI path.
Option 2: API token¶
For clients that only accept a static API token (some local CLI tools, custom integrations, or older clients), generate an access token through the TestGen API and paste it into the client's configuration.
- Follow the API Authentication one-time setup to register a client and obtain a refresh token.
- Each time you need a fresh access token, exchange the refresh token at
/oauth/token— see Get a fresh access token. - In your AI client, configure the MCP server with:
- URL:
https://<your-testgen-host>/mcp - Authorization header:
Bearer <access_token>
- URL:
Verify the connection¶
After connecting, ask the assistant a simple discovery question — for example:
List the projects I have access to in TestGen.
The assistant should return your projects. If you see an authentication error, confirm your URL is correct and your TestGen user account has access to at least one project.
Related topics¶
- MCP Server — what MCP is and what TestGen exposes
- Supported Tools — the full list of tools, resources, and prompts