@frogbotai/plugin-mcp 0.36.0 → 0.37.0
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/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +32 -27
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MCPPluginConfig } from '@payloadcms/plugin-mcp';
|
|
2
|
-
import type
|
|
2
|
+
import { type Plugin } from 'frogbot';
|
|
3
3
|
import type { AUTH_TOOLS, COLLECTION_TOOLS, McpTool } from './tools.js';
|
|
4
4
|
export type { McpTool } from './tools.js';
|
|
5
5
|
export { definePrompt } from '@payloadcms/plugin-mcp';
|
|
@@ -16,5 +16,10 @@ export type McpPluginOptions = Pick<MCPPluginConfig, 'disabled' | 'hooks' | 'mcp
|
|
|
16
16
|
/** FrogBot tools, piece actions and piece instances to serve, each named by its slug. */
|
|
17
17
|
tools?: readonly McpTool[];
|
|
18
18
|
};
|
|
19
|
+
declare module 'frogbot' {
|
|
20
|
+
interface RegisteredPlugins {
|
|
21
|
+
'plugin-mcp': McpPluginOptions;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
19
24
|
export declare function mcpPlugin(options?: McpPluginOptions): Plugin;
|
|
20
25
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAgB,KAAK,MAAM,EAAE,M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import { definePlugin } from 'frogbot';
|
|
3
4
|
import { authorizeMcp } from './access.js';
|
|
4
5
|
import { toPayloadTools } from './tools.js';
|
|
5
6
|
export { definePrompt } from '@payloadcms/plugin-mcp';
|
|
6
7
|
export function mcpPlugin(options = {}) {
|
|
7
8
|
const { tools = [], ...rest } = options;
|
|
8
9
|
const payloadTools = toPayloadTools(tools);
|
|
9
|
-
return (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
return definePlugin({
|
|
11
|
+
slug: 'plugin-mcp',
|
|
12
|
+
order: 10,
|
|
13
|
+
plugin: ({ config, plugins })=>{
|
|
14
|
+
const apiKeys = plugins['plugin-api-keys'];
|
|
15
|
+
if (!apiKeys) {
|
|
16
|
+
throw new Error('[plugin-mcp] mcpPlugin needs apiKeysPlugin(). Add apiKeysPlugin() to plugins.');
|
|
17
|
+
}
|
|
18
|
+
const { authCollection } = apiKeys.options;
|
|
19
|
+
const auth = config.collections.find((collection)=>collection.slug === authCollection)?.auth;
|
|
20
|
+
const strategy = (typeof auth === 'object' ? auth.strategies ?? [] : []).find(isApiKeyStrategy);
|
|
21
|
+
if (!strategy) {
|
|
22
|
+
throw new Error(`[plugin-mcp] The API key strategy is missing from '${authCollection}'.`);
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
...config,
|
|
26
|
+
_payloadPlugins: [
|
|
27
|
+
...config._payloadPlugins ?? [],
|
|
28
|
+
payloadMcpPlugin({
|
|
29
|
+
...rest,
|
|
30
|
+
tools: payloadTools,
|
|
31
|
+
overrideGetAuthorizedMCP: ({ pluginConfig, req })=>authorizeMcp({
|
|
32
|
+
collection: authCollection,
|
|
33
|
+
strategy,
|
|
34
|
+
pluginConfig,
|
|
35
|
+
req
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
]
|
|
39
|
+
};
|
|
19
40
|
}
|
|
20
|
-
|
|
21
|
-
...config,
|
|
22
|
-
_payloadPlugins: [
|
|
23
|
-
...config._payloadPlugins ?? [],
|
|
24
|
-
payloadMcpPlugin({
|
|
25
|
-
...rest,
|
|
26
|
-
tools: payloadTools,
|
|
27
|
-
overrideGetAuthorizedMCP: ({ pluginConfig, req })=>authorizeMcp({
|
|
28
|
-
collection: apiKeyStrategy.collection,
|
|
29
|
-
strategy: apiKeyStrategy.strategy,
|
|
30
|
-
pluginConfig,
|
|
31
|
-
req
|
|
32
|
-
})
|
|
33
|
-
})
|
|
34
|
-
]
|
|
35
|
-
};
|
|
36
|
-
};
|
|
41
|
+
})(options);
|
|
37
42
|
}
|
|
38
43
|
|
|
39
44
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":["isApiKeyStrategy","mcpPlugin","payloadMcpPlugin","authorizeMcp","toPayloadTools","definePrompt","options","tools","rest","payloadTools","
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["isApiKeyStrategy","mcpPlugin","payloadMcpPlugin","definePlugin","authorizeMcp","toPayloadTools","definePrompt","options","tools","rest","payloadTools","slug","order","plugin","config","plugins","apiKeys","Error","authCollection","auth","collections","find","collection","strategy","strategies","_payloadPlugins","overrideGetAuthorizedMCP","pluginConfig","req"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,6BAA6B;AAE9D,SAASC,aAAaC,gBAAgB,QAAQ,yBAAyB;AACvE,SAASC,YAAY,QAAqB,UAAU;AAEpD,SAASC,YAAY,QAAQ,cAAc;AAE3C,SAASC,cAAc,QAAQ,aAAa;AAG5C,SAASC,YAAY,QAAQ,yBAAyB;AA4BtD,OAAO,SAASL,UAAUM,UAA4B,CAAC,CAAC;IACtD,MAAM,EAAEC,QAAQ,EAAE,EAAE,GAAGC,MAAM,GAAGF;IAChC,MAAMG,eAAeL,eAAeG;IAEpC,OAAOL,aAA+B;QACpCQ,MAAM;QACNC,OAAO;QACPC,QAAQ,CAAC,EAAEC,MAAM,EAAEC,OAAO,EAAE;YAC1B,MAAMC,UAAUD,OAAO,CAAC,kBAAkB;YAE1C,IAAI,CAACC,SAAS;gBACZ,MAAM,IAAIC,MACR;YAEJ;YAEA,MAAM,EAAEC,cAAc,EAAE,GAAGF,QAAQT,OAAO;YAC1C,MAAMY,OAAOL,OAAOM,WAAW,CAACC,IAAI,CAClC,CAACC,aAAeA,WAAWX,IAAI,KAAKO,iBACnCC;YAEH,MAAMI,WAAW,AAAC,CAAA,OAAOJ,SAAS,WAAYA,KAAKK,UAAU,IAAI,EAAE,GAAI,EAAE,AAAD,EAAGH,IAAI,CAC7ErB;YAGF,IAAI,CAACuB,UAAU;gBACb,MAAM,IAAIN,MAAM,CAAC,mDAAmD,EAAEC,eAAe,EAAE,CAAC;YAC1F;YAEA,OAAO;gBACL,GAAGJ,MAAM;gBACTW,iBAAiB;uBACXX,OAAOW,eAAe,IAAI,EAAE;oBAChCvB,iBAAiB;wBACf,GAAGO,IAAI;wBACPD,OAAOE;wBACPgB,0BAA0B,CAAC,EAAEC,YAAY,EAAEC,GAAG,EAAE,GAC9CxB,aAAa;gCACXkB,YAAYJ;gCACZK;gCACAI;gCACAC;4BACF;oBACJ;iBACD;YACH;QACF;IACF,GAAGrB;AACL","file":"index.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frogbotai/plugin-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"description": "Payload MCP integration for FrogBot.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Colby Gilbert",
|
|
@@ -27,19 +27,19 @@
|
|
|
27
27
|
"node": ">=24.21.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@payloadcms/plugin-mcp": "4.0.0-beta.
|
|
30
|
+
"@payloadcms/plugin-mcp": "4.0.0-beta.5"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"payload": "4.0.0-beta.
|
|
34
|
-
"
|
|
35
|
-
"
|
|
33
|
+
"payload": "4.0.0-beta.5",
|
|
34
|
+
"@frogbotai/plugin-api-keys": "0.37.0",
|
|
35
|
+
"frogbot": "0.37.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"payload": "4.0.0-beta.
|
|
38
|
+
"payload": "4.0.0-beta.5",
|
|
39
39
|
"typescript": "6.0.3",
|
|
40
|
-
"@frogbotai/plugin-api-keys": "0.
|
|
41
|
-
"@frogbotai/plugin-roles": "0.
|
|
42
|
-
"frogbot": "0.
|
|
40
|
+
"@frogbotai/plugin-api-keys": "0.37.0",
|
|
41
|
+
"@frogbotai/plugin-roles": "0.37.0",
|
|
42
|
+
"frogbot": "0.37.0"
|
|
43
43
|
},
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|