N8N MCP Tool Puppeteer: Failed to execute operation

I’m trying to run Puppeteer MCP on the N8N, it works normally up to the MCP node with operation List Tools, but on the next MCP node with operation Execute Tool it gives this error. Can anyone help me solve it? I’ve tried a lot of things and it still gives this error.

In this case, I asked it to access google, then the AI Agent node executes the first tool that has the operation list tools, but when it executes the tool that has the operation execute tool, it gives the error.

Failed to execute operation: Operation not permitted, make sure you have the right permissions

Error details

n8n version: 1.82.3 (Self Hosted)

Time: 16/03/2025, 14:53:35

Error cause: { “message”: “Failed to execute operation: Operation not permitted, make sure you have the right permissions”, “timestamp”: 1742147615047, “name”: “NodeOperationError”, “context”: {}, “cause”: { “level”: “error”, “tags”: {} } }

2 Likes

Tried to navigate to a website and take a screenshot, same error here.

I tried everything here, I couldn’t get it, not even using Playwright

FWIW:

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

I managed to solve it in another way. But thanks

@Matheus_Dalosto how did you manage to do that? I’m struggling a bit :pray:

1 Like

Build a customized N8N image using dockerfile, then add the install docker cli line “RUN apk update && apk add docker-cli”.

In docker compose, include the docker socket volume for access to the host’s damon:

volumes:
- /var/run/docker.sock:/var/run/docker.sock

On the N8N, instead of using npx credentials, use docker.

1 Like

Hi, have you noticed that it spins up a new container on each request and never closes since the node process keep listening. just naming the instance creates an error on the second one. not really a scalable solution.

That’s right. I even found a way for it to use just one container, but it still loses the snapshot references with each run.

In this case, I’m trying with the Docker MCP Server Playwright that I created. Running an N8N project with Puppeteer or Playwright using MCP is something complex that needs a lot of testing before it finally works.

1 Like

Thanks for the feedback. I’m still struggling to generate a non-empty (blank) screenshot through the mcp itself. Directly via a custom js on the same container it works :thinking: Mind sharing how you managed to only spin up one container?

This is because in the MCP Client credential on the N8N you are using docker run to list tools and execute tools, the way I found is to do docker run from the terminal using:

docker run -d --name name-container --entrypoint sleep name-image infinity

Then in the MCP Client inside the N8N, you will continue using the STDIO credential, with the command “Docker” and in Arguments use “docker exec -i nome-container node /app/cli.js --headless”

I’ve created a Dockerfile repository on GitHub for this project of mine, but it’s from Playwright.

But even with this solution, I still had problems because when playwright goes to the URL it takes the snapshot and with that we have page references such as login fields, password and button, and when asking to insert text in these elements it gives an error.

And from what I understand it’s because we’re losing these references when the MCP Server is run again.

I don’t know what else to do. Please help me if you can.

I forked my mcp playwright project from the original one, which didn’t have a dockerfile, and docked it.

But still, in Docker-Compose, I set the root user with these two lines:

  • user: “0”
  • privileged: true

(the two lines probably do the same thing, but I decided to keep them)

And you have to make sure that the Docker socket is correctly mounted to access the host daemon

volumes:

  • /var/run/docker.sock:/var/run/docker.sock

Also, I customized the N8N image by installing docker cli “RUN apk update && apk add docker-cli”

All this to ensure that N8N has full access to the docker container and can execute commands there.

1 Like

thank you! some feedback on my approach (which looks similar for puppeteer). Currently tested manually (need to -d it for sure), but the idea is:

  • DooD: connect /var/run/docker.sock between the host docker and the N8N
  • on N8N container : apk update&&apk add docker-cli
  • brute force (n8n): chmod 666 /var/run/docker.sock
    • your method circumvents this by --privileged I guess)
  • (for now) manually started a named puppeteer process in the host
    • docker run -i --name puppeteer --rm --init -e DOCKER_CONTAINER=true mcp/puppeteer &
  • N8N mcp client config
    • Command: docker
    • Args: attach puppeteer

Have you managed to keep references at MCP?

Sorry, in which way? If you mean whether I can use it repeatedly? For what I tested it works as expected