mcp-AI-playwright-template

mcp-AI-playwright-template

A template for building a custom Playwright MCP server that enables AI-driven browser automation, translating high-level test intentions into dynamic Playwright actions.

Category
Visit Server

README

This project is set up to debug with LOCAL AI

This is in sync with C:\MCP_BDC\mcpServer-Playwright-templateV8 on author's hard drive.


Custom MCP-Playwrght Server

Architecture Overview and Configuration

High-level test cases are processed by the AI and translated into structured JSON commands that are natively understood by the Model Context Protocol (MCP) server.

Underlying Language Model: The project leverages the Phi-3 Mini LLM for this translation layer.

Client Requirements: The MCP-aware AI client (in this architecture, the Playwright MCP server itself) requires a specific configuration file to establish communication.

Configuration File Path

Ensure the configuration file is present at the following location, replacing {userName} with your local system username:

C:\Users{userName}.config\mcp\clients\playwright-mcp-config.json This file tells the MCP server to expect you calls from:

{  
  "servers": {  
    "playwright-mcp": {  
      "command": "node",  
      "args": ["./mcp/server.js"],  
      "env": {  
        "NODE_ENV": "development"  
      }  
    }  
  }  
}  

Compiling TypeScript Files to Distinct Target Directories

To compile TypeScript (.ts) source files into JavaScript (.js) and distribute them to specific target directories, you can leverage dedicated TypeScript configuration files (e.g., tsconfig.*.json).

Run the standard project build script

npm run build

Compile using a specific TypeScript configuration target

npx tsc -p tsconfig.prompts.json

In another window verify if ollama is installed

DOS PROMPT>>>ollama list

possibly it is scheduled to start on boot

DOS PROMPT>>>tasklist | findstr ollama

verify if it is running

DOS PROMPT>>>>curl http://localhost:11434/api/tags

If not start Phi-3::

DOS PROMPT>>>ollama run phi3

It it is expected to fail in GitHub Action Workflow every time. To run other AI's you need to replace the code below

   async function callOllama(prompt) {
     const response = await axios.post("http://localhost:11434/api/generate", {
       model: "phi3",
       prompt: prompt,
       stream: false
     });
RUN RESULT:  
TOOL RECEIVED: close_browser  
ARGS: undefined  
=======================    
[close_browser] Closing browser  
[close_browser] Page closed  
[close_browser] Browser closed  
  
========================  
šŸ“Š TEST SUMMARY  
========================  
Test 1: āœ… PASS - BDC Entrepreneur support   
Test 2: āœ… PASS - BDC reCAPTCHA Link must be present  
Test 3: āœ… PASS - BDC Should Not Contain a string MakunaimaRA  
Test 4: āŒ FAIL - BDC must contain string 'Warszwa'  
Test 5: āœ… PASS - BDC must contain string 'Solutions'  
============================================================  
Total: 4/5 tests passed  
TOTAL TIME: 116572ms  
============================================================
##  Test cases are re-defined by AI ( Phi-3-mini )   but they are  not truly plain English.  
For example:  
[STDIN] {"method":"tools/call","params":{"name":"search_text","arguments":{"text":"Warszwa"}},"jsonrpc":"2.0","id":15}  

is constructed from :  
{  
  "id": 4,  
  "question": "Is the text 'Warszwa' present on the BDC website?",  
  "description": "BDC must contain string 'Warszwa'",  
  "baseUrl": "https://www.bdc.ca/fr",  
  "expectation": "should-contain",  
  "searchTerm": "Warszwa"  
}  

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured