# ---- Lexware Office API ---- # Required. Create an API key at https://app.lexware.de/addons/public-api # Treat it like banking credentials. LEXWARE_API_KEY= # Optional. API base URL (override for testing). Default: https://api.lexware.io # LEXWARE_API_BASE_URL=https://api.lexware.io # Optional. Web-app base used to build document deeplinks. Default: https://app.lexware.de # LEXWARE_APP_BASE_URL=https://app.lexware.de # ---- MCP endpoint protection ---- # Required (unless MCP_ALLOW_UNAUTHENTICATED=true). Static bearer token that # clients must send to reach /mcp. Generate a strong one: # openssl rand -hex 32 MCP_AUTH_TOKEN= # Escape hatch: run WITHOUT auth on /mcp. Only for trusted local testing — # never expose an unauthenticated server to the internet. # MCP_ALLOW_UNAUTHENTICATED=false # ---- OAuth (optional; required for the Claude app's "custom connector" UI) ---- # Set OAUTH_ISSUER to switch /mcp to OAuth 2.1 (takes precedence over MCP_AUTH_TOKEN). # The server then advertises this authorization server and validates the JWT access # tokens it issues. Example: a WorkOS AuthKit domain. # OAUTH_ISSUER=https://your-tenant.authkit.app # # This server's MCP endpoint URL, including /mcp — exactly what users enter in Claude, # which sends it (path included) as the RFC 8707 resource. It is the token audience, so # register the same URL as a Resource Indicator with your provider. # Required in OAuth mode (SERVER_URL is accepted as an alias). # # It ALSO applies outside OAuth mode: create-upload-ticket builds its browser URL and # its curl command from this value, minus a trailing /mcp, in every auth mode. If you run # with MCP_AUTH_TOKEN (or unauthenticated) behind a real domain, set it here — otherwise # those links fall back to http://127.0.0.1:$PORT, which resolves nowhere but on the # server itself. # OAUTH_RESOURCE=https://your-server.example.com/mcp # SERVER_URL=https://your-server.example.com # # Restrict access to these email domains (comma-separated). Enforced server-side in addition to # your provider's rules. STRONGLY recommended: if left empty in OAuth mode, ANY user who can # authenticate with your issuer can reach the server. # OAUTH_ALLOWED_EMAIL_DOMAINS=example.com # # Verify the access token's audience (aud) equals OAUTH_RESOURCE. Default: true — keep it. # Setting it false makes the server accept ANY valid token from the issuer, including one # minted for a different app on the same issuer (a confused-deputy risk). Only disable for a # dedicated, single-audience issuer that has no Resource Indicator configured. # OAUTH_VERIFY_AUDIENCE=true # # Additional accepted aud values (comma-separated), on top of OAUTH_RESOURCE. Needed for IdPs # that ignore the Resource Indicator: Microsoft Entra always puts the API's client ID (a GUID) # in the aud of a v2.0 token, never the Application ID URI, so the check above can never match # and every token is rejected with 401. Prefer this over OAUTH_VERIFY_AUDIENCE=false — the # audience is still verified, just against a value your IdP actually issues. # Matched exactly — these are opaque identifiers, so no normalisation is applied. # OAUTH_AUDIENCE=00000000-0000-0000-0000-000000000000 # Scopes advertised to clients, so a client knows what to put in the authorization request. # Separate with commas or spaces — a scope value can never contain a space (RFC 6749 3.3). # Applies to BOTH well-known documents (protected-resource and authorization-server) so the # two cannot disagree. Unset advertises nothing in the protected-resource doc and leaves the # authorization-server doc on its `openid email profile` default, which is what this server # did before the option existed. Set it for IdPs that reject a request without a scope # parameter (Microsoft Entra fails with AADSTS900144). # OAUTH_SCOPES_SUPPORTED=openid,email,profile # # Overrides (defaults derived from OAUTH_ISSUER): # OAUTH_JWKS_URL=https://your-tenant.authkit.app/oauth2/jwks # OAUTH_USERINFO_URL=https://your-tenant.authkit.app/oauth2/userinfo # OAUTH_AUTHORIZATION_ENDPOINT=https://your-tenant.authkit.app/oauth2/authorize # OAUTH_TOKEN_ENDPOINT=https://your-tenant.authkit.app/oauth2/token # # Dynamic Client Registration. Defaults to {issuer}/oauth2/register. Set to `none` if your # issuer does not support DCR — advertising an endpoint that rejects every request makes a # client attempt registration and fail, instead of falling back to a pre-registered client. # registration_endpoint is optional in RFC 8414, so omitting it is the correct signal. # OAUTH_REGISTRATION_ENDPOINT=none # ---- Capabilities (choose your risk level) ---- # Master switch: when true, ONLY read tools are registered (overrides the flags below). # LEXWARE_READ_ONLY=false # Create-draft tools (draft invoices/quotations, create contacts). Default: true # LEXWARE_ENABLE_DRAFTS=true # Finalize / legally-binding write tools (issue invoices). IRREVERSIBLE. Default: false # LEXWARE_ENABLE_FINALIZE=false # Ask the HUMAN before create-finalized-* issues anything, through a confirmation form # (MCP elicitation, protocol 2026-07-28). confirm_finalize alone is a value the model sets. # off (default) no form # when-supported form where the client can show one; other clients finalize as before # required refuse to finalize on a client that cannot show the form # Client support is uneven: claude.ai has none yet, and Claude Cowork has been reported to # hang on the request — try it with your client before relying on it. # LEXWARE_FINALIZE_ELICITATION=off # HMAC key signing the confirmation's round-trip state, >= 32 bytes (openssl rand -hex 32). # Unset = a random key per process, which is fine for a single instance; set it when more # than one instance can serve the same client. # LEXWARE_REQUEST_STATE_KEY= # upload-file-from-url: fetch a file from a share link server-side and store it in # Lexware. OFF by default, and the only tool that makes this server originate an outbound # request to an address the model chose. Requires the drafts tier (it will not turn it on). # The connection is pinned to the address that passed the checks, so DNS cannot answer # differently between the check and the connection. Default: false # LEXWARE_ENABLE_URL_UPLOAD=false # Hosts upload-file-from-url may fetch from, comma-separated. Unset = the Microsoft # file-sharing defaults below. Setting it REPLACES those defaults (so they can be opted # out of); an EMPTY value blocks every host, which is how you switch the fetcher off # without unregistering it. Matched on a dot boundary: evilsharepoint.com never passes # as sharepoint.com. # LEXWARE_UPLOAD_ALLOWED_HOSTS=sharepoint.com,onedrive.live.com,1drv.ms,graph.microsoft.com # ---- Reading downloaded files (get-voucher-file, download-file, get-document-file) ---- # Largest image, in megapixels (1-200), the server decodes to make a page image of a scanned # receipt; a larger one is reported and the raw file attached instead. Rendering peaks at about # 12 bytes per image pixel: keep the default on 1 GiB, use 20 on a 512 MiB instance. Default: 50 # LEXWARE_MAX_DECODE_MP=50 # Time (1000-120000 ms) one download may spend on page images before it answers without the # rest; those pages are listed as missing and the raw file is attached. Default: 20000 # LEXWARE_RENDER_TIME_BUDGET_MS=20000 # ---- Server ---- # Listen port. Cloud Run injects this automatically. Default: 8080 # PORT=8080 # Verbose logging (method/path/status only — never secrets or bodies). Default: false # LEXWARE_DEBUG_LOGGING=false