@easy-cms/plugin-mcp 0.43.0 → 0.45.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 +2 -2
- package/dist/index.js +5 -5
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EasyCMS, AuthUser, Plugin } from '@easy-cms/core';
|
|
1
|
+
import { EasyCMS, AuthUser, RequestContext, Plugin } from '@easy-cms/core';
|
|
2
2
|
|
|
3
3
|
/** A JSON Schema, as MCP tools describe their input. */
|
|
4
4
|
type JsonSchema = Record<string, unknown>;
|
|
@@ -20,7 +20,7 @@ interface ToolOptions {
|
|
|
20
20
|
* The tools a user (normally an API key) may use: one per collection or global and operation,
|
|
21
21
|
* only where the key allows it. Access rules are applied again on every call.
|
|
22
22
|
*/
|
|
23
|
-
declare function buildTools(cms: EasyCMS, user: AuthUser, options?: ToolOptions): Tool[];
|
|
23
|
+
declare function buildTools(cms: EasyCMS, user: AuthUser, options?: ToolOptions, context?: RequestContext): Tool[];
|
|
24
24
|
|
|
25
25
|
interface McpPluginOptions extends ToolOptions {
|
|
26
26
|
/** Path under the REST API. Default `/mcp`, so the server is at `/api/cms/mcp`. */
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprot
|
|
|
10
10
|
// src/info.ts
|
|
11
11
|
var INFO = {
|
|
12
12
|
name: "@easy-cms/plugin-mcp",
|
|
13
|
-
...true ? { version: "0.
|
|
13
|
+
...true ? { version: "0.45.0" } : {}
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
// src/tools.ts
|
|
@@ -187,8 +187,8 @@ var obj = (properties, required = []) => ({
|
|
|
187
187
|
...required.length ? { required } : {},
|
|
188
188
|
additionalProperties: false
|
|
189
189
|
});
|
|
190
|
-
function buildTools(cms, user, options = {}) {
|
|
191
|
-
const access = { user, overrideAccess: false };
|
|
190
|
+
function buildTools(cms, user, options = {}, context = {}) {
|
|
191
|
+
const access = { user, context, overrideAccess: false };
|
|
192
192
|
const may = (target, op) => keyAllows(user, target, op);
|
|
193
193
|
const tools = [];
|
|
194
194
|
const locale = localeProp(cms);
|
|
@@ -392,14 +392,14 @@ function mcpPlugin(options = {}) {
|
|
|
392
392
|
const endpoint = {
|
|
393
393
|
path: options.path ?? "/mcp",
|
|
394
394
|
method: "post",
|
|
395
|
-
handler: async ({ request, user, cms }) => {
|
|
395
|
+
handler: async ({ request, user, context, cms }) => {
|
|
396
396
|
if (!user?.apiKey) {
|
|
397
397
|
return Response.json(
|
|
398
398
|
{ errors: [{ message: "Connect with an API key: Authorization: Bearer ecms_\u2026" }] },
|
|
399
399
|
{ status: 401, headers: { "www-authenticate": "Bearer" } }
|
|
400
400
|
);
|
|
401
401
|
}
|
|
402
|
-
const tools = buildTools(cms, user, options);
|
|
402
|
+
const tools = buildTools(cms, user, options, context);
|
|
403
403
|
const server = new Server(
|
|
404
404
|
{ name: options.name ?? "easy-cms", version: "1.0.0" },
|
|
405
405
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easy-cms/plugin-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.0",
|
|
4
4
|
"description": "MCP server for Easy CMS: let AI assistants read and write content with API keys",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"@modelcontextprotocol/sdk": "^1.30.1"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"@easy-cms/core": "^0.
|
|
22
|
+
"@easy-cms/core": "^0.45.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@easy-cms/
|
|
26
|
-
"@easy-cms/
|
|
25
|
+
"@easy-cms/db-sqlite": "^0.45.0",
|
|
26
|
+
"@easy-cms/core": "^0.45.0"
|
|
27
27
|
},
|
|
28
28
|
"engines": {
|
|
29
29
|
"node": ">=22.12"
|