# Daftiq MCP server: connect an AI app to your ERP data

> Connect Claude, ChatGPT or any MCP client to Daftiq: endpoint https://daftiq.com/mcp, a Bearer key from Settings, and read-only tools for sales, stock, customers, bills and staff.

- Endpoint: https://daftiq.com/mcp
- Authentication: Bearer key ("Authorization: Bearer <key>") created in Settings → Integrations → MCP server
- Plan: Premium (https://daftiq.com/pricing)
- Server card: https://daftiq.com/.well-known/mcp/server-card.json
- Last updated: 2026-12-03

## How to connect

1. Have a company on the Premium plan (the MCP server is part of Premium; Daftiq AI itself is also on Standard).
2. Sign in to Daftiq as the company owner or a user whose role may manage MCP keys, and open Settings → Integrations → MCP server.
3. Create a key and copy it: it is shown only once. Each key acts as the user who created it, with that user's permissions.
4. In your AI app, add a remote MCP server (Streamable HTTP) with the endpoint https://daftiq.com/mcp and send the key as "Authorization: Bearer <key>".
5. Ask a question, for example "Which customers owe us the most?". Revoke the key in the same settings screen at any time.

## Tools

- `company_overview` (Company overview): Key figures for a period: revenue (with the previous period), today's sales, receivables and overdue invoices, payables, spending in the last 30 days and cash in bank accounts.
- `list_sales_invoices` (List sales invoices): Sales invoices, newest first, filtered by status, customer and invoice date, with the count and totals of all matching invoices.
- `get_sales_invoice` (Get a sales invoice): One sales invoice by its number or id, with its lines and the payments applied to it.
- `top_unpaid_customers` (Customers who owe the most): Customers ranked by the amount they still owe, with their open and overdue invoices and the oldest due date.
- `list_customers` (List customers): Customers with contact details, payment terms, credit limit and the balance they owe on open invoices.
- `list_products` (List products): Active products and services with sale price, cost and stock on hand; can list only items running low or out of stock.
- `list_purchase_bills` (List purchase bills): Purchase bills (vendor invoices), newest first, filtered by status, vendor and bill date, with the count and totals.
- `expenses_summary` (Expenses summary): Recorded expenses for a date range (default: the last 30 days), totalled by category.
- `hrm_headcount` (Headcount): Number of employees by department, and how many joined in the last 30 days.

## Rules

- Read-only: these tools look data up and never create, change or delete anything.
- One company: a key only sees the company of its user, and only what that user may see in Daftiq (same roles and modules).
- Transport: JSON-RPC 2.0 over HTTP POST (MCP Streamable HTTP, JSON responses, stateless). Methods: initialize, ping, tools/list, tools/call. Protocol versions 2025-11-25, 2025-06-18, 2025-03-26 and 2024-11-05.
- Without a valid key the server answers 401 with a "WWW-Authenticate: Bearer" header. Requests are rate limited per key and per address.
- Money comes with the company currency code (for example "1250.00 PKR") and dates as YYYY-MM-DD.

## Example request

```http
POST /mcp HTTP/1.1
Host: daftiq.com
Authorization: Bearer <key>
Content-Type: application/json
Accept: application/json, text/event-stream

{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"top_unpaid_customers","arguments":{"limit":5}}}
```
