Skip to content

Send the catalog User-Agent on calls from installed connectors - #1539

Merged
helpcodeai merged 2 commits into
mainfrom
fix/catalog-user-agent
Nov 5, 2026
Merged

helpcodeai merged 2 commits into
mainfrom
fix/catalog-user-agent

Conversation

@helpcodeai

Copy link
Copy Markdown
Contributor

Summary

sevdesk asks technology partners to send a User-Agent on every API call (requirement #2 of its partner programme). Our sevdesk adapter sent none. Adding the header to the adapter alone is not enough: the header is copied onto a connector at install, and catalog sync never updates stored headers (CatalogResyncService "never touches auth/envVars/headers"), so connectors installed earlier would keep sending none.

Changes

  • de/sevdesk.json: "headers": {"User-Agent": "AnythingMCP ([email protected])"} (same value as br/tiendanube.json).
  • connectors/catalog-user-agent.util.ts: withCatalogUserAgent(headers, connectorConfig). For a catalog connector (config.adapterSlug) with no User-Agent, add the adapter's User-Agent. Rules:
    • only a static value (no {{VAR}}) is used;
    • a User-Agent stored on the connector always wins, whatever its case;
    • hand-made connectors are unchanged;
    • no database write.
  • Applied where request headers are built: tool calls (dynamic-mcp-tools.ts), ConnectorsService tool execution and the connection test.
  • Production check before merging: of all connectors whose adapter has a static User-Agent, the only ones without it today are the 15 sevdesk connectors. So in practice this changes sevdesk calls only.
  • Cloud and self-hosted behave the same: the catalog ships with the image.

Type

  • Bug fix

Testing

  • Added/updated unit tests

In packages/backend:

  • npx jest src/connectors/catalog-user-agent.util.spec.ts: 6 passed. The tests cover:
    • the adapter declares the header;
    • it is added when missing;
    • a stored one wins;
    • hand-made, unknown and no-header adapters are unchanged;
    • a templated value is ignored;
    • an on-the-wire test with a local HTTP server receives user-agent: AnythingMCP ([email protected]) on a sevdesk call.
  • npx eslint on the 4 changed TS files: clean.
  • node scripts/validate-adapters.mjs --warn: no sevdesk warnings. node scripts/regenerate-catalog.mjs: no catalog diff.
  • Locally, tsc and the dynamic-mcp-tools* / connectors.service* suites fail to compile because the shared local node_modules lacks @types/picomatch and other modules. That is a baseline of this machine, unrelated to this change, and the same on main. CI runs the full suites.

Checklist

  • My code follows the existing code style
  • I have tested my changes locally
  • This PR has a descriptive title

Related Issues

None (sevdesk technology partner requirement).

sevdesk asks technology partners to send a User-Agent on every API
call. The sevdesk adapter now declares one, and catalog connectors
that were installed before their adapter gained a static User-Agent
get it at request time, since catalog sync never updates stored
headers. A User-Agent stored on the connector still wins.
@helpcodeai
helpcodeai requested a review from D3nisty as a code owner November 5, 2026 14:57
@helpcodeai
helpcodeai merged commit 12852ba into main Nov 5, 2026
16 checks passed
@helpcodeai
helpcodeai deleted the fix/catalog-user-agent branch November 5, 2026 15:19
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant