@upassist/neos-mcp 2.4.0 → 2.5.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/CHANGELOG.md +13 -0
- package/README.md +3 -2
- package/dist/index.js +9 -9
- package/package.json +2 -2
- package/src/tools/createContentNode.ts +1 -1
- package/src/tools/createDocumentNode.ts +1 -1
- package/src/tools/getDocumentProperties.ts +1 -1
- package/src/tools/getPageContent.ts +1 -1
- package/src/tools/getSiteContext.ts +1 -0
- package/src/tools/listNodeTypes.ts +3 -1
- package/src/tools/listPages.ts +1 -1
- package/src/tools/updateNodeProperty.ts +6 -2
- package/src/types.ts +14 -0
- package/test/referenceValues.test.ts +85 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [2.5.0](https://github.com/UpAssist/neos-mcp-client/compare/2.4.0...2.5.0) (2026-11-12)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* describe references in the tool descriptions ([2a0aedb](https://github.com/UpAssist/neos-mcp-client/commit/2a0aedbd3ad7503f0d62a9da27fbf06fa3f2f544)), closes [UpAssist/neos-mcp#14](https://github.com/UpAssist/neos-mcp/issues/14)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* allow an empty list for references in the types ([af7ed4c](https://github.com/UpAssist/neos-mcp-client/commit/af7ed4c4c29538316ce3a7992a8017e37c901e51))
|
|
16
|
+
* run the tests with a glob so npm test works on Node 22 and newer ([#8](https://github.com/UpAssist/neos-mcp-client/issues/8)) ([6a17c1c](https://github.com/UpAssist/neos-mcp-client/commit/6a17c1c89b7b7835397497e732f46feac3b6c91b)), closes [#7](https://github.com/UpAssist/neos-mcp-client/issues/7)
|
|
17
|
+
|
|
5
18
|
## [2.4.0](https://github.com/UpAssist/neos-mcp-client/compare/2.3.0...2.4.0) (2026-11-02)
|
|
6
19
|
|
|
7
20
|
|
package/README.md
CHANGED
|
@@ -9,9 +9,9 @@ This is the client-side component. It runs locally on your machine and translate
|
|
|
9
9
|
| MCP Server version | Bridge version | Neos CMS | Node.js |
|
|
10
10
|
|-------------------|------------------------|----------|---------|
|
|
11
11
|
| 2.x (`main`) | upassist/neos-mcp 1.x or 2.x | 8.3+ / 9.0+ | 18+ |
|
|
12
|
-
| 1.x (`neos-8
|
|
12
|
+
| 1.x (`neos-8`, no longer maintained) | upassist/neos-mcp 1.x | 8.3+ | 18+ |
|
|
13
13
|
|
|
14
|
-
> **v2 auto-detects** the bridge API version. A single MCP server v2 works with both Neos 8 and Neos 9 bridges.
|
|
14
|
+
> **v2 auto-detects** the bridge API version. A single MCP server v2 works with both Neos 8 and Neos 9 bridges. **Use v2 for Neos 8 as well:** all new client features (`neos_upload_asset`, multi-site, content dimensions) only land in v2 and are not backported to 1.x. What each feature needs from the bridge is listed below.
|
|
15
15
|
|
|
16
16
|
> **Multi-site** (`neos_list_sites` and the `site` parameter) needs a bridge with multi-site support (see the [bridge README](https://github.com/UpAssist/neos-mcp#multi-site): upassist/neos-mcp **2.3+** for Neos 9, **1.2+** for Neos 8). Older bridges ignore `site` and always work on the default site; `neos_list_sites` fails with a 404 there. To avoid publishing every site by accident, `neos_publish_changes` with `site` first checks that the bridge supports multi-site and refuses to publish otherwise.
|
|
17
17
|
|
|
@@ -154,6 +154,7 @@ Property values are passed to the bridge unchanged and resolved there against th
|
|
|
154
154
|
|
|
155
155
|
- Image/asset properties: the asset `identifier` (e.g. from `neos_list_assets` or `neos_upload_asset`).
|
|
156
156
|
- Link properties (`Neos\Neos\Domain\Link\Link`, edited with the LinkEditor): a URI string such as `node://<nodeAggregateId>`, `asset://<id>` or `https://…`, or an object `{ "href": "…", "title": "…", "target": "_blank" }`. An empty string clears the link. A `node://` target must exist in the workspace, otherwise the bridge rejects the write. Needs a Neos 9 bridge with Link property support (see the [bridge README](https://github.com/UpAssist/neos-mcp#property-resolution)).
|
|
157
|
+
- References (for example selected brands or a contact person): write a `nodeAggregateId` for a `reference` and an array of them for `references`; the array replaces the previous list, in that order. An empty value clears them. On Neos 9 references are no node properties: `neos_list_node_types` and `neos_get_site_context` list them per node type under `references` with `type`, `label` and `targetNodeTypes`, and `neos_list_pages`, `neos_get_page_content` and `neos_get_document_properties` show the current targets under `references`. This needs bridge 2.5.0 or later, which also rejects unknown targets and targets of another node type; setting references works with every Neos 9 bridge since 2.3.0. On Neos 8 references are regular properties of type `reference`/`references`, and there is no separate `references` block.
|
|
157
158
|
|
|
158
159
|
### Media
|
|
159
160
|
|
package/dist/index.js
CHANGED
|
@@ -21066,7 +21066,7 @@ async function callBridge(action, method, params = {}) {
|
|
|
21066
21066
|
function registerGetSiteContext(server) {
|
|
21067
21067
|
server.tool(
|
|
21068
21068
|
"neos_get_site_context",
|
|
21069
|
-
'Get the site context: site name, available content NodeTypes with their properties, current page tree, and editorial workflow instructions. Always call this first at the start of any Neos content editing session. On a multi-site instance "sites" lists all sites; pass "site" to get the context of another site than the default one. The "dimensions" in the result list the content dimensions (for example language or country) with their default and fallback chains; pass "dimensions" to the other tools to work in one of them.',
|
|
21069
|
+
'Get the site context: site name, available content NodeTypes with their properties, current page tree, and editorial workflow instructions. Always call this first at the start of any Neos content editing session. On a multi-site instance "sites" lists all sites; pass "site" to get the context of another site than the default one. Neos 9: each node type also lists its "references" to other nodes, see neos_list_node_types. The "dimensions" in the result list the content dimensions (for example language or country) with their default and fallback chains; pass "dimensions" to the other tools to work in one of them.',
|
|
21070
21070
|
{
|
|
21071
21071
|
site: external_exports.string().optional().describe("Site node name (see neos_list_sites). Defaults to the default site of the instance.")
|
|
21072
21072
|
},
|
|
@@ -21142,7 +21142,7 @@ async function dimensionsParam(dimensions, key = "dimensions") {
|
|
|
21142
21142
|
function registerListPages(server) {
|
|
21143
21143
|
server.tool(
|
|
21144
21144
|
"neos_list_pages",
|
|
21145
|
-
|
|
21145
|
+
'List all document nodes (pages) in the Neos CMS site as a flat tree with paths and titles. Neos 9: each page also lists its "references" (nodeAggregateIds of the referenced nodes).',
|
|
21146
21146
|
{
|
|
21147
21147
|
workspace: external_exports.string().default("mcp").describe('Workspace name. Use "live" for published content, "mcp" for staged changes.'),
|
|
21148
21148
|
site: external_exports.string().optional().describe("Site node name (see neos_list_sites). Defaults to the default site of the instance."),
|
|
@@ -21159,7 +21159,7 @@ function registerListPages(server) {
|
|
|
21159
21159
|
function registerGetPageContent(server) {
|
|
21160
21160
|
server.tool(
|
|
21161
21161
|
"neos_get_page_content",
|
|
21162
|
-
|
|
21162
|
+
'Get all content nodes on a specific page with their properties. Neos 9: each node also lists its "references" (nodeAggregateIds of the referenced nodes, in the format neos_update_node_property accepts). Call neos_get_site_context first if you have not already done so this session.',
|
|
21163
21163
|
{
|
|
21164
21164
|
node_id: external_exports.string().describe("Node identifier \u2014 use the nodeAggregateId (Neos 9) or path (Neos 8) from neos_get_site_context / neos_list_pages"),
|
|
21165
21165
|
workspace: external_exports.string().default("mcp").describe("Workspace name"),
|
|
@@ -21176,7 +21176,7 @@ function registerGetPageContent(server) {
|
|
|
21176
21176
|
function registerGetDocumentProperties(server) {
|
|
21177
21177
|
server.tool(
|
|
21178
21178
|
"neos_get_document_properties",
|
|
21179
|
-
|
|
21179
|
+
`Get all properties of a document node (page) without its content nodes. Use this for SEO fields, meta data, and other document-level properties. Neos 9: the document's "references" (nodeAggregateIds of the referenced nodes) are listed next to "properties".`,
|
|
21180
21180
|
{
|
|
21181
21181
|
node_id: external_exports.string().describe("Node identifier \u2014 use the nodeAggregateId (Neos 9) or path (Neos 8) from neos_get_site_context / neos_list_pages"),
|
|
21182
21182
|
workspace: external_exports.string().default("mcp").describe('Workspace name. Use "live" for published content, "mcp" for staged changes.'),
|
|
@@ -21193,7 +21193,7 @@ function registerGetDocumentProperties(server) {
|
|
|
21193
21193
|
function registerListNodeTypes(server) {
|
|
21194
21194
|
server.tool(
|
|
21195
21195
|
"neos_list_node_types",
|
|
21196
|
-
|
|
21196
|
+
'List available content node types with their property schemas. Useful to know which types and properties are available before creating or updating nodes. Neos 9: references to other nodes (for example selected brands or a contact person) are listed separately under "references", each with "type" ("reference" for one node, "references" for several), "label" and "targetNodeTypes" (the node types that can be referenced, null if any node can). In Neos 8 references are regular properties of type "reference"/"references".',
|
|
21197
21197
|
{
|
|
21198
21198
|
filter: external_exports.enum(["content", "document", "all"]).default("content").describe(
|
|
21199
21199
|
'"content" for content elements, "document" for page types, "all" for everything'
|
|
@@ -21253,7 +21253,7 @@ function registerCreateContentNode(server) {
|
|
|
21253
21253
|
"Node type name, e.g. UpAssist.Site:Content.Headline"
|
|
21254
21254
|
),
|
|
21255
21255
|
properties: external_exports.record(external_exports.unknown()).default({}).describe(
|
|
21256
|
-
"Property key-value pairs to set on the new node. Use neos_list_node_types to see available properties. Values are resolved like in neos_update_node_property (asset identifiers, link URIs or { href, \u2026 } objects)."
|
|
21256
|
+
"Property key-value pairs to set on the new node. Use neos_list_node_types to see available properties. Values are resolved like in neos_update_node_property (asset identifiers, link URIs or { href, \u2026 } objects, nodeAggregateIds for references)."
|
|
21257
21257
|
),
|
|
21258
21258
|
workspace: external_exports.string().default("mcp").describe("Draft workspace name"),
|
|
21259
21259
|
dimensions: dimensionsSchema("The content is created in these dimensions; the parent has to exist there.")
|
|
@@ -21280,9 +21280,9 @@ function registerUpdateNodeProperty(server) {
|
|
|
21280
21280
|
node_id: external_exports.string().describe(
|
|
21281
21281
|
"Node identifier \u2014 use nodeAggregateId (Neos 9) or contextPath/path (Neos 8)"
|
|
21282
21282
|
),
|
|
21283
|
-
property: external_exports.string().describe("Property name to update"),
|
|
21283
|
+
property: external_exports.string().describe("Property or reference name to update"),
|
|
21284
21284
|
value: external_exports.unknown().describe(
|
|
21285
|
-
|
|
21285
|
+
`New property value (string, number, boolean, or object). Image/asset properties: the asset identifier. Link properties (type Neos\\Neos\\Domain\\Link\\Link): a URI string such as "node://<nodeAggregateId>", "asset://<id>" or "https://\u2026", or an object { href, title?, target?, rel?, download? }; an empty string clears the link. A node:// target must exist in the workspace (check with neos_list_pages), otherwise the write is rejected. References (Neos 9: listed under "references" of the node type in neos_list_node_types, not under "properties"): a nodeAggregateId for type "reference", an array of nodeAggregateIds for type "references" (the complete new list in the desired order, it replaces the old one); an empty string or empty array clears them. Every target must exist in the workspace and be of one of the reference's "targetNodeTypes" (if set), otherwise the write is rejected. The current targets are shown under "references" in neos_get_page_content / neos_get_document_properties.`
|
|
21286
21286
|
),
|
|
21287
21287
|
workspace: external_exports.string().default("mcp").describe("Workspace to write to"),
|
|
21288
21288
|
dimensions: dimensionsSchema("The property is changed in exactly these dimensions; a node that only exists in another dimension is refused, create a variant first with neos_create_node_variant.")
|
|
@@ -21361,7 +21361,7 @@ function registerCreateDocumentNode(server) {
|
|
|
21361
21361
|
"Document node type name, e.g. UpAssist.Site:Document.Page"
|
|
21362
21362
|
),
|
|
21363
21363
|
properties: external_exports.record(external_exports.unknown()).default({}).describe(
|
|
21364
|
-
'Property key-value pairs, e.g. { title: "About us", uriPathSegment: "about-us" }. Values are resolved like in neos_update_node_property (asset identifiers, link URIs or { href, \u2026 } objects).'
|
|
21364
|
+
'Property key-value pairs, e.g. { title: "About us", uriPathSegment: "about-us" }. Values are resolved like in neos_update_node_property (asset identifiers, link URIs or { href, \u2026 } objects, nodeAggregateIds for references).'
|
|
21365
21365
|
),
|
|
21366
21366
|
workspace: external_exports.string().default("mcp").describe("Draft workspace name"),
|
|
21367
21367
|
node_name: external_exports.string().optional().describe(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@upassist/neos-mcp",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "MCP server for Neos CMS — connects AI assistants to any UpAssist.Neos.Mcp bridge",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"release:minor": "npx standard-version -t '' -r minor && npm publish --access public && git push --follow-tags",
|
|
18
18
|
"release:major": "npx standard-version -t '' -r major && npm publish --access public && git push --follow-tags",
|
|
19
19
|
"release": "yarn release:patch",
|
|
20
|
-
"test": "esbuild test/*.test.ts --bundle --platform=node --format=esm --target=node20 --outdir=.test-build --out-extension:.js=.mjs --packages=external && node --test .test-build
|
|
20
|
+
"test": "esbuild test/*.test.ts --bundle --platform=node --format=esm --target=node20 --outdir=.test-build --out-extension:.js=.mjs --packages=external && node --test .test-build/*.mjs"
|
|
21
21
|
},
|
|
22
22
|
"engines": {
|
|
23
23
|
"node": ">=18.0.0"
|
|
@@ -16,7 +16,7 @@ export function registerCreateContentNode(server: McpServer): void {
|
|
|
16
16
|
),
|
|
17
17
|
properties: z.record(z.unknown()).default({}).describe(
|
|
18
18
|
'Property key-value pairs to set on the new node. Use neos_list_node_types to see available properties. ' +
|
|
19
|
-
'Values are resolved like in neos_update_node_property (asset identifiers, link URIs or { href, … } objects).'
|
|
19
|
+
'Values are resolved like in neos_update_node_property (asset identifiers, link URIs or { href, … } objects, nodeAggregateIds for references).'
|
|
20
20
|
),
|
|
21
21
|
workspace: z.string().default('mcp').describe('Draft workspace name'),
|
|
22
22
|
dimensions: dimensionsSchema('The content is created in these dimensions; the parent has to exist there.'),
|
|
@@ -18,7 +18,7 @@ export function registerCreateDocumentNode(server: McpServer): void {
|
|
|
18
18
|
),
|
|
19
19
|
properties: z.record(z.unknown()).default({}).describe(
|
|
20
20
|
'Property key-value pairs, e.g. { title: "About us", uriPathSegment: "about-us" }. ' +
|
|
21
|
-
'Values are resolved like in neos_update_node_property (asset identifiers, link URIs or { href, … } objects).'
|
|
21
|
+
'Values are resolved like in neos_update_node_property (asset identifiers, link URIs or { href, … } objects, nodeAggregateIds for references).'
|
|
22
22
|
),
|
|
23
23
|
workspace: z.string().default('mcp').describe('Draft workspace name'),
|
|
24
24
|
node_name: z.string().optional().describe(
|
|
@@ -6,7 +6,7 @@ import { dimensionsSchema, dimensionsParam } from '../dimensions.js';
|
|
|
6
6
|
export function registerGetDocumentProperties(server: McpServer): void {
|
|
7
7
|
server.tool(
|
|
8
8
|
'neos_get_document_properties',
|
|
9
|
-
'Get all properties of a document node (page) without its content nodes. Use this for SEO fields, meta data, and other document-level properties.',
|
|
9
|
+
'Get all properties of a document node (page) without its content nodes. Use this for SEO fields, meta data, and other document-level properties. Neos 9: the document\'s "references" (nodeAggregateIds of the referenced nodes) are listed next to "properties".',
|
|
10
10
|
{
|
|
11
11
|
node_id: z.string().describe('Node identifier — use the nodeAggregateId (Neos 9) or path (Neos 8) from neos_get_site_context / neos_list_pages'),
|
|
12
12
|
workspace: z.string().default('mcp').describe('Workspace name. Use "live" for published content, "mcp" for staged changes.'),
|
|
@@ -6,7 +6,7 @@ import { dimensionsSchema, dimensionsParam } from '../dimensions.js';
|
|
|
6
6
|
export function registerGetPageContent(server: McpServer): void {
|
|
7
7
|
server.tool(
|
|
8
8
|
'neos_get_page_content',
|
|
9
|
-
'Get all content nodes on a specific page with their properties. Call neos_get_site_context first if you have not already done so this session.',
|
|
9
|
+
'Get all content nodes on a specific page with their properties. Neos 9: each node also lists its "references" (nodeAggregateIds of the referenced nodes, in the format neos_update_node_property accepts). Call neos_get_site_context first if you have not already done so this session.',
|
|
10
10
|
{
|
|
11
11
|
node_id: z.string().describe('Node identifier — use the nodeAggregateId (Neos 9) or path (Neos 8) from neos_get_site_context / neos_list_pages'),
|
|
12
12
|
workspace: z.string().default('mcp').describe('Workspace name'),
|
|
@@ -7,6 +7,7 @@ export function registerGetSiteContext(server: McpServer): void {
|
|
|
7
7
|
'neos_get_site_context',
|
|
8
8
|
'Get the site context: site name, available content NodeTypes with their properties, current page tree, and editorial workflow instructions. Always call this first at the start of any Neos content editing session. ' +
|
|
9
9
|
'On a multi-site instance "sites" lists all sites; pass "site" to get the context of another site than the default one. ' +
|
|
10
|
+
'Neos 9: each node type also lists its "references" to other nodes, see neos_list_node_types. ' +
|
|
10
11
|
'The "dimensions" in the result list the content dimensions (for example language or country) with their default and fallback chains; pass "dimensions" to the other tools to work in one of them.',
|
|
11
12
|
{
|
|
12
13
|
site: z.string().optional().describe('Site node name (see neos_list_sites). Defaults to the default site of the instance.'),
|
|
@@ -5,7 +5,9 @@ import { callBridge } from '../bridge.js';
|
|
|
5
5
|
export function registerListNodeTypes(server: McpServer): void {
|
|
6
6
|
server.tool(
|
|
7
7
|
'neos_list_node_types',
|
|
8
|
-
'List available content node types with their property schemas. Useful to know which types and properties are available before creating or updating nodes.'
|
|
8
|
+
'List available content node types with their property schemas. Useful to know which types and properties are available before creating or updating nodes. ' +
|
|
9
|
+
'Neos 9: references to other nodes (for example selected brands or a contact person) are listed separately under "references", each with "type" ("reference" for one node, "references" for several), "label" and "targetNodeTypes" (the node types that can be referenced, null if any node can). ' +
|
|
10
|
+
'In Neos 8 references are regular properties of type "reference"/"references".',
|
|
9
11
|
{
|
|
10
12
|
filter: z.enum(['content', 'document', 'all']).default('content').describe(
|
|
11
13
|
'"content" for content elements, "document" for page types, "all" for everything'
|
package/src/tools/listPages.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { dimensionsSchema, dimensionsParam } from '../dimensions.js';
|
|
|
6
6
|
export function registerListPages(server: McpServer): void {
|
|
7
7
|
server.tool(
|
|
8
8
|
'neos_list_pages',
|
|
9
|
-
'List all document nodes (pages) in the Neos CMS site as a flat tree with paths and titles.',
|
|
9
|
+
'List all document nodes (pages) in the Neos CMS site as a flat tree with paths and titles. Neos 9: each page also lists its "references" (nodeAggregateIds of the referenced nodes).',
|
|
10
10
|
{
|
|
11
11
|
workspace: z.string().default('mcp').describe('Workspace name. Use "live" for published content, "mcp" for staged changes.'),
|
|
12
12
|
site: z.string().optional().describe('Site node name (see neos_list_sites). Defaults to the default site of the instance.'),
|
|
@@ -11,12 +11,16 @@ export function registerUpdateNodeProperty(server: McpServer): void {
|
|
|
11
11
|
node_id: z.string().describe(
|
|
12
12
|
'Node identifier — use nodeAggregateId (Neos 9) or contextPath/path (Neos 8)'
|
|
13
13
|
),
|
|
14
|
-
property: z.string().describe('Property name to update'),
|
|
14
|
+
property: z.string().describe('Property or reference name to update'),
|
|
15
15
|
value: z.unknown().describe(
|
|
16
16
|
'New property value (string, number, boolean, or object). Image/asset properties: the asset identifier. ' +
|
|
17
17
|
'Link properties (type Neos\\Neos\\Domain\\Link\\Link): a URI string such as "node://<nodeAggregateId>", "asset://<id>" or "https://…", ' +
|
|
18
18
|
'or an object { href, title?, target?, rel?, download? }; an empty string clears the link. ' +
|
|
19
|
-
'A node:// target must exist in the workspace (check with neos_list_pages), otherwise the write is rejected.'
|
|
19
|
+
'A node:// target must exist in the workspace (check with neos_list_pages), otherwise the write is rejected. ' +
|
|
20
|
+
'References (Neos 9: listed under "references" of the node type in neos_list_node_types, not under "properties"): ' +
|
|
21
|
+
'a nodeAggregateId for type "reference", an array of nodeAggregateIds for type "references" (the complete new list in the desired order, it replaces the old one); ' +
|
|
22
|
+
'an empty string or empty array clears them. Every target must exist in the workspace and be of one of the reference\'s "targetNodeTypes" (if set), otherwise the write is rejected. ' +
|
|
23
|
+
'The current targets are shown under "references" in neos_get_page_content / neos_get_document_properties.'
|
|
20
24
|
),
|
|
21
25
|
workspace: z.string().default('mcp').describe('Workspace to write to'),
|
|
22
26
|
dimensions: dimensionsSchema('The property is changed in exactly these dimensions; a node that only exists in another dimension is refused, create a variant first with neos_create_node_variant.'),
|
package/src/types.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export type NodeReferences = Record<string, string | string[] | null> | [];
|
|
2
|
+
|
|
1
3
|
export interface PageNode {
|
|
2
4
|
// v2 (Neos 9) primary identifier
|
|
3
5
|
nodeAggregateId?: string;
|
|
@@ -12,6 +14,8 @@ export interface PageNode {
|
|
|
12
14
|
hidden: boolean;
|
|
13
15
|
depth: number;
|
|
14
16
|
properties?: Record<string, unknown>;
|
|
17
|
+
/** Keyed by reference name; the bridge sends an empty list ([]) instead of {} when the node type has none. */
|
|
18
|
+
references?: NodeReferences;
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
export interface ContentNode {
|
|
@@ -22,6 +26,8 @@ export interface ContentNode {
|
|
|
22
26
|
nodeType: string;
|
|
23
27
|
name: string;
|
|
24
28
|
properties: Record<string, unknown>;
|
|
29
|
+
/** Keyed by reference name; the bridge sends an empty list ([]) instead of {} when the node type has none. */
|
|
30
|
+
references?: NodeReferences;
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
export interface NodeTypeProperty {
|
|
@@ -30,11 +36,19 @@ export interface NodeTypeProperty {
|
|
|
30
36
|
label: string;
|
|
31
37
|
}
|
|
32
38
|
|
|
39
|
+
export interface NodeTypeReference {
|
|
40
|
+
type: 'reference' | 'references';
|
|
41
|
+
label: string;
|
|
42
|
+
targetNodeTypes: string[] | null;
|
|
43
|
+
}
|
|
44
|
+
|
|
33
45
|
export interface NodeTypeSchema {
|
|
34
46
|
name: string;
|
|
35
47
|
isContent: boolean;
|
|
36
48
|
isDocument: boolean;
|
|
37
49
|
properties: Record<string, NodeTypeProperty>;
|
|
50
|
+
/** An empty list ([]) instead of {} when the node type has none. */
|
|
51
|
+
references?: Record<string, NodeTypeReference> | [];
|
|
38
52
|
}
|
|
39
53
|
|
|
40
54
|
export interface PendingChange {
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { test, before, after, beforeEach } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
|
|
4
|
+
import './support/env.js';
|
|
5
|
+
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
6
|
+
import { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory.js';
|
|
7
|
+
import { createServer } from '../src/server.js';
|
|
8
|
+
import { setApiVersion } from '../src/bridge.js';
|
|
9
|
+
|
|
10
|
+
type Call = { url: string; body: any };
|
|
11
|
+
|
|
12
|
+
const realFetch = globalThis.fetch;
|
|
13
|
+
let calls: Call[] = [];
|
|
14
|
+
let client: Client;
|
|
15
|
+
|
|
16
|
+
/** Records bridge calls; the bridge resolves reference targets, so the client must pass them through untouched. */
|
|
17
|
+
function mockFetch() {
|
|
18
|
+
globalThis.fetch = (async (input: any, init: any = {}) => {
|
|
19
|
+
calls.push({ url: String(input), body: init.body ? JSON.parse(init.body) : undefined });
|
|
20
|
+
return new Response(JSON.stringify({ success: true }), {
|
|
21
|
+
status: 200,
|
|
22
|
+
headers: { 'content-type': 'application/json' },
|
|
23
|
+
});
|
|
24
|
+
}) as typeof fetch;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
before(async () => {
|
|
28
|
+
setApiVersion(2);
|
|
29
|
+
const server = createServer();
|
|
30
|
+
const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
|
|
31
|
+
client = new Client({ name: 'test', version: '0.0.0' });
|
|
32
|
+
await Promise.all([server.connect(serverTransport), client.connect(clientTransport)]);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
after(() => {
|
|
36
|
+
globalThis.fetch = realFetch;
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
beforeEach(() => {
|
|
40
|
+
calls = [];
|
|
41
|
+
mockFetch();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('neos_update_node_property: a list of reference targets is sent as an array', async () => {
|
|
45
|
+
const targets = ['brand-1', 'brand-2', 'brand-3'];
|
|
46
|
+
const result = await client.callTool({
|
|
47
|
+
name: 'neos_update_node_property',
|
|
48
|
+
arguments: { node_id: 'n1', property: 'brandReferences', value: targets },
|
|
49
|
+
});
|
|
50
|
+
assert.notEqual(result.isError, true);
|
|
51
|
+
|
|
52
|
+
assert.equal(calls[0].url, 'http://bridge.test/neos/mcp/updateNodeProperty');
|
|
53
|
+
assert.deepEqual(calls[0].body.value, targets);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('neos_create_content_node: reference targets inside properties are sent unchanged', async () => {
|
|
57
|
+
const properties = { contactPersonReference: 'person-1', brandReferences: ['brand-1', 'brand-2'] };
|
|
58
|
+
const result = await client.callTool({
|
|
59
|
+
name: 'neos_create_content_node',
|
|
60
|
+
arguments: { parent_id: 'p1', node_type: 'Vendor.Site:Content.BrandSelection', properties },
|
|
61
|
+
});
|
|
62
|
+
assert.notEqual(result.isError, true);
|
|
63
|
+
|
|
64
|
+
assert.deepEqual(calls[0].body.properties, properties);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test('references are described on the tools that read and write them', async () => {
|
|
68
|
+
const { tools } = await client.listTools();
|
|
69
|
+
const byName = (name: string) => tools.find((t) => t.name === name);
|
|
70
|
+
|
|
71
|
+
const value = (byName('neos_update_node_property')?.inputSchema.properties as any)?.value?.description ?? '';
|
|
72
|
+
assert.match(value, /"references"/);
|
|
73
|
+
assert.match(value, /targetNodeTypes/);
|
|
74
|
+
assert.match(byName('neos_list_node_types')?.description ?? '', /targetNodeTypes/);
|
|
75
|
+
for (const name of ['neos_list_pages', 'neos_get_page_content', 'neos_get_document_properties', 'neos_get_site_context']) {
|
|
76
|
+
assert.match(byName(name)?.description ?? '', /"references"/, name);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
test('the references block is described as Neos 9 only', async () => {
|
|
81
|
+
const { tools } = await client.listTools();
|
|
82
|
+
const value = (tools.find((t) => t.name === 'neos_update_node_property')?.inputSchema.properties as any)?.value?.description ?? '';
|
|
83
|
+
assert.match(value, /Neos 9/);
|
|
84
|
+
assert.match(tools.find((t) => t.name === 'neos_list_node_types')?.description ?? '', /Neos 8/);
|
|
85
|
+
});
|