An AI coding agent can help you work with Playwright code in your local repository, but connecting it to your test platform usually requires a way for the agent to access that platform too.
Leapwork Play supports Model Context Protocol (MCP), so an MCP-compatible coding agent such as OpenAI Codex can work with Leapwork Play while also working with your local repository and Playwright files.
Once connected, you can ask the agent to create or search for Play test cases, open an existing test, or start a browser session without leaving the coding workflow.
How do you connect an AI coding agent to Leapwork Play?
For OpenAI Codex, add Leapwork Play as a remote MCP server.
The Leapwork Play MCP endpoint is:
https://mcp.leapwork.ai/mcp
From a terminal, run:
codex mcp add ai-studio --url https://mcp.leapwork.ai/mcp
Then verify the connection:
codex mcp list
The configured server should appear as:
ai-studio
If Codex asks you to authenticate, complete the browser sign-in flow.
After authentication, Codex can call Leapwork Play through the configured MCP server.
What can you do after connecting?
Once MCP is connected, you can give the coding agent natural-language instructions for work in Leapwork Play.
For example:
Create a test case in Leapwork Play for this bug.
Or:
Search Leapwork Play for test cases mentioning admin.
Or:
Open the failing test case in Leapwork Play and start a browser session.
This gives the coding agent access to both sides of the workflow:
Local repository + Playwright
↓
AI coding agent
↓ MCP
Leapwork Play
The agent can therefore work with your local code while also performing supported actions in Play.
How does this help with Playwright development?
Without the connection, an AI coding agent can work with the Playwright files it can access locally, but it does not automatically have the context or capabilities available in Leapwork Play.
MCP provides the connection between those environments.
For example, you can investigate a bug in the repository and then ask the same agent to create a corresponding test case in Play:
Investigate bug
↓
Work with Playwright code
↓
Create Play test case through MCP
↓
Continue testing in Play
You do not need to manually transfer the entire workflow between the coding agent and Play.
How Play extends the AI-assisted Playwright workflow
|
Without the Play MCP connection |
With Leapwork Play MCP |
|---|---|
|
Agent works with the repository and local Playwright files |
Agent can also perform supported work in Leapwork Play |
|
Switch to Play separately to find test cases |
Ask the agent to search Play |
|
Create the corresponding Play test manually |
Ask the agent to create a Play test case |
|
Open the test and browser workflow separately |
Ask the agent to open the test and start a browser session |
|
Repository and Play workflows remain separate |
MCP connects the coding and test-platform workflows |
Play complements the AI coding workflow by making supported Play capabilities available to the agent through MCP.
How does authentication work?
Codex uses your normal Leapwork Play account when connecting through MCP.
That means the agent operates with the same Play access and permissions available to your account.
If authentication is required during setup, Codex opens the browser sign-in flow. Complete the sign-in before continuing.
What happens when Play needs more information?
Some operations may require approval or clarification before Play can continue. When that happens, Codex surfaces the response so you can provide the required information and continue the operation.
Leapwork Play uses MCP Streamable HTTP for the Codex connection. Long-running requests can remain connected while Play plans and performs the requested work, returning the result, approval request, or clarification request when it reaches that state.
Best practices
-
Connect your AI coding agent to Play through MCP when you want it to work with both your Playwright repository and Leapwork Play.
-
Use the Leapwork MCP endpoint ending in
/mcp. -
Verify the configured MCP server before troubleshooting individual requests.
-
Authenticate with the Play account that has the access required for the requested work.
-
Review approval and clarification requests before allowing an operation to continue.
-
Give the agent specific instructions, such as the test case or workflow you want it to work with.
Troubleshooting
|
Problem |
What to check |
|---|---|
|
Codex cannot connect to Play |
Confirm the MCP URL ends with |
|
MCP server does not appear |
Run |
|
Authentication is requested |
Complete the browser sign-in flow |
|
Authentication succeeds but MCP still cannot connect |
Ask your Play administrator to confirm external MCP authentication is enabled |
|
A long-running operation is interrupted |
Ask Codex to check the pending Play request and continue from there |
|
Agent cannot perform a Play operation |
Check whether your Play account has permission to perform that action |
Frequently asked questions
What is MCP?
Model Context Protocol (MCP) provides a standard way for compatible AI applications and agents to connect to external tools and systems.
Can Codex connect to Leapwork Play?
Yes. Configure Leapwork Play as a remote MCP server using:
codex mcp add ai-studio --url https://mcp.leapwork.ai/mcp
Does MCP replace Playwright?
No. Playwright remains part of your test code and automation workflow. MCP connects the AI coding agent to Leapwork Play so the agent can work across both contexts.
What can Codex do in Leapwork Play?
Based on the supplied Play documentation, examples include creating test cases, searching for existing test cases, opening a failing test case, and starting a browser session.
Does Codex get unrestricted access to Play?
No. It uses your normal Leapwork Play account and therefore has the same access and permissions that you have in the product.
What happens if Play needs my approval?
Codex surfaces the approval or clarification request so you can respond and allow the operation to continue.