Skip to content

Add a read-only SkuVault adapter - #1834

Merged
helpcodeai merged 6 commits into
HelpCode-ai:mainfrom
ZYZ666-RGB:cursor/skuvault-adapter-2308
Dec 5, 2026
Merged

helpcodeai merged 6 commits into
HelpCode-ai:mainfrom
ZYZ666-RGB:cursor/skuvault-adapter-2308

Conversation

@ZYZ666-RGB

@ZYZ666-RGB ZYZ666-RGB commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

People searching the connector catalog for SkuVault were getting nothing. This adds a read-only SkuVault (Linnworks) adapter so an assistant can look up products, bin-level inventory, warehouses, and sales that are ready to ship or pending.

SkuVault's getTokens call returns a tenant token and a user token, and every later call sends both in the JSON body. LOGIN_TOKEN could place only one issued value. The engine now also places the second login field (audJsonPath) as $loginAud in a body mapping or ${loginAud} in a body template, and a token field that comes back null is reported as a refused login. A wrong SkuVault password answers HTTP 200 with both tokens null, so that message is what the setup check shows.

The same connector works on AnythingMCP Cloud and on a self-hosted instance: app.skuvault.com is a public HTTPS API.

Changes

  • Add packages/backend/src/adapters/intl/skuvault.json with four read-only tools: products, inventory by location, warehouses, and sales. No write tools.
  • Sign in with POST /gettokens (SKUVAULT_EMAIL, SKUVAULT_PASSWORD) and send TenantToken and UserToken on every call.
  • Map each response down to the fields an assistant can act on. Sales answers omit street address, phone, and email.
  • Add intl/skuvault.live.spec.ts (static checks always; live calls only when RUN_SKUVAULT_LIVE=1) and a logo.
  • Regenerate the catalog, quoted adapter counts, and llms.txt / llms-full.txt.

Type

  • New feature
  • Bug fix
  • Documentation
  • Refactoring
  • Performance improvement
  • Other (describe below)

Testing

Built from the public reference at https://dev.skuvault.com/. I do not have a SkuVault account, so RUN_SKUVAULT_LIVE was not set and no authenticated call was made.

I did call the public API with credentials that are not an account, to learn the refusal shape:

  • POST https://app.skuvault.com/api/gettokens with a fake email and password returned HTTP 200 and {"TenantToken":null,"UserToken":null}.
  • POST https://app.skuvault.com/api/inventory/getWarehouses with fake tokens returned HTTP 401 and {"Warehouses":[]}.

Local commands, from the repo root unless noted:

  • node scripts/validate-adapters.mjs --warn passed: 976 adapters, 0 failed. SkuVault added no new warning. The run still reports the existing warnings (for example de/nina-warnung.json tool prefixes and intl/hubspot.json TODO markers).
  • node --test scripts/validate-adapters.test.mjs passed: 45 tests.
  • node scripts/regenerate-catalog.mjs regenerated catalog.ts (958 adapters in the count check).
  • node scripts/adapter-count.mjs --check passed after the quoted counts moved from 957 to 958.
  • node scripts/generate-llms-txt.mjs and node scripts/generate-llms-txt.mjs --check passed.
  • In packages/backend, after DATABASE_URL=postgresql://localhost:5433/anythingmcp npx prisma generate:
    • npx jest src/connectors/engines/login-token.service.spec.ts --runInBand passed: 96 tests.
    • npx jest src/connectors/engines/rest.engine.login-token-body.spec.ts --runInBand passed: 23 tests.
    • npx jest src/adapters/intl/skuvault.live.spec.ts --runInBand passed: 10 tests, 1 skipped (the live suite).
    • npx jest src/adapters/catalog.spec.ts --runInBand passed: 23287 tests.
  • npx tsc --noEmit -p tsconfig.json in packages/backend passed.
  • npx eslint on the touched backend TypeScript files passed.

The full npm test in packages/backend was not run. Jest workers ran out of memory when several suites loaded the catalog at once, so the suites above were run one at a time.

  • Added/updated unit tests
  • Tested manually (describe steps below)
  • No tests needed (explain why)

Checklist

  • My code follows the existing code style
  • I have tested my changes locally
  • I have updated documentation (if applicable)
  • All existing tests pass (npm test)
  • This PR has a descriptive title

Related Issues

Fixes #1406

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@ZYZ666-RGB

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@helpcodeai helpcodeai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! SkuVault on its official API is a good fit for the catalog, and the adapter itself looks clean.

A few things before we can run CI:

  1. CLA. The check reads the commit author, and the commits are authored by Cursor Agent (cursoragent), which has not signed. Please rewrite the commits under your own account, for example git rebase -i main with git commit --amend --reset-author --no-edit on each commit, then force-push.
  2. Login token in raw and form bodies. In rest.engine.ts, loginToken and loginAud are added to bodyParams for every bodyMapping branch, but renderTokenBody is set only in the JSON branch. For __raw, form-urlencoded and form-data this means two things: the body is not marked as carrying credentials, so it can follow a cross-origin redirect with the token, and after a re-login the retry goes out with the old token. Please either inject the values only in the JSON branch, or set renderTokenBody for the other branches too. Please add a spec for it: a bodyMapping that carries $loginToken is not re-sent after a cross-origin 307, and the retry after a re-login carries the new token.
  3. Rebase on main. Only package.json conflicts (the count text next to the 0.55.10 bump). Then run node scripts/adapter-count.mjs --check again.
  4. Please run the full backend suite once (npm test in packages/backend), not only the single specs.

Optional: the email pattern ^[^@\s]+@[^@\s]+\.[^@\s]+$ can backtrack, because . overlaps [^@\s]. A linear form is ^[^@\s]+@[^@\s.]+(\.[^@\s.]+)+$.

The engine part ($loginToken / $loginAud in bodyMapping) changes how connector credentials are sent, so we also look at it on our side. We will tell you here if we want it done differently.

@cursor
cursor Bot force-pushed the cursor/skuvault-adapter-2308 branch 2 times, most recently from 15685f9 to 9b66a4d Compare November 23, 2026 10:03
@ZYZ666-RGB
ZYZ666-RGB force-pushed the cursor/skuvault-adapter-2308 branch from 9b66a4d to cf867d7 Compare November 23, 2026 10:37
@helpcodeai

Copy link
Copy Markdown
Contributor

Thanks a lot for the fixes. I went through the new commits: the token now reaches every body format, the body is marked as carrying credentials so a cross-origin redirect is refused, the re-login retry rebuilds the body with the new token, and the engine values win over caller parameters with the same name. The adapter itself looks good to me.

Because this extends how the login-token engine places credentials, it needs one more sign-off on our side before it can merge. I'll come back to you here as soon as that is done. The new conflict in package.json comes from our release yesterday; you don't need to do anything about it, we will update the branch before merging.

@Coding-Professional Coding-Professional added the adapter-request A request for a new pre-built adapter label Nov 24, 2026
SkuVault puts a TenantToken and a UserToken in every JSON body.
LOGIN_TOKEN can now place both after getTokens, and a null token
is reported as a refused login.

Fixes HelpCode-ai#1406

Signed-off-by: yuzhou <1991039819@qq.com>
The null-token message is chosen after the login is already rejected,
so a field in the remote body cannot skip a lookup or the throw.

Signed-off-by: yuzhou <1991039819@qq.com>
A bodyMapping that carries the login token now refuses a cross-origin
redirect and is rebuilt after a re-login for raw and form bodies, the
same as JSON. The SkuVault email pattern no longer overlaps on the dot.

Signed-off-by: yuzhou <1991039819@qq.com>
@ZYZ666-RGB
ZYZ666-RGB force-pushed the cursor/skuvault-adapter-2308 branch from 268aafd to 54dc801 Compare November 30, 2026 06:07
@ZYZ666-RGB

Copy link
Copy Markdown
Contributor Author

Rebased onto current main and rewrote the commits so the author and committer are yuzhou <1991039819@qq.com> (the previous Cursor Agent Signed-off-by trailers are gone).

The conflicts were the advertised adapter counts next to the version line. The catalog is now 962, the version stays at 0.55.17, and node scripts/adapter-count.mjs --check passes.

The earlier review notes are in this history: $loginToken / $loginAud on JSON, raw and form bodies set renderTokenBody (a token-bearing body is not resent after a cross-origin 307, and a retry after re-login uses the new token), with coverage in rest.engine.login-token-body.http.spec.ts, and the SkuVault email pattern is the linear form. I also ran the login-token, SkuVault and catalog specs locally, plus scripts/validate-adapters.test.mjs.

@helpcodeai

Copy link
Copy Markdown
Contributor

Thanks for the rebase and for cleaning up the commits. CI is green and the adapter count check passes. The change to the login token engine still needs one sign-off on our side. As soon as that is done I will update the branch and merge it.

@helpcodeai helpcodeai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the rebase and the careful engine change. We reviewed it for security and found one thing to change before we can merge.

The SkuVault UserToken is stored in plain text. The adapter reads the second token from the getTokens answer through audJsonPath. LoginTokenService caches that value as aud in connectorAuthCache.metadata (see login-token.service.ts on main, where the cache row is written: metadata = bundle.metadata || { aud }). Only token is encrypted with ENCRYPTION_KEY. For the existing adapters aud is a public audience value, so that was fine. For SkuVault it is half of the credential pair: anyone who can read the database could call the SkuVault API with it.

What we need:

  1. Encrypt aud before it is written to connectorAuthCache and decrypt it when the row is read, the same way as token. A simple way is an opt-in flag on the auth config (for example audSecret: true) that the SkuVault adapter sets, so the other adapters keep their current rows. If you prefer to encrypt aud for every adapter, the read path must still accept old plain rows.
  2. Make sure aud never appears in logs or error messages (the same rule as for token).
  3. A unit test in login-token.service.spec.ts that checks the stored metadata does not contain the plain UserToken and that a cached row still gives the right value back.
  4. Update the branch with main afterwards (it has conflicts in the counts).

The rest looks good to us: the $loginToken / $loginAud body mapping, the null-token refusal message and the static spec. When this is done we review again.

Keep upstream's version (0.55.21) and metadata; the advertised adapter count
is upstream's 974 plus SkuVault (975). In rest.engine.ts keep both the
form-data login-token re-render and upstream's binary body encoding.
…oken cache

SkuVault's UserToken (audJsonPath / $loginAud) was cached in plain text in
connectorAuthCache.metadata. With authConfig.audSecret: true it is now stored
as metadata.audEnc, encrypted with ENCRYPTION_KEY like the token, decrypted on
read, and never logged. Rows cached without the flag still read. SkuVault sets
the flag; the validator checks it; tests cover storage, round trip, legacy rows,
the unflagged default and the logs.
@ZYZ666-RGB

Copy link
Copy Markdown
Contributor Author

Addressed the plaintext UserToken cache in ce50542 (merged with current main in 63123a4).

  • New opt-in authConfig.audSecret: true. The second login value (audJsonPath / aud, i.e. $loginAud) is then stored as metadata.audEnc, encrypted with ENCRYPTION_KEY the same way the token is, and decrypted when the row is read. No plain aud is written to the row any more for such a connector.
  • skuvault.json sets audSecret: true. Other adapters are unchanged and keep their current rows. A row cached before the flag existed still reads, and is re-written encrypted on the next login.
  • The value is not logged: the login logs only the URL, and a failed cache write logs only the error message.
  • validate-adapters now checks audSecret is a boolean and that an audJsonPath or aud names the value; documented in docs/connectors/login-token-auth.md, llms-full.txt regenerated.
  • Tests in login-token.service.spec.ts cover: no plain UserToken in the stored row, a round trip through a cold cache, legacy plain rows, the unflagged default, and no token or aud in the logs, including on a failed persist. Validator tests added too.

@helpcodeai helpcodeai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update. The UserToken is now stored encrypted with audSecret, it is never logged, and a body that carries the token is not sent to another origin on a redirect. The tests cover both the old and the new cache rows. Looks good to me, merging.

@helpcodeai
helpcodeai merged commit 5489282 into HelpCode-ai:main Dec 5, 2026
14 checks passed
@helpcodeai helpcodeai mentioned this pull request Dec 5, 2026
5 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adapter-request A request for a new pre-built adapter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adapter: SkuVault (Linnworks)

4 participants