{
  "name": "Convert Fleet - MCP File Conversion Bridge (convert_file / get_status)",
  "nodes": [
    {
      "name": "MCP Convert Request (Webhook)",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        -200,
        300
      ],
      "parameters": {
        "httpMethod": "POST",
        "path": "convert-file",
        "responseMode": "responseNode",
        "options": {}
      }
    },
    {
      "name": "Submit Conversion Job",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        40,
        300
      ],
      "parameters": {
        "method": "POST",
        "url": "https://api.example.com/v1/convert",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_API_KEY"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"file_url\": \"{{ $json.body.file_url }}\",\n  \"source_format\": \"{{ $json.body.source_format }}\",\n  \"target_format\": \"{{ $json.body.target_format }}\"\n}",
        "options": {}
      }
    },
    {
      "name": "Job Already Complete?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        280,
        300
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "cond1",
              "leftValue": "={{ $json.status }}",
              "rightValue": "completed",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "name": "Wait Before Poll",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        280,
        500
      ],
      "parameters": {
        "amount": 5,
        "unit": "seconds"
      }
    },
    {
      "name": "Poll get_status",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        520,
        500
      ],
      "parameters": {
        "method": "GET",
        "url": "=https://api.example.com/v1/status/{{ $json.job_id }}",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_API_KEY"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "name": "Format MCP Response",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        760,
        300
      ],
      "parameters": {
        "mode": "manual",
        "assignments": {
          "assignments": [
            {
              "name": "job_id",
              "type": "string",
              "value": "={{ $json.job_id }}"
            },
            {
              "name": "status",
              "type": "string",
              "value": "={{ $json.status }}"
            },
            {
              "name": "download_url",
              "type": "string",
              "value": "={{ $json.download_url }}"
            },
            {
              "name": "tool",
              "type": "string",
              "value": "convert_file"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "name": "Respond to MCP Host",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        1000,
        300
      ],
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ $json }}",
        "options": {}
      }
    },
    {
      "name": "Setup Notes",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -200,
        60
      ],
      "parameters": {
        "width": 420,
        "height": 200,
        "content": "## Convert Fleet -> MCP Bridge\n\n1. This webhook mirrors an MCP `convert_file` tool call: an MCP host (Claude Code/Desktop) POSTs {file_url, source_format, target_format} here.\n2. Replace `https://api.example.com/v1/convert` and `/v1/status/{job_id}` with your Convert Fleet API base URL.\n3. Set your real key in both HTTP Request nodes' Authorization header (replace YOUR_API_KEY) or move it to an n8n Header Auth credential.\n4. Job not done yet? Loop 'Poll get_status' back into 'Job Already Complete?' for long conversions (video/large PDFs).\n5. Final JSON returned matches what your MCP server's `get_status` tool would report back to the agent."
      }
    }
  ],
  "connections": {
    "MCP Convert Request (Webhook)": {
      "main": [
        [
          {
            "node": "Submit Conversion Job",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Submit Conversion Job": {
      "main": [
        [
          {
            "node": "Job Already Complete?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Job Already Complete?": {
      "main": [
        [
          {
            "node": "Format MCP Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait Before Poll",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait Before Poll": {
      "main": [
        [
          {
            "node": "Poll get_status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Poll get_status": {
      "main": [
        [
          {
            "node": "Format MCP Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format MCP Response": {
      "main": [
        [
          {
            "node": "Respond to MCP Host",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {}
}