This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
MCP (Model Context Protocol) server for the Fakturia billing/subscription management API.
- Fakturia API docs: https://api.fakturia.de/documentation/
- OpenAPI spec:
docs/api/fakturia-openapi.json— full REST API spec (OpenAPI 3.0.1) - API base path:
/api/v1/— authenticated viaapi-keyheader - API domains: Customers, Contracts, Invoices, Items, Orders, Accounts, Subscriptions, CreditNotes, Webhooks, Reports, Activities, UserLogins, Discounts/Coupons
src/index.ts— entry point: env var validation, client init, tool registration, stdio transportsrc/client.ts—FakturiaApiClientHTTP client (GET/POST/PUT/PATCH/DELETE),api-keyheader authsrc/tools/util.ts— shared helpers:errorResult(),jsonResult(),buildParams()src/tools/*.ts— tool registrations organized by domain (one file per domain, 14 files, 123 tools total)docs/api/— Fakturia OpenAPI specbundle/— esbuild single-file bundle (fakturia-mcp.mjs), checked into git
- Node version: 24 (see
.nvmrc) - Package manager: pnpm
pnpm build— compile TypeScript todist/pnpm bundle— compile + bundle tobundle/fakturia-mcp.mjspnpm start— run from compileddist/
FAKTURIA_API_HOST(required) — API base URL (e.g.https://api.fakturia.de)FAKTURIA_API_KEY(required) — API key for authenticationFAKTURIA_API_INSECURE(optional) — set to1to disable TLS cert validation (dev only)
<type>([scope]): <description>
Examples:
feat(contracts): add terminate and cancel toolsfix(client): handle 401 error responses correctlyrefactor(invoices): extract shared filter params
Types: feat, fix, docs, style, refactor, test, config, chore, revert
- Each domain has a
registerXTools(server, client)function that registers MCP tools viaserver.tool() - Tools use Zod schemas for parameter validation with
.describe()for documentation FakturiaApiClienthandles auth, timeouts, and error parsing; tools only deal with paths/params/bodies- Errors are wrapped in
FakturiaApiErrorand formatted viaerrorResult()for MCP-compatible responses - Reference the OpenAPI spec at
docs/api/fakturia-openapi.jsonfor endpoint details and schemas