@contentrain/mcp 0.3.1 → 1.0.3
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/LICENSE +1 -1
- package/README.md +154 -238
- package/dist/apply-manager-BAeqrAHX.mjs +751 -0
- package/dist/apply-manager-BAeqrAHX.mjs.map +1 -0
- package/dist/astro-parser-RofKmKQi.mjs +166 -0
- package/dist/astro-parser-RofKmKQi.mjs.map +1 -0
- package/dist/branch-lifecycle-DB6sgeJi.mjs +97 -0
- package/dist/branch-lifecycle-DB6sgeJi.mjs.map +1 -0
- package/dist/chunk-BEJ448es.mjs +35 -0
- package/dist/compiler-rIC4ETHv.mjs +44509 -0
- package/dist/compiler-rIC4ETHv.mjs.map +1 -0
- package/dist/compiler-sfc.cjs-BbD04rn_.mjs +50279 -0
- package/dist/compiler-sfc.cjs-BbD04rn_.mjs.map +1 -0
- package/dist/config-CPlhDwsv.mjs +27 -0
- package/dist/config-CPlhDwsv.mjs.map +1 -0
- package/dist/context-CRBCTYPB.mjs +46 -0
- package/dist/context-CRBCTYPB.mjs.map +1 -0
- package/dist/core/apply-manager.d.mts +144 -0
- package/dist/core/apply-manager.d.mts.map +1 -0
- package/dist/core/apply-manager.mjs +6 -0
- package/dist/core/config.d.mts +8 -0
- package/dist/core/config.d.mts.map +1 -0
- package/dist/core/config.mjs +2 -0
- package/dist/core/content-manager.d.mts +53 -0
- package/dist/core/content-manager.d.mts.map +1 -0
- package/dist/core/content-manager.mjs +2 -0
- package/dist/core/context.d.mts +13 -0
- package/dist/core/context.d.mts.map +1 -0
- package/dist/core/context.mjs +3 -0
- package/dist/core/graph-builder.d.mts +12 -0
- package/dist/core/graph-builder.d.mts.map +1 -0
- package/dist/core/graph-builder.mjs +2 -0
- package/dist/core/meta-manager.d.mts +14 -0
- package/dist/core/meta-manager.d.mts.map +1 -0
- package/dist/core/meta-manager.mjs +2 -0
- package/dist/core/model-manager.d.mts +44 -0
- package/dist/core/model-manager.d.mts.map +1 -0
- package/dist/core/model-manager.mjs +2 -0
- package/dist/core/scan-config.d.mts +24 -0
- package/dist/core/scan-config.d.mts.map +1 -0
- package/dist/core/scan-config.mjs +2 -0
- package/dist/core/scanner.d.mts +25 -0
- package/dist/core/scanner.d.mts.map +1 -0
- package/dist/core/scanner.mjs +3 -0
- package/dist/core/validator.d.mts +23 -0
- package/dist/core/validator.d.mts.map +1 -0
- package/dist/core/validator.mjs +3 -0
- package/dist/detect-C8XmJ4S6.mjs +362 -0
- package/dist/detect-C8XmJ4S6.mjs.map +1 -0
- package/dist/fs-BbuGnVcG.mjs +52 -0
- package/dist/fs-BbuGnVcG.mjs.map +1 -0
- package/dist/git/branch-lifecycle.d.mts +28 -0
- package/dist/git/branch-lifecycle.d.mts.map +1 -0
- package/dist/git/branch-lifecycle.mjs +2 -0
- package/dist/git/transaction.d.mts +25 -0
- package/dist/git/transaction.d.mts.map +1 -0
- package/dist/git/transaction.mjs +4 -0
- package/dist/graph-builder-fPrDDwnu.mjs +162 -0
- package/dist/graph-builder-fPrDDwnu.mjs.map +1 -0
- package/dist/id-BdD4HvMY.mjs +12 -0
- package/dist/id-BdD4HvMY.mjs.map +1 -0
- package/dist/index.d.mts +1 -359
- package/dist/index.mjs +15 -2161
- package/dist/index.mjs.map +1 -1
- package/dist/meta-manager-CECrfsKm.mjs +53 -0
- package/dist/meta-manager-CECrfsKm.mjs.map +1 -0
- package/dist/model-manager-sfPdrVIJ.mjs +1016 -0
- package/dist/model-manager-sfPdrVIJ.mjs.map +1 -0
- package/dist/node-Cbq5eR5i.mjs +300 -0
- package/dist/node-Cbq5eR5i.mjs.map +1 -0
- package/dist/scan-config-AJGxCdNd.mjs +159 -0
- package/dist/scan-config-AJGxCdNd.mjs.map +1 -0
- package/dist/scanner-BdTiv8sw.mjs +619 -0
- package/dist/scanner-BdTiv8sw.mjs.map +1 -0
- package/dist/serializer-Dueih-i2.mjs +33 -0
- package/dist/serializer-Dueih-i2.mjs.map +1 -0
- package/dist/server-CC12z_xq.mjs +1868 -0
- package/dist/server-CC12z_xq.mjs.map +1 -0
- package/dist/server.d.mts +7 -0
- package/dist/server.d.mts.map +1 -0
- package/dist/server.mjs +11 -0
- package/dist/source-map-generator-DpO-ejrt.mjs +893 -0
- package/dist/source-map-generator-DpO-ejrt.mjs.map +1 -0
- package/dist/svelte-parser-COTNG92w.mjs +225 -0
- package/dist/svelte-parser-COTNG92w.mjs.map +1 -0
- package/dist/templates/index.d.mts +8 -0
- package/dist/templates/index.d.mts.map +1 -0
- package/dist/templates/index.mjs +2 -0
- package/dist/templates-3HWi-PTu.mjs +824 -0
- package/dist/templates-3HWi-PTu.mjs.map +1 -0
- package/dist/transaction-DXkMulzr.mjs +128 -0
- package/dist/transaction-DXkMulzr.mjs.map +1 -0
- package/dist/tsx-parser-Bf8Firrq.mjs +2 -0
- package/dist/tsx-parser-CYVyBWjn.mjs +234 -0
- package/dist/tsx-parser-CYVyBWjn.mjs.map +1 -0
- package/dist/util/detect.d.mts +20 -0
- package/dist/util/detect.d.mts.map +1 -0
- package/dist/util/detect.mjs +2 -0
- package/dist/util/fs.d.mts +12 -0
- package/dist/util/fs.d.mts.map +1 -0
- package/dist/util/fs.mjs +2 -0
- package/dist/util/id.d.mts +6 -0
- package/dist/util/id.d.mts.map +1 -0
- package/dist/util/id.mjs +2 -0
- package/dist/util/serializer.d.mts +14 -0
- package/dist/util/serializer.d.mts.map +1 -0
- package/dist/util/serializer.mjs +2 -0
- package/dist/validator-C3lZqO3U.mjs +755 -0
- package/dist/validator-C3lZqO3U.mjs.map +1 -0
- package/dist/vue-parser-CjS4YAoQ.mjs +225 -0
- package/dist/vue-parser-CjS4YAoQ.mjs.map +1 -0
- package/package.json +113 -43
- package/dist/fs-D83-Ii_y.mjs +0 -75
- package/dist/fs-D83-Ii_y.mjs.map +0 -1
- package/dist/index.d.mts.map +0 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,282 +1,198 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@contentrain/mcp`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@contentrain/mcp)
|
|
4
|
+
[](https://github.com/Contentrain/ai/tree/main/packages/mcp)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
Local-first MCP server and core primitives for Contentrain.
|
|
6
7
|
|
|
7
|
-
Contentrain is
|
|
8
|
+
Contentrain is AI-generated content governance infrastructure:
|
|
8
9
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
10
|
+
- agent produces content decisions
|
|
11
|
+
- MCP applies deterministic filesystem and git workflow
|
|
12
|
+
- humans review and merge
|
|
13
|
+
- the system keeps schema, locale, and serialization consistent
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
This package is the runtime core behind Contentrain's MCP integration. It can be used as:
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
- a stdio MCP server (`contentrain-mcp`)
|
|
18
|
+
- an embeddable server (`createServer(projectRoot)`)
|
|
19
|
+
- a low-level toolkit for config, models, content, validation, scanning, and git transaction flow
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
- The project's GitHub repository cloned locally
|
|
19
|
-
- Node.js >= 18
|
|
21
|
+
## 🚀 Install
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
```bash
|
|
24
|
+
pnpm add @contentrain/mcp
|
|
25
|
+
```
|
|
22
26
|
|
|
23
|
-
|
|
27
|
+
Requirements:
|
|
24
28
|
|
|
25
|
-
|
|
29
|
+
- Node.js `22+`
|
|
30
|
+
- git available on the machine
|
|
26
31
|
|
|
27
|
-
|
|
28
|
-
# From npm (when published)
|
|
29
|
-
npm install -g @contentrain/mcp
|
|
32
|
+
Optional parser support for higher-quality source scanning:
|
|
30
33
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
pnpm install && pnpm build
|
|
35
|
-
```
|
|
34
|
+
- `@vue/compiler-sfc`
|
|
35
|
+
- `@astrojs/compiler`
|
|
36
|
+
- `svelte`
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
They are listed as optional dependencies. The scanner still works without them, but Vue/Astro/Svelte detection is stronger when they are installed.
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
## ✨ What It Does
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
`@contentrain/mcp` manages a `.contentrain/` directory in your project and exposes MCP tools for:
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"CONTENTRAIN_BRANCH": "contentrain"
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
```
|
|
44
|
+
- project initialization
|
|
45
|
+
- model creation and deletion
|
|
46
|
+
- content save, delete, and list
|
|
47
|
+
- validation and auto-fix
|
|
48
|
+
- normalize scan and apply flows
|
|
49
|
+
- bulk operations
|
|
50
|
+
- branch submission and branch-health awareness
|
|
56
51
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
```json
|
|
60
|
-
{
|
|
61
|
-
"mcpServers": {
|
|
62
|
-
"contentrain": {
|
|
63
|
-
"command": "contentrain-mcp",
|
|
64
|
-
"env": {
|
|
65
|
-
"CONTENTRAIN_REPO_PATH": "/path/to/your/contentrain-project",
|
|
66
|
-
"CONTENTRAIN_BRANCH": "contentrain"
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
```
|
|
52
|
+
All write operations are designed around git-backed safety:
|
|
72
53
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
"command": "contentrain-mcp",
|
|
80
|
-
"env": {
|
|
81
|
-
"CONTENTRAIN_REPO_PATH": "/path/to/your/contentrain-project",
|
|
82
|
-
"CONTENTRAIN_BRANCH": "contentrain"
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
```
|
|
54
|
+
- write to a dedicated `contentrain/*` branch
|
|
55
|
+
- keep canonical JSON output
|
|
56
|
+
- update `.contentrain/context.json`
|
|
57
|
+
- surface validation and next-step hints to the caller
|
|
58
|
+
|
|
59
|
+
## 🧰 Tool Surface
|
|
88
60
|
|
|
89
|
-
|
|
61
|
+
Current MCP tools exposed by the server:
|
|
90
62
|
|
|
91
|
-
|
|
63
|
+
| Tool | Purpose |
|
|
64
|
+
| --- | --- |
|
|
65
|
+
| `contentrain_status` | Project status, config, models, branch health, context |
|
|
66
|
+
| `contentrain_describe` | Full schema and sample data for a model |
|
|
67
|
+
| `contentrain_describe_format` | File-format and storage contract reference |
|
|
68
|
+
| `contentrain_init` | Create `.contentrain/` structure and base config |
|
|
69
|
+
| `contentrain_scaffold` | Apply a starter template such as blog, docs, landing, saas |
|
|
70
|
+
| `contentrain_model_save` | Create or update a model definition |
|
|
71
|
+
| `contentrain_model_delete` | Delete a model definition |
|
|
72
|
+
| `contentrain_content_save` | Save content entries for any model kind |
|
|
73
|
+
| `contentrain_content_delete` | Delete content entries |
|
|
74
|
+
| `contentrain_content_list` | Read content entries |
|
|
75
|
+
| `contentrain_validate` | Validate project content, optionally auto-fix structural issues |
|
|
76
|
+
| `contentrain_submit` | Push `contentrain/*` branches to remote |
|
|
77
|
+
| `contentrain_scan` | Graph- and candidate-based hardcoded string scan |
|
|
78
|
+
| `contentrain_apply` | Normalize extract/reuse execution with dry-run support |
|
|
79
|
+
| `contentrain_bulk` | Bulk locale copy, status updates, and deletes |
|
|
92
80
|
|
|
93
|
-
|
|
81
|
+
## 🚀 Quick Start
|
|
94
82
|
|
|
83
|
+
### Run as an MCP server
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
CONTENTRAIN_PROJECT_ROOT=/path/to/project npx contentrain-mcp
|
|
95
87
|
```
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
locale: "en",
|
|
110
|
-
status: "draft",
|
|
111
|
-
content: "# Getting Started\n\nWelcome to Contentrain..."
|
|
112
|
-
}
|
|
113
|
-
Created entry e7f3a1b9c0d2 in blog model (draft).
|
|
114
|
-
Committed and pushed to contentrain branch.
|
|
115
|
-
|
|
116
|
-
You: Now publish it
|
|
117
|
-
Agent: → calls contentrain_update_content {
|
|
118
|
-
modelId: "blog",
|
|
119
|
-
entryId: "e7f3a1b9c0d2",
|
|
120
|
-
data: { status: "publish" },
|
|
121
|
-
locale: "en"
|
|
122
|
-
}
|
|
123
|
-
Updated and published.
|
|
88
|
+
|
|
89
|
+
If `CONTENTRAIN_PROJECT_ROOT` is omitted, the current working directory is used.
|
|
90
|
+
|
|
91
|
+
### Embed the server in your own process
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
import { createServer } from '@contentrain/mcp/server'
|
|
95
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
|
|
96
|
+
|
|
97
|
+
const server = createServer(process.cwd())
|
|
98
|
+
const transport = new StdioServerTransport()
|
|
99
|
+
|
|
100
|
+
await server.connect(transport)
|
|
124
101
|
```
|
|
125
102
|
|
|
126
|
-
##
|
|
103
|
+
## 🔄 Example MCP Flow
|
|
127
104
|
|
|
128
|
-
|
|
105
|
+
Typical agent workflow:
|
|
129
106
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
107
|
+
1. Call `contentrain_status`
|
|
108
|
+
2. If needed, call `contentrain_init`
|
|
109
|
+
3. Create models with `contentrain_model_save` or `contentrain_scaffold`
|
|
110
|
+
4. Save content with `contentrain_content_save`
|
|
111
|
+
5. Validate with `contentrain_validate`
|
|
112
|
+
6. For hardcoded strings, use `contentrain_scan` then `contentrain_apply`
|
|
113
|
+
7. Push review branches with `contentrain_submit`
|
|
135
114
|
|
|
136
|
-
|
|
115
|
+
## 🧪 Normalize Flow
|
|
137
116
|
|
|
138
|
-
|
|
117
|
+
Normalize is intentionally split into two phases:
|
|
139
118
|
|
|
140
|
-
|
|
119
|
+
### 1. Extract
|
|
141
120
|
|
|
142
|
-
|
|
143
|
-
{
|
|
144
|
-
"mcpServers": {
|
|
145
|
-
"contentrain": {
|
|
146
|
-
"command": "contentrain-mcp",
|
|
147
|
-
"env": {
|
|
148
|
-
"CONTENTRAIN_REPO_PATH": "/path/to/project",
|
|
149
|
-
"CONTENTRAIN_BRANCH": "contentrain-staging"
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
```
|
|
121
|
+
`contentrain_scan` finds candidate strings.
|
|
155
122
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
You can register multiple MCP server instances — one per environment:
|
|
159
|
-
|
|
160
|
-
```json
|
|
161
|
-
{
|
|
162
|
-
"mcpServers": {
|
|
163
|
-
"contentrain-default": {
|
|
164
|
-
"command": "contentrain-mcp",
|
|
165
|
-
"env": {
|
|
166
|
-
"CONTENTRAIN_REPO_PATH": "/path/to/project",
|
|
167
|
-
"CONTENTRAIN_BRANCH": "contentrain"
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
"contentrain-staging": {
|
|
171
|
-
"command": "contentrain-mcp",
|
|
172
|
-
"env": {
|
|
173
|
-
"CONTENTRAIN_REPO_PATH": "/path/to/project",
|
|
174
|
-
"CONTENTRAIN_BRANCH": "contentrain-staging"
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
```
|
|
123
|
+
`contentrain_apply` with `mode: "extract"`:
|
|
180
124
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
| `contentrain_get_content` | Get a single entry by ID |
|
|
199
|
-
| `contentrain_create_content` | Create a new entry with validation |
|
|
200
|
-
| `contentrain_update_content` | Update specific fields of an entry |
|
|
201
|
-
| `contentrain_delete_content` | Delete an entry (all locales + markdown) |
|
|
202
|
-
| `contentrain_validate` | Dry-run validation against model schema |
|
|
203
|
-
|
|
204
|
-
### Asset Management
|
|
205
|
-
|
|
206
|
-
| Tool | Description |
|
|
207
|
-
|------|-------------|
|
|
208
|
-
| `contentrain_list_assets` | List all registered assets |
|
|
209
|
-
| `contentrain_register_asset` | Register an existing file as an asset |
|
|
210
|
-
| `contentrain_deregister_asset` | Remove an asset from the registry |
|
|
211
|
-
|
|
212
|
-
### Diagnostics
|
|
213
|
-
|
|
214
|
-
| Tool | Description |
|
|
215
|
-
|------|-------------|
|
|
216
|
-
| `contentrain_doctor` | Full diagnostic scan — detects ID, schema, relation, asset, and sync issues. Use `fix=true` to auto-repair (pushes to a staging branch for review). |
|
|
217
|
-
| `contentrain_doctor_apply` | Merge a staged doctor fix into the target branch |
|
|
218
|
-
| `contentrain_doctor_discard` | Discard a staged doctor fix without merging |
|
|
219
|
-
|
|
220
|
-
## Environment Variables
|
|
221
|
-
|
|
222
|
-
| Variable | Default | Description |
|
|
223
|
-
|----------|---------|-------------|
|
|
224
|
-
| `CONTENTRAIN_REPO_PATH` | `process.cwd()` | Path to the git repository |
|
|
225
|
-
| `CONTENTRAIN_BRANCH` | `contentrain` | Target environment branch |
|
|
226
|
-
| `CONTENTRAIN_REMOTE` | `origin` | Git remote name |
|
|
227
|
-
| `CONTENTRAIN_DIR` | `contentrain` | Contentrain directory name |
|
|
228
|
-
| `CONTENTRAIN_DRY_RUN` | `false` | Skip git operations (local changes only) |
|
|
229
|
-
| `CONTENTRAIN_AUTHOR_NAME` | — | Git commit author name |
|
|
230
|
-
| `CONTENTRAIN_AUTHOR_EMAIL` | — | Git commit author email |
|
|
231
|
-
|
|
232
|
-
## Programmatic Usage
|
|
233
|
-
|
|
234
|
-
You can also use the writer directly in your own code:
|
|
235
|
-
|
|
236
|
-
```typescript
|
|
237
|
-
import { ContentrainWriter } from '@contentrain/mcp'
|
|
238
|
-
|
|
239
|
-
const writer = new ContentrainWriter({
|
|
240
|
-
repoPath: '/path/to/your/project',
|
|
241
|
-
branch: 'contentrain',
|
|
242
|
-
})
|
|
243
|
-
|
|
244
|
-
// Read operations (no git transaction needed)
|
|
245
|
-
const models = await writer.model.list()
|
|
246
|
-
const entries = await writer.content.list('blog-posts')
|
|
247
|
-
|
|
248
|
-
// Write operations (uses git worktree + commit + push)
|
|
249
|
-
await writer.transaction(async (tx) => {
|
|
250
|
-
await tx.content.create('blog-posts', {
|
|
251
|
-
title: 'Hello World',
|
|
252
|
-
excerpt: 'My first post',
|
|
253
|
-
}, { status: 'draft' })
|
|
254
|
-
}, { message: 'add new blog post' })
|
|
255
|
-
```
|
|
125
|
+
- creates or updates models
|
|
126
|
+
- writes content entries
|
|
127
|
+
- records source tracking
|
|
128
|
+
- creates a review branch
|
|
129
|
+
|
|
130
|
+
### 2. Reuse
|
|
131
|
+
|
|
132
|
+
`contentrain_apply` with `mode: "reuse"`:
|
|
133
|
+
|
|
134
|
+
- patches source files using agent-provided expressions
|
|
135
|
+
- adds imports when needed
|
|
136
|
+
- enforces patch path safety and scope checks
|
|
137
|
+
- creates a separate review branch
|
|
138
|
+
|
|
139
|
+
This split keeps content extraction separate from source rewriting.
|
|
140
|
+
|
|
141
|
+
## 📦 Core Exports
|
|
256
142
|
|
|
257
|
-
|
|
143
|
+
The package also exposes low-level modules for embedding and advanced use:
|
|
258
144
|
|
|
259
|
-
|
|
145
|
+
- `@contentrain/mcp/server`
|
|
146
|
+
- `@contentrain/mcp/core/config`
|
|
147
|
+
- `@contentrain/mcp/core/context`
|
|
148
|
+
- `@contentrain/mcp/core/model-manager`
|
|
149
|
+
- `@contentrain/mcp/core/content-manager`
|
|
150
|
+
- `@contentrain/mcp/core/validator`
|
|
151
|
+
- `@contentrain/mcp/core/scanner`
|
|
152
|
+
- `@contentrain/mcp/core/graph-builder`
|
|
153
|
+
- `@contentrain/mcp/core/apply-manager`
|
|
154
|
+
- `@contentrain/mcp/util/detect`
|
|
155
|
+
- `@contentrain/mcp/util/fs`
|
|
156
|
+
- `@contentrain/mcp/git/transaction`
|
|
157
|
+
- `@contentrain/mcp/git/branch-lifecycle`
|
|
158
|
+
- `@contentrain/mcp/templates`
|
|
260
159
|
|
|
261
|
-
|
|
262
|
-
2. Applies all changes inside the worktree
|
|
263
|
-
3. Commits and pushes to the target branch
|
|
264
|
-
4. If the push is rejected (remote advanced), performs a **structural 3-way merge** — diffing JSON entries by their `ID` field instead of text lines — then retries (up to 3 attempts)
|
|
265
|
-
5. Cleans up the worktree
|
|
160
|
+
These are intended for Contentrain tooling and advanced integrations, not for direct manual editing of `.contentrain/` files.
|
|
266
161
|
|
|
267
|
-
|
|
162
|
+
## 🧠 Design Constraints
|
|
268
163
|
|
|
269
|
-
|
|
164
|
+
Key design decisions in this package:
|
|
165
|
+
|
|
166
|
+
- local-first, filesystem-based MCP
|
|
167
|
+
- no GitHub API dependency in MCP
|
|
168
|
+
- JSON-only content storage
|
|
169
|
+
- git-backed write workflow
|
|
170
|
+
- canonical serialization
|
|
171
|
+
- framework-agnostic MCP layer
|
|
172
|
+
- agent decides content semantics, MCP enforces deterministic execution
|
|
173
|
+
|
|
174
|
+
## 🛠 Development
|
|
175
|
+
|
|
176
|
+
From the monorepo root:
|
|
270
177
|
|
|
271
178
|
```bash
|
|
272
|
-
pnpm
|
|
273
|
-
pnpm
|
|
274
|
-
pnpm
|
|
275
|
-
pnpm
|
|
276
|
-
pnpm lint # Lint with oxlint
|
|
277
|
-
pnpm build # Production build
|
|
179
|
+
pnpm --filter @contentrain/mcp build
|
|
180
|
+
pnpm --filter @contentrain/mcp test
|
|
181
|
+
pnpm --filter @contentrain/mcp typecheck
|
|
182
|
+
pnpm exec oxlint packages/mcp/src packages/mcp/tests
|
|
278
183
|
```
|
|
279
184
|
|
|
280
|
-
##
|
|
185
|
+
## 🔗 Related Packages
|
|
186
|
+
|
|
187
|
+
- `contentrain` — CLI and local review tooling
|
|
188
|
+
- `@contentrain/query` — generated runtime query SDK
|
|
189
|
+
- `@contentrain/rules` — IDE/agent rules and prompts
|
|
190
|
+
- `@contentrain/types` — shared schema and model types
|
|
191
|
+
|
|
192
|
+
## 📚 Documentation
|
|
193
|
+
|
|
194
|
+
Full documentation at **[ai.contentrain.io/packages/mcp](https://ai.contentrain.io/packages/mcp)**.
|
|
195
|
+
|
|
196
|
+
## 📄 License
|
|
281
197
|
|
|
282
198
|
MIT
|