{
  "name": "Keep Notes - Label Manager",
  "nodes": [
    {
      "parameters": {},
      "id": "mcp-trigger-4",
      "name": "MCP Server Trigger",
      "type": "n8n-nodes-langchain.mcptrigger",
      "typeVersion": 1,
      "position": [250, 300],
      "webhookId": "keep-notes-labels",
      "description": "MCP trigger to manage labels"
    },
    {
      "parameters": {
        "switches": {
          "values": [
            {
              "conditions": [
                {
                  "leftValue": "={{ $json.action }}",
                  "rightValue": "create",
                  "operator": {
                    "type": "string",
                    "operation": "equals"
                  }
                }
              ],
              "output": "create"
            },
            {
              "conditions": [
                {
                  "leftValue": "={{ $json.action }}",
                  "rightValue": "list",
                  "operator": {
                    "type": "string",
                    "operation": "equals"
                  }
                }
              ],
              "output": "list"
            },
            {
              "conditions": [
                {
                  "leftValue": "={{ $json.action }}",
                  "rightValue": "update",
                  "operator": {
                    "type": "string",
                    "operation": "equals"
                  }
                }
              ],
              "output": "update"
            },
            {
              "conditions": [
                {
                  "leftValue": "={{ $json.action }}",
                  "rightValue": "delete",
                  "operator": {
                    "type": "string",
                    "operation": "equals"
                  }
                }
              ],
              "output": "delete"
            },
            {
              "conditions": [
                {
                  "leftValue": "={{ $json.action }}",
                  "rightValue": "suggest",
                  "operator": {
                    "type": "string",
                    "operation": "equals"
                  }
                }
              ],
              "output": "suggest"
            }
          ]
        },
        "options": {}
      },
      "id": "switch-labels",
      "name": "Action Switch",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.1,
      "position": [500, 300]
    },
    {
      "parameters": {
        "resource": "label",
        "operation": "create",
        "url": "http://localhost:3000/api/labels",
        "method": "POST",
        "bodyParameters": {
          "parameters": [
            {
              "name": "name",
              "value": "={{ $json.name }}"
            },
            {
              "name": "color",
              "value": "={{ $json.color || 'blue' }}"
            },
            {
              "name": "notebookId",
              "value": "={{ $json.notebookId }}"
            }
          ]
        }
      },
      "id": "create-label",
      "name": "Create Label",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [750, 150],
      "sendHeaders": true,
      "headerParameters": {
        "parameters": [
          {
            "name": "Content-Type",
            "value": "application/json"
          }
        ]
      }
    },
    {
      "parameters": {
        "url": "http://localhost:3000/api/labels",
        "method": "GET",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "options": {
          "qs": {
            "parameters": [
              {
                "name": "notebookId",
                "value": "={{ $json.notebookId }}"
              }
            ]
          }
        }
      },
      "id": "list-labels",
      "name": "List Labels",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [750, 300]
    },
    {
      "parameters": {
        "resource": "label",
        "operation": "update",
        "url": "http://localhost:3000/api/labels/{{ $json.id }}",
        "method": "PUT",
        "bodyParameters": {
          "parameters": [
            {
              "name": "name",
              "value": "={{ $json.name }}"
            },
            {
              "name": "color",
              "value": "={{ $json.color }}"
            }
          ]
        }
      },
      "id": "update-label",
      "name": "Update Label",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [750, 450],
      "sendHeaders": true,
      "headerParameters": {
        "parameters": [
          {
            "name": "Content-Type",
            "value": "application/json"
          }
        ]
      }
    },
    {
      "parameters": {
        "resource": "label",
        "operation": "delete",
        "url": "http://localhost:3000/api/labels/{{ $json.id }}",
        "method": "DELETE"
      },
      "id": "delete-label",
      "name": "Delete Label",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [750, 600]
    },
    {
      "parameters": {
        "modelId": "openai/gpt-4",
        "prompt": "Suggest 3-5 appropriate labels for this note based on its content. Return only the label names in a JSON array.\n\nNote title: {{ $json.title }}\nNote content: {{ $json.content }}\n\nExample format:\n[\"work\", \"project\", \"important\"]"
      },
      "id": "ai-suggest-labels",
      "name": "AI Suggest Labels",
      "type": "n8n-nodes-langchain.agent",
      "typeVersion": 1.1,
      "position": [750, 750]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "name": "action",
              "value": "={{ $json.action }}",
              "type": "string"
            },
            {
              "name": "success",
              "value": true,
              "type": "boolean"
            },
            {
              "name": "data",
              "value": "={{ $json }}",
              "type": "object"
            }
          ]
        },
        "options": {}
      },
      "id": "format-labels",
      "name": "Format Response",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [1000, 300]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ $json }}"
      },
      "id": "mcp-response-labels",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [1250, 300]
    }
  ],
  "connections": {
    "MCP Server Trigger": {
      "main": [
        [
          {
            "node": "Action Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Action Switch": {
      "main": [
        [
          {
            "node": "Create Label",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "List Labels",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update Label",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Delete Label",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "AI Suggest Labels",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Label": {
      "main": [
        [
          {
            "node": "Format Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List Labels": {
      "main": [
        [
          {
            "node": "Format Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Label": {
      "main": [
        [
          {
            "node": "Format Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete Label": {
      "main": [
        [
          {
            "node": "Format Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Suggest Labels": {
      "main": [
        [
          {
            "node": "Format Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Response": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "tags": [
    {
      "createdAt": "2026-01-18T00:00:00.000Z",
      "id": "keep-notes-mcp",
      "name": "Keep Notes MCP"
    }
  ],
  "triggerCount": 1,
  "updatedAt": "2026-01-18T00:00:00.000Z",
  "versionId": "1"
}
