diff --git a/CITATION.cff b/CITATION.cff index d8c96b14f..6e59efe6a 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -13,7 +13,7 @@ abstract: > server that turns REST/OpenAPI, SOAP/WSDL and GraphQL APIs, SQL/NoSQL databases and other MCP servers into tools for AI clients such as Claude, ChatGPT, Google Gemini, GitHub Copilot and Cursor, without writing code. - It ships 713 pre-built adapters, with a focus on ERP and e-commerce + It ships 714 pre-built adapters, with a focus on ERP and e-commerce systems (SAP Business One, Odoo, Xentral, JTL-Wawi, weclapp, Shopware, WooCommerce, Amazon Seller, Kaufland, OTTO, etc.), a per-workspace knowledge graph served over MCP, File Search over company file servers diff --git a/README.de.md b/README.de.md index 145aedb39..b1d466f4f 100644 --- a/README.de.md +++ b/README.de.md @@ -1,5 +1,5 @@

- AnythingMCP verbindet Claude, ChatGPT, Copilot und Gemini mit ERP-, E-Commerce-, REST-, SOAP- und SQL-Systemen und mit deinen Fileservern: 713 Connectors, dazu Firmengedächtnis, Skills und Dateisuche. + AnythingMCP verbindet Claude, ChatGPT, Copilot und Gemini mit ERP-, E-Commerce-, REST-, SOAP- und SQL-Systemen und mit deinen Fileservern: 714 Connectors, dazu Firmengedächtnis, Skills und Dateisuche.

AnythingMCP: das Open-Source-MCP-Gateway, das zum Gehirn deines Unternehmens wird

@@ -54,7 +54,7 @@ Ein Gateway reicht Aufrufe weiter. Ein Firmengehirn weiß außerdem, wo deine Do | | Was es macht | Edition | |---|---|---| -| **Jedes System, ein Endpunkt** | 713 Connectors aus dem Katalog oder deine eigene REST-/OpenAPI-, SOAP-, GraphQL-, OData-, SQL-, IMAP/SMTP- oder MCP-Quelle. Tools werden zur Laufzeit registriert. [Connectors](#connect-any-api-soap-service-or-database) | Alle | +| **Jedes System, ein Endpunkt** | 714 Connectors aus dem Katalog oder deine eigene REST-/OpenAPI-, SOAP-, GraphQL-, OData-, SQL-, IMAP/SMTP- oder MCP-Quelle. Tools werden zur Laufzeit registriert. [Connectors](#connect-any-api-soap-service-or-database) | Alle | | **File Search** | Indexiert SFTP, FTP/FTPS, WebDAV (Nextcloud, NAS), S3 oder eine Netzwerkfreigabe: jede PDF-Seite, Excel-Zeilen mit ihren Spaltennamen, Word, PowerPoint, Outlook-Mails mit Anhängen. Die KI antwortet mit Datei, Seite und Datum. [File Search](docs/connectors/file-search.md) | Cloud; selbst gehostet Enterprise | | **File Share** | Befristete Download-Links für Dateien aus deinen Ordnern oder für Dateien, die die KI erstellt (einen CSV-Export, einen Bericht), intern oder öffentlich, mit Ablaufdatum und Widerruf. [File Share](docs/connectors/file-search.md) | Cloud; selbst gehostet Enterprise | | **Firmengedächtnis** | Fakten und Vorlieben, in einem KI-Client gespeichert und in jedem anderen wiedergefunden: einmal in Claude gesagt, von Copilot genutzt. Persönlicher und firmenweiter Bereich, mit Ordnern und Rollengrenzen. [Gedächtnis](docs/memory.md) | Enterprise | @@ -139,7 +139,7 @@ Tools werden zur Laufzeit registriert, ohne Neustart. `{{VAR}}`-Werte pro Connec ## Connector-Katalog -713 Adapter mit über 12.000 Tools. Zu jedem gibt es eine Einrichtungsanleitung auf [anythingmcp.com/de/guides](https://anythingmcp.com/de/guides), in sieben Sprachen. +714 Adapter mit über 12.000 Tools. Zu jedem gibt es eine Einrichtungsanleitung auf [anythingmcp.com/de/guides](https://anythingmcp.com/de/guides), in sieben Sprachen. | Kategorie | Beispiele | |---|---| diff --git a/README.ja.md b/README.ja.md index 2d1a2416b..a5ed5a16f 100644 --- a/README.ja.md +++ b/README.ja.md @@ -1,5 +1,5 @@

- AnythingMCP は Claude、ChatGPT、Copilot、Gemini を ERP、E コマース、REST、SOAP、SQL の各システムと社内のファイルサーバーにつなぎます。713 のコネクターに加え、社内メモリ、AI スキル、ファイル検索も備えています。 + AnythingMCP は Claude、ChatGPT、Copilot、Gemini を ERP、E コマース、REST、SOAP、SQL の各システムと社内のファイルサーバーにつなぎます。714 のコネクターに加え、社内メモリ、AI スキル、ファイル検索も備えています。

AnythingMCP:企業の頭脳になるオープンソースの MCP ゲートウェイ

@@ -20,7 +20,7 @@

AnythingMCP は、オープンソースのセルフホスト型 MCP ゲートウェイです。MCP サーバーを書かずに、Claude、ChatGPT、Copilot、Gemini を、自社で使っているソフトウェアやファイルサーバー上の文書につなぎます。
ゲートウェイの上には企業の頭脳を保持します。システム同士のつながりを表すナレッジグラフ、AI スキル、社内メモリです。すべての AI クライアントで共有され、ユーザーごとのロールで範囲が制限されます。
- SAP、Odoo、weclapp、Amazon Seller などを含む 713 種類の既製アダプターで 12,000 以上のツールを提供しており、うち 35 は API キー不要です。 + SAP、Odoo、weclapp、Amazon Seller などを含む 714 種類の既製アダプターで 12,000 以上のツールを提供しており、うち 35 は API キー不要です。

@@ -139,7 +139,7 @@ amd64 ではイメージの取得に約 30 秒、その 24 秒後に API が利 ## コネクターカタログ -713 個のアダプターで 12,000 以上のツールを提供しています。どのアダプターにも [anythingmcp.com/ja/guides](https://anythingmcp.com/ja/guides) に 7 言語の設定ガイドがあります。 +714 個のアダプターで 12,000 以上のツールを提供しています。どのアダプターにも [anythingmcp.com/ja/guides](https://anythingmcp.com/ja/guides) に 7 言語の設定ガイドがあります。 | カテゴリー | 例 | |---|---| diff --git a/README.md b/README.md index c6400912d..d7eaf4f2d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

- AnythingMCP connects Claude, ChatGPT, Copilot and Gemini to ERP, e-commerce, REST, SOAP and SQL systems and to your file servers: 713 connectors, plus company memory, skills and file search. + AnythingMCP connects Claude, ChatGPT, Copilot and Gemini to ERP, e-commerce, REST, SOAP and SQL systems and to your file servers: 714 connectors, plus company memory, skills and file search.

AnythingMCP: the open-source MCP gateway that becomes your company brain

@@ -20,7 +20,7 @@

AnythingMCP is an open-source, self-hosted MCP gateway that connects Claude, ChatGPT, Copilot and Gemini to the software your company runs and to the documents on your file servers, without writing an MCP server.
On top of the gateway it keeps your company brain: a knowledge graph of how your systems connect, AI skills and company memory, shared by every AI client and limited by each user's role.
- 713 ready connectors with 12,000+ tools, among them SAP, Odoo, weclapp and Amazon Seller; 35 need no API key. + 714 ready connectors with 12,000+ tools, among them SAP, Odoo, weclapp and Amazon Seller; 35 need no API key.

@@ -129,7 +129,7 @@ Tools register at runtime, without a restart. Per-connector `{{VAR}}` values are ## Connector catalog -713 adapters, exposing 12,000+ tools. Every one has a setup guide on [anythingmcp.com/guides](https://anythingmcp.com/guides), in seven languages. The [full catalog by category](docs/catalog/README.md) lists every Cloud connector with links to its guides for Claude, ChatGPT, Copilot, Cursor and Gemini. +714 adapters, exposing 12,000+ tools. Every one has a setup guide on [anythingmcp.com/guides](https://anythingmcp.com/guides), in seven languages. The [full catalog by category](docs/catalog/README.md) lists every Cloud connector with links to its guides for Claude, ChatGPT, Copilot, Cursor and Gemini. | Category | Examples | |---|---| diff --git a/README.zh-CN.md b/README.zh-CN.md index 021d1e837..47aa234e2 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -1,5 +1,5 @@

- AnythingMCP 将 Claude、ChatGPT、Copilot 和 Gemini 连接到 ERP、电子商务、REST、SOAP 和 SQL 系统以及你的文件服务器:713 个连接器,还有企业记忆、技能和文件搜索。 + AnythingMCP 将 Claude、ChatGPT、Copilot 和 Gemini 连接到 ERP、电子商务、REST、SOAP 和 SQL 系统以及你的文件服务器:714 个连接器,还有企业记忆、技能和文件搜索。

AnythingMCP:成为你企业大脑的开源 MCP 网关

@@ -20,7 +20,7 @@

AnythingMCP 是一个开源、可自行托管的 MCP 网关,无需编写 MCP 服务器,即可将 Claude、ChatGPT、Copilot 和 Gemini 连接到你公司运行的软件以及文件服务器上的文档。
在网关之上,它还为你维护企业大脑:一张描述各系统如何关联的知识图谱、AI 技能和企业记忆,由所有 AI 客户端共享,并按每个用户的角色限制访问。
- 713 个现成连接器,提供 12,000 多个工具,涵盖 SAP、Odoo、weclapp 和 Amazon Seller 等;其中 35 个无需 API 密钥。 + 714 个现成连接器,提供 12,000 多个工具,涵盖 SAP、Odoo、weclapp 和 Amazon Seller 等;其中 35 个无需 API 密钥。

@@ -139,7 +139,7 @@ docker compose up -d ## 连接器目录 -共 713 个适配器,提供 12,000 多个工具。每个适配器都在 [anythingmcp.com/zh/guides](https://anythingmcp.com/zh/guides) 上提供七种语言的配置指南。 +共 714 个适配器,提供 12,000 多个工具。每个适配器都在 [anythingmcp.com/zh/guides](https://anythingmcp.com/zh/guides) 上提供七种语言的配置指南。 | 类别 | 示例 | |---|---| diff --git a/docs/connectors/login-token-auth.md b/docs/connectors/login-token-auth.md index 8d25acf06..da5283f25 100644 --- a/docs/connectors/login-token-auth.md +++ b/docs/connectors/login-token-auth.md @@ -113,7 +113,7 @@ The token cache is keyed by `connectorId` (when available) or by `loginUrl|usern }, // ─── Where to find the token & expiry in the login response ──── - "tokenJsonPath": "data.signIn.jwtToken.token", + "tokenJsonPath": "data.signIn.jwtToken.token", // or a list, see below "expiryJsonPath": "data.signIn.jwtToken.expiredAt", "audJsonPath": "data.signIn.jwtToken.aud", // optional — overrides authConfig.aud "expiryFormat": "iso8601", // iso8601 | unix | ttl_seconds @@ -137,6 +137,19 @@ The token cache is keyed by `connectorId` (when available) or by `loginUrl|usern } ``` +### Several candidate token paths + +When the vendor does not document the login answer, `tokenJsonPath` can be a +list of paths, tried in order; the first that holds a non-empty string is the +token. `"."` takes the whole body, for a login that answers with a bare +string. A login that finds none fails with every path named (or with the +service's own refusal message, when the body carries one). A single string +works as before. + +```json +"tokenJsonPath": ["AuthenticationResult.IdToken", "IdToken", "idToken", "data.idToken", "token", "."] +``` + ### Placeholders available in templates The placeholders below are substituted by the engine when rendering `loginBody` / `loginBodyTemplate` and the salt-source URL: diff --git a/docs/tool-definition.md b/docs/tool-definition.md index 8e947390a..d5fefed34 100644 --- a/docs/tool-definition.md +++ b/docs/tool-definition.md @@ -1245,6 +1245,8 @@ The engine handles salt fetch → bcrypt → login → token cache → proactive A login that takes HTTP Basic credentials (Wazuh's `POST /security/user/authenticate`) sets `"loginBasicAuth": true`: the engine sends `Authorization: Basic base64(username:password)` on the login request only (the API calls keep using `headerTemplate`), the password is never offered to the body templates (`${password}` renders empty), and no body is sent without a `loginBody`. An `Authorization` in `loginHeaders` is refused rather than overridden, as are `signedJwt`, bcrypt `passwordHashing` and a username containing `:`; `scripts/validate-adapters.mjs` reports the same mistakes (rule `login-basic-auth`). +When the login answer is not documented, `tokenJsonPath` may be a list of paths tried in order (the first non-empty string wins), e.g. `["AuthenticationResult.IdToken", "idToken", "token", "."]`. + See [`docs/connectors/login-token-auth.md`](connectors/login-token-auth.md) for the full field-by-field reference, salt-source types (`fetch` vs `static`), expiry formats (`iso8601` / `unix` / `ttl_seconds`), and re-login policies. --- diff --git a/glama.json b/glama.json index 2acf39bdf..d6b34a793 100644 --- a/glama.json +++ b/glama.json @@ -3,5 +3,5 @@ "maintainers": [ "helpcodeai" ], - "description": "Self-hosted MCP gateway and company brain for AI agents. Turn any REST/OpenAPI, SOAP/WSDL, GraphQL, OData or SQL API into MCP tools for Claude, ChatGPT and Copilot, no code: 713 pre-built adapters for ERP and e-commerce (SAP S/4HANA, SAP Business One, Odoo, Xentral, JTL-Wawi, weclapp, Shopware, WooCommerce, Amazon Seller, Kaufland, OTTO\u2026) and more. File Search over SFTP/WebDAV/S3 file servers, company memory, AI skills and a knowledge graph shared by every AI client. Per-tool response mapping, OAuth2/RBAC/SSO/SCIM, audit log. Open source under AGPL-3.0." + "description": "Self-hosted MCP gateway and company brain for AI agents. Turn any REST/OpenAPI, SOAP/WSDL, GraphQL, OData or SQL API into MCP tools for Claude, ChatGPT and Copilot, no code: 714 pre-built adapters for ERP and e-commerce (SAP S/4HANA, SAP Business One, Odoo, Xentral, JTL-Wawi, weclapp, Shopware, WooCommerce, Amazon Seller, Kaufland, OTTO\u2026) and more. File Search over SFTP/WebDAV/S3 file servers, company memory, AI skills and a knowledge graph shared by every AI client. Per-tool response mapping, OAuth2/RBAC/SSO/SCIM, audit log. Open source under AGPL-3.0." } diff --git a/llms-full.txt b/llms-full.txt index cecef0997..37d3b68d3 100644 --- a/llms-full.txt +++ b/llms-full.txt @@ -1,6 +1,6 @@ # AnythingMCP -> Turn any REST/OpenAPI, SOAP/WSDL, GraphQL, OData or SQL API into MCP tools for Claude, ChatGPT and Copilot, no code. 713 pre-built adapters for ERP, e-commerce and more (SAP S/4HANA, SAP Business One, Odoo, Xentral, JTL-Wawi, Shopware, WooCommerce, Amazon Seller). Self-hosted, open source (AGPL-3.0). +> Turn any REST/OpenAPI, SOAP/WSDL, GraphQL, OData or SQL API into MCP tools for Claude, ChatGPT and Copilot, no code. 714 pre-built adapters for ERP, e-commerce and more (SAP S/4HANA, SAP Business One, Odoo, Xentral, JTL-Wawi, Shopware, WooCommerce, Amazon Seller). Self-hosted, open source (AGPL-3.0). --- @@ -92,7 +92,7 @@ Tools register at runtime, without a restart. Per-connector `{{VAR}}` values are ## Connector catalog -713 adapters, exposing 12,000+ tools. Every one has a setup guide on [anythingmcp.com/guides](), in seven languages. The [full catalog by category]() lists every Cloud connector with links to its guides for Claude, ChatGPT, Copilot, Cursor and Gemini. +714 adapters, exposing 12,000+ tools. Every one has a setup guide on [anythingmcp.com/guides](), in seven languages. The [full catalog by category]() lists every Cloud connector with links to its guides for Claude, ChatGPT, Copilot, Cursor and Gemini. | Category | Examples | |---|---| @@ -1863,7 +1863,7 @@ The token cache is keyed by `connectorId` (when available) or by `loginUrl|usern }, // ─── Where to find the token & expiry in the login response ──── - "tokenJsonPath": "data.signIn.jwtToken.token", + "tokenJsonPath": "data.signIn.jwtToken.token", // or a list, see below "expiryJsonPath": "data.signIn.jwtToken.expiredAt", "audJsonPath": "data.signIn.jwtToken.aud", // optional — overrides authConfig.aud "expiryFormat": "iso8601", // iso8601 | unix | ttl_seconds @@ -1887,6 +1887,19 @@ The token cache is keyed by `connectorId` (when available) or by `loginUrl|usern } ``` +### Several candidate token paths + +When the vendor does not document the login answer, `tokenJsonPath` can be a +list of paths, tried in order; the first that holds a non-empty string is the +token. `"."` takes the whole body, for a login that answers with a bare +string. A login that finds none fails with every path named (or with the +service's own refusal message, when the body carries one). A single string +works as before. + +```json +"tokenJsonPath": ["AuthenticationResult.IdToken", "IdToken", "idToken", "data.idToken", "token", "."] +``` + ### Placeholders available in templates The placeholders below are substituted by the engine when rendering `loginBody` / `loginBodyTemplate` and the salt-source URL: @@ -4748,6 +4761,8 @@ The engine handles salt fetch → bcrypt → login → token cache → proactive A login that takes HTTP Basic credentials (Wazuh's `POST /security/user/authenticate`) sets `"loginBasicAuth": true`: the engine sends `Authorization: Basic base64(username:password)` on the login request only (the API calls keep using `headerTemplate`), the password is never offered to the body templates (`${password}` renders empty), and no body is sent without a `loginBody`. An `Authorization` in `loginHeaders` is refused rather than overridden, as are `signedJwt`, bcrypt `passwordHashing` and a username containing `:`; `scripts/validate-adapters.mjs` reports the same mistakes (rule `login-basic-auth`). +When the login answer is not documented, `tokenJsonPath` may be a list of paths tried in order (the first non-empty string wins), e.g. `["AuthenticationResult.IdToken", "idToken", "token", "."]`. + See [`docs/connectors/login-token-auth.md`]() for the full field-by-field reference, salt-source types (`fetch` vs `static`), expiry formats (`iso8601` / `unix` / `ttl_seconds`), and re-login policies. --- diff --git a/llms.txt b/llms.txt index 9cf195ce8..9e4041e5a 100644 --- a/llms.txt +++ b/llms.txt @@ -1,6 +1,6 @@ # AnythingMCP -> Turn any REST/OpenAPI, SOAP/WSDL, GraphQL, OData or SQL API into MCP tools for Claude, ChatGPT and Copilot, no code. 713 pre-built adapters for ERP, e-commerce and more (SAP S/4HANA, SAP Business One, Odoo, Xentral, JTL-Wawi, Shopware, WooCommerce, Amazon Seller). Self-hosted, open source (AGPL-3.0). +> Turn any REST/OpenAPI, SOAP/WSDL, GraphQL, OData or SQL API into MCP tools for Claude, ChatGPT and Copilot, no code. 714 pre-built adapters for ERP, e-commerce and more (SAP S/4HANA, SAP Business One, Odoo, Xentral, JTL-Wawi, Shopware, WooCommerce, Amazon Seller). Self-hosted, open source (AGPL-3.0). ## Getting started diff --git a/package.json b/package.json index 3f58c4f9b..b7c6c1bf2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "anythingmcp", "version": "0.52.2", - "description": "Turn any REST/OpenAPI, SOAP/WSDL, GraphQL, OData or SQL API into MCP tools for Claude, ChatGPT and Copilot, no code. 713 pre-built adapters for ERP, e-commerce and more (SAP S/4HANA, SAP Business One, Odoo, Xentral, JTL-Wawi, Shopware, WooCommerce, Amazon Seller). Self-hosted, open source (AGPL-3.0).", + "description": "Turn any REST/OpenAPI, SOAP/WSDL, GraphQL, OData or SQL API into MCP tools for Claude, ChatGPT and Copilot, no code. 714 pre-built adapters for ERP, e-commerce and more (SAP S/4HANA, SAP Business One, Odoo, Xentral, JTL-Wawi, Shopware, WooCommerce, Amazon Seller). Self-hosted, open source (AGPL-3.0).", "private": true, "license": "AGPL-3.0-only", "engines": { diff --git a/packages/backend/src/adapters/catalog.spec.ts b/packages/backend/src/adapters/catalog.spec.ts index 21c3be1d9..a61bd9407 100644 --- a/packages/backend/src/adapters/catalog.spec.ts +++ b/packages/backend/src/adapters/catalog.spec.ts @@ -389,6 +389,10 @@ describe('adapter catalog', () => { // optional. if (cfg.tokenSource === 'cookie') { if (cfg.cookieMode !== 'all') expect(typeof cfg.cookieName).toBe('string'); + } else if (Array.isArray(cfg.tokenJsonPath)) { + // Several candidate paths, tried in order (tokenJsonPaths()). + expect(cfg.tokenJsonPath.length).toBeGreaterThan(0); + for (const p of cfg.tokenJsonPath) expect(typeof p === 'string' && p.length > 0).toBe(true); } else { expect(typeof cfg.tokenJsonPath).toBe('string'); } diff --git a/packages/backend/src/adapters/catalog.ts b/packages/backend/src/adapters/catalog.ts index c4fb1444b..56e5c7972 100644 --- a/packages/backend/src/adapters/catalog.ts +++ b/packages/backend/src/adapters/catalog.ts @@ -234,6 +234,7 @@ import * as eventbrite from './intl/eventbrite.json'; import * as everhour from './intl/everhour.json'; import * as exa from './intl/exa.json'; import * as exerciseCom from './intl/exercise-com.json'; +import * as exitoMarketplace from './intl/exito-marketplace.json'; import * as facebookPages from './intl/facebook-pages.json'; import * as factorialHr from './intl/factorial-hr.json'; import * as falabellaSellerCenter from './intl/falabella-seller-center.json'; @@ -1263,6 +1264,7 @@ const RAW_ADAPTERS: AdapterDefinition[] = [ everhour as unknown as AdapterDefinition, exa as unknown as AdapterDefinition, exerciseCom as unknown as AdapterDefinition, + exitoMarketplace as unknown as AdapterDefinition, facebookPages as unknown as AdapterDefinition, factorialHr as unknown as AdapterDefinition, falabellaSellerCenter as unknown as AdapterDefinition, diff --git a/packages/backend/src/adapters/intl/exito-marketplace.json b/packages/backend/src/adapters/intl/exito-marketplace.json new file mode 100644 index 000000000..9ec38d419 --- /dev/null +++ b/packages/backend/src/adapters/intl/exito-marketplace.json @@ -0,0 +1,1496 @@ +{ + "slug": "exito-marketplace", + "name": "Grupo Éxito Marketplace", + "aliases": [ + "Éxito", + "Exito", + "Grupo Éxito", + "Éxito Marketplace", + "Exito Seller Center", + "exito.com" + ], + "description": "Let your AI run your exito.com marketplace store in Colombia through Grupo Éxito's seller API: list your products and their approval status, create products with images, descriptions and attributes, set prices and stock, and read orders and payout statements.", + "region": "intl", + "category": "e-commerce", + "icon": "exito", + "docsUrl": "https://developers.exito.com/", + "instructions": "## Grupo Éxito Marketplace\nThis connector calls the **Grupo Éxito marketplace seller API** (documented at https://developers.exito.com/) for one seller on exito.com and Éxito's other sites in Colombia: products and their approval status, categories and their specifications, offers (price and stock), orders and payout statements. The API is spread over several Amazon API Gateway addresses (`*.execute-api.us-east-1.amazonaws.com`, stage `-pdn`); the connector knows each one. **No sandbox is documented**: every call, writes included, acts on the live store.\n\n**What you need**: API access granted by Éxito. With it Éxito sends authentication instructions with a **username**, a **password**, an **API key** (`x-api-key`) and the **address that issues the token**. You also need your numeric **seller id**.\n\n**Setup**\n1. `EXITO_USERNAME` and `EXITO_PASSWORD`: the API username and password from Éxito's instructions.\n2. `EXITO_API_KEY`: the `x-api-key` from the same instructions.\n3. `EXITO_LOGIN_URL`: the full `https://` address of the token request in those instructions. It is not published on developers.exito.com, so copy it from the document Éxito sent.\n4. `EXITO_SELLER_ID`: your numeric seller id (idSeller, e.g. 11795). `exito_marketplace_get_bulk_upload_status` also shows it as `data.idSeller`.\n\n**How it signs in**: the connector sends `POST` to `EXITO_LOGIN_URL` with the header `x-api-key` and the body `{\"username\": ..., \"password\": ...}`, takes the token from the answer and sends it as `Authorization: ` (no `Bearer`; Éxito's docs call it COGNITO_TOKEN) together with `x-api-key` on every call. Tokens are renewed automatically, every hour at the latest and right away when Éxito answers 401. The password and the key are stored encrypted and never shown to the AI.\n\n**How selling on Éxito works (asynchronous)**\n1. Pick the most specific category with `exito_marketplace_list_categories` (or check one with `exito_marketplace_get_category`) and read its specifications with `exito_marketplace_get_category_features`: required ones must be sent, and a spec with a list of values only accepts those.\n2. Create the products with `exito_marketplace_create_products` (up to 400 EANs per call; images are public URLs in `ImageUrl1` to `ImageUrl5`, 1000x1000 px, 733x1000 px for Clothing). The brand must already exist at Éxito (in capitals); a missing brand is created by your Éxito account manager. `Ean` \"0\" asks Éxito to assign a barcode.\n3. Follow the batch with `exito_marketplace_get_bulk_upload_status`: status 4 starting, 1 processing, 2 completed, 3 finished with errors (`ProductNotify` lists the reasons). No new batch is accepted while it is 4 or 1.\n4. Every product is **moderated by Éxito's content team**: `exito_marketplace_get_products_waiting` lists those in review, `exito_marketplace_get_products_rejected` those rejected with `Reason` and `Comment`, `exito_marketplace_get_products_pending_seller_approval` those that differ from the same product already in the marketplace. Éxito also e-mails the result. After approval a product needs up to 1 hour of indexing before it can get an offer.\n5. Give approved products their price and stock with `exito_marketplace_upsert_offers` (several EANs, all fields on the first offer) or `exito_marketplace_update_offer_price_stock` (one EAN). `exito_marketplace_load_products_and_offers` sends products and their offers in one request. Offers reach the sites within about 4 hours (site cache) and are shared by every Éxito site where you sell.\n6. Read the result with `exito_marketplace_get_products` (price, salePrice, inventoryQuantity, bestOffer, availableToOffer).\n\n**Prices and stock**: prices are whole Colombian pesos above 8000 without separators (`45000`); a sale price (`DiscountPrice`) must be lower than `Price`. Every update carries EAN, Stock and Price; stock is only applied with `IsUpdatedStock` 1, so to change only the price send the current stock with `IsUpdatedStock` 0. A price change of more than 30% comes back with code `PEX` and is applied only when sent again with price approval: ask the user before doing that. `PromiseDelivery` is \"N a M\" (business days, or hours with `Periodicity` 2). At most one of `IsFreeShipping`, `IsEnviosExito` and `IsFreightCalculator` is 1. To stop selling a product, set its stock to 0: the API has no delete.\n\n**Orders and money**: `exito_marketplace_get_orders` (status 35 assigned, 170 sent; dates as yyyy/MM/dd) and `exito_marketplace_get_bills` (payout statements). Lists page with `paginationToken`: send `{}` first, then the token of the previous answer, until it comes back as `{}`.\n\n**Switched off at install**: `exito_marketplace_set_order_tracking` (mark products shipped) and `exito_marketplace_upload_order_invoice` (attach the invoice). Turn them on in the connector's tools when the AI should handle orders, and confirm each call.\n\n**Answers and errors**: answers are JSON with `data`, `errors` and `message` (lists use `viewModel`, `count`, `paginationToken`). Batch writes answer HTTP 200 with `totalProcess`, `error` and `successful` and one message per refused EAN: always read them, a 200 does not mean every product or offer was accepted. A non-empty `errors` list is reported as a failed call. `401 Unauthorized` means no valid token; `403 Forbidden` usually means the `x-api-key` is missing or wrong. Requests and answers are in Spanish (`culture=es-CO`).\n\n**Not covered**: shipping labels (Éxito documents them only on a development stage), the moderation and offer notifications (`notifyproduct`, `notifyoffer`: Éxito calls a service on the seller's side) and anything the Seller Center web app does that the API does not offer.", + "prerequisites": "A seller account on the Grupo Éxito marketplace with API access granted by Éxito: its authentication instructions give you the username, password, x-api-key and the token address. There is no documented sandbox: the connector works on your live store.", + "requiredEnvVars": [ + "EXITO_USERNAME", + "EXITO_PASSWORD", + "EXITO_API_KEY", + "EXITO_LOGIN_URL", + "EXITO_SELLER_ID" + ], + "envVarMeta": { + "EXITO_USERNAME": { + "label": "Usuario API (API username)", + "kind": "credential", + "help": "The API username from the authentication instructions Éxito sent with your API access." + }, + "EXITO_PASSWORD": { + "label": "Contraseña API (API password)", + "kind": "credential", + "secret": true, + "help": "The API password from the same instructions. It is only sent to the token address." + }, + "EXITO_API_KEY": { + "label": "API key (x-api-key)", + "kind": "credential", + "secret": true, + "help": "The x-api-key from Éxito's instructions. It goes in the x-api-key header of the token request and of every API call.", + "pattern": "^\\S{8,256}$", + "patternMessage": "Paste the API key alone, without spaces or quotes." + }, + "EXITO_LOGIN_URL": { + "label": "URL del token (token URL)", + "kind": "address", + "help": "The full address of the token request in Éxito's authentication instructions (the step that takes the username, password and x-api-key). It is not published on developers.exito.com.", + "link": "https://developers.exito.com/", + "pattern": "^https://[^\\s/]+\\.[^\\s]+$", + "patternMessage": "Paste the full https:// address from Éxito's instructions." + }, + "EXITO_SELLER_ID": { + "label": "ID de vendedor (seller ID)", + "kind": "setting", + "help": "Your numeric seller id at Éxito (idSeller), e.g. 11795. The bulk upload status tool also shows it as data.idSeller.", + "pattern": "^\\d{1,12}$", + "patternMessage": "The seller id is a number, e.g. 11795." + } + }, + "verifyHints": { + "auth_failed": "Éxito did not issue a token. Check EXITO_USERNAME, EXITO_PASSWORD and EXITO_API_KEY against the authentication instructions Éxito sent, and that EXITO_LOGIN_URL is the token address from that document.", + "401": "Éxito answered Unauthorized: the token was refused. Check EXITO_USERNAME and EXITO_PASSWORD, and that EXITO_LOGIN_URL is the token address from Éxito's instructions.", + "403": "Éxito answered Forbidden: the x-api-key is missing or wrong, or this API is not enabled for your user. Check EXITO_API_KEY and ask Éxito which APIs your access covers." + }, + "probe": { + "tool": "exito_marketplace_get_products", + "params": { + "limit": 1, + "page": 1 + } + }, + "connector": { + "name": "Grupo Éxito Marketplace API", + "type": "REST", + "baseUrl": "https://rbrefxe0d8.execute-api.us-east-1.amazonaws.com/External-pdn", + "authType": "LOGIN_TOKEN", + "authConfig": { + "loginUrl": "{{EXITO_LOGIN_URL}}", + "loginMethod": "POST", + "loginHeaders": { + "x-api-key": "{{EXITO_API_KEY}}", + "Content-Type": "application/json", + "Accept": "application/json" + }, + "loginBody": { + "username": "${username}", + "password": "${password}" + }, + "username": "{{EXITO_USERNAME}}", + "password": "{{EXITO_PASSWORD}}", + "tokenJsonPath": [ + "AuthenticationResult.IdToken", + "IdToken", + "idToken", + "id_token", + "data.AuthenticationResult.IdToken", + "data.IdToken", + "data.idToken", + "Data.IdToken", + "token", + "Token", + "data.token", + "Data.Token", + "AuthenticationResult.AccessToken", + "AccessToken", + "accessToken", + "access_token", + "data.accessToken", + "data.access_token", + "." + ], + "tokenTTLSeconds": 3600, + "proactiveRefreshSeconds": 300, + "refreshOn401": true, + "headerName": "Authorization", + "headerTemplate": "${token}", + "extraHeaders": { + "x-api-key": "{{EXITO_API_KEY}}" + } + }, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json" + }, + "config": { + "errorWhen": [ + { + "path": "errors[0]", + "messagePath": "errors[0].message", + "status": 400 + }, + { + "path": "Errors[0]", + "messagePath": "Errors[0].Message", + "status": 400 + } + ] + } + }, + "tools": [ + { + "name": "exito_marketplace_get_products", + "description": "List the seller's products in the Éxito marketplace with name, EAN, VTEX PLU, image, created and updated dates, price, sale price, stock (inventoryQuantity), bestOffer and availableToOffer. Answer: data.list plus data.total (all matches). Filter by EAN, seller SKU, name, parent reference, PLU, category or dates; page with page and limit. Products still in moderation or rejected are listed by exito_marketplace_get_products_waiting and exito_marketplace_get_products_rejected.", + "parameters": { + "type": "object", + "properties": { + "limit": { + "type": "integer", + "description": "Products per page, e.g. 20. Default 20.", + "minimum": 1, + "default": 20 + }, + "page": { + "type": "integer", + "description": "Page number, from 1. Default 1.", + "minimum": 1, + "default": 1 + }, + "my_products": { + "type": "boolean", + "description": "true (default) returns only your own products.", + "default": true + }, + "ean": { + "type": "string", + "description": "Only this EAN." + }, + "seller_sku": { + "type": "string", + "description": "Only this seller SKU (your own product id)." + }, + "product_name": { + "type": "string", + "description": "Filter by product name." + }, + "reference": { + "type": "string", + "description": "Filter by parent reference (variations of one clothing product)." + }, + "plu_vtex": { + "type": "string", + "description": "Filter by the VTEX PLU identifier, e.g. 100286013." + }, + "categories": { + "type": "string", + "description": "Filter by category id, e.g. 27193." + }, + "creation_date": { + "type": "string", + "description": "Only products created on this day, YYYY-MM-DD." + }, + "initial_date": { + "type": "string", + "description": "Start of a date range, YYYY-MM-DD." + }, + "final_date": { + "type": "string", + "description": "End of a date range, YYYY-MM-DD." + } + }, + "required": [ + "limit", + "page" + ] + }, + "endpointMapping": { + "method": "GET", + "path": "https://rbrefxe0d8.execute-api.us-east-1.amazonaws.com/External-pdn/products/", + "queryParams": { + "culture": "es-CO", + "limit": "$limit", + "page": "$page", + "myProducts": "$my_products", + "ean": "$ean", + "sellerSku": "$seller_sku", + "productName": "$product_name", + "reference": "$reference", + "pluVtex": "$plu_vtex", + "categories": "$categories", + "creationDate": "$creation_date", + "initialDate": "$initial_date", + "finalDate": "$final_date" + } + } + }, + { + "name": "exito_marketplace_get_products_waiting", + "description": "Products waiting for approval by Éxito's content team (moderation), with EAN, name, image, processing date and parent reference. Answer: viewModel, count and paginationToken. Use it after exito_marketplace_create_products to see what is still in review.", + "parameters": { + "type": "object", + "properties": { + "limit": { + "type": "integer", + "description": "Rows per page. Default 20.", + "minimum": 1, + "default": 20 + }, + "pagination_token": { + "type": "string", + "description": "Pagination token. Send {} (the default) on the first request; for the next page send the paginationToken the previous answer returned. An answer whose paginationToken is {} has no further page.", + "default": "{}" + }, + "current_page": { + "type": "integer", + "description": "Current page number.", + "minimum": 1 + }, + "new_limit": { + "type": "integer", + "description": "New page size when changing limit between pages.", + "minimum": 1 + }, + "ean": { + "type": "string", + "description": "Only this EAN." + }, + "name": { + "type": "string", + "description": "Filter by product name." + } + }, + "required": [ + "limit" + ] + }, + "endpointMapping": { + "method": "GET", + "path": "https://rbrefxe0d8.execute-api.us-east-1.amazonaws.com/External-pdn/productswaiting/productswaiting", + "queryParams": { + "culture": "es-CO", + "limit": "$limit", + "paginationToken": "$pagination_token", + "idSeller": "{{EXITO_SELLER_ID}}", + "currentPage": "$current_page", + "newLimit": "$new_limit", + "ean": "$ean", + "name": "$name" + } + } + }, + { + "name": "exito_marketplace_get_products_rejected", + "description": "Products Éxito's content team rejected and that must be corrected, with EAN, name, image, Reason and Comment of the rejection. Answer: viewModel, count and paginationToken. Correct the product and send it again with exito_marketplace_create_products.", + "parameters": { + "type": "object", + "properties": { + "limit": { + "type": "integer", + "description": "Rows per page. Default 20.", + "minimum": 1, + "default": 20 + }, + "pagination_token": { + "type": "string", + "description": "Pagination token. Send {} (the default) on the first request; for the next page send the paginationToken the previous answer returned. An answer whose paginationToken is {} has no further page.", + "default": "{}" + }, + "current_page": { + "type": "integer", + "description": "Current page number.", + "minimum": 1 + }, + "new_limit": { + "type": "integer", + "description": "New page size when changing limit between pages.", + "minimum": 1 + }, + "ean": { + "type": "string", + "description": "Only this EAN." + }, + "name": { + "type": "string", + "description": "Filter by product name." + } + }, + "required": [ + "limit" + ] + }, + "endpointMapping": { + "method": "GET", + "path": "https://rbrefxe0d8.execute-api.us-east-1.amazonaws.com/External-pdn/productswaiting/productsrejected", + "queryParams": { + "culture": "es-CO", + "limit": "$limit", + "paginationToken": "$pagination_token", + "idSeller": "{{EXITO_SELLER_ID}}", + "currentPage": "$current_page", + "newLimit": "$new_limit", + "ean": "$ean", + "name": "$name" + } + } + }, + { + "name": "exito_marketplace_get_products_pending_seller_approval", + "description": "Products that need your decision because they differ from the same product already in the marketplace: each row has oldProduct and currentProduct (JSON text with the differing fields), status, EAN, PLU and name. Answer: viewModel, count and paginationToken.", + "parameters": { + "type": "object", + "properties": { + "limit": { + "type": "integer", + "description": "Rows per page. Default 20.", + "minimum": 1, + "default": 20 + }, + "pagination_token": { + "type": "string", + "description": "Pagination token. Send {} (the default) on the first request; for the next page send the paginationToken the previous answer returned. An answer whose paginationToken is {} has no further page.", + "default": "{}" + }, + "current_page": { + "type": "integer", + "description": "Current page number.", + "minimum": 1 + }, + "new_limit": { + "type": "integer", + "description": "New page size when changing limit between pages.", + "minimum": 1 + }, + "ean": { + "type": "string", + "description": "Only this EAN." + }, + "name": { + "type": "string", + "description": "Filter by product name." + }, + "plu": { + "type": "string", + "description": "Filter by the VTEX PLU identifier." + } + }, + "required": [ + "limit" + ] + }, + "endpointMapping": { + "method": "GET", + "path": "https://rbrefxe0d8.execute-api.us-east-1.amazonaws.com/External-pdn/products/productspendingtoapprovebyseller", + "queryParams": { + "culture": "es-CO", + "limit": "$limit", + "paginationToken": "$pagination_token", + "currentPage": "$current_page", + "newLimit": "$new_limit", + "ean": "$ean", + "name": "$name", + "plu": "$plu" + } + } + }, + { + "name": "exito_marketplace_get_bulk_upload_status", + "description": "Status of your last product creation batch (exito_marketplace_create_products). data.status: 4 starting, 1 processing, 2 completed correctly, 3 finished with errors. While it is 4 or 1 no new batch is accepted. data.response is JSON text with TotalProcess, Error, Successful and ProductNotify (EAN, Message, ProductName per rejected product). data.idSeller is your seller id.", + "parameters": { + "type": "object", + "properties": {} + }, + "endpointMapping": { + "method": "GET", + "path": "https://akaxxado2l.execute-api.us-east-1.amazonaws.com/products-massive-pdn/status", + "queryParams": { + "culture": "es-CO" + } + } + }, + { + "name": "exito_marketplace_list_categories", + "description": "All Éxito marketplace categories with Id, IdParent, Name and ProductType (Technology or Clothing). Answer: data.categories. Use the most specific category that fits as Category when creating a product, then read its specifications with exito_marketplace_get_category_features. The list is long: search it for the product type rather than reading it all out.", + "parameters": { + "type": "object", + "properties": {} + }, + "endpointMapping": { + "method": "GET", + "path": "https://n8pu9xx2ba.execute-api.us-east-1.amazonaws.com/products-massive-pdn/categories" + } + }, + { + "name": "exito_marketplace_get_category", + "description": "One category by id: Id, IdParent, Name and ProductType. An unknown id answers 400 \"Category does not exist or invalid id\".", + "parameters": { + "type": "object", + "properties": { + "category_id": { + "type": "integer", + "description": "Category id, e.g. 50249." + } + }, + "required": [ + "category_id" + ] + }, + "endpointMapping": { + "method": "GET", + "path": "https://n8pu9xx2ba.execute-api.us-east-1.amazonaws.com/products-massive-pdn/categories/{category_id}" + } + }, + { + "name": "exito_marketplace_get_category_features", + "description": "Specification groups of a category: for each spec its specName, label, whether it is required and its allowed values (values[].label; an empty list means free text). These are the features (key/value) a product of that category takes in exito_marketplace_create_products.", + "parameters": { + "type": "object", + "properties": { + "category_id": { + "type": "integer", + "description": "Category id, e.g. 28086." + } + }, + "required": [ + "category_id" + ] + }, + "endpointMapping": { + "method": "GET", + "path": "https://9ddwtrb7mc.execute-api.us-east-1.amazonaws.com/specs-external-pdn/getbycategoryid/{category_id}", + "queryParams": { + "culture": "es-CO" + } + } + }, + { + "name": "exito_marketplace_get_orders", + "description": "Orders received through Éxito's sites (exito.com, carulla.com and others) with order number, channel, dates, status, totals, commission, delivery type, the customer's name, id, address and phone, and the products of each order (id, EAN, SKU, quantity, status, tracking, carrier). Answer: viewModel, count and paginationToken.", + "parameters": { + "type": "object", + "properties": { + "limit": { + "type": "integer", + "description": "Orders per page. Default 50.", + "minimum": 1, + "default": 50 + }, + "current_page": { + "type": "integer", + "description": "Page number; send it when you change limit between pages.", + "minimum": 1 + }, + "date_order_initial": { + "type": "string", + "description": "Earliest order date, yyyy/MM/dd, e.g. 2026/11/01." + }, + "date_order_final": { + "type": "string", + "description": "Latest order date, yyyy/MM/dd." + }, + "id_status_order": { + "type": "integer", + "description": "Order status: 35 assigned (to ship), 170 sent.", + "enum": [ + 35, + 170 + ] + }, + "order_number": { + "type": "integer", + "description": "One order number." + }, + "pagination_token": { + "type": "string", + "description": "Pagination token: leave empty on the first request, then send the paginationToken of the previous answer. {} means there is no further page." + } + }, + "required": [ + "limit" + ] + }, + "endpointMapping": { + "method": "GET", + "path": "https://cl9k3h7xr4.execute-api.us-east-1.amazonaws.com/orders-pdn/api/orders", + "queryParams": { + "culture": "es-CO", + "limit": "$limit", + "currentPage": "$current_page", + "dateOrderInitial": "$date_order_initial", + "dateOrderFinal": "$date_order_final", + "idStatusOrder": "$id_status_order", + "orderNumber": "$order_number", + "paginationToken": "$pagination_token" + } + } + }, + { + "name": "exito_marketplace_get_bills", + "description": "Payout statements (billing) of the seller: billing number, order number, payment order, concept, payment date, commission, total, IVA and the detail per product. Answer: viewModel, count and paginationToken.", + "parameters": { + "type": "object", + "properties": { + "limit": { + "type": "integer", + "description": "Rows per page. Default 50.", + "minimum": 1, + "default": 50 + }, + "pagination_token": { + "type": "string", + "description": "Pagination token. Send {} (the default) on the first request; for the next page send the paginationToken the previous answer returned. An answer whose paginationToken is {} has no further page.", + "default": "{}" + }, + "billing_number": { + "type": "string", + "description": "One billing number." + }, + "order_number": { + "type": "integer", + "description": "One order number." + }, + "payment_date_initial": { + "type": "string", + "description": "Earliest payment date, yyyy/MM/dd." + }, + "payment_date_final": { + "type": "string", + "description": "Latest payment date, yyyy/MM/dd." + } + }, + "required": [ + "limit" + ] + }, + "endpointMapping": { + "method": "GET", + "path": "https://rtox6c92tc.execute-api.us-east-1.amazonaws.com/financial-pdn/api/", + "queryParams": { + "culture": "es-CO", + "idSeller": "{{EXITO_SELLER_ID}}", + "limit": "$limit", + "paginationToken": "$pagination_token", + "billingNumber": "$billing_number", + "orderNumber": "$order_number", + "paymentDateInitial": "$payment_date_initial", + "paymentDateFinal": "$payment_date_final" + } + } + }, + { + "name": "exito_marketplace_create_products", + "description": "Create products (or change existing ones: send the same EAN again; ModifyImage \"1\" replaces the images) with title, HTML description, brand, category, dimensions, up to 5 image URLs and the category's features. At most 400 EANs per call. Every product goes to Éxito's content team for approval (moderation); it cannot be sold until approved, and it gets its offer (price and stock) through exito_marketplace_upsert_offers or exito_marketplace_update_offer_price_stock afterwards. The answer reports totalProcess, error, successful and per-EAN messages (productNotifyViewModel); then follow the batch with exito_marketplace_get_bulk_upload_status and the moderation with exito_marketplace_get_products_waiting and exito_marketplace_get_products_rejected. No new batch is accepted while the previous one is still processing.", + "parameters": { + "type": "object", + "properties": { + "products": { + "type": "array", + "description": "The products, 1 to 400. Clothing variations each have their own EAN and share ParentReference.", + "minItems": 1, + "maxItems": 400, + "items": { + "type": "object", + "description": "One product (one EAN). Field names are case-sensitive as written.", + "properties": { + "Ean": { + "type": "string", + "description": "Barcode (EAN) of the product. Send \"0\" when the product has no barcode: Éxito assigns one and communicates it after approval." + }, + "Name": { + "type": "string", + "description": "Product title, at most 60 characters: product type + brand + reference + main feature. No special characters other than accented vowels, + and -." + }, + "Category": { + "type": "string", + "description": "Id of the most specific category (from exito_marketplace_list_categories), e.g. \"27193\"." + }, + "Brand": { + "type": "string", + "description": "Brand in capitals, at most 200 characters. It must already exist at Éxito; ask your Éxito account manager to create a missing brand first." + }, + "Description": { + "type": "string", + "description": "HTML description. No scripts." + }, + "KeyWords": { + "type": "string", + "description": "Search keywords separated by commas, at most 200 characters in total." + }, + "Model": { + "type": "string", + "description": "Optional model, at most 29 characters." + }, + "Details": { + "type": "string", + "description": "Optional internal seller reference, at most 29 characters." + }, + "PackageHeight": { + "type": "string", + "description": "Height of the package in cm. Decimals with a comma, e.g. \"14,7\"." + }, + "PackageLength": { + "type": "string", + "description": "Length of the package in cm." + }, + "PackageWidth": { + "type": "string", + "description": "Width of the package in cm." + }, + "PackageWeight": { + "type": "string", + "description": "Weight of the package in kg." + }, + "SkuShippingSize": { + "type": "string", + "description": "Relative size from \"1\" (very small) to \"5\" (extra large)." + }, + "ProductHeight": { + "type": "string", + "description": "Height of the product without packaging, in cm." + }, + "ProductLength": { + "type": "string", + "description": "Length of the product without packaging, in cm." + }, + "ProductWidth": { + "type": "string", + "description": "Width of the product without packaging, in cm." + }, + "ProductWeight": { + "type": "string", + "description": "Weight of the product without packaging, in kg." + }, + "Seller": { + "type": "string", + "description": "Always \"Marketplace\"." + }, + "ProductType": { + "type": "string", + "description": "\"Technology\" for products without size variations, \"Clothing\" for products with size and colour variations (fashion and accessories).", + "enum": [ + "Technology", + "Clothing" + ] + }, + "ImageUrl1": { + "type": "string", + "description": "Public URL of the main image (.jpg recommended): 1000x1000 px, 733x1000 px for Clothing." + }, + "ImageUrl2": { + "type": "string", + "description": "Optional second image URL, same format." + }, + "ImageUrl3": { + "type": "string", + "description": "Optional third image URL." + }, + "ImageUrl4": { + "type": "string", + "description": "Optional fourth image URL." + }, + "ImageUrl5": { + "type": "string", + "description": "Optional fifth image URL." + }, + "ModifyImage": { + "type": "string", + "description": "\"1\" when this request replaces the images of an existing product, otherwise \"0\" or null." + }, + "IsLogisticsExito": { + "type": "string", + "description": "\"1\" when the product is fulfilled by Éxito (Fulfillment), otherwise \"0\"." + }, + "MeasurementUnit": { + "type": "string", + "description": "Unit for the price per unit: Gramo, Mililitro, Metro or Unidad.", + "enum": [ + "Gramo", + "Mililitro", + "Metro", + "Unidad" + ] + }, + "ConversionFactor": { + "type": "string", + "description": "Amount of MeasurementUnit in the product, a positive number with at most 2 decimals (e.g. \"300\" for a 300 ml perfume, \"2\" for a set of two units)." + }, + "DrainedFactor": { + "type": "string", + "description": "Optional drained factor; null when it does not apply." + }, + "EanCombo": { + "type": "string", + "description": "Only for a combo: the EANs of the combined products, separated by commas. Otherwise null." + }, + "MetaTitle": { + "type": "string", + "description": "Optional SEO title." + }, + "MetaDescription": { + "type": "string", + "description": "Optional SEO description." + }, + "SellerSku": { + "type": "string", + "description": "Optional: your own product id. Éxito's moderation notifications refer to it." + }, + "features": { + "type": "array", + "description": "Specifications of the category, from exito_marketplace_get_category_features: [{\"key\": \"\", \"value\": \"\"}]. Mandatory ones must be present; a list of allowed values means the value must be one of them.", + "items": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "key", + "value" + ] + } + }, + "ParentReference": { + "type": "string", + "description": "Clothing only: the same parent reference for every size and colour of one product, e.g. \"BlusaPolo\"." + }, + "SonReference": { + "type": "string", + "description": "Clothing only: the reference of this variation." + }, + "Size": { + "type": "string", + "description": "Clothing only: size, from Éxito's size list (e.g. S, M, L)." + }, + "Color": { + "type": "string", + "description": "Clothing only: Beige, Negro, Blanco, Azul, Amarillo, Cafe, Gris, Verde, Naranja, Rosa, Morado, Rojo, Plata, Dorado or MultiColor." + }, + "HexColourName": { + "type": "string", + "description": "Clothing only: specific colour name, e.g. \"Verde Menta\"." + } + }, + "required": [ + "Ean", + "Name", + "Category", + "Brand", + "Description", + "KeyWords", + "PackageHeight", + "PackageLength", + "PackageWidth", + "PackageWeight", + "SkuShippingSize", + "ProductHeight", + "ProductLength", + "ProductWidth", + "ProductWeight", + "Seller", + "ProductType", + "ImageUrl1", + "IsLogisticsExito", + "MeasurementUnit", + "ConversionFactor" + ] + } + } + }, + "required": [ + "products" + ] + }, + "endpointMapping": { + "method": "POST", + "path": "https://akaxxado2l.execute-api.us-east-1.amazonaws.com/products-massive-pdn/", + "queryParams": { + "culture": "es-CO" + }, + "bodyMapping": { + "__raw": "$products" + } + } + }, + { + "name": "exito_marketplace_load_products_and_offers", + "description": "Send products together with their offers in one request: each item has a Product (the fields of exito_marketplace_create_products) and an Offer (the fields of exito_marketplace_upsert_offers). Éxito routes the product to moderation and the offer to the offer flow; the answer only says the batch is being processed. Follow up with exito_marketplace_get_products_waiting, exito_marketplace_get_products_rejected and exito_marketplace_get_products.", + "parameters": { + "type": "object", + "properties": { + "price_approval": { + "type": "boolean", + "description": "true confirms price changes of more than 30% (see exito_marketplace_upsert_offers). Default false.", + "default": false + }, + "items": { + "type": "array", + "description": "Pairs of product and offer.", + "minItems": 1, + "items": { + "type": "object", + "properties": { + "Product": { + "type": "object", + "description": "One product (one EAN). Field names are case-sensitive as written.", + "properties": { + "Ean": { + "type": "string", + "description": "Barcode (EAN) of the product. Send \"0\" when the product has no barcode: Éxito assigns one and communicates it after approval." + }, + "Name": { + "type": "string", + "description": "Product title, at most 60 characters: product type + brand + reference + main feature. No special characters other than accented vowels, + and -." + }, + "Category": { + "type": "string", + "description": "Id of the most specific category (from exito_marketplace_list_categories), e.g. \"27193\"." + }, + "Brand": { + "type": "string", + "description": "Brand in capitals, at most 200 characters. It must already exist at Éxito; ask your Éxito account manager to create a missing brand first." + }, + "Description": { + "type": "string", + "description": "HTML description. No scripts." + }, + "KeyWords": { + "type": "string", + "description": "Search keywords separated by commas, at most 200 characters in total." + }, + "Model": { + "type": "string", + "description": "Optional model, at most 29 characters." + }, + "Details": { + "type": "string", + "description": "Optional internal seller reference, at most 29 characters." + }, + "PackageHeight": { + "type": "string", + "description": "Height of the package in cm. Decimals with a comma, e.g. \"14,7\"." + }, + "PackageLength": { + "type": "string", + "description": "Length of the package in cm." + }, + "PackageWidth": { + "type": "string", + "description": "Width of the package in cm." + }, + "PackageWeight": { + "type": "string", + "description": "Weight of the package in kg." + }, + "SkuShippingSize": { + "type": "string", + "description": "Relative size from \"1\" (very small) to \"5\" (extra large)." + }, + "ProductHeight": { + "type": "string", + "description": "Height of the product without packaging, in cm." + }, + "ProductLength": { + "type": "string", + "description": "Length of the product without packaging, in cm." + }, + "ProductWidth": { + "type": "string", + "description": "Width of the product without packaging, in cm." + }, + "ProductWeight": { + "type": "string", + "description": "Weight of the product without packaging, in kg." + }, + "Seller": { + "type": "string", + "description": "Always \"Marketplace\"." + }, + "ProductType": { + "type": "string", + "description": "\"Technology\" for products without size variations, \"Clothing\" for products with size and colour variations (fashion and accessories).", + "enum": [ + "Technology", + "Clothing" + ] + }, + "ImageUrl1": { + "type": "string", + "description": "Public URL of the main image (.jpg recommended): 1000x1000 px, 733x1000 px for Clothing." + }, + "ImageUrl2": { + "type": "string", + "description": "Optional second image URL, same format." + }, + "ImageUrl3": { + "type": "string", + "description": "Optional third image URL." + }, + "ImageUrl4": { + "type": "string", + "description": "Optional fourth image URL." + }, + "ImageUrl5": { + "type": "string", + "description": "Optional fifth image URL." + }, + "ModifyImage": { + "type": "string", + "description": "\"1\" when this request replaces the images of an existing product, otherwise \"0\" or null." + }, + "IsLogisticsExito": { + "type": "string", + "description": "\"1\" when the product is fulfilled by Éxito (Fulfillment), otherwise \"0\"." + }, + "MeasurementUnit": { + "type": "string", + "description": "Unit for the price per unit: Gramo, Mililitro, Metro or Unidad.", + "enum": [ + "Gramo", + "Mililitro", + "Metro", + "Unidad" + ] + }, + "ConversionFactor": { + "type": "string", + "description": "Amount of MeasurementUnit in the product, a positive number with at most 2 decimals (e.g. \"300\" for a 300 ml perfume, \"2\" for a set of two units)." + }, + "DrainedFactor": { + "type": "string", + "description": "Optional drained factor; null when it does not apply." + }, + "EanCombo": { + "type": "string", + "description": "Only for a combo: the EANs of the combined products, separated by commas. Otherwise null." + }, + "MetaTitle": { + "type": "string", + "description": "Optional SEO title." + }, + "MetaDescription": { + "type": "string", + "description": "Optional SEO description." + }, + "SellerSku": { + "type": "string", + "description": "Optional: your own product id. Éxito's moderation notifications refer to it." + }, + "features": { + "type": "array", + "description": "Specifications of the category, from exito_marketplace_get_category_features: [{\"key\": \"\", \"value\": \"\"}]. Mandatory ones must be present; a list of allowed values means the value must be one of them.", + "items": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "key", + "value" + ] + } + }, + "ParentReference": { + "type": "string", + "description": "Clothing only: the same parent reference for every size and colour of one product, e.g. \"BlusaPolo\"." + }, + "SonReference": { + "type": "string", + "description": "Clothing only: the reference of this variation." + }, + "Size": { + "type": "string", + "description": "Clothing only: size, from Éxito's size list (e.g. S, M, L)." + }, + "Color": { + "type": "string", + "description": "Clothing only: Beige, Negro, Blanco, Azul, Amarillo, Cafe, Gris, Verde, Naranja, Rosa, Morado, Rojo, Plata, Dorado or MultiColor." + }, + "HexColourName": { + "type": "string", + "description": "Clothing only: specific colour name, e.g. \"Verde Menta\"." + } + }, + "required": [ + "Ean", + "Name", + "Category", + "Brand", + "Description", + "KeyWords", + "PackageHeight", + "PackageLength", + "PackageWidth", + "PackageWeight", + "SkuShippingSize", + "ProductHeight", + "ProductLength", + "ProductWidth", + "ProductWeight", + "Seller", + "ProductType", + "ImageUrl1", + "IsLogisticsExito", + "MeasurementUnit", + "ConversionFactor" + ] + }, + "Offer": { + "type": "object", + "description": "One offer (price and stock) for an EAN that already exists at Éxito.", + "properties": { + "EAN": { + "type": "string", + "description": "EAN of an approved product." + }, + "Stock": { + "type": "string", + "description": "Units available, a whole number, e.g. \"20\". Applied only when IsUpdatedStock is 1." + }, + "Price": { + "type": "string", + "description": "Full price in Colombian pesos, whole number above 8000, no separators, e.g. \"45000\"." + }, + "DiscountPrice": { + "type": "string", + "description": "Optional sale price, above 8000 and lower than Price." + }, + "AverageFreightCost": { + "type": "string", + "description": "Average shipping cost in pesos. Required the first time an EAN is offered." + }, + "PromiseDelivery": { + "type": "string", + "description": "Delivery promise as \"N a M\" with N < M, e.g. \"2 a 5\". Required the first time." + }, + "Periodicity": { + "type": "integer", + "description": "Unit of PromiseDelivery: 1 business days (default), 2 hours.", + "enum": [ + 1, + 2 + ] + }, + "Warranty": { + "type": "integer", + "description": "Warranty in months. Required the first time." + }, + "IsFreeShipping": { + "type": "integer", + "description": "1 free shipping, 0 not. At most one of IsFreeShipping, IsEnviosExito and IsFreightCalculator may be 1.", + "enum": [ + 0, + 1 + ] + }, + "IsEnviosExito": { + "type": "integer", + "description": "1 when shipping is quoted through Envíos Éxito, else 0.", + "enum": [ + 0, + 1 + ] + }, + "IsFreightCalculator": { + "type": "integer", + "description": "1 when shipping is quoted by Éxito's freight calculator, else 0.", + "enum": [ + 0, + 1 + ] + }, + "IsLogisticsExito": { + "type": "integer", + "description": "1 when fulfilled by Éxito, else 0.", + "enum": [ + 0, + 1 + ] + }, + "IsUpdatedStock": { + "type": "integer", + "description": "1 to apply Stock, 0 to leave the current stock unchanged.", + "enum": [ + 0, + 1 + ] + }, + "Currency": { + "type": "string", + "description": "\"COP\"." + }, + "SellerSku": { + "type": "string", + "description": "Optional: your own product id." + }, + "DaneCode": { + "type": "string", + "description": "Optional DANE code of the dispatch city, e.g. \"08001000\"." + }, + "Address": { + "type": "string", + "description": "Optional dispatch address." + }, + "EanCombo": { + "type": "string", + "description": "Combo component lines only: the EAN of the combo this line belongs to." + }, + "ComboQuantity": { + "type": "string", + "description": "Combo component lines only: units of this EAN in the combo." + } + }, + "required": [ + "EAN", + "Stock", + "Price" + ] + } + }, + "required": [ + "Product", + "Offer" + ] + } + } + }, + "required": [ + "items" + ] + }, + "endpointMapping": { + "method": "POST", + "path": "https://rbrefxe0d8.execute-api.us-east-1.amazonaws.com/External-pdn/productsandoffers", + "queryParams": { + "culture": "es-CO" + }, + "bodyMapping": { + "PriceApproval": "$price_approval", + "ProductsAndOffers": "$items" + } + } + }, + { + "name": "exito_marketplace_upsert_offers", + "description": "Create or update offers (price, sale price, stock, shipping and delivery promise) for EANs that Éxito already approved, in all Éxito sites where you sell. When creating an offer every field is needed; when updating, EAN, Stock and Price are enough, and stock changes only with IsUpdatedStock 1. A price change of more than 30% is refused with code PEX unless price_approval is 1: confirm with the user first. The answer reports totalProcess, error, successful and per-EAN messages (offerNotifyViewModels); successful offers reach the sites within about 4 hours (site cache).", + "parameters": { + "type": "object", + "properties": { + "price_approval": { + "type": "integer", + "description": "1 confirms price changes of more than 30%. Default 0.", + "enum": [ + 0, + 1 + ], + "default": 0 + }, + "offers": { + "type": "array", + "description": "The offers, one per EAN.", + "minItems": 1, + "items": { + "type": "object", + "description": "One offer (price and stock) for an EAN that already exists at Éxito.", + "properties": { + "EAN": { + "type": "string", + "description": "EAN of an approved product." + }, + "Stock": { + "type": "string", + "description": "Units available, a whole number, e.g. \"20\". Applied only when IsUpdatedStock is 1." + }, + "Price": { + "type": "string", + "description": "Full price in Colombian pesos, whole number above 8000, no separators, e.g. \"45000\"." + }, + "DiscountPrice": { + "type": "string", + "description": "Optional sale price, above 8000 and lower than Price." + }, + "AverageFreightCost": { + "type": "string", + "description": "Average shipping cost in pesos. Required the first time an EAN is offered." + }, + "PromiseDelivery": { + "type": "string", + "description": "Delivery promise as \"N a M\" with N < M, e.g. \"2 a 5\". Required the first time." + }, + "Periodicity": { + "type": "integer", + "description": "Unit of PromiseDelivery: 1 business days (default), 2 hours.", + "enum": [ + 1, + 2 + ] + }, + "Warranty": { + "type": "integer", + "description": "Warranty in months. Required the first time." + }, + "IsFreeShipping": { + "type": "integer", + "description": "1 free shipping, 0 not. At most one of IsFreeShipping, IsEnviosExito and IsFreightCalculator may be 1.", + "enum": [ + 0, + 1 + ] + }, + "IsEnviosExito": { + "type": "integer", + "description": "1 when shipping is quoted through Envíos Éxito, else 0.", + "enum": [ + 0, + 1 + ] + }, + "IsFreightCalculator": { + "type": "integer", + "description": "1 when shipping is quoted by Éxito's freight calculator, else 0.", + "enum": [ + 0, + 1 + ] + }, + "IsLogisticsExito": { + "type": "integer", + "description": "1 when fulfilled by Éxito, else 0.", + "enum": [ + 0, + 1 + ] + }, + "IsUpdatedStock": { + "type": "integer", + "description": "1 to apply Stock, 0 to leave the current stock unchanged.", + "enum": [ + 0, + 1 + ] + }, + "Currency": { + "type": "string", + "description": "\"COP\"." + }, + "SellerSku": { + "type": "string", + "description": "Optional: your own product id." + }, + "DaneCode": { + "type": "string", + "description": "Optional DANE code of the dispatch city, e.g. \"08001000\"." + }, + "Address": { + "type": "string", + "description": "Optional dispatch address." + }, + "EanCombo": { + "type": "string", + "description": "Combo component lines only: the EAN of the combo this line belongs to." + }, + "ComboQuantity": { + "type": "string", + "description": "Combo component lines only: units of this EAN in the combo." + } + }, + "required": [ + "EAN", + "Stock", + "Price" + ] + } + } + }, + "required": [ + "offers" + ] + }, + "endpointMapping": { + "method": "PATCH", + "path": "https://af2jnwlpmg.execute-api.us-east-1.amazonaws.com/OfferExternal-pdn", + "queryParams": { + "culture": "es-CO" + }, + "bodyMapping": { + "PriceApproval": "$price_approval", + "ListOffers": "$offers" + } + } + }, + { + "name": "exito_marketplace_update_offer_price_stock", + "description": "Change the price and/or stock of one existing offer (one EAN). Éxito needs EAN, Stock and Price on every update: to change only the price, pass the current stock (inventoryQuantity from exito_marketplace_get_products) with update_stock 0; to change only the stock, pass the current price. A price change of more than 30% is refused with code PEX unless price_approval is 1: confirm with the user first. Check offerNotifyViewModels in the answer for a per-EAN error.", + "parameters": { + "type": "object", + "properties": { + "ean": { + "type": "string", + "description": "EAN of the offer." + }, + "price": { + "type": "string", + "description": "Full price in Colombian pesos, whole number above 8000, no separators, e.g. \"45000\"." + }, + "stock": { + "type": "integer", + "description": "Units available. Applied only when update_stock is 1.", + "minimum": 0 + }, + "discount_price": { + "type": "string", + "description": "Optional sale price, above 8000 and lower than price." + }, + "update_stock": { + "type": "integer", + "description": "1 (default) applies stock, 0 leaves the current stock unchanged.", + "enum": [ + 0, + 1 + ], + "default": 1 + }, + "price_approval": { + "type": "integer", + "description": "1 confirms a price change of more than 30%. Default 0.", + "enum": [ + 0, + 1 + ], + "default": 0 + }, + "seller_sku": { + "type": "string", + "description": "Optional: your own product id." + } + }, + "required": [ + "ean", + "price", + "stock" + ] + }, + "endpointMapping": { + "method": "PATCH", + "path": "https://af2jnwlpmg.execute-api.us-east-1.amazonaws.com/OfferExternal-pdn", + "queryParams": { + "culture": "es-CO" + }, + "bodyMapping": { + "PriceApproval": "$price_approval", + "ListOffers": [ + { + "EAN": "$ean", + "Stock": "$stock", + "Price": "$price", + "DiscountPrice": "$discount_price", + "IsUpdatedStock": "$update_stock", + "SellerSku": "$seller_sku" + } + ] + } + } + }, + { + "name": "exito_marketplace_set_order_tracking", + "description": "Mark products of an order as shipped with the carrier and tracking number (orders with standard delivery). The products must be in status 35 (assigned); take their ids from products[].id in exito_marketplace_get_orders. Answer: status, products (per product result), errors, updates and total. Switched off at install: turn it on when the AI should ship orders, and confirm each call.", + "enabled": false, + "parameters": { + "type": "object", + "properties": { + "order_id": { + "type": "string", + "description": "Order id (the id field of the order, not orderNumber), e.g. 637040012650663267." + }, + "tracking": { + "type": "string", + "description": "Tracking number from the carrier." + }, + "carrier": { + "type": "string", + "description": "Shipping company." + }, + "products": { + "type": "array", + "description": "Product ids (products[].id) of this order to mark as sent.", + "minItems": 1, + "items": { + "type": "string" + } + } + }, + "required": [ + "order_id", + "tracking", + "carrier", + "products" + ] + }, + "endpointMapping": { + "method": "PATCH", + "path": "https://cl9k3h7xr4.execute-api.us-east-1.amazonaws.com/orders-pdn/api/orders/{order_id}/tracking", + "encodePathParams": true, + "queryParams": { + "culture": "es-CO" + }, + "bodyMapping": { + "tracking": "$tracking", + "carrier": "$carrier", + "products": "$products" + } + } + }, + { + "name": "exito_marketplace_upload_order_invoice", + "description": "Attach the invoice of an order as a base64 PDF or ZIP. An order takes one invoice; a second one is refused (\"This order already has an attached invoice\"). Switched off at install: turn it on when the AI should upload invoices, and confirm each call.", + "enabled": false, + "parameters": { + "type": "object", + "properties": { + "order_id": { + "type": "string", + "description": "Order id (the id field of the order)." + }, + "base64_file": { + "type": "string", + "description": "The file content in base64." + }, + "file_type": { + "type": "integer", + "description": "1 PDF, 2 ZIP.", + "enum": [ + 1, + 2 + ] + } + }, + "required": [ + "order_id", + "base64_file", + "file_type" + ] + }, + "endpointMapping": { + "method": "PATCH", + "path": "https://cl9k3h7xr4.execute-api.us-east-1.amazonaws.com/orders-pdn/api/orders/bill", + "queryParams": { + "culture": "es-CO" + }, + "bodyMapping": { + "IdOrder": "$order_id", + "Base64File": "$base64_file", + "FileType": "$file_type" + } + } + } + ] +} diff --git a/packages/backend/src/adapters/intl/exito-marketplace.live.spec.ts b/packages/backend/src/adapters/intl/exito-marketplace.live.spec.ts new file mode 100644 index 000000000..71c112147 --- /dev/null +++ b/packages/backend/src/adapters/intl/exito-marketplace.live.spec.ts @@ -0,0 +1,465 @@ +import axios, { AxiosError } from 'axios'; +import * as adapter from './exito-marketplace.json'; +import { RestEngine } from '../../connectors/engines/rest.engine'; +import { OAuth2TokenService } from '../../connectors/engines/oauth2-token.service'; +import { LoginTokenService } from '../../connectors/engines/login-token.service'; +import { + assertNoResponseBodyError, + describeErrorWhenProblems, + ResponseBodyError, +} from '../../connectors/engines/response-error.util'; +import { applySchemaDefaults } from '../../common/schema-defaults.util'; +import { interpolateConnectorConfig, interpolateDeep } from '../../common/env-interpolation.util'; +import { deriveToolAnnotations } from '../../mcp-server/tool-annotations'; + +/** + * Grupo Éxito marketplace seller API (developers.exito.com, read Nov 2026). + * + * 1. Static: always runs. Every tool goes through the real RestEngine and + * LoginTokenService with axios mocked: the token request (x-api-key + * header, username and password in the body), the token sent bare as + * `Authorization` (the docs write COGNITO_TOKEN) with `x-api-key` on every + * call, a new login after a 401, each documented API Gateway address and + * query, and the request bodies. Éxito does not publish the token + * request, so its address is the connector variable EXITO_LOGIN_URL and + * the token is looked up at several usual paths. + * + * 2. Live: skipped unless RUN_EXITO_LIVE=1 (or RUN_EXITO_MARKETPLACE_LIVE=1) + * and EXITO_LOGIN_URL, EXITO_USERNAME, EXITO_PASSWORD, EXITO_API_KEY and + * EXITO_SELLER_ID are set. Reads only (one product, the batch status, the + * moderation queue). There is no documented sandbox, so nothing is + * ever written. + * + * RUN_EXITO_LIVE=1 EXITO_LOGIN_URL=... EXITO_USERNAME=... EXITO_PASSWORD=... \ + * EXITO_API_KEY=... EXITO_SELLER_ID=... npx jest src/adapters/intl/exito-marketplace + */ + +jest.mock('axios', () => { + const actual = jest.requireActual('axios'); + return { __esModule: true, default: jest.fn(), AxiosError: actual.AxiosError }; +}); +const mockedAxios = axios as unknown as jest.Mock; + +type Tool = { + name: string; + description: string; + enabled?: boolean; + parameters: { properties?: Record; required?: string[] }; + endpointMapping: { + method: string; + path: string; + queryParams?: Record; + bodyMapping?: Record; + }; + annotations?: Record; +}; +const a = adapter as unknown as { + slug: string; + region: string; + category: string; + icon: string; + docsUrl: string; + instructions: string; + requiredEnvVars: string[]; + envVarMeta: Record; + probe: { tool: string; params?: Record }; + connector: { + baseUrl: string; + authType: string; + authConfig: Record; + headers: Record; + config: { errorWhen: unknown }; + }; + tools: Tool[]; +}; +const tool = (name: string) => { + const t = a.tools.find((x) => x.name === name); + if (!t) throw new Error(`missing tool ${name}`); + return t; +}; + +const R = 'https://rbrefxe0d8.execute-api.us-east-1.amazonaws.com/External-pdn'; +const A = 'https://akaxxado2l.execute-api.us-east-1.amazonaws.com/products-massive-pdn'; +const O = 'https://af2jnwlpmg.execute-api.us-east-1.amazonaws.com/OfferExternal-pdn'; +const C = 'https://cl9k3h7xr4.execute-api.us-east-1.amazonaws.com/orders-pdn/api/orders'; +const F = 'https://rtox6c92tc.execute-api.us-east-1.amazonaws.com/financial-pdn/api/'; +const N = 'https://n8pu9xx2ba.execute-api.us-east-1.amazonaws.com/products-massive-pdn/categories'; +const S = 'https://9ddwtrb7mc.execute-api.us-east-1.amazonaws.com/specs-external-pdn/getbycategoryid'; + +const P = 'exito_marketplace_'; +// The documented address of each tool, its HTTP method and whether it installs switched on. +const ROUTES: Record = { + get_products: ['GET', `${R}/products/`, true], + get_products_waiting: ['GET', `${R}/productswaiting/productswaiting`, true], + get_products_rejected: ['GET', `${R}/productswaiting/productsrejected`, true], + get_products_pending_seller_approval: ['GET', `${R}/products/productspendingtoapprovebyseller`, true], + get_bulk_upload_status: ['GET', `${A}/status`, true], + list_categories: ['GET', N, true], + get_category: ['GET', `${N}/{category_id}`, true], + get_category_features: ['GET', `${S}/{category_id}`, true], + get_orders: ['GET', C, true], + get_bills: ['GET', F, true], + create_products: ['POST', `${A}/`, true], + load_products_and_offers: ['POST', `${R}/productsandoffers`, true], + upsert_offers: ['PATCH', O, true], + update_offer_price_stock: ['PATCH', O, true], + set_order_tracking: ['PATCH', `${C}/{order_id}/tracking`, false], + upload_order_invoice: ['PATCH', `${C}/bill`, false], +}; + +// Built at run time so no literal here looks like a real secret. +const API_KEY = ['exi', 'test', 'key', '0000', '1111'].join(''); +const PASSWORD = ['pass', 'word', '-', 'test'].join(''); +const LOGIN_URL = 'https://abcdefghij.execute-api.us-east-1.amazonaws.com/auth-test/token'; +const ENV = { + EXITO_LOGIN_URL: LOGIN_URL, + EXITO_USERNAME: 'integraciones@tienda.example', + EXITO_PASSWORD: PASSWORD, + EXITO_API_KEY: API_KEY, + EXITO_SELLER_ID: '11795', +}; + +let tokens: string[]; +let apiCalls: Array>; +let loginCalls: Array>; +let rejectNextApiCall: boolean; +let apiAnswer: unknown; + +const fakeAxios = async (cfg: Record) => { + if (cfg.url === LOGIN_URL) { + loginCalls.push(cfg); + return { status: 200, data: { AuthenticationResult: { IdToken: tokens.shift(), ExpiresIn: 3600 } }, headers: {} }; + } + apiCalls.push({ ...cfg, headers: { ...cfg.headers } }); + if (rejectNextApiCall) { + rejectNextApiCall = false; + const response = { status: 401, statusText: 'Unauthorized', data: { message: 'Unauthorized' }, headers: {}, config: cfg }; + throw new AxiosError('Request failed with status code 401', 'ERR_BAD_REQUEST', cfg as never, null, response as never); + } + return { status: 200, data: apiAnswer, headers: {} }; +}; + +const newEngine = () => { + const prisma = { connectorAuthCache: { findUnique: jest.fn().mockResolvedValue(null), upsert: jest.fn() } }; + const config = { get: jest.fn().mockReturnValue('test-encryption-key-32-chars-ok!') }; + return new RestEngine({} as OAuth2TokenService, new LoginTokenService(prisma as never, config as never)); +}; +let engine: RestEngine; + +// Mirrors DynamicMcpTools: {{VAR}} interpolated in the address, the mapping and authConfig. +const execute = (name: string, params: Record) => { + const { config, endpointMapping } = interpolateConnectorConfig( + { baseUrl: a.connector.baseUrl, headers: a.connector.headers }, + tool(name).endpointMapping, + ENV, + ); + return engine.execute( + { + baseUrl: config.baseUrl, + authType: a.connector.authType, + authConfig: interpolateDeep(a.connector.authConfig, ENV), + headers: config.headers, + errorWhen: a.connector.config.errorWhen, + } as never, + endpointMapping as never, + applySchemaDefaults(tool(name).parameters, params), + ) as Promise; +}; +const sent = () => apiCalls[apiCalls.length - 1]; +const header = (cfg: { headers?: Record }, name: string) => + Object.entries(cfg.headers ?? {}).find(([k]) => k.toLowerCase() === name.toLowerCase())?.[1]; +const annotationsOf = (t: Tool) => + deriveToolAnnotations({ name: t.name, connectorType: 'REST', endpointMapping: t.endpointMapping, annotations: t.annotations } as never); + +describe('exito-marketplace adapter: static spec conformance', () => { + beforeEach(() => { + tokens = ['id-token-1', 'id-token-2', 'id-token-3']; + apiCalls = []; + loginCalls = []; + rejectNextApiCall = false; + apiAnswer = { errors: [], data: { list: [], total: 0 }, message: 'Operación realizada con éxito.' }; + mockedAxios.mockReset(); + mockedAxios.mockImplementation(fakeAxios); + engine = newEngine(); + }); + + it('is listed in e-commerce with the Éxito icon, five variables and a light read probe', () => { + expect(a.slug).toBe('exito-marketplace'); + expect(a.region).toBe('intl'); + expect(a.category).toBe('e-commerce'); + expect(a.icon).toBe('exito'); + expect(a.docsUrl).toBe('https://developers.exito.com/'); + expect(a.requiredEnvVars).toEqual(['EXITO_USERNAME', 'EXITO_PASSWORD', 'EXITO_API_KEY', 'EXITO_LOGIN_URL', 'EXITO_SELLER_ID']); + expect(a.envVarMeta.EXITO_PASSWORD.secret).toBe(true); + expect(a.envVarMeta.EXITO_API_KEY.secret).toBe(true); + const seller = new RegExp(a.envVarMeta.EXITO_SELLER_ID.pattern!); + expect(seller.test('11795')).toBe(true); + expect(['SC-1', '', '11 795'].some((v) => seller.test(v))).toBe(false); + const url = new RegExp(a.envVarMeta.EXITO_LOGIN_URL.pattern!); + expect(url.test(LOGIN_URL)).toBe(true); + expect(['http://x.example/token', 'https://', 'abcdefghij.execute-api.us-east-1.amazonaws.com'].some((v) => url.test(v))).toBe(false); + expect(a.probe).toEqual({ tool: `${P}get_products`, params: { limit: 1, page: 1 } }); + expect(tool(a.probe.tool).endpointMapping.method).toBe('GET'); + }); + + it('logs in with x-api-key and the credentials, and sends the bare token with x-api-key on every call', async () => { + expect(a.connector.authType).toBe('LOGIN_TOKEN'); + expect(a.connector.authConfig).toMatchObject({ + loginUrl: '{{EXITO_LOGIN_URL}}', + loginMethod: 'POST', + loginHeaders: { 'x-api-key': '{{EXITO_API_KEY}}' }, + loginBody: { username: '${username}', password: '${password}' }, + username: '{{EXITO_USERNAME}}', + password: '{{EXITO_PASSWORD}}', + refreshOn401: true, + headerName: 'Authorization', + headerTemplate: '${token}', + extraHeaders: { 'x-api-key': '{{EXITO_API_KEY}}' }, + }); + // API Gateway's Cognito authorizer validates the ID token by default. + expect(a.connector.authConfig.tokenJsonPath[0]).toBe('AuthenticationResult.IdToken'); + expect(a.connector.authConfig.tokenTTLSeconds).toBe(3600); + + await execute(`${P}get_products`, { limit: 1, page: 1 }); + expect(loginCalls).toHaveLength(1); + const login = loginCalls[0]; + expect(login.method).toBe('POST'); + expect(header(login, 'x-api-key')).toBe(API_KEY); + expect(login.data).toEqual({ username: 'integraciones@tienda.example', password: PASSWORD }); + + const call = sent(); + expect(header(call, 'Authorization')).toBe('id-token-1'); + expect(header(call, 'x-api-key')).toBe(API_KEY); + expect(JSON.stringify(call)).not.toContain(PASSWORD); + + // The token is reused, not fetched per call. + await execute(`${P}get_bulk_upload_status`, {}); + expect(loginCalls).toHaveLength(1); + expect(header(sent(), 'Authorization')).toBe('id-token-1'); + }); + + it('logs in again and retries once when Éxito answers 401', async () => { + await execute(`${P}get_products`, { limit: 1, page: 1 }); + rejectNextApiCall = true; + await execute(`${P}get_orders`, {}); + expect(loginCalls).toHaveLength(2); + expect(apiCalls.map((c) => header(c, 'Authorization'))).toEqual(['id-token-1', 'id-token-1', 'id-token-2']); + }); + + it('maps every tool to its documented address and method, reads as GET', () => { + expect(a.tools.map((t) => t.name).sort()).toEqual(Object.keys(ROUTES).map((n) => P + n).sort()); + for (const t of a.tools) { + const [method, path, enabled] = ROUTES[t.name.slice(P.length)]; + expect(`${t.name}:${t.endpointMapping.method} ${t.endpointMapping.path}`).toBe(`${t.name}:${method} ${path}`); + expect(`${t.name}:${t.enabled ?? true}`).toBe(`${t.name}:${enabled}`); + expect(`${t.name}:${annotationsOf(t).readOnlyHint}`).toBe(`${t.name}:${method === 'GET'}`); + // Categories are documented without culture; every other call carries es-CO. + const culture = t.endpointMapping.queryParams?.culture; + expect(`${t.name}:${culture}`).toBe(`${t.name}:${path.startsWith(N) ? undefined : 'es-CO'}`); + } + }); + + it('every tool is prefixed and every declared parameter reaches the request', () => { + for (const t of a.tools) { + expect(t.name.startsWith(P)).toBe(true); + const m = t.endpointMapping; + const mapped = JSON.stringify({ p: m.path, q: m.queryParams, b: m.bodyMapping }); + for (const p of Object.keys(t.parameters.properties ?? {})) { + const reached = mapped.includes(`"$${p}"`) || mapped.includes(`{${p}}`); + expect(`${t.name}:${p}:${reached}`).toBe(`${t.name}:${p}:true`); + } + for (const [, p] of m.path.matchAll(/\{(\w+)\}/g)) { + expect(`${t.name}:${p}:${(t.parameters.required ?? []).includes(p)}`).toBe(`${t.name}:${p}:true`); + } + } + }); + + it('lists products with the documented query and only the seller\'s own by default', async () => { + await execute(`${P}get_products`, { limit: 10, page: 2, ean: '9205147694107', seller_sku: '1992', initial_date: '2026-01-01' }); + const call = sent(); + expect(call.method).toBe('GET'); + expect(call.url).toBe(`${R}/products/`); + expect(call.params).toEqual({ + culture: 'es-CO', + limit: 10, + page: 2, + myProducts: true, + ean: '9205147694107', + sellerSku: '1992', + initialDate: '2026-01-01', + }); + }); + + it('pages the moderation queues with {} first and the seller id from the connector', async () => { + await execute(`${P}get_products_waiting`, {}); + expect(sent().url).toBe(`${R}/productswaiting/productswaiting`); + expect(sent().params).toEqual({ culture: 'es-CO', limit: 20, paginationToken: '{}', idSeller: '11795' }); + await execute(`${P}get_products_rejected`, { ean: 'IZ20000082449', pagination_token: '{"Id":{"N":"1"}}' }); + expect(sent().params).toMatchObject({ idSeller: '11795', ean: 'IZ20000082449', paginationToken: '{"Id":{"N":"1"}}' }); + await execute(`${P}get_products_pending_seller_approval`, { plu: '100286013' }); + expect(sent().params).toEqual({ culture: 'es-CO', limit: 20, paginationToken: '{}', plu: '100286013' }); + await execute(`${P}get_bills`, { payment_date_initial: '2026/10/01' }); + expect(sent().url).toBe(F); + expect(sent().params).toEqual({ culture: 'es-CO', idSeller: '11795', limit: 50, paginationToken: '{}', paymentDateInitial: '2026/10/01' }); + }); + + it('reads orders, categories and category features at their own addresses', async () => { + await execute(`${P}get_orders`, { id_status_order: 35, date_order_initial: '2026/11/01' }); + expect(sent().url).toBe(C); + expect(sent().params).toEqual({ culture: 'es-CO', limit: 50, idStatusOrder: 35, dateOrderInitial: '2026/11/01' }); + await execute(`${P}get_category`, { category_id: 50249 }); + expect(sent().url).toBe(`${N}/50249`); + await execute(`${P}list_categories`, {}); + expect(sent().url).toBe(N); + await execute(`${P}get_category_features`, { category_id: 28086 }); + expect(sent().url).toBe(`${S}/28086`); + expect(sent().params).toEqual({ culture: 'es-CO' }); + }); + + it('creates products with the caller\'s array as the whole JSON body', async () => { + const products = [ + { + Ean: '0', + Name: 'Camara deportiva ADIDAS X1 4K', + Category: '27193', + Brand: 'ADIDAS', + Description: '

La mejor camara

', + ImageUrl1: 'https://cdn.example/camara.jpg', + features: [{ key: 'Tipo de cámara', value: 'Deportiva' }], + }, + ]; + await execute(`${P}create_products`, { products }); + expect(sent().method).toBe('POST'); + expect(sent().url).toBe(`${A}/`); + expect(sent().params).toEqual({ culture: 'es-CO' }); + expect(sent().data).toEqual(products); + expect(tool(`${P}create_products`).parameters.properties!.products.maxItems).toBe(400); + }); + + it('sends offers as {PriceApproval, ListOffers} and products with offers as {PriceApproval, ProductsAndOffers}', async () => { + const offers = [{ EAN: '7701410118349', Stock: '3', Price: '16000', IsUpdatedStock: 1 }]; + await execute(`${P}upsert_offers`, { offers }); + expect(sent().method).toBe('PATCH'); + expect(sent().url).toBe(O); + expect(sent().data).toEqual({ PriceApproval: 0, ListOffers: offers }); + + const items = [{ Product: { Ean: '0', Name: 'Auriculares' }, Offer: { EAN: '0', Stock: '100', Price: '65001' } }]; + await execute(`${P}load_products_and_offers`, { items }); + expect(sent().url).toBe(`${R}/productsandoffers`); + expect(sent().data).toEqual({ PriceApproval: false, ProductsAndOffers: items }); + }); + + it('changes one offer\'s price and stock, and only the price when update_stock is 0', async () => { + await execute(`${P}update_offer_price_stock`, { ean: '7701410118349', price: '45000', stock: 12 }); + expect(sent().data).toEqual({ + PriceApproval: 0, + ListOffers: [{ EAN: '7701410118349', Stock: 12, Price: '45000', IsUpdatedStock: 1 }], + }); + await execute(`${P}update_offer_price_stock`, { + ean: '7701410118349', + price: '39900', + discount_price: '35900', + stock: 12, + update_stock: 0, + price_approval: 1, + seller_sku: '1992', + }); + expect(sent().data).toEqual({ + PriceApproval: 1, + ListOffers: [{ EAN: '7701410118349', Stock: 12, Price: '39900', DiscountPrice: '35900', IsUpdatedStock: 0, SellerSku: '1992' }], + }); + }); + + it('ships and invoices orders with the documented bodies (both switched off)', async () => { + await execute(`${P}set_order_tracking`, { order_id: '637040012650663267', tracking: '787878', carrier: 'SERVIENTREGA', products: ['6370700714712646841'] }); + expect(sent().method).toBe('PATCH'); + expect(sent().url).toBe(`${C}/637040012650663267/tracking`); + expect(sent().data).toEqual({ tracking: '787878', carrier: 'SERVIENTREGA', products: ['6370700714712646841'] }); + await execute(`${P}upload_order_invoice`, { order_id: '637040012650663267', base64_file: 'JVBERi0x', file_type: 1 }); + expect(sent().url).toBe(`${C}/bill`); + expect(sent().data).toEqual({ IdOrder: '637040012650663267', Base64File: 'JVBERi0x', FileType: 1 }); + }); + + it('turns a non-empty errors list inside HTTP 200 into a failed call, and leaves batch results alone', () => { + expect(describeErrorWhenProblems(a.connector.config.errorWhen)).toEqual([]); + const outcome = (body: unknown) => { + try { + assertNoResponseBodyError(body, a.connector.config.errorWhen as never); + } catch (e) { + return `${(e as ResponseBodyError).status}:${(e as Error).message}`; + } + return 'ok'; + }; + expect(outcome({ errors: [{ code: '500', message: 'La orden no tiene Centro de Acopio asignado' }], data: null })).toMatch(/^400:.*Centro de Acopio/); + expect(outcome({ Errors: [{ Message: 'Token inválido' }], Data: [] })).toMatch(/^400:.*Token inválido/); + // Documented successes: empty error lists, a batch with per-EAN messages, the tracking summary. + expect(outcome({ errors: [], data: { idSeller: 100121, status: 3 }, Message: 'Operación realizada éxitosamente.' })).toBe('ok'); + expect(outcome({ Errors: [], Data: [{ totalProcess: 1, error: 1, successful: 0, productNotifyViewModel: [{ Ean: '1', Message: 'x' }] }] })).toBe('ok'); + expect(outcome({ status: 'Created', products: [], errors: 0, updates: 1, total: 1 })).toBe('ok'); + expect(outcome({ viewModel: [], count: 0, paginationToken: '{}', paginationTokens: [] })).toBe('ok'); + }); + + it('documents every tool, the moderation flow, the price rules and the token request, without em dashes', () => { + for (const t of a.tools) expect(`${t.name}:${a.instructions.includes(t.name)}`).toBe(`${t.name}:true`); + expect(a.instructions).toMatch(/moderated by Éxito's content team/); + expect(a.instructions).toMatch(/PEX/); + expect(a.instructions).toMatch(/IsUpdatedStock/); + expect(a.instructions).toMatch(/EXITO_LOGIN_URL/); + expect(a.instructions).toMatch(/No sandbox is documented/); + for (const name of ['create_products', 'load_products_and_offers']) { + expect(`${name}:${/get_products_waiting/.test(tool(P + name).description)}`).toBe(`${name}:true`); + } + for (const name of ['upsert_offers', 'update_offer_price_stock']) { + expect(`${name}:${/PEX/.test(tool(P + name).description)}`).toBe(`${name}:true`); + } + expect(JSON.stringify(a)).not.toMatch(/—/); + }); +}); + +const live = + (process.env.RUN_EXITO_LIVE === '1' || process.env.RUN_EXITO_MARKETPLACE_LIVE === '1') && + process.env.EXITO_LOGIN_URL && + process.env.EXITO_USERNAME && + process.env.EXITO_PASSWORD && + process.env.EXITO_API_KEY && + process.env.EXITO_SELLER_ID + ? describe + : describe.skip; +live('exito-marketplace adapter: live (read-only)', () => { + const env = process.env as Record; + let token = ''; + const paths: string[] = a.connector.authConfig.tokenJsonPath; + const at = (body: unknown, path: string): unknown => + path === '.' ? body : path.split('.').reduce((v, k) => (v == null ? undefined : v[k]), body); + + beforeAll(async () => { + const res = await fetch(env.EXITO_LOGIN_URL, { + method: 'POST', + headers: { 'Content-Type': 'application/json', Accept: 'application/json', 'x-api-key': env.EXITO_API_KEY }, + body: JSON.stringify({ username: env.EXITO_USERNAME, password: env.EXITO_PASSWORD }), + }); + const text = await res.text(); + let body: unknown = text; + try { + body = JSON.parse(text); + } catch { + /* a bare token */ + } + expect(res.status).toBe(200); + token = String(paths.map((p) => at(body, p)).find((v) => typeof v === 'string' && v.trim() !== '') ?? ''); + // Only the shape of the answer, never its values. + expect(`token at one of the paths; answer keys: ${body && typeof body === 'object' ? Object.keys(body).join(',') : typeof body}:${token !== ''}`).toMatch(/:true$/); + }, 60_000); + + const get = async (url: string) => { + const res = await fetch(url, { headers: { Authorization: token, 'x-api-key': env.EXITO_API_KEY, Accept: 'application/json' } }); + expect(`${url.split('?')[0]} ${res.status}`).toBe(`${url.split('?')[0]} 200`); + return (await res.json()) as Record; + }; + + it('reads one product, the batch status and the moderation queue', async () => { + expect((await get(`${R}/products/?culture=es-CO&limit=1&page=1&myProducts=true`)).data).toHaveProperty('total'); + expect(await get(`${A}/status?culture=es-CO`)).toHaveProperty('data'); + expect(await get(`${R}/productswaiting/productswaiting?culture=es-CO&limit=1&paginationToken=%7B%7D&idSeller=${env.EXITO_SELLER_ID}`)).toHaveProperty('viewModel'); + }, 60_000); +}); diff --git a/packages/backend/src/connectors/engines/login-token.service.spec.ts b/packages/backend/src/connectors/engines/login-token.service.spec.ts index 0ebb96db0..244479479 100644 --- a/packages/backend/src/connectors/engines/login-token.service.spec.ts +++ b/packages/backend/src/connectors/engines/login-token.service.spec.ts @@ -339,6 +339,72 @@ describe('LoginTokenService', () => { /token not found at "data.signIn.token"/, ); }); + + describe('tokenJsonPath as a list (login answer not documented)', () => { + const listAuth: LoginTokenAuthConfig = { + loginUrl: 'https://login.example.com/token', + loginHeaders: { 'x-api-key': 'key-1' }, + loginBody: { username: '${username}', password: '${password}' }, + username: 'seller@example.com', + password: 'plain-password', + tokenJsonPath: ['AuthenticationResult.IdToken', 'data.idToken', 'token', '.'], + tokenTTLSeconds: 3600, + }; + const answer = (data: unknown) => + (mockedAxios as unknown as jest.Mock).mockImplementation(async () => ({ data })); + + it('takes the first path that holds a string', async () => { + answer({ data: { idToken: 'id-2' }, token: 'later-3' }); + const bundle = await service.getToken(listAuth, 'conn-list-1'); + expect(bundle.token).toBe('id-2'); + }); + + it('reads a Cognito-shaped answer from the first path', async () => { + answer({ AuthenticationResult: { IdToken: 'id-1', AccessToken: 'acc-1', ExpiresIn: 3600 } }); + const bundle = await service.getToken(listAuth, 'conn-list-2'); + expect(bundle.token).toBe('id-1'); + }); + + it('skips empty strings and non-strings', async () => { + answer({ AuthenticationResult: { IdToken: '' }, data: { idToken: { nested: true } }, token: 'tok-3' }); + const bundle = await service.getToken(listAuth, 'conn-list-3'); + expect(bundle.token).toBe('tok-3'); + }); + + it('takes a bare string answer through "."', async () => { + answer('bare-jwt'); + const bundle = await service.getToken(listAuth, 'conn-list-4'); + expect(bundle.token).toBe('bare-jwt'); + }); + + it('names every path when none holds a token', async () => { + answer({ ok: true }); + await expect( + service.getToken({ ...listAuth, tokenJsonPath: ['a.b', 'c'] }, 'conn-list-5'), + ).rejects.toThrow(/token not found at "a.b", "c" in login response/); + }); + + it('still quotes the refusal the service gave', async () => { + answer({ errors: [{ message: 'Usuario o contraseña inválidos' }] }); + await expect(service.getToken(listAuth, 'conn-list-6')).rejects.toThrow( + /refused the login — Usuario o contraseña inválidos/, + ); + }); + + it('refuses an empty list or a non-string entry before logging in', async () => { + const calls = (mockedAxios as unknown as jest.Mock).mock.calls.length; + await expect( + service.getToken({ ...listAuth, tokenJsonPath: [] }, 'conn-list-7'), + ).rejects.toThrow(/tokenJsonPath is required/); + await expect( + service.getToken( + { ...listAuth, tokenJsonPath: ['token', 5 as unknown as string] }, + 'conn-list-8', + ), + ).rejects.toThrow(/tokenJsonPath is required/); + expect((mockedAxios as unknown as jest.Mock).mock.calls.length).toBe(calls); + }); + }); }); describe('proactiveRefreshWindowMs', () => { diff --git a/packages/backend/src/connectors/engines/login-token.service.ts b/packages/backend/src/connectors/engines/login-token.service.ts index 6e9a0fdd4..48331b95d 100644 --- a/packages/backend/src/connectors/engines/login-token.service.ts +++ b/packages/backend/src/connectors/engines/login-token.service.ts @@ -121,7 +121,9 @@ export interface LoginTokenAuthConfig { outputParam?: string; // template param name (default: passwordHashed) }; - tokenJsonPath: string; + // One path, or several tried in order when the vendor does not document + // the login answer's shape: the first that holds a non-empty string wins. + tokenJsonPath: string | string[]; expiryJsonPath?: string; audJsonPath?: string; expiryFormat?: 'iso8601' | 'unix' | 'ttl_seconds'; @@ -312,7 +314,7 @@ export class LoginTokenService { this.requireString(authConfig.password, 'password'); } if (authConfig.tokenSource !== 'cookie') { - this.requireString(authConfig.tokenJsonPath, 'tokenJsonPath'); + tokenJsonPaths(authConfig.tokenJsonPath); } const basicAuth = loginBasicAuthHeader(authConfig); @@ -419,8 +421,9 @@ export class LoginTokenService { ); } } else { - token = jsonPath(response.data, authConfig.tokenJsonPath); - if (!token || typeof token !== 'string') { + const paths = tokenJsonPaths(authConfig.tokenJsonPath); + token = readTokenAt(response.data, paths); + if (!token) { // Far and away the commonest reason the token is missing is that the // login itself was refused — wrong password, 2FA, a locked account. // The endpoint answers 200 and puts the reason in the body, so saying @@ -431,7 +434,7 @@ export class LoginTokenService { throw new Error( refusal ? `LOGIN_TOKEN: the service refused the login — ${refusal}` - : `LOGIN_TOKEN: token not found at "${authConfig.tokenJsonPath}" in login response`, + : `LOGIN_TOKEN: token not found at ${paths.map((p) => `"${p}"`).join(', ')} in login response`, ); } } @@ -701,6 +704,30 @@ function scrubLoginError(err: unknown, secrets: string[]): void { } } +/** + * The token path(s) of an authConfig as a list. A single string is the usual + * form; a list is for logins whose answer is undocumented, tried in order. + * Anything else (missing, empty, a non-string entry) is a configuration error. + */ +export function tokenJsonPaths(value: unknown): string[] { + const list = Array.isArray(value) ? value : [value]; + if (list.length === 0 || list.some((p) => !p || typeof p !== 'string')) { + throw new Error( + 'LOGIN_TOKEN: authConfig.tokenJsonPath is required (a path, or a list of paths)', + ); + } + return list as string[]; +} + +/** The first non-empty string found at one of `paths`, in order. */ +export function readTokenAt(body: unknown, paths: string[]): string | undefined { + for (const path of paths) { + const value = jsonPath(body, path); + if (typeof value === 'string' && value.trim() !== '') return value; + } + return undefined; +} + /** * Resolve a dotted/bracket JSON path against a value. * Supports a.b.c and a.b[0].c. diff --git a/packages/frontend/public/logos/connectors/exito.svg b/packages/frontend/public/logos/connectors/exito.svg new file mode 100644 index 000000000..79bba380a --- /dev/null +++ b/packages/frontend/public/logos/connectors/exito.svg @@ -0,0 +1 @@ +Grupo Éxito \ No newline at end of file diff --git a/scripts/probe-keyless.mjs b/scripts/probe-keyless.mjs index 058d1044f..3961016cd 100644 --- a/scripts/probe-keyless.mjs +++ b/scripts/probe-keyless.mjs @@ -260,8 +260,10 @@ async function loginTokenHeaders(cfg) { } else { let json; try { json = JSON.parse(text); } catch { /* not JSON */ } - token = jsonPath(json, cfg.tokenJsonPath || ''); - if (!token || typeof token !== 'string') throw fail('login-failed', `no token at "${cfg.tokenJsonPath}" in login response`, res.status); + // tokenJsonPath may list several paths, tried in order (LoginTokenService). + const paths = Array.isArray(cfg.tokenJsonPath) ? cfg.tokenJsonPath : [cfg.tokenJsonPath || '']; + token = paths.map((p) => jsonPath(json, p)).find((v) => typeof v === 'string' && v.trim() !== ''); + if (!token) throw fail('login-failed', `no token at ${paths.map((p) => `"${p}"`).join(', ')} in login response`, res.status); } const aud = cfg.audJsonPath ? undefined : cfg.aud; const fill = (s) => s.replace(/\$\{token\}/g, token).replace(/\$\{aud\}/g, aud || ''); diff --git a/server.json b/server.json index 318d28a7b..c0df97688 100644 --- a/server.json +++ b/server.json @@ -2,7 +2,7 @@ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json", "name": "io.github.HelpCode-ai/anythingmcp", "title": "AnythingMCP", - "description": "MCP gateway and company brain: 713 connectors (SAP, ERP, SQL), file search, memory and skills.", + "description": "MCP gateway and company brain: 714 connectors (SAP, ERP, SQL), file search, memory and skills.", "repository": { "url": "https://github.com/HelpCode-ai/anythingmcp", "source": "github"