Guides
MCP server for AI assistants
Connect KSeF Faktury to Claude, Cursor, Codex or another MCP client. The assistant checks invoice status, finds problems and hands you PDF links, and creates documents only after you agree.
What it is
The MCP (Model Context Protocol) server lets an AI assistant such as Claude or Cursor use KSeF Faktury as a tool: find invoices that did not reach KSeF, get a link to a PDF or UPO, check a business partner's NIP. It runs on our server; there is nothing to install.
| Setting | Value |
|---|---|
| URL | https://app.ksefshop.pl/mcp |
| Transport | Streamable HTTP (current MCP specification), stateless |
| Authentication | header Authorization: Bearer sk_test_... or sk_live_... |
| Scope | one store in one mode, exactly as in the /v1 API |
| Rate limit | shared with the API: 100 requests per minute per key |
You use the same keys as the API. A test key sees only test documents and creates invoices only in KSeF TEST, with no legal effect. A live key works once live mode is enabled. Create a key in the customer panel: Stores and API keys > New key. Authentication
A plain step-by-step guide for store owners and accountants: KSeF in ChatGPT and Claude.
Tools
| Tool | What it does | Writes |
|---|---|---|
get_account |
store, key mode, KSeF environment and connection, plan and usage | no |
list_invoices |
invoices, newest first; filters: date range, status (accepted, pending, failed, skipped, not_sent), buyer NIP, order id; cursor pagination |
no |
get_invoice |
an invoice or correction: status, number, KSeF number, error, whether PDF, XML and UPO exist | no |
get_invoice_pdf_link |
signed link to the invoice PDF or the UPO PDF, valid for 15 minutes | no |
get_invoice_xml |
signed link to the FA(3) XML or the UPO XML, valid for 15 minutes | no |
list_problems |
rejected and stuck invoices, held orders, what to do | no |
check_nip |
NIP format and checksum; optionally the MF VAT white list or VIES | no |
create_invoice |
an invoice from a paid order, like POST /v1/invoices |
yes, confirm |
create_correction |
a correction for a refund, like POST /v1/invoices/{id}/corrections |
yes, confirm |
retry_invoice |
sends a rejected or stuck invoice again | yes, confirm |
Write tools carry the destructiveHint or readOnlyHint: false annotation, and without confirm: true they change nothing: they return a summary (buyer, lines, total, KSeF environment) for the assistant to show to the user. create_invoice and create_correction need an idempotency_key; it is the same mechanism as the Idempotency-Key header, so a retry never creates a second invoice. Idempotency
PDFs and XML never enter the conversation as files. The tool returns an HMAC-signed https://app.ksefshop.pl/mcp/files/... link valid for 15 minutes; it works without a key, so share it only with people who may see the invoice.
Claude
claude.ai and Claude Desktop (Pro, Max): Customize > Connectors > + Add > Add custom connector. Name: KSeF Faktury, URL: https://app.ksefshop.pl/mcp, authentication: No sign in, and under Request headers add Authorization with the value Bearer sk_test_.... The connector works in the browser and in the Claude Desktop app on the same account.
Team and Enterprise: an owner adds the connector under Organization settings > Connectors > Add > Custom > Web. The header is shared by all members of the organization, so everyone sees the same store: use the key of a store everyone should see.
Claude Code:
claude mcp add --transport http ksef-faktury https://app.ksefshop.pl/mcp --header "Authorization: Bearer sk_test_..."
ChatGPT
ChatGPT lets you add your own MCP server (Plugins > + > Add custom MCP server), but according to OpenAI's documentation it supports only OAuth or no authentication, not a fixed key in a header. Our server needs an API key, so it cannot be connected in the ChatGPT app today. It does work in OpenAI Codex (~/.codex/config.toml):
[mcp_servers.ksef-faktury]
url = "https://app.ksefshop.pl/mcp"
bearer_token_env_var = "KSEF_API_KEY"
Cursor
~/.cursor/mcp.json (or .cursor/mcp.json in a project):
{
"mcpServers": {
"ksef-faktury": {
"url": "https://app.ksefshop.pl/mcp",
"headers": { "Authorization": "Bearer sk_test_..." }
}
}
}
mcp-remote for clients without remote MCP
A client that only starts local (stdio) servers connects through the mcp-remote bridge (needs Node.js 18+). Example for claude_desktop_config.json (Claude Desktop > Settings > Developer > Edit Config):
{
"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_..." }
}
}
}
The key sits in the KSEF_AUTH variable rather than in the arguments because some clients mangle spaces in arguments.
Example prompts
- "Show me the October invoices that did not reach KSeF."
- "Why did KSeF reject the invoice for order 1043? What should I fix?"
- "Give me the PDF and UPO links for invoice FV/2026/10/15."
- "Check NIP 526-025-02-74 on the VAT white list."
- "How many invoices did we use this month, and is KSeF connected?"
- "Send this week's rejected invoices again" (the assistant shows a summary and asks for your consent).
Security
- Start with a test key. Invoices made with an
sk_test_key go to KSeF TEST only. - Every write needs
confirm: true; a good client also asks for your consent before it calls a write tool. - A key gives access to the invoices of one store. Paste it into the connector settings, not into the chat. You can revoke it at any time under Stores and API keys.
- We never write keys to logs. We log the key id, tool name, outcome and duration, as for the API.
- Invoice data the assistant reads goes to that assistant's provider (e.g. Anthropic, OpenAI) under its terms. Check that your agreements with clients and your office's policy allow it. Security and data