MCP_SERVER_WITH_PLAYWRIGHT_AND_CLAUDE

nikhilfufu/MCP_SERVER_WITH_PLAYWRIGHT_AND_CLAUDE

3.2

If you are the rightful owner of MCP_SERVER_WITH_PLAYWRIGHT_AND_CLAUDE and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

The MCP Automation Server is a C# based server that integrates with AI assistants to perform browser automation tasks using Playwright and ExtentReports.

Tools
3
Resources
0
Prompts
0

🤖 QA Testing MCP Server

AI-Powered Automated QA Testing with Claude and Playwright

A Model Context Protocol (MCP) server that enables Claude to perform intelligent, automated QA testing on web applications. Get detailed test reports, AI-powered failure analysis, and actionable recommendations - all through natural conversation with Claude.

License: MIT .NET Playwright


✨ Features

🎯 Comprehensive Test Scenarios

  • Valid Login Testing - Verify successful authentication flows
  • Invalid Credentials Testing - Ensure security measures work correctly
  • 📝 Form Validation Testing - Test empty field handling and validation
  • 🔄 Batch Testing - Run all scenarios sequentially with detailed reporting

📊 Intelligent Reporting

  • Detailed Pass/Fail Analysis - Know exactly what passed and what failed
  • Root Cause Identification - AI-powered failure analysis
  • Impact Assessment - Understand the severity of each issue
  • Actionable Recommendations - Get specific steps to fix problems
  • Automated Screenshots - Capture failures for debugging

🚀 Built for Claude

  • Natural Language Interface - Ask Claude to run tests conversationally
  • Contextual Understanding - Claude interprets results and provides insights
  • Integrated Workflow - Seamless testing within your Claude conversations

📋 Table of Contents


🔧 Prerequisites

Before you begin, ensure you have the following installed:


📦 Installation

Step 1: Clone the Repository

git clone https://github.com/nikhilfufu/MCP_SERVER_WITH_PLAYWRIGHT_AND_CLAUDE.git
cd MCP_SERVER_WITH_PLAYWRIGHT_AND_CLAUDE

Step 2: Restore Dependencies

dotnet restore

Step 3: Install Playwright Browsers

# Install Playwright CLI globally
dotnet tool install --global Microsoft.Playwright.CLI

# Install Chromium browser
pwsh bin/Debug/net8.0/playwright.ps1 install

Step 4: Build the Project

dotnet build

Step 5: Test the Installation

dotnet run

You should see the MCP server start up successfully.


⚙️ Configuration

Configure Claude Desktop

  1. Locate your Claude Desktop config file:

    • Windows: %APPDATA%\Claude\claude_desktop_config.json
    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Linux: ~/.config/Claude/claude_desktop_config.json
  2. Add the MCP server configuration:

{
  "mcpServers": {
    "csharp-mcp": {
      "command": "dotnet",
      "args": [
        "run",
        "--project",
        "C:/createdFolder/McpServer/bin/Debug/net8.0/McpServer.dll"
      ]
    }
  }
}

⚠️ Important: Use the absolute path to your project directory.

Example Configurations:

Windows:

{
  "mcpServers": {
    "csharp-mcp": {
      "command": "dotnet",
      "args": [
        "run",
        "--project",
        "C:/createdFolder/McpServer/bin/Debug/net8.0/McpServer.dll"
      ]
    }
  }
}

macOS/Linux:

{
  "mcpServers": {
    "csharp-mcp": {
      "command": "dotnet",
      "args": [
        "run",
        "--project",
        "/Users/yourname/projects/MCP_Server/McpServer/bin/Debug/net8.0/McpServer.dll"
      ]
    }
  }
}

Step 3: Restart Claude Desktop

  1. Quit Claude Desktop completely (not just close the window)
  2. Reopen Claude Desktop
  3. Look for the 🔌 tool icon in the input box

🚀 Usage

Quick Start

Once configured, you can interact with the QA testing tools through natural conversation with Claude:

Hey Claude, can you test the login functionality on https://myapp.com 
with username "testuser" and password "testpass"?

Claude will automatically call the appropriate testing tools and provide detailed analysis.

Direct Tool Invocation

You can also directly invoke specific test scenarios:

Test Valid Login
Run scenario1_ValidLogin with:
- url: "https://myapp.com/login"
- username: "testuser"
- password: "testpass123"
Test Invalid Login
Run scenario2_InvalidLogin with:
- url: "https://myapp.com/login"  
- wrongUsername: "baduser"
- wrongPassword: "wrongpass"
Test Empty Fields
Run scenario3_EmptyFields with:
- url: "https://myapp.com/login"
Run All Tests
Run runAllScenarios with:
- url: "https://myapp.com/login"
- validUsername: "testuser"
- validPassword: "testpass123"
- invalidUsername: "baduser"
- invalidPassword: "wrongpass"

🛠️ Available Tools

ToolDescriptionParameters
sayHelloTest MCP connectionname (string)
list_toolsList all available toolsNone
scenario1_ValidLoginTest successful login flowurl, username, password
scenario2_InvalidLoginTest invalid credentials rejectionurl, wrongUsername, wrongPassword
scenario3_EmptyFieldsTest empty field validationurl
runAllScenariosExecute all test scenariosurl, validUsername, validPassword, invalidUsername, invalidPassword

📊 Example Output

When you run runAllScenarios, you'll receive a comprehensive report like this:

╔════════════════════════════════════════════════════════════════╗
║           QA TEST EXECUTION - DETAILED RESULTS                 ║
╚════════════════════════════════════════════════════════════════╝

📊 SUMMARY: 2 Passed | 1 Failed | Total: 3
⏱️  Executed at: 2024-11-23 14:30:45

======================================================================

TEST 1: Scenario 1: Valid Login Test
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Status: ✅ PASSED
Description: Tests that a valid user can successfully log in with correct credentials
Duration: 3.45 seconds

✓ Result: All validations passed successfully
  All assertions passed. No issues detected.

──────────────────────────────────────────────────────────────────────

TEST 2: Scenario 2: Invalid Login Test
══════════════════════════════════════════════════════════════════════
Status: ❌ FAILED
Description: Tests that invalid credentials are properly rejected by the system
Duration: 2.87 seconds

✗ Failure Reason: SECURITY ISSUE: System accepted invalid credentials

📋 Detailed Analysis:
  • Invalid credentials were accepted by the system
  • This is a critical security vulnerability
  • Impact: Unauthorized access possible
  • Action Required: Fix authentication validation immediately

──────────────────────────────────────────────────────────────────────

TEST 3: Scenario 3: Empty Fields Validation
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Status: ✅ PASSED
Description: Tests that the login form validates empty username/password fields
Duration: 1.23 seconds

✓ Result: All validations passed successfully
  All assertions passed. No issues detected.

──────────────────────────────────────────────────────────────────────

======================================================================

🎯 RECOMMENDATIONS:
  🔴 CRITICAL: Address security vulnerabilities immediately
     - Review authentication logic
     - Implement proper credential validation

📄 Full HTML report available at: ExtentReport.html

Claude's AI-Powered Analysis

After running tests, Claude will provide intelligent insights like:

"I've completed the QA testing on your login page. Here's what I found:

Good News: Your valid login flow works perfectly (3.45s), and empty field validation is properly implemented.

Critical Issue: There's a serious security vulnerability - the system is accepting invalid credentials. This needs immediate attention as it could allow unauthorized access to your application.

Recommendation: I suggest reviewing your authentication logic in the backend. The issue is likely in the credential validation step. Would you like me to help you investigate this further?"


🐛 Troubleshooting

MCP Not Appearing in Claude

Problem: Tool icon doesn't show up in Claude Desktop

Solutions:

  1. Verify the config file path is correct
  2. Ensure JSON syntax is valid (use a JSON validator)
  3. Use absolute paths, not relative paths
  4. Check Claude Desktop logs:
    • Windows: %APPDATA%\Claude\logs
    • macOS: ~/Library/Logs/Claude
    • Linux: ~/.config/Claude/logs
  5. Completely restart Claude Desktop

Playwright Browser Not Found

Problem: Error: "Executable doesn't exist at..."

Solution:

playwright install chromium

Test Fails with Timeout

Problem: "Timeout 10000ms exceeded"

Solutions:

  1. Increase timeout in code
  2. Check if the target website is loading slowly
  3. Verify selectors are correct
  4. Ensure your internet connection is stable

Selectors Not Found

Problem: "No element matches selector..."

Solutions:

  1. Inspect the webpage and verify selector IDs/classes
  2. Update selectors in the code to match your application
  3. Wait for page to load completely before interacting
  4. Use more specific selectors

Build Errors

Problem: Build fails with dependency errors

Solution:

dotnet clean
dotnet restore
dotnet build

🤝 Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

Ideas for Contributions

  • 🌐 Support for additional browsers (Firefox, Safari)
  • 📱 Mobile testing capabilities
  • 🔄 API testing integration
  • 🎨 Custom reporting themes
  • 🌍 Multi-language support
  • ⚡ Parallel test execution
  • 📊 Performance metrics tracking

🙏 Acknowledgments


📞 Support


🌟 Star History

If you find this project useful, please consider giving it a ⭐ on GitHub!


📚 Additional Resources