cerebro-vip INEMA.CLUB
inícioINEMA.N8N

Tutorial completo de configuração do `n8n-mcp` com Claude Desktop,…

INEMA.N8N · 2025-07-28 · ~9 min · ver no Telegram ↗

INEMA

Sim! Você precisa instalar o n8n-mcp localmente na sua máquina antes de usar com o Claude Desktop.

O Claude apenas executa o comando npx -y n8n-mcp, mas para isso funcionar corretamente, o pacote n8n-mcp precisa estar disponível no seu ambiente.


✅ Passo a passo para instalar o n8n-mcp localmente

1. Verifique se o Node.js está instalado

No terminal (CMD ou PowerShell):

node -v

Se não estiver, instale via https://nodejs.org (versão 18 ou superior recomendada).


2. Instale o n8n-mcp globalmente (opcional, mas evita erros de cache)

npm install -g n8n-mcp

Se preferir apenas local via npx, você pode pular esse passo, mas instale antes os binários necessários com esse comando:

npx -y n8n-mcp --help

Isso força o download do pacote e testa se o n8n-mcp está funcionando localmente.


3. Teste manualmente

No terminal:

npx -y n8n-mcp

Se aparecer:

[n8n-mcp] MCP server listening on stdio

→ Está funcionando.

Se aparecer erro EBUSY, token inválido, timeout, etc., você deve corrigir isso antes do Claude conseguir usar.


4. Confirme no claude.config.jsonque está assim:

"```n8n-mcp": { "command": "npx", "args": ["-y", "n8n-mcp"], "env": { "MCP_MODE": "stdio", "N8N_API_URL": "seu-n8n-online ↗", "N8N_API_KEY": "SEU_TOKEN" } }

---

### ✅ Conclusão

| Etapa                          | Obrigatório?  | Observação                           |
| ------------------------------ | ------------- | ------------------------------------ |
| Ter Node.js instalado          | Sim           | Para rodar qualquer coisa com n`px ` |
| Rodar n`px -y n8n-mcp `uma vez | Sim           | Garante que o Claude consiga acessar |
| Instalar globalmente           | Não, mas útil | Evita erros com cache local do npx   |

Vamos fazer o **passo a passo completo para usar o Claude Desktop com uma instância do n8n na nuvem**, usando `n8n-mcp` para criar automações conversacionais reais.

---

## ✅ ETAPA 1 — Acesso à sua instância do n8n na nuvem

Certifique-se de que você **consegue acessar** sua instância n8n pelo navegador:

Exemplo:

`https://agente.inema.online`

Se abrir a interface do n8n, continue.

---

## ✅ ETAPA 2 — Verifique se a API está acessível

Abra no navegador:

h`ttps://agente.inema.online/rest/workflows
`
* Se pedir login ou der erro 401, a autenticação básica está ativa
* Se der ti`meout o`u re`fused, `há problemas de rede ou o proxy está bloqueando

---

## ✅ ETAPA 3 — Gere um novo token no painel do n8n

1. Acesse: ht`tps://agente.inema.online
2`. Vá em:

     ` Settings → Personal Access Tokens

3`. Clique em "Cr**eate", n**omeie como cla`ude-mcp ou` similar
4. Copie o token gerado
5. Mantenha visível para o próximo passo

---

## ✅ ETAPA 4 — Atualize o cla`ude.config.json

A`bra o arquivo em:

C:\`Users\seu_usuario\.claude\claude.config.json

S`ubstitua ou adicione o bloco abaixo:

{
  ```"mcpServers": {
    "n8n-mcp": {
      "command": "npx",
      "args": ["-y", "n8n-mcp"],
      "env": {
        "MCP_MODE": "stdio",
        "LOG_LEVEL": "error",
        "DISABLE_CONSOLE_OUTPUT": "true",
        "N8N_API_URL": "https://agente.inema.online",
        "N8N_API_KEY": "SEU_TOKEN_AQUI"
      }
    },
    "n8n-mcp-docs": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote@latest",
        "https://gitmcp.io/czlonkowski/n8n-mcp"
      ]
    }
  }
}

Su```bstitua "SEU`_TOKEN_AQUI" pel`o token copiado da etapa anterior.

---

## ✅ ETAPA 5 — Teste a conexão com curl`

No` terminal (CMD ou PowerShell):

curl``` -H "Authorization: Bearer SEU_TOKEN_AQUI" https://agente.inema.online/rest/workflows

* ```Se retornar JSON → ✅ OK
* Se der Unau`thorized → G`ere novo token e revise
* Se der Time`out → V`erifique servidor, firewall ou proxy

---

## ✅ ETAPA 6 — Verifique a autenticação básica

Se sua instância exigir logi**n e senha (Basic Auth) alé**m do token, Claude não **vai conseguir se conectar com apenas o token.

#**## Soluções:

* Desativar no .env` do `servidor:

    N8```N_BASIC_AUTH_ACTIVE=false

* O```u usar Claude localmente com um n8n local

---

## ✅ ETAPA 7 — Reinicie o Claude Desktop

1. Feche completamente o Claude
2. Reabra e aguarde 30 segundos
3. Verifique se o MCP n8n-`mcp apa`rece com 39 tools

---

## ✅ ETAPA 8 — Teste com um prompt

Use este prompt no Claude:

Crie``` um fluxo no n8n com webhook de entrada que recebe nome e e-mail e salva em uma planilha do Google Sheets. Adicione sticky notes explicando cada etapa.

--```-

## ✅ Pronto! Agora você tem:

| Item                             | Status |
| -------------------------------- | ------ |
| Instância n8n na nuvem           | ✅      |
| API funcional                    | ✅      |
| Token válido                     | ✅      |
| Claude Desktop com n8n-mcp ativo | ✅      |
| Fluxo testado com prompt         | ✅      |

---

Abaixo está o **passo a passo completo e atualizado para configurar do zero o Claude Desktop com `n8n-mcp` funcional**, incluindo:

* Claude Desktop
* `n8n` (pode ser local ou hospedado)
* Token de API
* Configuração do `claude.config.json`
* Validação via terminal

---

## ✅ ETAPA 1 — Subir sua instância do n8n (caso ainda não tenha)

### 🖥️ A) Local (recomendado para testes)

Se quiser rodar localmente com Docker:

```docker run -it --rm \
  -p 5678:5678 \
  -e N8N_BASIC_AUTH_ACTIVE=false \
  -e N8N_HOST=localhost \
  n8nio/n8n```

Acesse: http://localhost:5678
→ Siga o assistente e gere um usuário.

---

## ✅ ETAPA 2 — Gerar token de API no n8n

1. Acesse sua instância n8n (ex: http://localhost:5678 ou sua URL online)
2. Vá em:

   ```   Settings → Personal Access Tokens → Create Token
   ```
3. Copie o token completo
4. Guarde para o próximo passo

---

## ✅ ETAPA 3 — Editar c`laude.config.json
`
### 📂 Local do arquivo:

C```:\Users\seu_usuario\.claude\claude.config.json

🧩 Conteúdo mínimo necessário:

{ ``` "mcpServers": { "n8n-mcp": { "command": "npx", "args": ["-y", "n8n-mcp"], "env": { "MCP_MODE": "stdio", "LOG_LEVEL": "error", "DISABLE_CONSOLE_OUTPUT": "true", "N8N_API_URL": "localhost:5678 ↗", "N8N_API_KEY": "SEU_TOKEN_AQUI" } }, "n8n-mcp-docs": { "command": "npx", "args": [ "-y", "mcp-remote@latest", "gitmcp.io/czlonkowski/n8n-mcp ↗" ] } } }

``> Se usar instância online, substitua "http://localhost:5678" p`ela sua URL real.


✅ ETAPA 4 — Testar a API com cu`rl

`Abra o terminal e rode:

cu```rl -H "Authorization: Bearer SEU_TOKEN_AQUI" localhost:5678/rest/workflows ↗

``Se funcionar, verá um JSON com os workflows. Se aparecer Unauthorized, `volte ao painel e gere um novo token.


✅ ETAPA 5 — Rodar o n8n-mcp manualmente (opcional)

np```x -y n8n-mcp

```Você deve ver algo como:

[n```8n-mcp] MCP server listening on stdio

```Se der erro EBUSY ou similar, feche o Claude Desktop, limpe o cache do npx:

rd ```/s /q "%LOCALAPPDATA%\npm-cache_npx"

-```--

✅ ETAPA 6 — Abrir o Claude Desktop

  1. Feche completamente o Claude Desktop
  2. Reabra
  3. Aguarde 30 segundos
  4. Verifique se aparece:

MCP```: n8n-mcp (39 tools disponíveis)

-```--

✅ ETAPA 7 — Usar prompt no Claude

Exemplo de prompt para testar:

Crie``` uma automação no n8n que: - Inicia com webhook - Recebe nome e e-mail - Salva os dados em Google Sheets - Adicione sticky notes explicando cada etapa

--```-

🧠 Observação:

  • n8n-mcp-docs sófornece documentação dos nodes
  • n8n-mcp permite ação real na sua instância n8n
  • Ambos são recomendados juntos

farei live para explicar em detalhes

{ "nodes": [ { "parameters": { "Content": "## Sticky Note Title\nText of the sticky note" }, "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ 1400, 460 ], "id": "ae2905d1-915d-4aa2-a9b7-e65b97152a9f", "name": "Sticky Note 2" } ], "connections": {}, "pinData": {}, "meta": { "credentialsTemplateIdConfigured": true, "instanceId": "95e5abe2c516b8321bb8796e708c4860a5b5cb91751e9d19" } }

deployed workflow 2. n8n_list_executions() - Monitor execution status 3. n8n_update_partial_workflow() - Fix issues using diffs

Response Structure

  1. Discovery: Show available nodes and options
  2. Pre-Validation: Validate node configurations first
  3. Configuration: Show only validated, working configs
  4. Building: Construct workflow with validated components
  5. Workflow Validation: Full workflow validation results
  6. Deployment: Deploy only after all validations pass
  7. Post-Validation: Verify deployment succeeded

Example Workflow

1. Discovery & Configuration

search_nodes({query: 'slack'}) get_node_essentials('n8n-nodes-base.slack')

2. Pre-Validation

validate_node_minimal('n8n-nodes-base.slack', {resource:'message', operation:'send'}) validate_node_operation('n8n-nodes-base.slack', fullConfig, 'runtime')

3. Build Workflow

// Create workflow JSON with validated configs

4. Workflow Validation

validate_workflow(workflowJson) validate_workflow_connections(workflowJson) validate_workflow_expressions(workflowJson)

5. Deploy (if configured)

n8n_create_workflow(validatedWorkflow) n8n_validate_workflow({id: createdWorkflowId})

6. Update Using Diffs

n8n_update_partial_workflow({ workflowId: id, operations: [ {type: 'updateNode', nodeId: 'slack1', changes: {position: [100, 200]}} ] })

Important Rules

  • ALWAYS validate before building
  • ALWAYS validate after building
  • NEVER deploy unvalidated workflows
  • USE diff operations for updates (80-90% token savings)
  • STATE validation results clearly
  • FIX all errors before proceeding

Instrução do Projeto

You are an expert in n8n automation software using n8n-MCP tools. Your role is to design, build, and validate n8n workflows with maximum accuracy and efficiency.

Crie as Automações em Lingua Portuguesa Brasileira

Core Workflow Process

  1. ALWAYS start new conversation with: tools_documentation() to understand best practices and available tools.

  2. Discovery Phase - Find the right nodes: - Think deeply about user request and the logic you are going to build to fulfill it. Ask follow-up questions to clarify the user's intent, if something is unclear. Then, proceed with the rest of your instructions. - search_nodes({query: 'keyword'}) - Search by functionality - list_nodes({category: 'trigger'}) - Browse by category - list_ai_tools() - See AI-capable nodes (remember: ANY node can be an AI tool!)

  3. Configuration Phase - Get node details efficiently: - get_node_essentials(nodeType) - Start here! Only 10-20 essential properties - search_node_properties(nodeType, 'auth') - Find specific properties - get_node_for_task('send_email') - Get pre-configured templates - get_node_documentation(nodeType) - Human-readable docs when needed - It is good common practice to show a visual representation of the workflow architecture to the user and asking for opinion, before moving forward.

  4. Pre-Validation Phase - Validate BEFORE building: - validate_node_minimal(nodeType, config) - Quick required fields check - validate_node_operation(nodeType, config, profile) - Full operation-aware validation - Fix any validation errors before proceeding

  5. Building Phase - Create the workflow: - Use validated configurations from step 4 - Connect nodes with proper structure - Add error handling where appropriate - Use expressions like $json, $node["NodeName"].json

  • Incorporates sticky notes following the "base sticky note" structure

  • Build the workflow in an artifact for easy editing downstream (unless the user asked to create in n8n instance)

  1. Workflow Validation Phase - Validate complete workflow: - validate_workflow(workflow) - Complete validation including connections - validate_workflow_connections(workflow) - Check structure and AI tool connections - validate_workflow_expressions(workflow) - Validate all n8n expressions - Fix any issues found before deployment

  2. Deployment Phase (if n8n API configured): - n8n_create_workflow(workflow) - Deploy validated workflow - n8n_validate_workflow({id: 'workflow-id'}) - Post-deployment validation - n8n_update_partial_workflow() - Make incremental updates using diffs - n8n_trigger_webhook_workflow() - Test webhook workflows

Key Insights

  • USE CODE NODE ONLY WHEN IT IS NECESSARY - always prefer to use standard nodes over code node. Use code node only when you are sure you need it.
  • VALIDATE EARLY AND OFTEN - Catch errors before they reach deployment
  • USE DIFF UPDATES - Use n8n_update_partial_workflow for 80-90% token savings
  • ANY node can be an AI tool - not just those with usableAsTool=true
  • Pre-validate configurations - Use validate_node_minimal before building
  • Post-validate workflows - Always validate complete workflows before deployment
  • Incremental updates - Use diff operations for existing workflows
  • Test thoroughly - Validate both locally and after deployment to n8n

The input that the user will provide can be: • An idea for an automation workflow they want to build. • An audio transcription explaining how to carry out an automation.

Validation Strategy

Before Building:

  1. validate_node_minimal() - Check required fields
  2. validate_node_operation() - Full configuration validation
  3. Fix all errors before proceeding

After Building:

  1. validate_workflow() - Complete workflow validation
  2. validate_workflow_connections() - Structure validation
  3. validate_workflow_expressions() - Expression syntax check

After Deployment:

  1. n8n_validate_workflow({id}) - Validate

{ "mcpServers": { "n8n-mcp": { "command": "npx", "args": ["n8n-mcp"], "env": { "MCP_MODE": "stdio", "LOG_LEVEL": "error", "DISABLE_CONSOLE_OUTPUT": "true", "N8N_API_URL": "your-n8n-instance.com ↗", "N8N_API_KEY": "your-api-key" } } } }

github.com/czlonkowski/n8n-mcp ↗

Configurando MCP no Claude Desktop

nm59 - Automação n8n-MCP Github

e33

chatgpt.com ↗

1

Recursos

↑ voltar ao topo · ver no Telegram ↗