KSeF in ChatGPT and Claude: connect invoices over MCP
In short: KSeF Faktury has an MCP server, a "plug-in" for AI assistants. Once connected, you can ask Claude in plain language which October invoices did not reach KSeF (the Polish National e-Invoicing System), why KSeF rejected an invoice, or for a link to a PDF and UPO (the official KSeF receipt). All you need is an API key from the customer panel. It already works in Claude (claude.ai, Claude Desktop, Claude Code), Cursor and OpenAI Codex. The ChatGPT app does not support MCP servers with an API key yet, so you cannot connect it there for now.
What MCP is and what the assistant can do
MCP (Model Context Protocol) is an open standard that lets an AI assistant use outside services. Our server lives at https://app.ksefshop.pl/mcp and gives the assistant ten tools:
| You ask about | The assistant uses |
|---|---|
| plan, invoice allowance, whether KSeF is connected | get_account |
| invoices of a month, by status, buyer NIP or order number | list_invoices |
| the status of one invoice, its KSeF number, the UPO | get_invoice |
| a link to the invoice PDF or the UPO | get_invoice_pdf_link |
| a link to the invoice or UPO XML file | get_invoice_xml |
| rejected and held invoices, and what to do about them | list_problems |
| checking a NIP (checksum, VAT white list, VIES) | check_nip |
| issuing an invoice, a correction for a refund, sending again | create_invoice, create_correction, retry_invoice |
The first seven tools only read. The last three change data, so they do nothing without explicit confirmation: first they return a summary (buyer, amount, KSeF environment), and only a second call with confirmation issues the document. Technical details are in the MCP server documentation.
Who it is for
The MCP server works for stores connected in the KSeF Faktury customer panel: the WooCommerce plugin, the PrestaShop module or your own API integration. Each API key is one store, so the assistant sees only that store's invoices. The Shopify app has no API keys, so Shopify stores cannot connect an assistant yet.
We are in early access: test mode on KSeF TEST works, and live mode will be enabled later. A test key shows only test invoices and issues them only in KSeF TEST, with no legal effect. That makes it a safe way to see how the assistant handles invoices.
Step 1: an API key in the customer panel
- Sign in to the customer panel: app.ksefshop.pl/panel.
- Pick the store at the top of the page and open Stores and API keys.
- Under API keys, click New key, give it a name (e.g. "Claude"), keep the mode Test (KSeF TEST) and click Create key.
- Copy the
sk_test_...key right away. We show it only once; if you lose it, create a new one.
A separate key for the assistant is a good habit: you can revoke it with one click at any time without stopping the store plugin.
Step 2: Claude (claude.ai and Claude Desktop)
On a Pro or Max plan:
- Open Customize > Connectors.
- Click + Add, then Add custom connector.
- Name:
KSeF Faktury. Server URL:https://app.ksefshop.pl/mcp. - Under Authentication, choose No sign in.
- Under Request headers, add the header
Authorizationwith the valueBearer sk_test_...(the word Bearer, a space and your key). - Click Add. The connector works in the browser and in the Claude Desktop app on the same account.
On a Team or Enterprise plan, an organization owner adds the connector: Organization settings > Connectors > Add > Custom > Web. Note that the key header is then shared by all members of the organization, so everyone sees the same store.
Claude connects to the server from Anthropic's cloud, so you install nothing on your computer.
Claude Desktop without a connector (mcp-remote)
If you prefer a local setup, Claude Desktop can start the mcp-remote bridge (needs Node.js 18 or newer). Open Settings > Developer > Edit Config and put this in claude_desktop_config.json:
{
"mcpServers": {
"ksef-faktury": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://app.ksefshop.pl/mcp", "--transport", "http-only", "--header", "Authorization:${KSEF_AUTH}"],
"env": { "KSEF_AUTH": "Bearer sk_test_..." }
}
}
}
Restart Claude Desktop. The same entry works in other programs that support only local MCP servers.
Claude Code
claude mcp add --transport http ksef-faktury https://app.ksefshop.pl/mcp --header "Authorization: Bearer sk_test_..."
ChatGPT: what works today
ChatGPT lets you add your own MCP server (Plugins > + > Add custom MCP server, on Plus, Pro, Business, Enterprise and Edu plans). According to OpenAI's documentation, though, that form supports only OAuth sign-in or servers without authentication, and has no field for a fixed API key (OpenAI, Add custom MCP server). The KSeF Faktury server needs a key, because without one anybody could read your invoices. So you cannot connect it in the ChatGPT app for now. When we add OAuth sign-in, we will describe it here.
OpenAI Codex (command line and editor extension) does work. Add this to ~/.codex/config.toml:
[mcp_servers.ksef-faktury]
url = "https://app.ksefshop.pl/mcp"
bearer_token_env_var = "KSEF_API_KEY"
and put your sk_test_... key in the KSEF_API_KEY environment variable.
Cursor and other programs
In Cursor, open ~/.cursor/mcp.json and add:
{
"mcpServers": {
"ksef-faktury": {
"url": "https://app.ksefshop.pl/mcp",
"headers": { "Authorization": "Bearer sk_test_..." }
}
}
}
Any other MCP client that lets you add a header to a remote server connects the same way. A client without remote server support connects through mcp-remote, as in the Claude Desktop example.
Example prompts
For store owners:
- "Is KSeF connected, and how many invoices do I have left this month?"
- "Show yesterday's invoices that do not have a KSeF number yet."
- "The customer from order 1043 wants the invoice. Give me the PDF link."
- "Issue a correction for invoice FV/2026/10/12: the customer returned one mug for 49 PLN." The assistant first shows a summary and asks whether to issue it.
For accountants:
- "Show me the October invoices that did not reach KSeF." (In Polish: "Pokaż faktury z października, które nie trafiły do KSeF.")
- "Why did KSeF reject invoice FV/2026/10/7, and what needs fixing?"
- "List October invoices for NIP 526-025-02-74 with KSeF numbers and gross totals."
- "Check NIP 774-000-14-54 on the VAT white list."
- "Give me the UPO links for all invoices of 15 October."
The assistant answers in the language you write in. It takes figures and numbers from KSeF Faktury, but check them before booking, as with any report.
Security
- Start with a test key. With an
sk_test_key nothing reaches production KSeF. - Writes only with consent. Issuing an invoice, a correction or sending again needs confirmation; without it you only get a summary. The same command cannot issue an invoice twice.
- The key is access to the store's invoices. Enter it in the connector settings, not in the chat. Revoke it under Stores and API keys.
- PDF and XML links expire after 15 minutes. They work without signing in, so share them only with people who may see the invoice.
- We never write keys to logs. We log only the key id, tool name, outcome and duration.
- Data goes to the assistant's provider. Invoices the assistant reads are processed by Anthropic, OpenAI or another provider under its own terms. An accounting office should check that its client agreements allow this. More about data in API security.
Frequently asked questions
Can the assistant issue an invoice on its own?
No. Without confirmation, write tools return only a summary. A good client such as Claude also asks for your consent before every tool that changes something.
Do I see invoices from all my stores?
One key is one store in one mode (test or live). If you run several stores, add a separate connector for each, with its own key.
Does this work with a Shopify store?
Not yet. The KSeF Faktury Shopify app does not issue API keys. The MCP server works for stores in the customer panel (WooCommerce, PrestaShop, API).
Why can't I connect it in ChatGPT?
ChatGPT's custom MCP server form supports only OAuth or no authentication. Our server needs an API key. Of OpenAI's tools, Codex works today.
How much does it cost?
The MCP server has no separate fee. Invoices issued by the assistant count against the plan allowance just like invoices from the plugin. The request limit is shared with the API: 100 per minute per key.
What does the assistant see?
The same as the API does for that key: seller data, invoices and corrections with KSeF numbers, buyer NIPs and names, amounts and KSeF errors. It never sees the KSeF certificate or token.