Catalog import via API leaves optional variables unset and hides the connector from MCP
What happens
Installing a catalog adapter through the API or the CLI with a credentials object that leaves out an optional variable keeps the connector hidden from MCP clients.
Example with Microsoft SQL Server (MSSQL_DOMAIN is optional and empty means a SQL login):
amcp api POST /api/adapters/mssql/import --yes --data '{"credentials":{
"MSSQL_HOST":"db.example.com","MSSQL_PORT":"1433","MSSQL_DATABASE":"erp",
"MSSQL_USER":"reader","MSSQL_PASSWORD":"…"}}'
- The import succeeds and creates the 5 tools.
GET /api/connectors/<id>then showssetupStatus: "needs_input"andmissingVariables: ["MSSQL_DOMAIN"].tools/liston the MCP server does not include anymssql_*tool, so the AI never sees the connector.
Seen on v0.55.3, self-hosted.
Why
resolvableEnvVars in connectors/connector-setup-status.util.ts treats an optional variable as resolved only when it was saved as '' (the dashboard form does this). importAdapter in adapters/adapters.service.ts stores only the keys present in credentials, so an omitted optional variable is never saved. Its {{MSSQL_DOMAIN}} placeholder in authConfig stays unresolved and the connector counts as not set up.
Expected
When an import is given credentials, an optional variable that is left out is stored as '', the same as an empty field in the form. The connector is then ready and its tools are listed.
Other adapters with optionalEnvVars used in the connector definition are probably affected the same way.
Workaround
Save the optional variable as an empty string afterwards:
amcp api PUT /api/connectors/<id> --yes --data '{"envVars":{…all values…,"MSSQL_DOMAIN":""}}'
Deployment modes
Same code path on Cloud and self-hosted; it matters most for agent-driven setups through the CLI or the management API, which skip the form.
Hi @helpcodeai, I'd like to take this one. Plan: in importAdapter, when credentials are provided, store every omitted optional variable as '' (same as the dashboard form), so resolvableEnvVars resolves it and the connector becomes ready. I'll add a test with the MSSQL adapter (omitting MSSQL_DOMAIN) checking setupStatus and that the tools show in tools/list, and check the other adapters that use optionalEnvVars. OK to go ahead?
Yes, please go ahead, thank you. Your plan is right: when credentials are given, store every omitted optional variable as an empty string, like the form does. Please also check that an optional variable the caller does send keeps its value, and that an import without any credentials stays as it is today. I assigned the issue to you.