The local document parser in ai_assistant.js calls
getDocument({ data: arrayBuffer }) without cMapUrl and
standardFontDataUrl. As a consequence, PDFs that ship with custom
CID fonts referencing ToUnicode CMaps (which is the norm for files
produced by TCPDF, wkhtmltopdf, iText and most server-side
generators) cannot be decoded properly: PDF.js getTextContent()
returns raw glyph codes and the resulting "text" looks like garbled
base64.
This patch passes the two URLs to getDocument(), pointing them at
the jsdelivr CDN package (cdnjs, which is used elsewhere for the
pdf.js bundle itself, does not distribute the cmaps/ and
standard_fonts/ resource directories).
Tested with a TCPDF-generated invoice that previously returned
unreadable base64-like output. Text now extracts cleanly, including
French accented characters.
The MCP server currently accepts the API key via X-API-Key or
Authorization: Bearer headers only. This works for most MCP clients
(Claude Code CLI, MCP Inspector, mcp-proxy, custom scripts) which let
users configure arbitrary headers.
However, Claude Desktop's "Custom Connectors" feature (currently in
public beta) only exposes OAuth credential fields in its UI. There is
no way for end users to pass a custom X-API-Key or Authorization
header from that client today.
Without a fallback, Claude Desktop users cannot connect to a Dolibarr
MCP server at all (HTTP 401 on every request), even though all other
prerequisites are met.
This patch adds a query-string fallback: ?api_key=XXX or ?key=XXX.
The header-based methods remain preferred and are tried first; the
query string is checked only when no valid header was provided.
Security considerations:
- Query-string credentials appear in webserver access logs and
potentially in Referer headers. This is documented in an inline
comment alongside the code.
- Administrators relying on the fallback should restrict access at
the webserver level (IP allowlist, mTLS, etc.) and/or rotate
AI_MCP_API_KEY regularly.
- Header-based auth remains the recommended path and is unchanged.
Tested with:
- Claude Desktop Custom Connectors (beta): connection now succeeds
- Claude Code CLI with --header: existing header path unchanged
- curl with both header and query-string: both work
Several tool schemas in ToolThirdParty::getDefinitions() declared
'required' => true inside individual properties. This is not valid
JSON Schema draft 2020-12, which requires 'required' to be an array
of property names at the parent object level.
Strict validators (such as Anthropic's Claude API used by Claude
Desktop Custom Connectors and Claude Code) reject these schemas with
HTTP 400 'input_schema is invalid', causing the entire MCP connection
to fail before any tool can be called.
This patch:
- Moves 'required: true' flags from individual properties to a proper
'required: [...]' array at the parent level
- Adds the missing parent-level required array to get_thirdparty_details
(which previously had no way to mark id as required in a compliant manner)
- Fixes 5 tools in total: get_thirdparty_details, create_thirdparty,
update_thirdparty, list_thirdparty_contacts, add_thirdparty_contact
Tested with:
- Claude Desktop Custom Connectors (BETA): tools/list now succeeds
- Claude Code CLI: 32 MCP tools load without 400 errors
PR #37840 added NC legal forms by adapting the French INSEE Niveau II
codes (prefixed with '165' to fit the country id) and inserting GDPL
entries on arbitrary 165XX slots. That approach worked but bypassed the
actual NC reference: the ISEE-NC (Institut de la Statistique et des
Études Économiques de Nouvelle-Calédonie) maintains its own published
"Nomenclature des formes juridiques" (July 2020 edition), which is what
the RIDET business registry actually uses to classify NC entities.
This commit replaces the 46 ad-hoc 165XX codes with the 34 INSEE Niveau
II codes from the ISEE-NC nomenclature (same convention used for France
in the same file), prefixed with '165' to satisfy the table's UNIQUE
(code) constraint, plus one Niveau IV entry for the GDPL (code '6901'
becomes '1656901'), which has no N2 equivalent.
Stripping the '165' prefix from any NC code yields the official
ISEE-NC code.
Source: https://www.isee.nc/definitions-et-methodes/nomenclatures
("Nomenclature des formes juridiques", July 2020)
The GDPL (Groupement de Droit Particulier Local) is a NC-specific legal
form established by French law 88-1028 of 9 November 1988, decree
89-570 of 16 August 1989, and reinforced by organic law 99-209 of
19 March 1999, art. 18.
This realignment lands before any Dolibarr release ships the 165XX
codes from PR #37840 (which sits only in develop, no tag contains it
yet), so no upgrade migration is needed on the upstream side.
Fixes#38203
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>