mcp-playwright icon indicating copy to clipboard operation
mcp-playwright copied to clipboard

how do i resolve this?

Open harishreddy69 opened this issue 8 months ago • 6 comments

Image

harishreddy69 avatar Mar 17 '25 18:03 harishreddy69

Did you figure out an answer to this? I am hitting the same problem.

I’m self-hosting n8n in Docker ( the n8n community version 1.82.3 and have registered it) - using this docker image



I’m using the MCP node at version 0.1.13 and I’m trying to use MCP-Playwright at version 0.2.10


(would you be able to rename this issue to - problems with headed browser usage)

ajoslin103 avatar Mar 21 '25 18:03 ajoslin103

I figured out that I was trying to run n8n in a Docker image, which does work -- but if I want my demo to work then we need a headed browser -- so I'm switching to running n8n via npx

ajoslin103 avatar Mar 22 '25 01:03 ajoslin103

@harishreddy69 when you Credential the Playwright MCP send { "headless": true } in the Environment -- that caused mine to run in Headless mode - you have to have already docker execd into the image and started an xvfb server

It was at that point that I decided I needed to run npx n8n so that I could see what was happening

First I switched to Node22 & then I installed the playwright and puppeteer-core at the root of the repo pnpm add -w playwright puppeteer-core

Now the Playwright is working from this [below] workflow, but it's not re-using the first window -- I'll work on that in another issue.

{ "name": "My workflow", "nodes": [ { "parameters": { "options": {} }, "type": "@n8n/n8n-nodes-langchain.chatTrigger", "typeVersion": 1.1, "position": [ -100, -20 ], "id": "1f9d931b-2f0a-4126-822b-c167984c836f", "name": "When chat message received", "webhookId": "f91a8d4f-00cc-4382-ac92-090a436b8fc9" }, { "parameters": {}, "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow", "typeVersion": 1.3, "position": [ 320, 300 ], "id": "78d29ddd-9239-4c85-909b-71029e18c6a4", "name": "Simple Memory" }, { "parameters": { "model": { "__rl": true, "mode": "list", "value": "claude-3-7-sonnet-20250219", "cachedResultName": "Claude 3.7 Sonnet" }, "options": {} }, "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic", "typeVersion": 1.3, "position": [ 160, 240 ], "id": "1d4ccea5-3f20-4e60-9f54-d1017eed3bd9", "name": "Anthropic Chat Model", "credentials": { "anthropicApi": { "id": "qqPi1QImWffTlvMc", "name": "Anthropic account" } } }, { "parameters": { "descriptionType": "manual", "toolDescription": "This Playwright List Tools node returns a list of Playwright Tools that can be run using a Playwright Execution Tool" }, "type": "n8n-nodes-mcp.mcpClientTool", "typeVersion": 1, "position": [ 460, 340 ], "id": "923bd3a3-2cd6-4208-b21b-ec60e69459c8", "name": "Playwright List Tools", "credentials": { "mcpClientApi": { "id": "xo5hJcVF6fdluH1s", "name": "playwright-mcp-server" } } }, { "parameters": { "descriptionType": "manual", "toolDescription": "This Playwright Tool Execution node is used for working with websites. Navigating to Urls, snapshotting pages, interacting with forms, and E2E testing.", "operation": "executeTool", "toolName": "={{ $fromAI(\"toolname\") }}", "toolParameters": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Tool_Parameters', ``, 'json') }}" }, "type": "n8n-nodes-mcp.mcpClientTool", "typeVersion": 1, "position": [ 620, 360 ], "id": "d8245bc2-2928-444d-a9d9-8cde2a17e095", "name": "Playwright Tool Executor", "credentials": { "mcpClientApi": { "id": "xo5hJcVF6fdluH1s", "name": "playwright-mcp-server" } } }, { "parameters": { "options": { "systemMessage": "Your job is to call the List Tools first and remember the tool names so that you can then use them to process the user query. You will use the output from each tool execution when calling them subsequent times to stay within the same window." } }, "type": "@n8n/n8n-nodes-langchain.agent", "typeVersion": 1.8, "position": [ 100, 40 ], "id": "6242a412-55cc-4bfb-9f3a-3e7024c77429", "name": "AI Agent - Use Playwright Tools" } ], "pinData": {}, "connections": { "When chat message received": { "main": [ [ { "node": "AI Agent - Use Playwright Tools", "type": "main", "index": 0 } ] ] }, "Simple Memory": { "ai_memory": [ [ { "node": "AI Agent - Use Playwright Tools", "type": "ai_memory", "index": 0 } ] ] }, "Anthropic Chat Model": { "ai_languageModel": [ [ { "node": "AI Agent - Use Playwright Tools", "type": "ai_languageModel", "index": 0 } ] ] }, "Playwright List Tools": { "ai_tool": [ [ { "node": "AI Agent - Use Playwright Tools", "type": "ai_tool", "index": 0 } ] ] }, "Playwright Tool Executor": { "ai_tool": [ [ { "node": "AI Agent - Use Playwright Tools", "type": "ai_tool", "index": 0 } ] ] }, "AI Agent - Use Playwright Tools": { "main": [ [] ] } }, "active": false, "settings": { "executionOrder": "v1" }, "versionId": "6b2e0685-8d4b-4663-80f2-3f7808c03646", "meta": { "templateCredsSetupCompleted": true, "instanceId": "9746ee7ffe9c92bd8595be3f89eeeda7bbeef172878abeb01c7371f21544c1b1" }, "id": "LY3uC6iL0Aer54aE", "tags": [] }

ajoslin103 avatar Mar 23 '25 18:03 ajoslin103

You can run the browser in headless mode. Try to pass command saying, run the browser in headless, the { "headless": true }

Thanks,

executeautomation avatar Mar 31 '25 21:03 executeautomation

Could you share a sample config for the above to run in headless mode @executeautomation ?

I run Playwright MCP in Docker and get the same issue with OpenWebUI plus MCPO trying to run it headed. I cannot seem to find a way to stop it. I have tried variations of headless in the MCPO args to no avail...

dd36 avatar May 07 '25 20:05 dd36