@antonytm/mcp-sitecore-server 0.6.1 → 0.7.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/README.md CHANGED
@@ -68,6 +68,11 @@
68
68
  - [x] `security-clear-item-acl-by-path`: clears an item ACL by path
69
69
  - [x] `security-set-item-acl-by-id`: sets an item ACL by ID
70
70
  - [x] `security-set-item-acl-by-path`: sets an item ACL by path
71
+ - [x] Provider
72
+ - [x] `provider-get-item-by-id`: returns an item by ID
73
+ - [x] `provider-get-item-by-path`: returns an item by path
74
+ - [x] `provider-get-item-by-query`: returns an item by query
75
+ - [x] `provider-get-item-by-path`: returns an item by path
71
76
 
72
77
  - [ ] Sitecore CLI
73
78
 
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp";
2
+ import type { Config } from "../../../../config.js";
3
+ export declare function registerGetItemPowerShell(server: McpServer, config: Config): void;
@@ -0,0 +1,118 @@
1
+ import { z } from "zod";
2
+ import { safeMcpResponse } from "../../../../helper.js";
3
+ import { runGenericPowershellCommand } from "../generic.js";
4
+ export function registerGetItemPowerShell(server, config) {
5
+ server.tool("provider-get-item-by-path", "Gets a Sitecore item by its path.", {
6
+ path: z.string()
7
+ .describe("The path of the item to retrieve (e.g. /sitecore/content/Home)"),
8
+ database: z.string().optional()
9
+ .describe("The database containing the item (defaults to the context database)"),
10
+ language: z.string().optional()
11
+ .describe("The language of the item to retrieve"),
12
+ version: z.string().optional()
13
+ .describe("The version of the item to retrieve"),
14
+ }, async (params) => {
15
+ const command = `Get-Item`;
16
+ const options = {
17
+ "Path": params.path,
18
+ };
19
+ if (params.database) {
20
+ options["Database"] = params.database;
21
+ }
22
+ if (params.language) {
23
+ options["Language"] = params.language;
24
+ }
25
+ if (params.version) {
26
+ options["Version"] = params.version;
27
+ }
28
+ return safeMcpResponse(runGenericPowershellCommand(config, command, options));
29
+ });
30
+ server.tool("provider-get-item-by-id", "Gets a Sitecore item by its ID.", {
31
+ path: z.string()
32
+ .default("master:")
33
+ .describe("The path of the item to retrieve (e.g. master:\\content\\home)"),
34
+ id: z.string()
35
+ .describe("The ID of the item to retrieve (e.g. {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9})"),
36
+ database: z.string().optional()
37
+ .describe("The database containing the item (defaults to the context database)"),
38
+ language: z.string().optional()
39
+ .describe("The language of the item to retrieve"),
40
+ version: z.string().optional()
41
+ .describe("The version of the item to retrieve"),
42
+ }, async (params) => {
43
+ const command = `Get-Item`;
44
+ const options = {
45
+ "ID": params.id,
46
+ "Path": params.path,
47
+ };
48
+ if (params.database) {
49
+ options["Database"] = params.database;
50
+ }
51
+ if (params.language) {
52
+ options["Language"] = params.language;
53
+ }
54
+ if (params.version) {
55
+ options["Version"] = params.version;
56
+ }
57
+ return safeMcpResponse(runGenericPowershellCommand(config, command, options));
58
+ });
59
+ server.tool("provider-get-item-by-query", "Gets a Sitecore item by Sitecore query.", {
60
+ path: z.string()
61
+ .default("master:")
62
+ .describe("The path of the item to retrieve (e.g. master:\\content\\home)"),
63
+ query: z.string()
64
+ .describe("The Sitecore query to execute (e.g. /sitecore/content/home/*/*)"),
65
+ database: z.string().optional()
66
+ .describe("The database containing the item (defaults to the context database)"),
67
+ language: z.string().optional()
68
+ .describe("The language of the item to retrieve"),
69
+ version: z.string().optional()
70
+ .describe("The version of the item to retrieve"),
71
+ }, async (params) => {
72
+ const command = `Get-Item`;
73
+ const options = {
74
+ "Query": params.query,
75
+ "Path": params.path,
76
+ };
77
+ if (params.database) {
78
+ options["Database"] = params.database;
79
+ }
80
+ if (params.language) {
81
+ options["Language"] = params.language;
82
+ }
83
+ if (params.version) {
84
+ options["Version"] = params.version;
85
+ }
86
+ return safeMcpResponse(runGenericPowershellCommand(config, command, options));
87
+ });
88
+ server.tool("provider-get-item-by-uri", "Gets a Sitecore item by its URI.", {
89
+ path: z.string()
90
+ .default("master:")
91
+ .describe("The path of the item to retrieve (e.g. master:\\content\\home)"),
92
+ uri: z.string()
93
+ .describe("The URI of the item to retrieve (e.g. sitecore://master/home)"),
94
+ database: z.string().optional()
95
+ .describe("The database containing the item (defaults to the context database)"),
96
+ language: z.string().optional()
97
+ .describe("The language of the item to retrieve"),
98
+ version: z.string().optional()
99
+ .describe("The version of the item to retrieve"),
100
+ }, async (params) => {
101
+ const command = `Get-Item`;
102
+ const options = {
103
+ "Uri": params.uri,
104
+ "Path": params.path,
105
+ };
106
+ if (params.database) {
107
+ options["Database"] = params.database;
108
+ }
109
+ if (params.language) {
110
+ options["Language"] = params.language;
111
+ }
112
+ if (params.version) {
113
+ options["Version"] = params.version;
114
+ }
115
+ return safeMcpResponse(runGenericPowershellCommand(config, command, options));
116
+ });
117
+ }
118
+ //# sourceMappingURL=register-get-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-get-item.js","sourceRoot":"","sources":["../../../../../src/tools/powershell/simple/provider/register-get-item.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAE5D,MAAM,UAAU,yBAAyB,CAAC,MAAiB,EAAE,MAAc;IACvE,MAAM,CAAC,IAAI,CACP,2BAA2B,EAC3B,mCAAmC,EACnC;QACI,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;aACX,QAAQ,CAAC,gEAAgE,CAAC;QAC/E,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;aAC1B,QAAQ,CAAC,qEAAqE,CAAC;QACpF,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;aAC1B,QAAQ,CAAC,sCAAsC,CAAC;QACrD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;aACzB,QAAQ,CAAC,qCAAqC,CAAC;KACvD,EACD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AAC;YAClB,OAAO,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC;QAC1C,CAAC;QAED,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YAClB,OAAO,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC;QAC1C,CAAC;QAED,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC;QACxC,CAAC;QAED,OAAO,eAAe,CAAC,2BAA2B,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAClF,CAAC,CACJ,CAAC;AACN,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp";
2
+ import type { Config } from "../../../../config.js";
3
+ export declare function registerProviderPowerShell(server: McpServer, config: Config): void;
@@ -0,0 +1,5 @@
1
+ import { registerGetItemPowerShell } from "./register-get-item.js";
2
+ export function registerProviderPowerShell(server, config) {
3
+ registerGetItemPowerShell(server, config);
4
+ }
5
+ //# sourceMappingURL=register-provider-powershell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-provider-powershell.js","sourceRoot":"","sources":["../../../../../src/tools/powershell/simple/provider/register-provider-powershell.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAEnE,MAAM,UAAU,0BAA0B,CAAC,MAAiB,EAAE,MAAc;IACxE,yBAAyB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC9C,CAAC"}
@@ -1,5 +1,7 @@
1
1
  import { registerSecurityPowerShell } from "./security/register-security-powershell.js";
2
+ import { registerProviderPowerShell } from "./provider/register-provider-powershell.js";
2
3
  export function registerSimplePowerShell(server, config) {
3
4
  registerSecurityPowerShell(server, config);
5
+ registerProviderPowerShell(server, config);
4
6
  }
5
7
  //# sourceMappingURL=register-simple-powershell.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"register-simple-powershell.js","sourceRoot":"","sources":["../../../../src/tools/powershell/simple/register-simple-powershell.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AAExF,MAAM,UAAU,wBAAwB,CAAC,MAAiB,EAAE,MAAc;IACtE,0BAA0B,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC/C,CAAC"}
1
+ {"version":3,"file":"register-simple-powershell.js","sourceRoot":"","sources":["../../../../src/tools/powershell/simple/register-simple-powershell.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AAExF,MAAM,UAAU,wBAAwB,CAAC,MAAiB,EAAE,MAAc;IACtE,0BAA0B,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,0BAA0B,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC/C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antonytm/mcp-sitecore-server",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "description": "A Model Context Protocol server for Sitecore",
5
5
  "files": [
6
6
  "dist",