{
    "schema_version": "v1",
    "protocol": "mcp",
    "protocol_version": "2024-11-05",
    "name": "Contractor Hub",
    "version": "1.0.0",
    "description": "Business management platform for South African contractors — jobs, invoices, clients, bookings, marketing, and SOS dispatch.",
    "homepage": "https://www.nextechdisplay.com/",
    "docs": "https://www.nextechdisplay.com/llms.txt",
    "server": {
        "url": "https://www.nextechdisplay.com/finance/api/mcp.php",
        "transport": "http",
        "methods": [
            "POST"
        ],
        "content_type": "application/json"
    },
    "authentication": {
        "type": "bearer",
        "description": "Bearer token required for tool calls. Obtain yours via the get_api_key tool (active session) or in Settings → API Access after logging in.",
        "obtain_url": "https://www.nextechdisplay.com/finance"
    },
    "capabilities": {
        "tools": {
            "listChanged": false
        },
        "resources": false,
        "prompts": false,
        "logging": false
    },
    "tools": [
        {
            "name": "get_business_overview",
            "description": "Returns a summary of the business: revenue this month, total jobs, pending invoice count and amount, open jobs, and total client count.",
            "inputSchema": {
                "type": "object",
                "properties": {},
                "required": []
            },
            "outputSchema": {
                "type": "object",
                "properties": {
                    "overview": {
                        "type": "object",
                        "properties": {
                            "revenue_this_month": {
                                "type": "number",
                                "description": "Total paid invoice revenue this calendar month (ZAR)"
                            },
                            "jobs_this_month": {
                                "type": "integer",
                                "description": "Number of jobs created this calendar month"
                            },
                            "pending_invoices_count": {
                                "type": "integer",
                                "description": "Number of draft/sent/overdue invoices"
                            },
                            "pending_invoices_amount": {
                                "type": "number",
                                "description": "Total value of unpaid invoices (ZAR)"
                            },
                            "total_clients": {
                                "type": "integer",
                                "description": "Total number of clients"
                            },
                            "open_jobs": {
                                "type": "integer",
                                "description": "Jobs not yet completed or cancelled"
                            }
                        }
                    }
                }
            }
        },
        {
            "name": "list_recent_jobs",
            "description": "Lists the most recent jobs with their status, client name, amount, and scheduled date.",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "limit": {
                        "type": "integer",
                        "description": "Max jobs to return (default 10, max 50)",
                        "default": 10,
                        "minimum": 1,
                        "maximum": 50
                    },
                    "status": {
                        "type": "string",
                        "description": "Filter by status",
                        "enum": [
                            "pending",
                            "in_progress",
                            "completed",
                            "invoiced",
                            "cancelled"
                        ]
                    }
                },
                "required": []
            },
            "outputSchema": {
                "type": "object",
                "properties": {
                    "jobs": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "title": {
                                    "type": "string"
                                },
                                "status": {
                                    "type": "string"
                                },
                                "amount": {
                                    "type": [
                                        "number",
                                        "null"
                                    ]
                                },
                                "client_name": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "scheduled_date": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "format": "date"
                                },
                                "created_at": {
                                    "type": "string",
                                    "format": "date-time"
                                }
                            }
                        }
                    }
                }
            }
        },
        {
            "name": "list_clients",
            "description": "Lists clients with their contact details and calculated lifetime value (total paid invoices).",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "limit": {
                        "type": "integer",
                        "description": "Max clients to return (default 20, max 100)",
                        "default": 20,
                        "minimum": 1,
                        "maximum": 100
                    },
                    "search": {
                        "type": "string",
                        "description": "Search by name, email, or phone number"
                    }
                },
                "required": []
            },
            "outputSchema": {
                "type": "object",
                "properties": {
                    "clients": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "name": {
                                    "type": "string"
                                },
                                "email": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "phone": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "company": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "lifetime_value": {
                                    "type": "number",
                                    "description": "Total paid invoice value (ZAR)"
                                },
                                "created_at": {
                                    "type": "string",
                                    "format": "date-time"
                                }
                            }
                        }
                    }
                }
            }
        },
        {
            "name": "list_pending_invoices",
            "description": "Lists all unpaid invoices (draft, sent, and overdue) with amounts and due dates.",
            "inputSchema": {
                "type": "object",
                "properties": {},
                "required": []
            },
            "outputSchema": {
                "type": "object",
                "properties": {
                    "invoices": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "invoice_number": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "total": {
                                    "type": "number",
                                    "description": "Invoice total (ZAR)"
                                },
                                "status": {
                                    "type": "string",
                                    "enum": [
                                        "draft",
                                        "sent",
                                        "overdue"
                                    ]
                                },
                                "due_date": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "format": "date"
                                },
                                "client_name": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "created_at": {
                                    "type": "string",
                                    "format": "date-time"
                                }
                            }
                        }
                    }
                }
            }
        },
        {
            "name": "list_upcoming_bookings",
            "description": "Lists upcoming bookings and appointments within the next N days.",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "days": {
                        "type": "integer",
                        "description": "Number of days ahead to look (default 30, max 90)",
                        "default": 30,
                        "minimum": 1,
                        "maximum": 90
                    }
                },
                "required": []
            },
            "outputSchema": {
                "type": "object",
                "properties": {
                    "bookings": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "title": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "client_name": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "start_datetime": {
                                    "type": "string",
                                    "format": "date-time"
                                },
                                "end_datetime": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "format": "date-time"
                                },
                                "status": {
                                    "type": "string"
                                },
                                "notes": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                }
                            }
                        }
                    }
                }
            }
        },
        {
            "name": "get_api_key",
            "description": "Returns (or generates) the current authenticated user's MCP Bearer API key. Requires an active browser session. Use the returned key as the Authorization: Bearer header for all subsequent tool calls.",
            "inputSchema": {
                "type": "object",
                "properties": {},
                "required": []
            },
            "outputSchema": {
                "type": "object",
                "properties": {
                    "api_key": {
                        "type": "string",
                        "description": "Bearer token for headless API access"
                    },
                    "usage": {
                        "type": "string",
                        "description": "How to use the key as an HTTP header"
                    },
                    "description": {
                        "type": "string"
                    }
                }
            }
        }
    ]
}