QistPay MCP Docs

Run QistPay from your AI assistant

QistPay's MCP server lets Claude, ChatGPT and other Model Context Protocol clients read your branches, customers, orders, installments and reports, and record payments or create orders when you ask, using your existing QistPay login and role.

MCP server URL https://qistpay.org/mcp

No API keys

Sign in with your QistPay account through OAuth. Nothing to generate or paste.

Your role applies

The assistant sees and does only what your QistPay user is allowed to.

Deletes need a preview

Every delete shows what will be removed and needs a one-time confirmation token.

Fully audited

Changes made from chat show up in your QistPay activity history.

Quick start

You need a QistPay account. If you don't have one yet, register your business first.

Claude (claude.ai, Claude Desktop, Claude mobile)

  1. Open Settings → Connectors and choose Add custom connector. On Team and Enterprise plans, an owner may need to add it under organization settings first.
  2. Name it QistPay and paste the server URL https://qistpay.org/mcp. Leave the OAuth client ID and secret empty; QistPay registers Claude automatically.
  3. Click Connect. A QistPay window opens. Sign in, review the requested access and click Allow access.
  4. In a new chat, enable the QistPay connector from the tools menu and ask something like "List my QistPay branches."

ChatGPT

  1. Open Settings → Apps & Connectors. If you're adding a custom server, turn on developer mode under Advanced settings.
  2. Create a connector named QistPay with the URL https://qistpay.org/mcp and authentication set to OAuth.
  3. Sign in to QistPay when prompted and click Allow access.
  4. Select QistPay in a chat and start asking questions.

Other MCP clients

Any client that supports the Streamable HTTP transport with OAuth 2.1 (Authorization Code + PKCE and Dynamic Client Registration) can connect. Point it at https://qistpay.org/mcp; it discovers everything else from the metadata endpoints listed under Authentication.

Example prompts

AskWhat happens
"Show me the dashboard for the Main Branch."list_branches finds the branch, then get_branch_dashboard returns balance, collections and overdue figures.
"Search for customer Ali Raza and show his installments."search_customers then get_order / search_installments.
"Which installments are overdue this month?"search_installments with status=overdue and the current month.
"Record a Rs 5,000 payment on his next installment."The assistant restates the payment, waits for your yes, then calls record_installment_payment.
"Create an order for a Samsung A15 with Rs 10,000 advance and 6 monthly installments."Checks for an existing customer, asks for anything missing, restates every value, then calls create_order after you confirm.
"Preview what would be deleted if I delete this order."preview_destructive_action shows the payments, ledger entries and stock that would be reversed. Nothing is deleted.
"Give me the invoice PDF for Sana Malik's iPhone order."search_invoices then get_invoice, which returns a short-lived download link.
"Summarize this branch's last six months of recoveries."get_branch_reports returns the same reports as the QistPay Reports page.

Architecture

The assistant never gets direct access to your data. It calls named tools on QistPay's MCP endpoint, and each call is authenticated and checked against your access before anything runs.

AI assistant Claude, ChatGPT… qistpay.org/mcp JSON-RPC over HTTPS Access checks scopes + your role Activity history every tool call Your business your data only
  • Transport: Streamable HTTP, JSON-RPC 2.0 at POST https://qistpay.org/mcp.
  • Business isolation: a connection is tied to your user and your business, and can never reach another business's records.
  • Same rules as the web app: an order created from chat updates stock, the installment schedule and the branch ledger exactly as it would in the browser.

Authentication

QistPay uses OAuth 2.1 with Authorization Code + PKCE (S256) and Dynamic Client Registration. AI clients register themselves, so there's no client ID or secret to manage.

  1. The client calls /mcp without a token and gets 401 with a WWW-Authenticate header pointing to the protected-resource metadata.
  2. It reads the metadata, registers at /oauth/register, and sends you to /oauth/authorize.
  3. You sign in to QistPay. The consent screen shows which client is asking, the account you're signed in as, and the requested scopes. Click Allow access or Cancel.
  4. The client exchanges the code at /oauth/token for an access token and, if requested, a refresh token.
EndpointURL
MCP serverhttps://qistpay.org/mcp
Protected resource metadatahttps://qistpay.org/.well-known/oauth-protected-resource/mcp
Authorization server metadatahttps://qistpay.org/.well-known/oauth-authorization-server
Dynamic client registrationhttps://qistpay.org/oauth/register
Authorizationhttps://qistpay.org/oauth/authorize
Token & refreshhttps://qistpay.org/oauth/token
Revocationhttps://qistpay.org/oauth/revoke
CredentialLifetime
Connection (with offline_access)Stays signed in for up to 30 days of inactivity
Delete confirmation token5 minutes, single use
Invoice download linkA few minutes

Scopes

Scopes limit what a connection can do. If a client doesn't ask for specific scopes, it gets the read-only defaults. Write and delete scopes are granted only when the client requests them, and they're listed on the consent screen.

ScopeAllowsDefault
qistpay.profile.readWho you are, your business, your permissions; delete previewsYes
qistpay.branches.readList branchesYes
qistpay.operations.readCustomers, products, stock, orders, installmentsYes
qistpay.finance.readDashboards, ledger, investors, reports, audit activityYes
qistpay.invoices.readFind and download order invoice PDFsYes
offline_accessRefresh tokens, so you stay connected for up to 30 daysWhen requested
qistpay.orders.writeCreate and update orders and their statusNo
qistpay.orders.deleteDelete orders (with confirmation)No
qistpay.installments.writeRecord payments, collect advances, add, edit, replace and roll installmentsNo
qistpay.installments.deleteDelete installments and payments (with confirmation)No
qistpay.transactions.writeManual ledger entries, investors and investor transactionsNo
qistpay.transactions.deleteDelete manual and investor transactions (with confirmation)No
qistpay.catalog.writeCreate, update and delete customers and products; adjust stockNo
qistpay.branches.writeCreate, update and delete branchesNo

Permissions & branches

Every tool call has to pass two checks:

  1. OAuth scope: the connection was granted the tool's scope. Tools outside your scopes aren't even listed to the assistant.
  2. QistPay role: your user is currently allowed to do this in QistPay. This is checked on every call, so if an admin changes your role, it takes effect immediately.

Investor-role users only ever see their own investor record. Staff see only what their role allows in the web app.

Explicit branch selection

Branch-scoped tools always need a branch_id. The assistant calls list_branches first and passes the ID explicitly. It never relies on whichever branch you last opened in the browser, so it can't accidentally write to the wrong branch.

Write safety

1. Confirm before every change

Connected assistants are asked to treat every create, update or delete as a conversation:

  • Ask for missing details one at a time instead of guessing.
  • Search for an existing customer before creating a new one, and ask whether it's the same person.
  • Restate the full request (branch, customer, product, prices, plan, dates) in plain language.
  • In voice sessions, spell names letter by letter.
  • Wait for your explicit "yes" before calling the tool.

2. Preview + one-time token for deletes

Delete tools don't run on request alone. The assistant first calls preview_destructive_action (orders, installments, payments, manual transactions) or preview_business_deletion (customers, products, branches, investor transactions). The preview shows exactly what will be removed or reversed and returns a confirmation_token that:

  • expires after 5 minutes and works only once;
  • works only for the exact action that was previewed;
  • becomes invalid if the record changes after the preview.

3. Idempotency keys

Every write includes an idempotency_key. If the network drops and the assistant retries, QistPay returns the original result instead of recording the payment twice.

4. All-or-nothing changes

A payment updates the installment, the order balance and the branch ledger together, or not at all.

Your responsibility

Review every action before you approve it. AI assistants can misunderstand instructions, pick the wrong customer or order, or mistype an amount or date. Read the assistant's summary and any deletion preview carefully before saying yes.

Actions taken through a connection you authorized count as actions taken by you. QistPay is not responsible for data loss, incorrect records or financial discrepancies caused by actions performed through an MCP connection, including those caused by AI errors. See Section 7 of the Privacy Policy and Section 7 of the Terms of Service.

Good practice:

  • Use a staff account with a limited role for day-to-day chat use, and keep admin connections for owners.
  • Grant write scopes only if you need them. Read-only is the default.
  • Check your activity history after bulk changes.
  • Data the assistant reads is sent to your AI provider and handled under its privacy policy.

Activity history

QistPay keeps a record of activity made through MCP connections for security and support. Business changes appear on the Activity Logs page alongside changes made in the browser, and you can review them in chat with list_activity_logs.

Tool reference

Read never changes data. Write creates or changes records and needs an idempotency_key. Delete also needs a confirmation_token from a preview tool.

Account & branches

ToolTypeDescription
get_qistpay_contextReadThe connected user, business, permissions and branch-selection rule.
list_branchesReadBranches your business can operate on, with IDs to pass to other tools.
get_branch_dashboardReadLive financial and collections dashboard for one branch.
get_branch_reportsReadFinancial, installment, customer, product, cohort, investor and cost reports, the same as the Reports page.
create_branchWriteAdd a branch.
update_branchWriteRename a branch or change its phone, address or status.
delete_branchDeleteDelete a branch and everything in it. Needs preview_business_deletion.

Customers

ToolTypeDescription
search_customersReadSearch a branch's customers by name or phone, with portfolio totals.
get_customerReadOne customer with guarantors, tags and portfolio totals.
create_customerWriteAdd a customer with optional CNIC, address, guarantors and tags.
update_customerWriteEdit customer details.
delete_customerDeleteDelete a customer. Needs preview_business_deletion.

Products & inventory

ToolTypeDescription
search_productsReadSearch the catalog with per-variant stock for one branch.
get_productReadA product, its variants, branch stock and recent movements.
list_inventory_movementsReadStock changes in a branch, optionally for one variant.
create_productWriteAdd a product with variants and opening stock.
update_productWriteEdit a product and its variants.
adjust_inventoryWriteStock in, stock out or set a variant's quantity in a branch.
delete_productDeleteDelete a product. Needs preview_business_deletion.

Orders

ToolTypeDescription
search_ordersReadSearch and filter a branch's orders by text or status (active, completed, cancelled, overdue).
get_orderReadAn order with customer, product, installment schedule and payments.
create_orderWriteCreate an order, its installment schedule, stock movement and ledger entries in one transaction.
update_orderWriteUpdate an active order and rebuild its ledger, stock and unpaid schedule.
update_order_statusWriteChange an order's status using QistPay's rules.
collect_order_advanceWriteRecord collection of an advance that was agreed but unpaid.
delete_orderDeleteReverse and delete an eligible order. Needs preview_destructive_action.

Installments & payments

ToolTypeDescription
search_installmentsReadA branch's installments by status (pending, partially paid, paid, skipped, overdue) or month.
get_installmentReadOne installment with its order and payment history.
record_installment_paymentWriteRecord a payment and update installment, order and ledger together.
add_installmentWriteAppend an installment to an order, optionally with a first payment.
update_installmentWriteChange due date, amount, note or status.
replace_installmentWriteSkip an unpaid installment and move what's left to the end of the schedule.
roll_installment_balanceWriteMove an installment's remaining balance into another installment on the same order.
delete_installmentDeleteDelete an installment and reverse its payments. Needs a preview.
delete_installment_paymentDeleteReverse a payment and its ledger credit. Needs a preview.

Ledger & investors

ToolTypeDescription
list_transactionsReadBranch ledger with date, type and category filters.
get_transactionReadOne ledger transaction.
record_manual_transactionWriteAdd a manual credit or debit, such as rent or a cash injection.
update_manual_transactionWriteEdit a manual transaction and adjust the balance.
delete_manual_transactionDeleteDelete a manual transaction. Needs a preview.
list_investorsReadInvestors with live capital and profit figures.
get_investorReadAn investor's stake and transaction history.
create_investorWriteAdd an investor with a profit share and optional read-only login.
update_investorWriteEdit an investor.
record_investor_transactionWriteRecord a deposit, withdrawal or profit payout.
update_investor_transactionWriteEdit an investor transaction.
delete_investor_transactionDeleteDelete an investor transaction. Needs preview_business_deletion.

Invoices, audit & previews

ToolTypeDescription
search_invoicesReadFind order invoices by invoice number, order ID, customer name or phone.
get_invoiceReadRender an invoice as a PDF and return a short-lived download link.
list_activity_logsReadThe business audit trail by branch, event or date range.
preview_destructive_actionReadPreview deleting an order, installment, payment or manual transaction and get a confirmation token.
preview_business_deletionReadPreview deleting a customer, product, branch or investor transaction and get a confirmation token.

Invoices

Every order has a PDF invoice, the same one as the Invoice button in QistPay. If several invoices match a customer, the assistant asks which one you want. Download links are private and expire after a few minutes.

Errors

When a request can't be completed, the assistant gets a short error code and a readable message so it can explain what went wrong.

CodeMeaning
scope_deniedThe connection wasn't granted access for this action. Reconnect and allow it.
permission_deniedYour QistPay role doesn't allow this action.
invalid_argumentsA required detail is missing or invalid, or the record isn't in that branch.
confirmation_invalidThe delete confirmation expired, was already used, or doesn't match. Preview again.
deletion_blockedThis record can't be deleted under QistPay's rules.

If you're signed out of the connection, your assistant will ask you to sign in to QistPay again.

Limits

  • Fair use: connections are rate-limited to protect the service. Normal conversational use won't hit the limit.
  • Page size: list and search tools return up to 50 results per page; ask the assistant for the next page.
  • Currency: all amounts are in Pakistani rupees (PKR).
  • Plan limits on your QistPay subscription apply to records created through MCP, just like in the browser.

Disconnecting

To stop an assistant from accessing QistPay, remove the QistPay connector in the assistant's settings (in Claude: Settings → Connectors → QistPay → Disconnect). To revoke all connections immediately, contact support@qistpay.org. Removing a staff user from your business also ends their connections.

FAQ

Does the AI provider get all my data?

No. The assistant only receives the results of the specific tools it calls during your conversation, limited by your scopes and role.

Can a staff member do more through chat than in the app?

No. Every call checks the same role permissions as the web app.

Can the assistant delete something by mistake?

Deletes need a preview and a one-time token, and the assistant is instructed to get your explicit confirmation first. You still need to read what you're approving. See Your responsibility.

Is there a cost?

The MCP connection is included with every QistPay plan. Your AI assistant's own subscription is separate.

Where do I get help?

Email support@qistpay.org or visit qistpay.org/support.