🎃 Export a single connector as JSON or YAML, and accept YAML on import
维护者通常 1 天内回复
@keysersoft 已经在做这个了。
开始于 2026年10月5日。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 65/100
- Issue 类型
- 功能
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
调研方向
Start with exportAll(), findOne(), and importAll() in packages/backend/src/connectors/connectors.controller.ts, plus the secrets helpers and round-trip tests named in the issue. Then inspect handleExportAll/handleImportAll and the connector page header actions; run the specified backend and frontend tests. Done means secure JSON/YAML export and YAML import work, with the API reference and REST docs updated.
由索引模型根据 Issue 内容生成。
描述
Part of the October Challenge #846.
Why
Today you can only back up all connectors at once (Export on the Connectors page). That works for backups, but not for sharing one hand-built connector with a colleague, attaching it to a bug report, or keeping it in Git. For Git, YAML diffs better than JSON. Users ask for "export this connector" from the connector page, and for a format they can review in a pull request.
Self-hosted vs Cloud
- Self-hosted: available in Community and Business, no licence gate.
- Cloud (
DEPLOYMENT_MODE=cloud): same behaviour. Import still goes through the existing licence/trial check per connector (licenseGuard.checkCanCreateConnector), so Cloud plan limits apply unchanged. Do not touch them. - Who can use it: export is available to any member who can open the connector (same check as
GET /api/connectors/:id, i.e.assertOrgMatch; VIEWER included). This is safe only because the single-connector export never contains secrets, whatever the role (see below). Import keeps today's rule: VIEWER is refused (assertCanCreate). All reads and writes are scoped toreq.user.organizationId.
What to build
- Backend:
GET /api/connectors/:id/export?format=json|yaml(defaultjson).- Return the same envelope as export-all (
{ version: '1.0', exportedAt, secretsIncluded: false, connectors: [ … ] }) with one connector. That way the existingPOST /api/connectors/import-allrestores it unchanged. - Secrets are always redacted, also for ADMIN: build the connector with
toPublicConnector()(env vars and headers emptied and listed inmaskedEnvVars/maskedHeaders;authConfigdropped). - Defence in depth, because a shared file travels further than a backup:
- strip
user:password@frombaseUrlwhenisSecretValue(baseUrl)(database connectors use connection strings); - empty any tool
endpointMapping.headersvalue whose name passesisSecretName()or whose value passesisSecretValue()(a cURL import stores literal headers such asX-Api-Key).
- strip
format=yaml: serialize withjs-yaml(already a backend dependency) usingdump(data, { noRefs: true }). Respond withContent-Type: application/yamlandContent-Disposition: attachment; filename="<slug>.anythingmcp.yaml"(or.json).- Optional, cheap: accept the same
formatquery onGET export-all.
- Return the same envelope as export-all (
- Frontend: connector page (
connectors/[id]/page.tsx): an Export button in the header actions with a small JSON/YAML choice. It downloads the file using the same Blob pattern ashandleExportAll. - Frontend: import dialog (
connectors/page.tsx): accept.json,.yaml,.yml. If the text does not start with{or[, parse it as YAML withjs-yamlload(text, { schema: JSON_SCHEMA })(addjs-yamlto the frontend). JSON_SCHEMA means no custom tags and no!!js/*. Then send the same JSON body as today. Show a clear error for invalid YAML. Update the dialog text ("JSON or YAML").
Where to look
packages/backend/src/connectors/connectors.controller.ts:827:exportAll(). Copy the field list; note that export-all can include secrets for an ADMIN backup (secretsIncluded), which the single export must never do.packages/backend/src/connectors/connectors.controller.ts:879:findOne(), the access check to reuse. Declare the new route so it does not clash with:id.packages/backend/src/connectors/connectors.controller.ts:1337:importAll()andImportAllDto(line 493). It already accepts the envelope and themasked*fields.packages/backend/src/connectors/connector-secrets.util.ts:77,:85,:267:isSecretName,isSecretValue,toPublicConnector.packages/backend/src/connectors/connectors.import-all.spec.ts:116: the export → import round-trip tests. Copy this pattern.packages/frontend/src/app/connectors/page.tsx:140:handleExportAll/handleImportAll(line 162) / import dialog (line 270ff,accept=".json").packages/frontend/src/app/connectors/[id]/page.tsx:753: header actions (Test / Edit / Delete).packages/frontend/src/lib/api.ts:422:connectors.exportAll/importAllclients.
Acceptance criteria
- Exporting a connector with secret env vars, a secret header, a
postgres://u:p@hostbase URL and a tool with a literalX-Api-Keyheader produces a file without any of those values, also for an ADMIN (unit test). - The JSON and YAML exports both re-import through
import-allinto an identical connector (minus secrets); round-trip test next toconnectors.import-all.spec.ts. - Another organization's connector id returns 403/404, never data.
- Importing a
.yamlfile works from the dialog. A YAML file with!!js/functionis rejected. Playwright test inpackages/frontend/tests/e2e/(runnpm run test:e2e -w packages/frontend). - Backend tests pass:
cd packages/backend && npx jest src/connectors. - Docs: the new endpoint (and the existing
export-all/import-all, which are missing) added to the connectors table indocs/api-reference.md(around line 85); a short "Share a single connector" note indocs/connectors/rest.md.
Out of scope
- Including secrets in single exports (even as an opt-in).
- Overwriting or merging into an existing connector on import (duplicates are still skipped by name).
- Changing the export-all secret behaviour for admins.
Size
M (1–2 days)
How to claim
Comment "I'd like to work on this" and we'll assign you. Rules in #846.
- 主要语言
- TypeScript
- 星标
- 856
- 派生
- 82
- 平均合并
- 5 小时 18 分钟
- 30 天内合并 PR
- 162
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
HelpCode-ai/anythingmcp 的其他 Issue
-
Docs: document all SMTP_* and other undocumented env vars for self-hosting可能已有人在做 @notlakshitha 于 3 天前认领。 未关闭enhancement
难度 2/5 1-3 小时 新手友好度 82/100
HelpCode-ai/anythingmcp#1049 · 3 条评论 ·
维护者通常 1 天内回复
-
good first issue hacktoberfest
难度 2/5 半天 新手友好度 70/100
HelpCode-ai/anythingmcp#996 ·
维护者通常 1 天内回复
-
good first issue hacktoberfest
难度 2/5 半天 新手友好度 72/100
HelpCode-ai/anythingmcp#995 ·
维护者通常 1 天内回复
-
enhancement good first issue hacktoberfest help wanted
难度 2/5 1-3 小时 新手友好度 78/100
HelpCode-ai/anythingmcp#982 ·
维护者通常 1 天内回复
-
Upload the new social preview可能已有人在做 @helpcodeai 于 3 天前认领。 未关闭
HelpCode-ai/anythingmcp#1087 · 6 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 HelpCode-ai/anythingmcp 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 67/100
agilepathway/label-checker#739 · 4 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 68/100
CopilotKit/OpenBot#800 ·
维护者通常 1 天内回复
-
Endpoint links in the tag operations list are below the 24px target size可能已有人在做 @AdzerKI 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 79/100
ehmpathy/rhachet-roles-bhuild#471 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 73/100
维护者通常 1 天内回复