rpg0-dotcms-mcp 1.1.0 → 1.1.1

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.
Files changed (2) hide show
  1. package/README.md +155 -0
  2. package/package.json +24 -2
package/README.md ADDED
@@ -0,0 +1,155 @@
1
+ # rpg0-dotcms-mcp
2
+
3
+ A [Model Context Protocol](https://modelcontextprotocol.io) server for [dotCMS](https://www.dotcms.com). It lets an AI assistant (GitHub Copilot, Claude Code, Claude Desktop, Cursor, …) inspect content types and their fields, and read — and optionally write — Velocity (VTL) files in a dotCMS instance.
4
+
5
+ - **Read-only by default.** Write tools are only exposed when you opt in.
6
+ - **Writes are plan-first.** A change is planned and shown as a diff before anything is saved, and is limited to folders you allow.
7
+ - **No install step.** Runs over stdio through `npx`.
8
+
9
+ ## Requirements
10
+
11
+ - Node.js 18 or newer
12
+ - A dotCMS instance reachable from the machine that runs your AI client
13
+ - A dotCMS API token (dotCMS admin → your user → *API Access Tokens*)
14
+
15
+ ## Quick start
16
+
17
+ ```bash
18
+ DOTCMS_URL=https://your-dotcms.example.com DOTCMS_TOKEN=your-token npx -y rpg0-dotcms-mcp
19
+ ```
20
+
21
+ The server speaks MCP over stdio, so you normally don't run it by hand — your AI client starts it using one of the configurations below.
22
+
23
+ ## Configuration
24
+
25
+ All configuration is through environment variables.
26
+
27
+ | Variable | Default | Purpose |
28
+ | --- | --- | --- |
29
+ | `DOTCMS_URL` | `http://localhost:8080` | Base URL of the dotCMS instance |
30
+ | `DOTCMS_TOKEN` | *(none)* | API token, sent as a `Bearer` token |
31
+ | `DOTCMS_ALLOW_WRITE` | `false` | Set to `true` to expose the write tools |
32
+ | `DOTCMS_WRITE_ROOTS` | `/application/apivtl/,/application/vtl/custom-fields/` | Comma-separated folders the write tools are limited to |
33
+ | `DOTCMS_PLANS_DIR` | `~/.dotcms-mcp/plans` | Where pending change plans are stored |
34
+
35
+ ## Client setup
36
+
37
+ ### GitHub Copilot (VS Code)
38
+
39
+ Create `.vscode/mcp.json` in your workspace, then start the server from the editor and use Copilot Chat in Agent mode. VS Code prompts for the token once and stores it securely.
40
+
41
+ ```json
42
+ {
43
+ "inputs": [
44
+ {
45
+ "id": "dotcms-token",
46
+ "type": "promptString",
47
+ "description": "dotCMS API token",
48
+ "password": true
49
+ }
50
+ ],
51
+ "servers": {
52
+ "dotcms": {
53
+ "type": "stdio",
54
+ "command": "npx",
55
+ "args": ["-y", "rpg0-dotcms-mcp"],
56
+ "env": {
57
+ "DOTCMS_URL": "https://your-dotcms.example.com",
58
+ "DOTCMS_TOKEN": "${input:dotcms-token}"
59
+ }
60
+ }
61
+ }
62
+ }
63
+ ```
64
+
65
+ ### Claude Code
66
+
67
+ ```bash
68
+ claude mcp add dotcms --env DOTCMS_URL=https://your-dotcms.example.com --env DOTCMS_TOKEN=your-token -- npx -y rpg0-dotcms-mcp
69
+ ```
70
+
71
+ ### Claude Desktop, Cursor and other clients
72
+
73
+ Add the server to the client's MCP configuration:
74
+
75
+ ```json
76
+ {
77
+ "mcpServers": {
78
+ "dotcms": {
79
+ "command": "npx",
80
+ "args": ["-y", "rpg0-dotcms-mcp"],
81
+ "env": {
82
+ "DOTCMS_URL": "https://your-dotcms.example.com",
83
+ "DOTCMS_TOKEN": "your-token"
84
+ }
85
+ }
86
+ }
87
+ }
88
+ ```
89
+
90
+ ## Tools
91
+
92
+ ### Always available (read-only)
93
+
94
+ | Tool | What it does |
95
+ | --- | --- |
96
+ | `list_content_types` | Lists content types, with optional name filter, base-type filter and paging |
97
+ | `get_content_type_fields` | Returns the fields of a content type (variable, type, data type, required/unique/indexed flags, field variables, relationships). Layout-only fields are hidden unless requested |
98
+ | `list_vtl_files` | Finds VTL files by folder and/or file name, with paging |
99
+ | `read_vtl_file` | Returns the source of a VTL file by path or identifier, optionally for a specific site or language |
100
+
101
+ ### Only with `DOTCMS_ALLOW_WRITE=true`
102
+
103
+ | Tool | What it does |
104
+ | --- | --- |
105
+ | `plan_vtl_change` | Prepares a create or update of a VTL file and returns a plan: target, publish flag, line diff and warnings. Writes nothing |
106
+ | `apply_vtl_change` | Applies a previously created plan by its `planId` |
107
+
108
+ ## How writing works
109
+
110
+ 1. The assistant calls `plan_vtl_change` with the full new file content. The server compares it with the current file and stores a plan.
111
+ 2. The plan is shown: instance, site, path, language, whether it publishes, and the changed lines.
112
+ 3. The assistant calls `apply_vtl_change` with the `planId`. Only what the plan contains can be written.
113
+
114
+ Safeguards:
115
+
116
+ - Paths outside `DOTCMS_WRITE_ROOTS` are rejected.
117
+ - A plan is valid for 30 minutes and can be used once.
118
+ - By default a change is saved as a working version; the live file is only replaced when publishing is explicitly requested.
119
+
120
+ Your AI client's own tool-approval prompt is the final check before `apply_vtl_change` runs, so keep approval enabled for that tool.
121
+
122
+ ### Optional: confirmation hook for Claude Code
123
+
124
+ The package ships a `PreToolUse` hook that shows the full plan and asks for approval every time `apply_vtl_change` is called, and denies calls without a valid plan. It expects the server to be registered under the name `dotcms`. Add it to your Claude Code `settings.json`:
125
+
126
+ ```json
127
+ {
128
+ "hooks": {
129
+ "PreToolUse": [
130
+ {
131
+ "matcher": "mcp__dotcms__apply_vtl_change",
132
+ "hooks": [
133
+ {
134
+ "type": "command",
135
+ "command": "npx -y -p rpg0-dotcms-mcp rpg0-dotcms-mcp-confirm-write"
136
+ }
137
+ ]
138
+ }
139
+ ]
140
+ }
141
+ }
142
+ ```
143
+
144
+ ## Troubleshooting
145
+
146
+ - **`Cannot reach dotCMS at …`** — the instance isn't running or isn't reachable from this machine. Check `DOTCMS_URL`.
147
+ - **401 / 403 responses** — the token is missing, expired, or belongs to a different instance. Tokens are per instance.
148
+ - **Write tools are missing** — set `DOTCMS_ALLOW_WRITE=true` and restart the server.
149
+ - **A write is rejected** — the path is outside `DOTCMS_WRITE_ROOTS`, or the plan expired; create a new plan.
150
+
151
+ ## Security notes
152
+
153
+ - Give the token only the permissions the assistant needs; use a read-only user if you don't need writes.
154
+ - Never commit the token. Prefer your client's secret prompt or an environment variable.
155
+ - The server sends requests only to `DOTCMS_URL`.
package/package.json CHANGED
@@ -1,7 +1,29 @@
1
1
  {
2
2
  "name": "rpg0-dotcms-mcp",
3
- "version": "1.1.0",
4
- "description": "MCP server for inspecting dotCMS content types and their fields, and reading/writing VTL files",
3
+ "version": "1.1.1",
4
+ "description": "MCP server for dotCMS: inspect content types and fields, and read or safely write Velocity (VTL) files from AI assistants such as GitHub Copilot and Claude",
5
+ "keywords": [
6
+ "mcp",
7
+ "model-context-protocol",
8
+ "mcp-server",
9
+ "dotcms",
10
+ "cms",
11
+ "velocity",
12
+ "vtl",
13
+ "content-types",
14
+ "copilot",
15
+ "claude",
16
+ "ai"
17
+ ],
18
+ "homepage": "https://github.com/DenysDatsiv/dotcms-mcp#readme",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/DenysDatsiv/dotcms-mcp.git"
22
+ },
23
+ "bugs": {
24
+ "url": "https://github.com/DenysDatsiv/dotcms-mcp/issues"
25
+ },
26
+ "author": "Denys Datsiv",
5
27
  "type": "module",
6
28
  "main": "index.js",
7
29
  "bin": {