@payloadcms/plugin-mcp 4.0.0-internal.011fd46 → 4.0.0-internal.17c13d2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/assets.d.js +2 -0
- package/dist/@types/assets.d.js.map +1 -0
- package/dist/defaultAccess.d.ts +3 -0
- package/dist/defaultAccess.d.ts.map +1 -0
- package/dist/defaultAccess.js +3 -0
- package/dist/defaultAccess.js.map +1 -0
- package/dist/endpoint/access.d.ts +17 -5
- package/dist/endpoint/access.d.ts.map +1 -1
- package/dist/endpoint/access.js +81 -103
- package/dist/endpoint/access.js.map +1 -1
- package/dist/endpoint/index.d.ts.map +1 -1
- package/dist/endpoint/index.js +11 -0
- package/dist/endpoint/index.js.map +1 -1
- package/dist/exports/client.d.ts +1 -4
- package/dist/exports/client.d.ts.map +1 -1
- package/dist/exports/client.js +1 -4
- package/dist/exports/client.js.map +1 -1
- package/dist/exports/internal.d.ts +2 -0
- package/dist/exports/internal.d.ts.map +1 -0
- package/dist/exports/internal.js +3 -0
- package/dist/exports/internal.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -54
- package/dist/index.js.map +1 -1
- package/dist/mcp/buildMcpServer.d.ts.map +1 -1
- package/dist/mcp/buildMcpServer.js.map +1 -1
- package/dist/mcp/builtin/collections/countTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/countTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/countTool.js +69 -0
- package/dist/mcp/builtin/collections/countTool.js.map +1 -0
- package/dist/mcp/builtin/collections/countVersionsTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/countVersionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/countVersionsTool.js +65 -0
- package/dist/mcp/builtin/collections/countVersionsTool.js.map +1 -0
- package/dist/mcp/builtin/collections/createTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/createTool.js +2 -0
- package/dist/mcp/builtin/collections/createTool.js.map +1 -1
- package/dist/mcp/builtin/collections/deleteTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/deleteTool.js +2 -0
- package/dist/mcp/builtin/collections/deleteTool.js.map +1 -1
- package/dist/mcp/builtin/collections/duplicateTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/duplicateTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/duplicateTool.js +97 -0
- package/dist/mcp/builtin/collections/duplicateTool.js.map +1 -0
- package/dist/mcp/builtin/collections/findDistinctTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/findDistinctTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/findDistinctTool.js +93 -0
- package/dist/mcp/builtin/collections/findDistinctTool.js.map +1 -0
- package/dist/mcp/builtin/collections/findTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/findTool.js +2 -0
- package/dist/mcp/builtin/collections/findTool.js.map +1 -1
- package/dist/mcp/builtin/collections/findVersionByIDTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/findVersionByIDTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/findVersionByIDTool.js +84 -0
- package/dist/mcp/builtin/collections/findVersionByIDTool.js.map +1 -0
- package/dist/mcp/builtin/collections/findVersionsTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/findVersionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/findVersionsTool.js +99 -0
- package/dist/mcp/builtin/collections/findVersionsTool.js.map +1 -0
- package/dist/mcp/builtin/collections/formatCollectionError.d.ts +1 -1
- package/dist/mcp/builtin/collections/formatCollectionError.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/formatCollectionError.js.map +1 -1
- package/dist/mcp/builtin/collections/getCollectionSchemaTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/getCollectionSchemaTool.js +5 -0
- package/dist/mcp/builtin/collections/getCollectionSchemaTool.js.map +1 -1
- package/dist/mcp/builtin/collections/restoreVersionTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/restoreVersionTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/restoreVersionTool.js +82 -0
- package/dist/mcp/builtin/collections/restoreVersionTool.js.map +1 -0
- package/dist/mcp/builtin/collections/updateTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/updateTool.js +2 -0
- package/dist/mcp/builtin/collections/updateTool.js.map +1 -1
- package/dist/mcp/builtin/getConfigInfoTool.d.ts.map +1 -1
- package/dist/mcp/builtin/getConfigInfoTool.js +20 -5
- package/dist/mcp/builtin/getConfigInfoTool.js.map +1 -1
- package/dist/mcp/builtin/globals/countVersionsTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/countVersionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/countVersionsTool.js +65 -0
- package/dist/mcp/builtin/globals/countVersionsTool.js.map +1 -0
- package/dist/mcp/builtin/globals/findTool.d.ts.map +1 -1
- package/dist/mcp/builtin/globals/findTool.js +2 -0
- package/dist/mcp/builtin/globals/findTool.js.map +1 -1
- package/dist/mcp/builtin/globals/findVersionByIDTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/findVersionByIDTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/findVersionByIDTool.js +80 -0
- package/dist/mcp/builtin/globals/findVersionByIDTool.js.map +1 -0
- package/dist/mcp/builtin/globals/findVersionsTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/findVersionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/findVersionsTool.js +95 -0
- package/dist/mcp/builtin/globals/findVersionsTool.js.map +1 -0
- package/dist/mcp/builtin/globals/getGlobalSchemaTool.d.ts.map +1 -1
- package/dist/mcp/builtin/globals/getGlobalSchemaTool.js +5 -0
- package/dist/mcp/builtin/globals/getGlobalSchemaTool.js.map +1 -1
- package/dist/mcp/builtin/globals/restoreVersionTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/restoreVersionTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/restoreVersionTool.js +78 -0
- package/dist/mcp/builtin/globals/restoreVersionTool.js.map +1 -0
- package/dist/mcp/builtin/globals/updateTool.d.ts.map +1 -1
- package/dist/mcp/builtin/globals/updateTool.js +2 -0
- package/dist/mcp/builtin/globals/updateTool.js.map +1 -1
- package/dist/mcp/builtinTools.d.ts +67 -2
- package/dist/mcp/builtinTools.d.ts.map +1 -1
- package/dist/mcp/builtinTools.js +64 -0
- package/dist/mcp/builtinTools.js.map +1 -1
- package/dist/mcp/sanitizeMCPConfig.d.ts +0 -1
- package/dist/mcp/sanitizeMCPConfig.d.ts.map +1 -1
- package/dist/mcp/sanitizeMCPConfig.js +44 -17
- package/dist/mcp/sanitizeMCPConfig.js.map +1 -1
- package/dist/stdio.d.ts +3 -2
- package/dist/stdio.d.ts.map +1 -1
- package/dist/stdio.js +27 -8
- package/dist/stdio.js.map +1 -1
- package/dist/types.d.ts +43 -85
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +4 -4
- package/dist/types.js.map +1 -1
- package/dist/utils/getPluginConfig.d.ts +1 -1
- package/dist/utils/getPluginConfig.js +1 -1
- package/dist/utils/getPluginConfig.js.map +1 -1
- package/package.json +10 -14
- package/src/@types/assets.d.ts +3 -0
- package/src/defaultAccess.ts +3 -0
- package/src/endpoint/access.ts +87 -112
- package/src/endpoint/index.ts +14 -1
- package/src/exports/client.ts +2 -4
- package/src/exports/internal.ts +1 -0
- package/src/index.ts +1 -58
- package/src/mcp/buildMcpServer.ts +6 -1
- package/src/mcp/builtin/collections/countTool.ts +74 -0
- package/src/mcp/builtin/collections/countVersionsTool.ts +70 -0
- package/src/mcp/builtin/collections/createTool.ts +3 -0
- package/src/mcp/builtin/collections/deleteTool.ts +3 -0
- package/src/mcp/builtin/collections/duplicateTool.ts +135 -0
- package/src/mcp/builtin/collections/findDistinctTool.ts +120 -0
- package/src/mcp/builtin/collections/findTool.ts +3 -0
- package/src/mcp/builtin/collections/findVersionByIDTool.ts +110 -0
- package/src/mcp/builtin/collections/findVersionsTool.ts +155 -0
- package/src/mcp/builtin/collections/formatCollectionError.ts +1 -1
- package/src/mcp/builtin/collections/getCollectionSchemaTool.ts +11 -0
- package/src/mcp/builtin/collections/restoreVersionTool.ts +108 -0
- package/src/mcp/builtin/collections/updateTool.ts +3 -0
- package/src/mcp/builtin/getConfigInfoTool.ts +22 -4
- package/src/mcp/builtin/globals/countVersionsTool.ts +69 -0
- package/src/mcp/builtin/globals/findTool.ts +3 -0
- package/src/mcp/builtin/globals/findVersionByIDTool.ts +104 -0
- package/src/mcp/builtin/globals/findVersionsTool.ts +148 -0
- package/src/mcp/builtin/globals/getGlobalSchemaTool.ts +6 -0
- package/src/mcp/builtin/globals/restoreVersionTool.ts +100 -0
- package/src/mcp/builtin/globals/updateTool.ts +3 -0
- package/src/mcp/builtinTools.ts +63 -4
- package/src/mcp/sanitizeMCPConfig.ts +32 -19
- package/src/stdio.ts +23 -8
- package/src/types.ts +50 -88
- package/src/utils/getPluginConfig.ts +1 -1
- package/dist/collection/getAccessField.d.ts +0 -12
- package/dist/collection/getAccessField.d.ts.map +0 -1
- package/dist/collection/getAccessField.js +0 -72
- package/dist/collection/getAccessField.js.map +0 -1
- package/dist/collection/index.d.ts +0 -6
- package/dist/collection/index.d.ts.map +0 -1
- package/dist/collection/index.js +0 -105
- package/dist/collection/index.js.map +0 -1
- package/dist/components/APIKeyField/index.client.d.ts +0 -9
- package/dist/components/APIKeyField/index.client.d.ts.map +0 -1
- package/dist/components/APIKeyField/index.client.js +0 -85
- package/dist/components/APIKeyField/index.client.js.map +0 -1
- package/dist/components/APIKeyField/index.css +0 -105
- package/dist/components/APIKeysEmptyState/index.client.d.ts +0 -4
- package/dist/components/APIKeysEmptyState/index.client.d.ts.map +0 -1
- package/dist/components/APIKeysEmptyState/index.client.js +0 -21
- package/dist/components/APIKeysEmptyState/index.client.js.map +0 -1
- package/dist/components/AccessField/index.client.d.ts +0 -10
- package/dist/components/AccessField/index.client.d.ts.map +0 -1
- package/dist/components/AccessField/index.client.js +0 -247
- package/dist/components/AccessField/index.client.js.map +0 -1
- package/dist/components/AccessField/index.css +0 -99
- package/dist/components/SettingsMenu/index.client.d.ts +0 -8
- package/dist/components/SettingsMenu/index.client.d.ts.map +0 -1
- package/dist/components/SettingsMenu/index.client.js +0 -24
- package/dist/components/SettingsMenu/index.client.js.map +0 -1
- package/dist/translations/index.d.ts +0 -11
- package/dist/translations/index.d.ts.map +0 -1
- package/dist/translations/index.js +0 -92
- package/dist/translations/index.js.map +0 -1
- package/dist/translations/languages/ar.d.ts +0 -31
- package/dist/translations/languages/ar.d.ts.map +0 -1
- package/dist/translations/languages/ar.js +0 -34
- package/dist/translations/languages/ar.js.map +0 -1
- package/dist/translations/languages/az.d.ts +0 -31
- package/dist/translations/languages/az.d.ts.map +0 -1
- package/dist/translations/languages/az.js +0 -34
- package/dist/translations/languages/az.js.map +0 -1
- package/dist/translations/languages/bg.d.ts +0 -31
- package/dist/translations/languages/bg.d.ts.map +0 -1
- package/dist/translations/languages/bg.js +0 -34
- package/dist/translations/languages/bg.js.map +0 -1
- package/dist/translations/languages/bnBd.d.ts +0 -31
- package/dist/translations/languages/bnBd.d.ts.map +0 -1
- package/dist/translations/languages/bnBd.js +0 -34
- package/dist/translations/languages/bnBd.js.map +0 -1
- package/dist/translations/languages/bnIn.d.ts +0 -31
- package/dist/translations/languages/bnIn.d.ts.map +0 -1
- package/dist/translations/languages/bnIn.js +0 -34
- package/dist/translations/languages/bnIn.js.map +0 -1
- package/dist/translations/languages/ca.d.ts +0 -31
- package/dist/translations/languages/ca.d.ts.map +0 -1
- package/dist/translations/languages/ca.js +0 -34
- package/dist/translations/languages/ca.js.map +0 -1
- package/dist/translations/languages/cs.d.ts +0 -31
- package/dist/translations/languages/cs.d.ts.map +0 -1
- package/dist/translations/languages/cs.js +0 -34
- package/dist/translations/languages/cs.js.map +0 -1
- package/dist/translations/languages/da.d.ts +0 -31
- package/dist/translations/languages/da.d.ts.map +0 -1
- package/dist/translations/languages/da.js +0 -34
- package/dist/translations/languages/da.js.map +0 -1
- package/dist/translations/languages/de.d.ts +0 -31
- package/dist/translations/languages/de.d.ts.map +0 -1
- package/dist/translations/languages/de.js +0 -34
- package/dist/translations/languages/de.js.map +0 -1
- package/dist/translations/languages/en.d.ts +0 -31
- package/dist/translations/languages/en.d.ts.map +0 -1
- package/dist/translations/languages/en.js +0 -34
- package/dist/translations/languages/en.js.map +0 -1
- package/dist/translations/languages/es.d.ts +0 -31
- package/dist/translations/languages/es.d.ts.map +0 -1
- package/dist/translations/languages/es.js +0 -34
- package/dist/translations/languages/es.js.map +0 -1
- package/dist/translations/languages/et.d.ts +0 -31
- package/dist/translations/languages/et.d.ts.map +0 -1
- package/dist/translations/languages/et.js +0 -34
- package/dist/translations/languages/et.js.map +0 -1
- package/dist/translations/languages/fa.d.ts +0 -31
- package/dist/translations/languages/fa.d.ts.map +0 -1
- package/dist/translations/languages/fa.js +0 -34
- package/dist/translations/languages/fa.js.map +0 -1
- package/dist/translations/languages/fr.d.ts +0 -31
- package/dist/translations/languages/fr.d.ts.map +0 -1
- package/dist/translations/languages/fr.js +0 -34
- package/dist/translations/languages/fr.js.map +0 -1
- package/dist/translations/languages/he.d.ts +0 -31
- package/dist/translations/languages/he.d.ts.map +0 -1
- package/dist/translations/languages/he.js +0 -34
- package/dist/translations/languages/he.js.map +0 -1
- package/dist/translations/languages/hr.d.ts +0 -31
- package/dist/translations/languages/hr.d.ts.map +0 -1
- package/dist/translations/languages/hr.js +0 -34
- package/dist/translations/languages/hr.js.map +0 -1
- package/dist/translations/languages/hu.d.ts +0 -31
- package/dist/translations/languages/hu.d.ts.map +0 -1
- package/dist/translations/languages/hu.js +0 -34
- package/dist/translations/languages/hu.js.map +0 -1
- package/dist/translations/languages/hy.d.ts +0 -31
- package/dist/translations/languages/hy.d.ts.map +0 -1
- package/dist/translations/languages/hy.js +0 -34
- package/dist/translations/languages/hy.js.map +0 -1
- package/dist/translations/languages/id.d.ts +0 -31
- package/dist/translations/languages/id.d.ts.map +0 -1
- package/dist/translations/languages/id.js +0 -34
- package/dist/translations/languages/id.js.map +0 -1
- package/dist/translations/languages/is.d.ts +0 -31
- package/dist/translations/languages/is.d.ts.map +0 -1
- package/dist/translations/languages/is.js +0 -34
- package/dist/translations/languages/is.js.map +0 -1
- package/dist/translations/languages/it.d.ts +0 -31
- package/dist/translations/languages/it.d.ts.map +0 -1
- package/dist/translations/languages/it.js +0 -34
- package/dist/translations/languages/it.js.map +0 -1
- package/dist/translations/languages/ja.d.ts +0 -31
- package/dist/translations/languages/ja.d.ts.map +0 -1
- package/dist/translations/languages/ja.js +0 -34
- package/dist/translations/languages/ja.js.map +0 -1
- package/dist/translations/languages/ko.d.ts +0 -31
- package/dist/translations/languages/ko.d.ts.map +0 -1
- package/dist/translations/languages/ko.js +0 -34
- package/dist/translations/languages/ko.js.map +0 -1
- package/dist/translations/languages/lt.d.ts +0 -31
- package/dist/translations/languages/lt.d.ts.map +0 -1
- package/dist/translations/languages/lt.js +0 -34
- package/dist/translations/languages/lt.js.map +0 -1
- package/dist/translations/languages/lv.d.ts +0 -31
- package/dist/translations/languages/lv.d.ts.map +0 -1
- package/dist/translations/languages/lv.js +0 -34
- package/dist/translations/languages/lv.js.map +0 -1
- package/dist/translations/languages/my.d.ts +0 -31
- package/dist/translations/languages/my.d.ts.map +0 -1
- package/dist/translations/languages/my.js +0 -34
- package/dist/translations/languages/my.js.map +0 -1
- package/dist/translations/languages/nb.d.ts +0 -31
- package/dist/translations/languages/nb.d.ts.map +0 -1
- package/dist/translations/languages/nb.js +0 -34
- package/dist/translations/languages/nb.js.map +0 -1
- package/dist/translations/languages/nl.d.ts +0 -31
- package/dist/translations/languages/nl.d.ts.map +0 -1
- package/dist/translations/languages/nl.js +0 -34
- package/dist/translations/languages/nl.js.map +0 -1
- package/dist/translations/languages/pl.d.ts +0 -31
- package/dist/translations/languages/pl.d.ts.map +0 -1
- package/dist/translations/languages/pl.js +0 -34
- package/dist/translations/languages/pl.js.map +0 -1
- package/dist/translations/languages/pt.d.ts +0 -31
- package/dist/translations/languages/pt.d.ts.map +0 -1
- package/dist/translations/languages/pt.js +0 -34
- package/dist/translations/languages/pt.js.map +0 -1
- package/dist/translations/languages/ro.d.ts +0 -31
- package/dist/translations/languages/ro.d.ts.map +0 -1
- package/dist/translations/languages/ro.js +0 -34
- package/dist/translations/languages/ro.js.map +0 -1
- package/dist/translations/languages/rs.d.ts +0 -31
- package/dist/translations/languages/rs.d.ts.map +0 -1
- package/dist/translations/languages/rs.js +0 -34
- package/dist/translations/languages/rs.js.map +0 -1
- package/dist/translations/languages/rsLatin.d.ts +0 -31
- package/dist/translations/languages/rsLatin.d.ts.map +0 -1
- package/dist/translations/languages/rsLatin.js +0 -34
- package/dist/translations/languages/rsLatin.js.map +0 -1
- package/dist/translations/languages/ru.d.ts +0 -31
- package/dist/translations/languages/ru.d.ts.map +0 -1
- package/dist/translations/languages/ru.js +0 -34
- package/dist/translations/languages/ru.js.map +0 -1
- package/dist/translations/languages/sk.d.ts +0 -31
- package/dist/translations/languages/sk.d.ts.map +0 -1
- package/dist/translations/languages/sk.js +0 -34
- package/dist/translations/languages/sk.js.map +0 -1
- package/dist/translations/languages/sl.d.ts +0 -31
- package/dist/translations/languages/sl.d.ts.map +0 -1
- package/dist/translations/languages/sl.js +0 -34
- package/dist/translations/languages/sl.js.map +0 -1
- package/dist/translations/languages/sv.d.ts +0 -31
- package/dist/translations/languages/sv.d.ts.map +0 -1
- package/dist/translations/languages/sv.js +0 -34
- package/dist/translations/languages/sv.js.map +0 -1
- package/dist/translations/languages/ta.d.ts +0 -31
- package/dist/translations/languages/ta.d.ts.map +0 -1
- package/dist/translations/languages/ta.js +0 -34
- package/dist/translations/languages/ta.js.map +0 -1
- package/dist/translations/languages/th.d.ts +0 -31
- package/dist/translations/languages/th.d.ts.map +0 -1
- package/dist/translations/languages/th.js +0 -34
- package/dist/translations/languages/th.js.map +0 -1
- package/dist/translations/languages/tr.d.ts +0 -31
- package/dist/translations/languages/tr.d.ts.map +0 -1
- package/dist/translations/languages/tr.js +0 -34
- package/dist/translations/languages/tr.js.map +0 -1
- package/dist/translations/languages/uk.d.ts +0 -31
- package/dist/translations/languages/uk.d.ts.map +0 -1
- package/dist/translations/languages/uk.js +0 -34
- package/dist/translations/languages/uk.js.map +0 -1
- package/dist/translations/languages/vi.d.ts +0 -31
- package/dist/translations/languages/vi.d.ts.map +0 -1
- package/dist/translations/languages/vi.js +0 -34
- package/dist/translations/languages/vi.js.map +0 -1
- package/dist/translations/languages/zh.d.ts +0 -31
- package/dist/translations/languages/zh.d.ts.map +0 -1
- package/dist/translations/languages/zh.js +0 -34
- package/dist/translations/languages/zh.js.map +0 -1
- package/dist/translations/languages/zhTw.d.ts +0 -31
- package/dist/translations/languages/zhTw.d.ts.map +0 -1
- package/dist/translations/languages/zhTw.js +0 -34
- package/dist/translations/languages/zhTw.js.map +0 -1
- package/dist/translations/types.d.ts +0 -32
- package/dist/translations/types.d.ts.map +0 -1
- package/dist/translations/types.js +0 -3
- package/dist/translations/types.js.map +0 -1
- package/src/collection/getAccessField.ts +0 -84
- package/src/collection/index.ts +0 -105
- package/src/components/APIKeyField/index.client.tsx +0 -68
- package/src/components/APIKeyField/index.css +0 -105
- package/src/components/APIKeysEmptyState/index.client.tsx +0 -33
- package/src/components/AccessField/index.client.tsx +0 -296
- package/src/components/AccessField/index.css +0 -99
- package/src/components/SettingsMenu/index.client.tsx +0 -30
- package/src/translations/index.ts +0 -105
- package/src/translations/languages/ar.ts +0 -38
- package/src/translations/languages/az.ts +0 -38
- package/src/translations/languages/bg.ts +0 -39
- package/src/translations/languages/bnBd.ts +0 -39
- package/src/translations/languages/bnIn.ts +0 -39
- package/src/translations/languages/ca.ts +0 -39
- package/src/translations/languages/cs.ts +0 -39
- package/src/translations/languages/da.ts +0 -38
- package/src/translations/languages/de.ts +0 -39
- package/src/translations/languages/en.ts +0 -39
- package/src/translations/languages/es.ts +0 -39
- package/src/translations/languages/et.ts +0 -38
- package/src/translations/languages/fa.ts +0 -39
- package/src/translations/languages/fr.ts +0 -39
- package/src/translations/languages/he.ts +0 -37
- package/src/translations/languages/hr.ts +0 -39
- package/src/translations/languages/hu.ts +0 -39
- package/src/translations/languages/hy.ts +0 -39
- package/src/translations/languages/id.ts +0 -39
- package/src/translations/languages/is.ts +0 -39
- package/src/translations/languages/it.ts +0 -39
- package/src/translations/languages/ja.ts +0 -39
- package/src/translations/languages/ko.ts +0 -39
- package/src/translations/languages/lt.ts +0 -39
- package/src/translations/languages/lv.ts +0 -38
- package/src/translations/languages/my.ts +0 -39
- package/src/translations/languages/nb.ts +0 -39
- package/src/translations/languages/nl.ts +0 -39
- package/src/translations/languages/pl.ts +0 -38
- package/src/translations/languages/pt.ts +0 -39
- package/src/translations/languages/ro.ts +0 -39
- package/src/translations/languages/rs.ts +0 -38
- package/src/translations/languages/rsLatin.ts +0 -38
- package/src/translations/languages/ru.ts +0 -39
- package/src/translations/languages/sk.ts +0 -39
- package/src/translations/languages/sl.ts +0 -38
- package/src/translations/languages/sv.ts +0 -39
- package/src/translations/languages/ta.ts +0 -39
- package/src/translations/languages/th.ts +0 -38
- package/src/translations/languages/tr.ts +0 -38
- package/src/translations/languages/uk.ts +0 -39
- package/src/translations/languages/vi.ts +0 -39
- package/src/translations/languages/zh.ts +0 -36
- package/src/translations/languages/zhTw.ts +0 -36
- package/src/translations/types.ts +0 -34
package/src/stdio.ts
CHANGED
|
@@ -6,8 +6,9 @@ import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
|
6
6
|
import { createLocalReq, getPayload } from 'payload'
|
|
7
7
|
import { findConfig } from 'payload/node'
|
|
8
8
|
|
|
9
|
-
import type {
|
|
9
|
+
import type { SanitizedMCPPluginConfig } from './types.js'
|
|
10
10
|
|
|
11
|
+
import { getAuthorizedMCP } from './endpoint/access.js'
|
|
11
12
|
import { buildMcpServer } from './mcp/buildMcpServer.js'
|
|
12
13
|
import { sanitizeMCPConfig } from './mcp/sanitizeMCPConfig.js'
|
|
13
14
|
import { getPluginConfig } from './utils/getPluginConfig.js'
|
|
@@ -16,8 +17,9 @@ import { resolveProjectRoot } from './utils/resolveProjectRoot.js'
|
|
|
16
17
|
/**
|
|
17
18
|
* Stdio adapter for the Payload MCP server.
|
|
18
19
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
20
|
+
* Pass PAYLOAD_MCP_AUTHORIZATION when stdio should authenticate with the same
|
|
21
|
+
* Payload auth header as HTTP. In development, PAYLOAD_MCP_OVERRIDE_ACCESS=true
|
|
22
|
+
* skips access control for local setup.
|
|
21
23
|
*/
|
|
22
24
|
export const runMcpStdio = async (): Promise<void> => {
|
|
23
25
|
/**
|
|
@@ -62,14 +64,27 @@ export const runMcpStdio = async (): Promise<void> => {
|
|
|
62
64
|
;(payload.config.plugins ??= []).push(fakePluginFn)
|
|
63
65
|
}
|
|
64
66
|
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
const overrideAccessEnv = process.env.PAYLOAD_MCP_OVERRIDE_ACCESS
|
|
68
|
+
let overrideAccess = false
|
|
69
|
+
|
|
70
|
+
if (overrideAccessEnv === 'true') {
|
|
71
|
+
overrideAccess = true
|
|
72
|
+
} else if (overrideAccessEnv && overrideAccessEnv !== 'false') {
|
|
73
|
+
throw new Error('PAYLOAD_MCP_OVERRIDE_ACCESS must be "true" or "false".')
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (overrideAccess && process.env.NODE_ENV !== 'development') {
|
|
77
|
+
throw new Error('PAYLOAD_MCP_OVERRIDE_ACCESS is only available in development.')
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const headers = new Headers()
|
|
81
|
+
if (process.env.PAYLOAD_MCP_AUTHORIZATION) {
|
|
82
|
+
headers.set('Authorization', process.env.PAYLOAD_MCP_AUTHORIZATION)
|
|
69
83
|
}
|
|
70
84
|
|
|
71
|
-
const req = await createLocalReq({}, payload)
|
|
85
|
+
const req = await createLocalReq({ req: { headers } }, payload)
|
|
72
86
|
req.payloadAPI = 'MCP' as const
|
|
87
|
+
const authorizedMCP = await getAuthorizedMCP({ overrideAccess, req })
|
|
73
88
|
|
|
74
89
|
const server = buildMcpServer({ authorizedMCP, pluginConfig, req })
|
|
75
90
|
|
package/src/types.ts
CHANGED
|
@@ -10,15 +10,15 @@ import type {
|
|
|
10
10
|
} from '@modelcontextprotocol/server'
|
|
11
11
|
import type {
|
|
12
12
|
AuthCollectionSlug,
|
|
13
|
-
CollectionConfig,
|
|
14
13
|
CollectionSlug,
|
|
15
|
-
DefaultDocumentIDType,
|
|
16
14
|
GlobalSlug,
|
|
17
15
|
MaybePromise,
|
|
18
16
|
PayloadRequest,
|
|
17
|
+
SanitizedPermissions,
|
|
19
18
|
TypedUser,
|
|
20
19
|
} from 'payload'
|
|
21
20
|
|
|
21
|
+
import type { GetAuthorizedMCPArgs } from './endpoint/access.js'
|
|
22
22
|
import type {
|
|
23
23
|
MCPCollectionAuthToolName,
|
|
24
24
|
MCPCollectionBuiltinName,
|
|
@@ -36,27 +36,6 @@ export type { JsonSchemaType, StandardSchemaWithJSON, ToolAnnotations }
|
|
|
36
36
|
*/
|
|
37
37
|
export type ToolInputSchema = JsonSchemaType | StandardSchemaWithJSON
|
|
38
38
|
|
|
39
|
-
/**
|
|
40
|
-
* Serializable mirror of `SanitizedMCPPluginConfig` for client components —
|
|
41
|
-
* the full sanitized config carries functions (tool handlers, etc.) that can't
|
|
42
|
-
* cross the server→client boundary. Built by `sanitizeClientPluginConfig` and
|
|
43
|
-
* passed to the `AccessField` component via `clientProps`.
|
|
44
|
-
*
|
|
45
|
-
* @internal
|
|
46
|
-
*/
|
|
47
|
-
export type ClientMCPPluginConfig = {
|
|
48
|
-
items: Array<{
|
|
49
|
-
collectionSlug?: string
|
|
50
|
-
configKey: string
|
|
51
|
-
description?: string
|
|
52
|
-
globalSlug?: string
|
|
53
|
-
/** Admin-UI bucket for collection/global tools: built-in CRUD, auth, or custom. */
|
|
54
|
-
group?: 'auth' | 'custom' | 'operations'
|
|
55
|
-
label: string
|
|
56
|
-
type: 'collectionTool' | 'globalTool' | 'prompt' | 'resource' | 'tool'
|
|
57
|
-
}>
|
|
58
|
-
}
|
|
59
|
-
|
|
60
39
|
export type MCPToolResponse = {
|
|
61
40
|
content: ContentBlock[]
|
|
62
41
|
/**
|
|
@@ -83,6 +62,19 @@ export type TypedInput<TSchema> = TSchema extends StandardSchemaWithJSON
|
|
|
83
62
|
: StandardSchemaWithJSON.InferOutput<TSchema>
|
|
84
63
|
: Record<string, unknown>
|
|
85
64
|
|
|
65
|
+
export type MCPAccessArgs = {
|
|
66
|
+
permissions?: SanitizedPermissions
|
|
67
|
+
req: PayloadRequest
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export type CollectionMCPAccessArgs = {
|
|
71
|
+
collectionSlug: CollectionSlug
|
|
72
|
+
} & MCPAccessArgs
|
|
73
|
+
|
|
74
|
+
export type GlobalMCPAccessArgs = {
|
|
75
|
+
globalSlug: GlobalSlug
|
|
76
|
+
} & MCPAccessArgs
|
|
77
|
+
|
|
86
78
|
export type ToolHandlerArgs<TSchema = undefined> = {
|
|
87
79
|
authorizedMCP: AuthorizedMCP
|
|
88
80
|
input: TypedInput<TSchema>
|
|
@@ -99,6 +91,7 @@ export type GlobalToolHandlerArgs<TSchema = undefined> = {
|
|
|
99
91
|
} & ToolHandlerArgs<TSchema>
|
|
100
92
|
|
|
101
93
|
export type Tool<TSchema extends ToolInputSchema | undefined = ToolInputSchema | undefined> = {
|
|
94
|
+
access?: (args: MCPAccessArgs) => MaybePromise<boolean>
|
|
102
95
|
annotations?: ToolAnnotations
|
|
103
96
|
description: string
|
|
104
97
|
handler: (args: ToolHandlerArgs<TSchema>) => MaybePromise<MCPToolResponse>
|
|
@@ -112,12 +105,14 @@ export type Tool<TSchema extends ToolInputSchema | undefined = ToolInputSchema |
|
|
|
112
105
|
export type CollectionTool<
|
|
113
106
|
TSchema extends ToolInputSchema | undefined = ToolInputSchema | undefined,
|
|
114
107
|
> = {
|
|
108
|
+
access?: (args: CollectionMCPAccessArgs) => MaybePromise<boolean>
|
|
115
109
|
handler: (args: CollectionToolHandlerArgs<TSchema>) => MaybePromise<MCPToolResponse>
|
|
116
110
|
input?: TSchema
|
|
117
111
|
} & Pick<Tool, 'annotations' | 'description' | 'overrideResponse'>
|
|
118
112
|
|
|
119
113
|
export type GlobalTool<TSchema extends ToolInputSchema | undefined = ToolInputSchema | undefined> =
|
|
120
114
|
{
|
|
115
|
+
access?: (args: GlobalMCPAccessArgs) => MaybePromise<boolean>
|
|
121
116
|
handler: (args: GlobalToolHandlerArgs<TSchema>) => MaybePromise<MCPToolResponse>
|
|
122
117
|
input?: TSchema
|
|
123
118
|
} & Pick<Tool, 'annotations' | 'description' | 'overrideResponse'>
|
|
@@ -127,7 +122,16 @@ export type GlobalTool<TSchema extends ToolInputSchema | undefined = ToolInputSc
|
|
|
127
122
|
* `handler?: never` prevents a full `CollectionTool`/`GlobalTool` (which has a
|
|
128
123
|
* required handler) from being silently accepted at a built-in key slot.
|
|
129
124
|
*/
|
|
130
|
-
export type
|
|
125
|
+
export type MCPBuiltInCollectionToolOverride = {
|
|
126
|
+
access?: (args: CollectionMCPAccessArgs) => MaybePromise<boolean>
|
|
127
|
+
annotations?: ToolAnnotations
|
|
128
|
+
description?: string
|
|
129
|
+
handler?: never
|
|
130
|
+
overrideResponse?: MCPResponseOverride
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export type MCPBuiltInGlobalToolOverride = {
|
|
134
|
+
access?: (args: GlobalMCPAccessArgs) => MaybePromise<boolean>
|
|
131
135
|
annotations?: ToolAnnotations
|
|
132
136
|
description?: string
|
|
133
137
|
handler?: never
|
|
@@ -142,13 +146,13 @@ export type MCPBuiltInToolOverride = {
|
|
|
142
146
|
export type MCPTopLevelToolEntry = Tool
|
|
143
147
|
|
|
144
148
|
export type MCPCollectionToolsMap = {
|
|
145
|
-
[customToolName: string]: boolean | CollectionTool |
|
|
149
|
+
[customToolName: string]: boolean | CollectionTool | MCPBuiltInCollectionToolOverride | undefined
|
|
146
150
|
} & {
|
|
147
|
-
[K in MCPCollectionBuiltinName]?: false |
|
|
151
|
+
[K in MCPCollectionBuiltinName]?: false | MCPBuiltInCollectionToolOverride
|
|
148
152
|
}
|
|
149
153
|
|
|
150
154
|
export type MCPAuthCollectionToolsMap = {
|
|
151
|
-
[K in MCPCollectionAuthToolName]?:
|
|
155
|
+
[K in MCPCollectionAuthToolName]?: MCPBuiltInCollectionToolOverride | true
|
|
152
156
|
} & MCPCollectionToolsMap
|
|
153
157
|
|
|
154
158
|
/** Auth-enabled collections get auth-tool name autocomplete; others get CRUD-only. */
|
|
@@ -157,9 +161,9 @@ export type MCPToolsMapForCollection<Slug extends CollectionSlug> = Slug extends
|
|
|
157
161
|
: MCPCollectionToolsMap
|
|
158
162
|
|
|
159
163
|
export type MCPGlobalToolsMap = {
|
|
160
|
-
[customToolName: string]: boolean | GlobalTool |
|
|
164
|
+
[customToolName: string]: boolean | GlobalTool | MCPBuiltInGlobalToolOverride | undefined
|
|
161
165
|
} & {
|
|
162
|
-
[K in MCPGlobalBuiltinName]?: false |
|
|
166
|
+
[K in MCPGlobalBuiltinName]?: false | MCPBuiltInGlobalToolOverride
|
|
163
167
|
}
|
|
164
168
|
|
|
165
169
|
export type MCPTopLevelToolsMap = Record<string, Tool>
|
|
@@ -171,6 +175,7 @@ export type PromptHandlerArgs<TSchema = undefined> = {
|
|
|
171
175
|
}
|
|
172
176
|
|
|
173
177
|
export type Prompt<TSchema extends ToolInputSchema = ToolInputSchema> = {
|
|
178
|
+
access?: (args: MCPAccessArgs) => MaybePromise<boolean>
|
|
174
179
|
argsSchema: TSchema
|
|
175
180
|
description: string
|
|
176
181
|
handler: (args: PromptHandlerArgs<TSchema>) => MaybePromise<{
|
|
@@ -188,6 +193,7 @@ export type ResourceHandlerArgs = {
|
|
|
188
193
|
}
|
|
189
194
|
|
|
190
195
|
export type Resource = {
|
|
196
|
+
access?: (args: MCPAccessArgs) => MaybePromise<boolean>
|
|
191
197
|
description: string
|
|
192
198
|
handler: (args: ResourceHandlerArgs) => MaybePromise<{
|
|
193
199
|
contents: Array<{ text: string; uri: string }>
|
|
@@ -221,7 +227,7 @@ export type MCPPluginConfig = {
|
|
|
221
227
|
collections?: {
|
|
222
228
|
[Slug in CollectionSlug]?: MCPPluginCollectionConfig<Slug>
|
|
223
229
|
}
|
|
224
|
-
/** Skip MCP registration.
|
|
230
|
+
/** Skip MCP endpoint registration. */
|
|
225
231
|
disabled?: boolean
|
|
226
232
|
globals?: {
|
|
227
233
|
[Slug in GlobalSlug]?: MCPPluginGlobalConfig
|
|
@@ -230,25 +236,21 @@ export type MCPPluginConfig = {
|
|
|
230
236
|
serverOptions?: MCPServerOptions
|
|
231
237
|
verboseLogs?: boolean
|
|
232
238
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
req: PayloadRequest
|
|
240
|
-
}) => MaybePromise<AuthorizedMCP>
|
|
239
|
+
/** Replace the default MCP authorization resolver. */
|
|
240
|
+
overrideGetAuthorizedMCP?: (
|
|
241
|
+
args: {
|
|
242
|
+
pluginConfig: SanitizedMCPPluginConfig
|
|
243
|
+
} & GetAuthorizedMCPArgs,
|
|
244
|
+
) => MaybePromise<AuthorizedMCP>
|
|
241
245
|
prompts?: Record<string, Prompt>
|
|
242
246
|
resources?: Record<string, Resource>
|
|
243
247
|
/** Cross-cutting tools (not scoped to any collection or global). */
|
|
244
248
|
tools?: MCPTopLevelToolsMap
|
|
245
|
-
userCollection?: CollectionSlug
|
|
246
249
|
}
|
|
247
250
|
|
|
248
251
|
export type SanitizedMCPPluginConfig = {
|
|
249
252
|
items: MCPItem[]
|
|
250
|
-
|
|
251
|
-
} & Pick<MCPPluginConfig, 'disabled' | 'mcp' | 'overrideApiKeyCollection' | 'overrideAuth'>
|
|
253
|
+
} & Pick<MCPPluginConfig, 'disabled' | 'mcp' | 'overrideGetAuthorizedMCP'>
|
|
252
254
|
|
|
253
255
|
export type MCPServerOptions = {
|
|
254
256
|
options?: ConstructorParameters<typeof McpServer>[1]
|
|
@@ -256,52 +258,12 @@ export type MCPServerOptions = {
|
|
|
256
258
|
}
|
|
257
259
|
|
|
258
260
|
/**
|
|
259
|
-
*
|
|
260
|
-
* A `false` leaf disables that tool; missing keys defer to
|
|
261
|
-
* defaults (built-in CRUD is on, opt-in tools are off).
|
|
262
|
-
*/
|
|
263
|
-
export type MCPAPIKeysDocAccessTree = {
|
|
264
|
-
collections?: {
|
|
265
|
-
[CollectionSlug: CollectionSlug]: {
|
|
266
|
-
[ToolKey: string]: boolean
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
globals?: {
|
|
270
|
-
[GlobalSlug: GlobalSlug]: {
|
|
271
|
-
[ToolKey: string]: boolean
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
prompts?: {
|
|
275
|
-
[PromptKey: string]: boolean
|
|
276
|
-
}
|
|
277
|
-
resources?: {
|
|
278
|
-
[ResourceKey: string]: boolean
|
|
279
|
-
}
|
|
280
|
-
tools?: {
|
|
281
|
-
[ToolKey: string]: boolean
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Stored on `payload-mcp-api-keys` docs
|
|
287
|
-
*/
|
|
288
|
-
export type MCPAPIKeysDoc = {
|
|
289
|
-
access: MCPAPIKeysDocAccessTree
|
|
290
|
-
apiKey?: string
|
|
291
|
-
apiKeyIndex?: string
|
|
292
|
-
id: DefaultDocumentIDType
|
|
293
|
-
lastUsed?: string
|
|
294
|
-
overrideAccess?: boolean
|
|
295
|
-
user: null | TypedUser
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* One MCP primitive plus the metadata needed for access checks, admin UI, and
|
|
261
|
+
* One MCP primitive plus the metadata needed for config-driven filtering and
|
|
300
262
|
* registration.
|
|
301
263
|
*
|
|
302
|
-
* - `configKey`: the config
|
|
264
|
+
* - `configKey`: the config identifier, e.g. `find` or `echo`.
|
|
303
265
|
* - `mcpName`: the MCP wire name, e.g. `findDocuments` or `echo`.
|
|
304
|
-
* - `label`: human-readable
|
|
266
|
+
* - `label`: human-readable display text.
|
|
305
267
|
*/
|
|
306
268
|
export type MCPItemBase = {
|
|
307
269
|
configKey: string
|
|
@@ -338,10 +300,10 @@ export type MCPItem =
|
|
|
338
300
|
| GlobalMCPItem
|
|
339
301
|
|
|
340
302
|
/**
|
|
341
|
-
* The caller's identity + the MCP items
|
|
342
|
-
*
|
|
343
|
-
* receive this via `args.authorizedMCP` so
|
|
344
|
-
* `localAPIDefaults(authorizedMCP)` into every local API call.
|
|
303
|
+
* The caller's identity + the MCP items authorized for this request. Disabled
|
|
304
|
+
* items and items blocked by access callbacks or Payload operation access are
|
|
305
|
+
* absent from `items`. Tool handlers receive this via `args.authorizedMCP` so
|
|
306
|
+
* they can spread `localAPIDefaults(authorizedMCP)` into every local API call.
|
|
345
307
|
*/
|
|
346
308
|
export type AuthorizedMCP = {
|
|
347
309
|
items: MCPItem[]
|
|
@@ -5,7 +5,7 @@ import type { SanitizedMCPPluginConfig } from '../types.js'
|
|
|
5
5
|
/**
|
|
6
6
|
* Returns the sanitized plugin config — the form produced by
|
|
7
7
|
* `sanitizeMCPConfig` and stashed back on the plugin's `options` during init.
|
|
8
|
-
* Callers downstream of plugin init can rely on `items
|
|
8
|
+
* Callers downstream of plugin init can rely on `items` and other defaults
|
|
9
9
|
* being fully resolved.
|
|
10
10
|
*/
|
|
11
11
|
export const getPluginConfig: (args: { config: SanitizedConfig }) => SanitizedMCPPluginConfig = ({
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { JSONField } from 'payload';
|
|
2
|
-
import type { SanitizedMCPPluginConfig } from '../types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Returns the API key collection's `access` field — a JSON field whose value
|
|
5
|
-
* is the `MCPAPIKeysDocAccessTree` the endpoint consults. The actual UI is
|
|
6
|
-
* a custom client component (`AccessField`) which renders a permissions
|
|
7
|
-
* matrix; the field's stored shape is just the runtime access tree.
|
|
8
|
-
*/
|
|
9
|
-
export declare const getAccessField: ({ pluginConfig, }: {
|
|
10
|
-
pluginConfig: SanitizedMCPPluginConfig;
|
|
11
|
-
}) => JSONField;
|
|
12
|
-
//# sourceMappingURL=getAccessField.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getAccessField.d.ts","sourceRoot":"","sources":["../../src/collection/getAccessField.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAExC,OAAO,KAAK,EAAkC,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAQ3F;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,mBAE5B;IACD,YAAY,EAAE,wBAAwB,CAAA;CACvC,KAAG,SAiBH,CAAA"}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { COLLECTION_AUTH_BUILTINS, COLLECTION_BUILTINS, GLOBAL_BUILTINS } from '../mcp/builtinTools.js';
|
|
2
|
-
/**
|
|
3
|
-
* Returns the API key collection's `access` field — a JSON field whose value
|
|
4
|
-
* is the `MCPAPIKeysDocAccessTree` the endpoint consults. The actual UI is
|
|
5
|
-
* a custom client component (`AccessField`) which renders a permissions
|
|
6
|
-
* matrix; the field's stored shape is just the runtime access tree.
|
|
7
|
-
*/ export const getAccessField = ({ pluginConfig })=>{
|
|
8
|
-
const clientPluginConfig = sanitizeClientPluginConfig(pluginConfig);
|
|
9
|
-
return {
|
|
10
|
-
name: 'access',
|
|
11
|
-
type: 'json',
|
|
12
|
-
admin: {
|
|
13
|
-
components: {
|
|
14
|
-
Field: {
|
|
15
|
-
clientProps: {
|
|
16
|
-
pluginConfig: clientPluginConfig
|
|
17
|
-
},
|
|
18
|
-
path: '@payloadcms/plugin-mcp/client#AccessField'
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
defaultValue: {},
|
|
23
|
-
label: false
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Strips the non-serializable parts of `SanitizedMCPPluginConfig` (handlers,
|
|
28
|
-
* input/argsSchema functions, etc.) so the result is safe to thread to a
|
|
29
|
-
* client component via `clientProps`.
|
|
30
|
-
*/ const sanitizeClientPluginConfig = (pluginConfig)=>({
|
|
31
|
-
items: pluginConfig.items.map((item)=>{
|
|
32
|
-
const group = itemGroup(item);
|
|
33
|
-
return {
|
|
34
|
-
...item.type === 'collectionTool' ? {
|
|
35
|
-
collectionSlug: item.collectionSlug
|
|
36
|
-
} : {},
|
|
37
|
-
...item.type === 'globalTool' ? {
|
|
38
|
-
globalSlug: item.globalSlug
|
|
39
|
-
} : {},
|
|
40
|
-
type: item.type,
|
|
41
|
-
configKey: item.configKey,
|
|
42
|
-
...group === 'operations' ? {} : {
|
|
43
|
-
description: itemDescription(item)
|
|
44
|
-
},
|
|
45
|
-
group,
|
|
46
|
-
label: item.label
|
|
47
|
-
};
|
|
48
|
-
})
|
|
49
|
-
});
|
|
50
|
-
const itemDescription = (item)=>{
|
|
51
|
-
if (item.type === 'prompt') {
|
|
52
|
-
return item.prompt.description;
|
|
53
|
-
}
|
|
54
|
-
if (item.type === 'resource') {
|
|
55
|
-
return item.resource.description;
|
|
56
|
-
}
|
|
57
|
-
return item.tool.description;
|
|
58
|
-
};
|
|
59
|
-
const itemGroup = (item)=>{
|
|
60
|
-
if (item.type === 'collectionTool') {
|
|
61
|
-
if (item.configKey in COLLECTION_BUILTINS) {
|
|
62
|
-
return 'operations';
|
|
63
|
-
}
|
|
64
|
-
return item.configKey in COLLECTION_AUTH_BUILTINS ? 'auth' : 'custom';
|
|
65
|
-
}
|
|
66
|
-
if (item.type === 'globalTool') {
|
|
67
|
-
return item.configKey in GLOBAL_BUILTINS ? 'operations' : 'custom';
|
|
68
|
-
}
|
|
69
|
-
return undefined;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
//# sourceMappingURL=getAccessField.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/collection/getAccessField.ts"],"sourcesContent":["import type { JSONField } from 'payload'\n\nimport type { ClientMCPPluginConfig, MCPItem, SanitizedMCPPluginConfig } from '../types.js'\n\nimport {\n COLLECTION_AUTH_BUILTINS,\n COLLECTION_BUILTINS,\n GLOBAL_BUILTINS,\n} from '../mcp/builtinTools.js'\n\n/**\n * Returns the API key collection's `access` field — a JSON field whose value\n * is the `MCPAPIKeysDocAccessTree` the endpoint consults. The actual UI is\n * a custom client component (`AccessField`) which renders a permissions\n * matrix; the field's stored shape is just the runtime access tree.\n */\nexport const getAccessField = ({\n pluginConfig,\n}: {\n pluginConfig: SanitizedMCPPluginConfig\n}): JSONField => {\n const clientPluginConfig = sanitizeClientPluginConfig(pluginConfig)\n\n return {\n name: 'access',\n type: 'json',\n admin: {\n components: {\n Field: {\n clientProps: { pluginConfig: clientPluginConfig },\n path: '@payloadcms/plugin-mcp/client#AccessField',\n },\n },\n },\n defaultValue: {},\n label: false,\n }\n}\n\n/**\n * Strips the non-serializable parts of `SanitizedMCPPluginConfig` (handlers,\n * input/argsSchema functions, etc.) so the result is safe to thread to a\n * client component via `clientProps`.\n */\nconst sanitizeClientPluginConfig = (\n pluginConfig: SanitizedMCPPluginConfig,\n): ClientMCPPluginConfig => ({\n items: pluginConfig.items.map((item) => {\n const group = itemGroup(item)\n\n return {\n ...(item.type === 'collectionTool' ? { collectionSlug: item.collectionSlug } : {}),\n ...(item.type === 'globalTool' ? { globalSlug: item.globalSlug } : {}),\n type: item.type,\n configKey: item.configKey,\n ...(group === 'operations' ? {} : { description: itemDescription(item) }),\n group,\n label: item.label,\n }\n }),\n})\n\nconst itemDescription = (item: MCPItem): string => {\n if (item.type === 'prompt') {\n return item.prompt.description\n }\n if (item.type === 'resource') {\n return item.resource.description\n }\n return item.tool.description\n}\n\nconst itemGroup = (item: MCPItem): 'auth' | 'custom' | 'operations' | undefined => {\n if (item.type === 'collectionTool') {\n if (item.configKey in COLLECTION_BUILTINS) {\n return 'operations'\n }\n return item.configKey in COLLECTION_AUTH_BUILTINS ? 'auth' : 'custom'\n }\n if (item.type === 'globalTool') {\n return item.configKey in GLOBAL_BUILTINS ? 'operations' : 'custom'\n }\n return undefined\n}\n"],"names":["COLLECTION_AUTH_BUILTINS","COLLECTION_BUILTINS","GLOBAL_BUILTINS","getAccessField","pluginConfig","clientPluginConfig","sanitizeClientPluginConfig","name","type","admin","components","Field","clientProps","path","defaultValue","label","items","map","item","group","itemGroup","collectionSlug","globalSlug","configKey","description","itemDescription","prompt","resource","tool","undefined"],"mappings":"AAIA,SACEA,wBAAwB,EACxBC,mBAAmB,EACnBC,eAAe,QACV,yBAAwB;AAE/B;;;;;CAKC,GACD,OAAO,MAAMC,iBAAiB,CAAC,EAC7BC,YAAY,EAGb;IACC,MAAMC,qBAAqBC,2BAA2BF;IAEtD,OAAO;QACLG,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,YAAY;gBACVC,OAAO;oBACLC,aAAa;wBAAER,cAAcC;oBAAmB;oBAChDQ,MAAM;gBACR;YACF;QACF;QACAC,cAAc,CAAC;QACfC,OAAO;IACT;AACF,EAAC;AAED;;;;CAIC,GACD,MAAMT,6BAA6B,CACjCF,eAC2B,CAAA;QAC3BY,OAAOZ,aAAaY,KAAK,CAACC,GAAG,CAAC,CAACC;YAC7B,MAAMC,QAAQC,UAAUF;YAExB,OAAO;gBACL,GAAIA,KAAKV,IAAI,KAAK,mBAAmB;oBAAEa,gBAAgBH,KAAKG,cAAc;gBAAC,IAAI,CAAC,CAAC;gBACjF,GAAIH,KAAKV,IAAI,KAAK,eAAe;oBAAEc,YAAYJ,KAAKI,UAAU;gBAAC,IAAI,CAAC,CAAC;gBACrEd,MAAMU,KAAKV,IAAI;gBACfe,WAAWL,KAAKK,SAAS;gBACzB,GAAIJ,UAAU,eAAe,CAAC,IAAI;oBAAEK,aAAaC,gBAAgBP;gBAAM,CAAC;gBACxEC;gBACAJ,OAAOG,KAAKH,KAAK;YACnB;QACF;IACF,CAAA;AAEA,MAAMU,kBAAkB,CAACP;IACvB,IAAIA,KAAKV,IAAI,KAAK,UAAU;QAC1B,OAAOU,KAAKQ,MAAM,CAACF,WAAW;IAChC;IACA,IAAIN,KAAKV,IAAI,KAAK,YAAY;QAC5B,OAAOU,KAAKS,QAAQ,CAACH,WAAW;IAClC;IACA,OAAON,KAAKU,IAAI,CAACJ,WAAW;AAC9B;AAEA,MAAMJ,YAAY,CAACF;IACjB,IAAIA,KAAKV,IAAI,KAAK,kBAAkB;QAClC,IAAIU,KAAKK,SAAS,IAAItB,qBAAqB;YACzC,OAAO;QACT;QACA,OAAOiB,KAAKK,SAAS,IAAIvB,2BAA2B,SAAS;IAC/D;IACA,IAAIkB,KAAKV,IAAI,KAAK,cAAc;QAC9B,OAAOU,KAAKK,SAAS,IAAIrB,kBAAkB,eAAe;IAC5D;IACA,OAAO2B;AACT"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { CollectionConfig } from 'payload';
|
|
2
|
-
import type { SanitizedMCPPluginConfig } from '../types.js';
|
|
3
|
-
export declare const getAPIKeysCollection: ({ pluginConfig, }: {
|
|
4
|
-
pluginConfig: SanitizedMCPPluginConfig;
|
|
5
|
-
}) => CollectionConfig;
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/collection/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAI/C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAkB3D,eAAO,MAAM,oBAAoB,GAAI,mBAElC;IACD,YAAY,EAAE,wBAAwB,CAAA;CACvC,KAAG,gBA8EH,CAAA"}
|
package/dist/collection/index.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { createAPIKeyFields } from 'payload';
|
|
2
|
-
import { getAccessField } from './getAccessField.js';
|
|
3
|
-
const apiKeyStorageFields = createAPIKeyFields({
|
|
4
|
-
apiKeyField: {
|
|
5
|
-
admin: {
|
|
6
|
-
components: {
|
|
7
|
-
Field: '@payloadcms/plugin-mcp/client#APIKeyField'
|
|
8
|
-
}
|
|
9
|
-
},
|
|
10
|
-
required: true
|
|
11
|
-
},
|
|
12
|
-
apiKeyIndexField: {
|
|
13
|
-
index: true,
|
|
14
|
-
required: true
|
|
15
|
-
},
|
|
16
|
-
includeEnableAPIKey: false
|
|
17
|
-
});
|
|
18
|
-
export const getAPIKeysCollection = ({ pluginConfig })=>{
|
|
19
|
-
const collection = {
|
|
20
|
-
slug: 'payload-mcp-api-keys',
|
|
21
|
-
admin: {
|
|
22
|
-
components: {
|
|
23
|
-
views: {
|
|
24
|
-
list: {
|
|
25
|
-
NoResults: '@payloadcms/plugin-mcp/client#APIKeysEmptyState'
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
defaultColumns: [
|
|
30
|
-
'label',
|
|
31
|
-
'lastUsed',
|
|
32
|
-
'user'
|
|
33
|
-
],
|
|
34
|
-
// Kept out of the main nav — reachable through the user menu's settings instead.
|
|
35
|
-
group: false,
|
|
36
|
-
useAsTitle: 'label'
|
|
37
|
-
},
|
|
38
|
-
fields: [
|
|
39
|
-
...apiKeyStorageFields,
|
|
40
|
-
getAccessField({
|
|
41
|
-
pluginConfig
|
|
42
|
-
}),
|
|
43
|
-
{
|
|
44
|
-
name: 'label',
|
|
45
|
-
type: 'text',
|
|
46
|
-
admin: {
|
|
47
|
-
description: ({ t })=>t('plugin-mcp:titleDescription'),
|
|
48
|
-
position: 'sidebar'
|
|
49
|
-
},
|
|
50
|
-
label: ({ t })=>t('plugin-mcp:title')
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
name: 'description',
|
|
54
|
-
type: 'text',
|
|
55
|
-
admin: {
|
|
56
|
-
description: ({ t })=>t('plugin-mcp:descriptionDescription'),
|
|
57
|
-
position: 'sidebar'
|
|
58
|
-
},
|
|
59
|
-
label: ({ t })=>t('plugin-mcp:description')
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
name: 'lastUsed',
|
|
63
|
-
type: 'date',
|
|
64
|
-
admin: {
|
|
65
|
-
date: {
|
|
66
|
-
pickerAppearance: 'dayAndTime'
|
|
67
|
-
},
|
|
68
|
-
disabled: {
|
|
69
|
-
field: true
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
label: ({ t })=>t('plugin-mcp:lastUsed')
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
name: 'user',
|
|
76
|
-
type: 'relationship',
|
|
77
|
-
admin: {
|
|
78
|
-
description: ({ t })=>t('plugin-mcp:userDescription'),
|
|
79
|
-
position: 'sidebar'
|
|
80
|
-
},
|
|
81
|
-
label: ({ t })=>t('general:user'),
|
|
82
|
-
relationTo: pluginConfig.userCollection,
|
|
83
|
-
required: true
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
name: 'overrideAccess',
|
|
87
|
-
type: 'checkbox',
|
|
88
|
-
admin: {
|
|
89
|
-
description: ({ t })=>t('plugin-mcp:overrideAccessDescription'),
|
|
90
|
-
position: 'sidebar'
|
|
91
|
-
},
|
|
92
|
-
defaultValue: false,
|
|
93
|
-
label: ({ t })=>t('plugin-mcp:overrideAccess')
|
|
94
|
-
}
|
|
95
|
-
],
|
|
96
|
-
labels: {
|
|
97
|
-
plural: ({ t })=>`${t('plugin-mcp:mcp')} ${t('plugin-mcp:apiKeys')}`,
|
|
98
|
-
singular: ({ t })=>`${t('plugin-mcp:mcp')} ${t('authentication:apiKey')}`
|
|
99
|
-
},
|
|
100
|
-
versions: false
|
|
101
|
-
};
|
|
102
|
-
return pluginConfig.overrideApiKeyCollection ? pluginConfig.overrideApiKeyCollection(collection) : collection;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/collection/index.ts"],"sourcesContent":["import type { CollectionConfig } from 'payload'\n\nimport { createAPIKeyFields } from 'payload'\n\nimport type { SanitizedMCPPluginConfig } from '../types.js'\n\nimport { getAccessField } from './getAccessField.js'\n\nconst apiKeyStorageFields = createAPIKeyFields({\n apiKeyField: {\n admin: {\n components: { Field: '@payloadcms/plugin-mcp/client#APIKeyField' },\n },\n required: true,\n },\n apiKeyIndexField: {\n index: true,\n required: true,\n },\n includeEnableAPIKey: false,\n})\n\nexport const getAPIKeysCollection = ({\n pluginConfig,\n}: {\n pluginConfig: SanitizedMCPPluginConfig\n}): CollectionConfig => {\n const collection: CollectionConfig = {\n slug: 'payload-mcp-api-keys',\n admin: {\n components: {\n views: {\n list: {\n NoResults: '@payloadcms/plugin-mcp/client#APIKeysEmptyState',\n },\n },\n },\n defaultColumns: ['label', 'lastUsed', 'user'],\n // Kept out of the main nav — reachable through the user menu's settings instead.\n group: false,\n useAsTitle: 'label',\n },\n fields: [\n ...apiKeyStorageFields,\n getAccessField({ pluginConfig }),\n {\n name: 'label',\n type: 'text',\n admin: {\n description: ({ t }) => t('plugin-mcp:titleDescription'),\n position: 'sidebar',\n },\n label: ({ t }) => t('plugin-mcp:title'),\n },\n {\n name: 'description',\n type: 'text',\n admin: {\n description: ({ t }) => t('plugin-mcp:descriptionDescription'),\n position: 'sidebar',\n },\n label: ({ t }) => t('plugin-mcp:description'),\n },\n {\n name: 'lastUsed',\n type: 'date',\n admin: {\n date: { pickerAppearance: 'dayAndTime' },\n disabled: { field: true },\n },\n label: ({ t }) => t('plugin-mcp:lastUsed'),\n },\n {\n name: 'user',\n type: 'relationship',\n admin: {\n description: ({ t }) => t('plugin-mcp:userDescription'),\n position: 'sidebar',\n },\n label: ({ t }) => t('general:user'),\n relationTo: pluginConfig.userCollection,\n required: true,\n },\n {\n name: 'overrideAccess',\n type: 'checkbox',\n admin: {\n description: ({ t }) => t('plugin-mcp:overrideAccessDescription'),\n position: 'sidebar',\n },\n defaultValue: false,\n label: ({ t }) => t('plugin-mcp:overrideAccess'),\n },\n ],\n labels: {\n plural: ({ t }) => `${t('plugin-mcp:mcp')} ${t('plugin-mcp:apiKeys')}`,\n singular: ({ t }) => `${t('plugin-mcp:mcp')} ${t('authentication:apiKey')}`,\n },\n versions: false,\n }\n\n return pluginConfig.overrideApiKeyCollection\n ? pluginConfig.overrideApiKeyCollection(collection)\n : collection\n}\n"],"names":["createAPIKeyFields","getAccessField","apiKeyStorageFields","apiKeyField","admin","components","Field","required","apiKeyIndexField","index","includeEnableAPIKey","getAPIKeysCollection","pluginConfig","collection","slug","views","list","NoResults","defaultColumns","group","useAsTitle","fields","name","type","description","t","position","label","date","pickerAppearance","disabled","field","relationTo","userCollection","defaultValue","labels","plural","singular","versions","overrideApiKeyCollection"],"mappings":"AAEA,SAASA,kBAAkB,QAAQ,UAAS;AAI5C,SAASC,cAAc,QAAQ,sBAAqB;AAEpD,MAAMC,sBAAsBF,mBAAmB;IAC7CG,aAAa;QACXC,OAAO;YACLC,YAAY;gBAAEC,OAAO;YAA4C;QACnE;QACAC,UAAU;IACZ;IACAC,kBAAkB;QAChBC,OAAO;QACPF,UAAU;IACZ;IACAG,qBAAqB;AACvB;AAEA,OAAO,MAAMC,uBAAuB,CAAC,EACnCC,YAAY,EAGb;IACC,MAAMC,aAA+B;QACnCC,MAAM;QACNV,OAAO;YACLC,YAAY;gBACVU,OAAO;oBACLC,MAAM;wBACJC,WAAW;oBACb;gBACF;YACF;YACAC,gBAAgB;gBAAC;gBAAS;gBAAY;aAAO;YAC7C,iFAAiF;YACjFC,OAAO;YACPC,YAAY;QACd;QACAC,QAAQ;eACHnB;YACHD,eAAe;gBAAEW;YAAa;YAC9B;gBACEU,MAAM;gBACNC,MAAM;gBACNnB,OAAO;oBACLoB,aAAa,CAAC,EAAEC,CAAC,EAAE,GAAKA,EAAE;oBAC1BC,UAAU;gBACZ;gBACAC,OAAO,CAAC,EAAEF,CAAC,EAAE,GAAKA,EAAE;YACtB;YACA;gBACEH,MAAM;gBACNC,MAAM;gBACNnB,OAAO;oBACLoB,aAAa,CAAC,EAAEC,CAAC,EAAE,GAAKA,EAAE;oBAC1BC,UAAU;gBACZ;gBACAC,OAAO,CAAC,EAAEF,CAAC,EAAE,GAAKA,EAAE;YACtB;YACA;gBACEH,MAAM;gBACNC,MAAM;gBACNnB,OAAO;oBACLwB,MAAM;wBAAEC,kBAAkB;oBAAa;oBACvCC,UAAU;wBAAEC,OAAO;oBAAK;gBAC1B;gBACAJ,OAAO,CAAC,EAAEF,CAAC,EAAE,GAAKA,EAAE;YACtB;YACA;gBACEH,MAAM;gBACNC,MAAM;gBACNnB,OAAO;oBACLoB,aAAa,CAAC,EAAEC,CAAC,EAAE,GAAKA,EAAE;oBAC1BC,UAAU;gBACZ;gBACAC,OAAO,CAAC,EAAEF,CAAC,EAAE,GAAKA,EAAE;gBACpBO,YAAYpB,aAAaqB,cAAc;gBACvC1B,UAAU;YACZ;YACA;gBACEe,MAAM;gBACNC,MAAM;gBACNnB,OAAO;oBACLoB,aAAa,CAAC,EAAEC,CAAC,EAAE,GAAKA,EAAE;oBAC1BC,UAAU;gBACZ;gBACAQ,cAAc;gBACdP,OAAO,CAAC,EAAEF,CAAC,EAAE,GAAKA,EAAE;YACtB;SACD;QACDU,QAAQ;YACNC,QAAQ,CAAC,EAAEX,CAAC,EAAE,GAAK,GAAGA,EAAE,kBAAkB,CAAC,EAAEA,EAAE,uBAAuB;YACtEY,UAAU,CAAC,EAAEZ,CAAC,EAAE,GAAK,GAAGA,EAAE,kBAAkB,CAAC,EAAEA,EAAE,0BAA0B;QAC7E;QACAa,UAAU;IACZ;IAEA,OAAO1B,aAAa2B,wBAAwB,GACxC3B,aAAa2B,wBAAwB,CAAC1B,cACtCA;AACN,EAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import './index.css';
|
|
3
|
-
/**
|
|
4
|
-
* Custom component for the MCP API-keys collection's `apiKey` field:
|
|
5
|
-
* - no key yet: a "Generate new key" button
|
|
6
|
-
* - key set: a dismissible privacy warning + the shared masked-key input
|
|
7
|
-
*/
|
|
8
|
-
export declare const APIKeyField: React.FC;
|
|
9
|
-
//# sourceMappingURL=index.client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../src/components/APIKeyField/index.client.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAIvC,OAAO,aAAa,CAAA;AAIpB;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAmD/B,CAAA"}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { APIKeyInput, Button, useField, useTranslation, WarningTriangleIcon } from '@payloadcms/ui';
|
|
4
|
-
import React, { useState } from 'react';
|
|
5
|
-
import './index.css';
|
|
6
|
-
const baseClass = 'mcp-api-key-field';
|
|
7
|
-
/**
|
|
8
|
-
* Custom component for the MCP API-keys collection's `apiKey` field:
|
|
9
|
-
* - no key yet: a "Generate new key" button
|
|
10
|
-
* - key set: a dismissible privacy warning + the shared masked-key input
|
|
11
|
-
*/ export const APIKeyField = ()=>{
|
|
12
|
-
const { setValue: setApiKey, value: apiKey } = useField({
|
|
13
|
-
path: 'apiKey'
|
|
14
|
-
});
|
|
15
|
-
const { t } = useTranslation();
|
|
16
|
-
const [isWarningDismissed, setIsWarningDismissed] = useState(false);
|
|
17
|
-
const generateKey = ()=>{
|
|
18
|
-
setApiKey(crypto.randomUUID());
|
|
19
|
-
setIsWarningDismissed(false);
|
|
20
|
-
};
|
|
21
|
-
return /*#__PURE__*/ _jsxs("div", {
|
|
22
|
-
className: baseClass,
|
|
23
|
-
children: [
|
|
24
|
-
/*#__PURE__*/ _jsx("p", {
|
|
25
|
-
className: `${baseClass}__description`,
|
|
26
|
-
children: t('plugin-mcp:apiKeyDescription')
|
|
27
|
-
}),
|
|
28
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
29
|
-
className: `${baseClass}__panel`,
|
|
30
|
-
children: [
|
|
31
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
32
|
-
className: `${baseClass}__header`,
|
|
33
|
-
children: [
|
|
34
|
-
/*#__PURE__*/ _jsx("span", {
|
|
35
|
-
className: `${baseClass}__title`,
|
|
36
|
-
children: t('authentication:apiKey')
|
|
37
|
-
}),
|
|
38
|
-
!apiKey && /*#__PURE__*/ _jsx(Button, {
|
|
39
|
-
buttonStyle: "primary",
|
|
40
|
-
className: `${baseClass}__generate`,
|
|
41
|
-
onClick: generateKey,
|
|
42
|
-
children: t('authentication:generateNewAPIKey')
|
|
43
|
-
})
|
|
44
|
-
]
|
|
45
|
-
}),
|
|
46
|
-
Boolean(apiKey) && /*#__PURE__*/ _jsxs("div", {
|
|
47
|
-
className: `${baseClass}__body`,
|
|
48
|
-
children: [
|
|
49
|
-
!isWarningDismissed && /*#__PURE__*/ _jsxs("div", {
|
|
50
|
-
className: `${baseClass}__warning`,
|
|
51
|
-
children: [
|
|
52
|
-
/*#__PURE__*/ _jsx(WarningTriangleIcon, {
|
|
53
|
-
className: `${baseClass}__warning-icon`
|
|
54
|
-
}),
|
|
55
|
-
/*#__PURE__*/ _jsxs("p", {
|
|
56
|
-
className: `${baseClass}__warning-text`,
|
|
57
|
-
children: [
|
|
58
|
-
/*#__PURE__*/ _jsx("strong", {
|
|
59
|
-
children: t('plugin-mcp:keepKeyPrivate')
|
|
60
|
-
}),
|
|
61
|
-
` ${t('plugin-mcp:keyPrivateDescription')}`
|
|
62
|
-
]
|
|
63
|
-
}),
|
|
64
|
-
/*#__PURE__*/ _jsx("button", {
|
|
65
|
-
"aria-label": t('plugin-mcp:dismiss'),
|
|
66
|
-
className: `${baseClass}__warning-dismiss`,
|
|
67
|
-
onClick: ()=>setIsWarningDismissed(true),
|
|
68
|
-
type: "button",
|
|
69
|
-
children: "×"
|
|
70
|
-
})
|
|
71
|
-
]
|
|
72
|
-
}),
|
|
73
|
-
/*#__PURE__*/ _jsx(APIKeyInput, {
|
|
74
|
-
"aria-label": t('authentication:apiKey'),
|
|
75
|
-
value: apiKey
|
|
76
|
-
})
|
|
77
|
-
]
|
|
78
|
-
})
|
|
79
|
-
]
|
|
80
|
-
})
|
|
81
|
-
]
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
//# sourceMappingURL=index.client.js.map
|