Opencode to troubleshoot N8N scripts

Most of the time when I am using N8N I make a scraping workflow for my own usage by Puppeteer or ComfyUI. The most part of the work I always have to make my own custom html/js script. Then all scripts are wrote by myself by using Web ChatGPT or OpenCode. Most of the time I have to copypaste each time to debug issue. Is it possible to connect the OpenCode and N8N together so the OpenCode could do writing the script / debug by himself?

1 Like

Hi @asheleytolmie Welcome!
i have done it and it is pretty awesome if you are using a very good model with a lot of n8n documentation, and by giving that AI agent access to how n8n API works its endpoints and all, for your use case you can expose your flow with a webhook Trigger so opencode can call that as an HTTP request and get input/output and then iterate that.

For fully autonomous workflow being built by AI agent what i have done is by using this first as a MCP for my AI:

and then i have used Claude to connect this MCP and also i have connected my instance so that claude can assist me debug or do whatever i want that AI to build.

Hey @asheleytolmie!
I work with Claude Code and n8n together daily and the setup @Anshul_Namdev mentioned with MCP is solid.

One thing I’d add: if you’re spending most of your time writing custom HTML/JS scripts for scraping and then debugging them back and forth with ChatGPT, there’s a simpler approach that might save you a lot of copy-pasting. Instead of writing the scripts manually and using AI to debug, you can have Claude Code write the full n8n workflow logic for you from the start.

I set mine up so Claude has context about my n8n instance, the nodes I’m using, and the data structure I need. Then I describe what I want to scrape and it builds the workflow, including the custom JS code nodes, error handling, and data transformation. For the debugging loop specifically, the MCP connection is key. Once Claude can see your workflow inputs and outputs directly, it can identify where the data breaks without you having to copy-paste anything.

The feedback loop goes from minutes to seconds. For scraping specifically, you might also want to look at Firecrawl as an alternative to Puppeteer for JS-heavy sites. It handles rendering and extraction in one step.

Happy to share more details on the Claude Code + n8n setup if anyone’s interested.

1 Like

Welcome to the community @asheleytolmie

Yes it is doable through MCP. N8n has a MCP server build in that you can enable within settings then connect to OpenCode through this server by providing your n8n API Key. When this is set up OpenCode can read your workflow schema and trigger nodes directly on your instance without copy-pasting the workflow in OpenCode first. That being said especially for script writing and troubleshooting Claude combined with n8n MCP is clearly better than ChatGPT for this application, Claude seems to get the nodes and the expressions much better when he can look at the workflow, setting it up is a great idea however, reducing communication overhead greatly.
Setting it up takes a while the first time. But once you’ve located the API part in the settings you will find it surprisingly fast to configure. Let me know here when something doesn’t work i’ll assist you.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.