@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.
Files changed (115) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +154 -238
  3. package/dist/apply-manager-BAeqrAHX.mjs +751 -0
  4. package/dist/apply-manager-BAeqrAHX.mjs.map +1 -0
  5. package/dist/astro-parser-RofKmKQi.mjs +166 -0
  6. package/dist/astro-parser-RofKmKQi.mjs.map +1 -0
  7. package/dist/branch-lifecycle-DB6sgeJi.mjs +97 -0
  8. package/dist/branch-lifecycle-DB6sgeJi.mjs.map +1 -0
  9. package/dist/chunk-BEJ448es.mjs +35 -0
  10. package/dist/compiler-rIC4ETHv.mjs +44509 -0
  11. package/dist/compiler-rIC4ETHv.mjs.map +1 -0
  12. package/dist/compiler-sfc.cjs-BbD04rn_.mjs +50279 -0
  13. package/dist/compiler-sfc.cjs-BbD04rn_.mjs.map +1 -0
  14. package/dist/config-CPlhDwsv.mjs +27 -0
  15. package/dist/config-CPlhDwsv.mjs.map +1 -0
  16. package/dist/context-CRBCTYPB.mjs +46 -0
  17. package/dist/context-CRBCTYPB.mjs.map +1 -0
  18. package/dist/core/apply-manager.d.mts +144 -0
  19. package/dist/core/apply-manager.d.mts.map +1 -0
  20. package/dist/core/apply-manager.mjs +6 -0
  21. package/dist/core/config.d.mts +8 -0
  22. package/dist/core/config.d.mts.map +1 -0
  23. package/dist/core/config.mjs +2 -0
  24. package/dist/core/content-manager.d.mts +53 -0
  25. package/dist/core/content-manager.d.mts.map +1 -0
  26. package/dist/core/content-manager.mjs +2 -0
  27. package/dist/core/context.d.mts +13 -0
  28. package/dist/core/context.d.mts.map +1 -0
  29. package/dist/core/context.mjs +3 -0
  30. package/dist/core/graph-builder.d.mts +12 -0
  31. package/dist/core/graph-builder.d.mts.map +1 -0
  32. package/dist/core/graph-builder.mjs +2 -0
  33. package/dist/core/meta-manager.d.mts +14 -0
  34. package/dist/core/meta-manager.d.mts.map +1 -0
  35. package/dist/core/meta-manager.mjs +2 -0
  36. package/dist/core/model-manager.d.mts +44 -0
  37. package/dist/core/model-manager.d.mts.map +1 -0
  38. package/dist/core/model-manager.mjs +2 -0
  39. package/dist/core/scan-config.d.mts +24 -0
  40. package/dist/core/scan-config.d.mts.map +1 -0
  41. package/dist/core/scan-config.mjs +2 -0
  42. package/dist/core/scanner.d.mts +25 -0
  43. package/dist/core/scanner.d.mts.map +1 -0
  44. package/dist/core/scanner.mjs +3 -0
  45. package/dist/core/validator.d.mts +23 -0
  46. package/dist/core/validator.d.mts.map +1 -0
  47. package/dist/core/validator.mjs +3 -0
  48. package/dist/detect-C8XmJ4S6.mjs +362 -0
  49. package/dist/detect-C8XmJ4S6.mjs.map +1 -0
  50. package/dist/fs-BbuGnVcG.mjs +52 -0
  51. package/dist/fs-BbuGnVcG.mjs.map +1 -0
  52. package/dist/git/branch-lifecycle.d.mts +28 -0
  53. package/dist/git/branch-lifecycle.d.mts.map +1 -0
  54. package/dist/git/branch-lifecycle.mjs +2 -0
  55. package/dist/git/transaction.d.mts +25 -0
  56. package/dist/git/transaction.d.mts.map +1 -0
  57. package/dist/git/transaction.mjs +4 -0
  58. package/dist/graph-builder-fPrDDwnu.mjs +162 -0
  59. package/dist/graph-builder-fPrDDwnu.mjs.map +1 -0
  60. package/dist/id-BdD4HvMY.mjs +12 -0
  61. package/dist/id-BdD4HvMY.mjs.map +1 -0
  62. package/dist/index.d.mts +1 -359
  63. package/dist/index.mjs +15 -2161
  64. package/dist/index.mjs.map +1 -1
  65. package/dist/meta-manager-CECrfsKm.mjs +53 -0
  66. package/dist/meta-manager-CECrfsKm.mjs.map +1 -0
  67. package/dist/model-manager-sfPdrVIJ.mjs +1016 -0
  68. package/dist/model-manager-sfPdrVIJ.mjs.map +1 -0
  69. package/dist/node-Cbq5eR5i.mjs +300 -0
  70. package/dist/node-Cbq5eR5i.mjs.map +1 -0
  71. package/dist/scan-config-AJGxCdNd.mjs +159 -0
  72. package/dist/scan-config-AJGxCdNd.mjs.map +1 -0
  73. package/dist/scanner-BdTiv8sw.mjs +619 -0
  74. package/dist/scanner-BdTiv8sw.mjs.map +1 -0
  75. package/dist/serializer-Dueih-i2.mjs +33 -0
  76. package/dist/serializer-Dueih-i2.mjs.map +1 -0
  77. package/dist/server-CC12z_xq.mjs +1868 -0
  78. package/dist/server-CC12z_xq.mjs.map +1 -0
  79. package/dist/server.d.mts +7 -0
  80. package/dist/server.d.mts.map +1 -0
  81. package/dist/server.mjs +11 -0
  82. package/dist/source-map-generator-DpO-ejrt.mjs +893 -0
  83. package/dist/source-map-generator-DpO-ejrt.mjs.map +1 -0
  84. package/dist/svelte-parser-COTNG92w.mjs +225 -0
  85. package/dist/svelte-parser-COTNG92w.mjs.map +1 -0
  86. package/dist/templates/index.d.mts +8 -0
  87. package/dist/templates/index.d.mts.map +1 -0
  88. package/dist/templates/index.mjs +2 -0
  89. package/dist/templates-3HWi-PTu.mjs +824 -0
  90. package/dist/templates-3HWi-PTu.mjs.map +1 -0
  91. package/dist/transaction-DXkMulzr.mjs +128 -0
  92. package/dist/transaction-DXkMulzr.mjs.map +1 -0
  93. package/dist/tsx-parser-Bf8Firrq.mjs +2 -0
  94. package/dist/tsx-parser-CYVyBWjn.mjs +234 -0
  95. package/dist/tsx-parser-CYVyBWjn.mjs.map +1 -0
  96. package/dist/util/detect.d.mts +20 -0
  97. package/dist/util/detect.d.mts.map +1 -0
  98. package/dist/util/detect.mjs +2 -0
  99. package/dist/util/fs.d.mts +12 -0
  100. package/dist/util/fs.d.mts.map +1 -0
  101. package/dist/util/fs.mjs +2 -0
  102. package/dist/util/id.d.mts +6 -0
  103. package/dist/util/id.d.mts.map +1 -0
  104. package/dist/util/id.mjs +2 -0
  105. package/dist/util/serializer.d.mts +14 -0
  106. package/dist/util/serializer.d.mts.map +1 -0
  107. package/dist/util/serializer.mjs +2 -0
  108. package/dist/validator-C3lZqO3U.mjs +755 -0
  109. package/dist/validator-C3lZqO3U.mjs.map +1 -0
  110. package/dist/vue-parser-CjS4YAoQ.mjs +225 -0
  111. package/dist/vue-parser-CjS4YAoQ.mjs.map +1 -0
  112. package/package.json +113 -43
  113. package/dist/fs-D83-Ii_y.mjs +0 -75
  114. package/dist/fs-D83-Ii_y.mjs.map +0 -1
  115. package/dist/index.d.mts.map +0 -1
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Contentrain
3
+ Copyright (c) 2026 Contentrain
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,282 +1,198 @@
1
- # @contentrain/mcp
1
+ # `@contentrain/mcp`
2
2
 
3
- MCP (Model Context Protocol) server for [Contentrain](https://contentrain.io) CMS content management. Enables AI agents (Claude, Codex, Cursor, etc.) and humans to create, read, update, and delete Contentrain models, content, and assets — with automatic git branch synchronization.
3
+ [![npm version](https://img.shields.io/npm/v/%40contentrain%2Fmcp?label=%40contentrain%2Fmcp)](https://www.npmjs.com/package/@contentrain/mcp)
4
+ [![GitHub source](https://img.shields.io/badge/source-Contentrain%2Fai-181717?logo=github)](https://github.com/Contentrain/ai/tree/main/packages/mcp)
4
5
 
5
- ## Why?
6
+ Local-first MCP server and core primitives for Contentrain.
6
7
 
7
- Contentrain is a git-based headless CMS. This MCP server lets AI assistants directly manage your Contentrain content through a standardized protocol, so you can say things like:
8
+ Contentrain is AI-generated content governance infrastructure:
8
9
 
9
- - *"Create a blog post model with title, excerpt, and cover image fields"*
10
- - *"Add a new blog post in English and Turkish"*
11
- - *"List all FAQ entries and update the second one"*
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
- All changes are committed and pushed to your git repository automatically.
15
+ This package is the runtime core behind Contentrain's MCP integration. It can be used as:
14
16
 
15
- ## Prerequisites
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
- - A Contentrain project already set up via the [Contentrain Web App](https://app.contentrain.io)
18
- - The project's GitHub repository cloned locally
19
- - Node.js >= 18
21
+ ## 🚀 Install
20
22
 
21
- > **Important:** Contentrain projects must be initialized through the Web App first. The Web App creates the repository structure, the `contentrain` branch, models, and environment configuration. This MCP server operates on an existing Contentrain project — it does not replace the initial setup.
23
+ ```bash
24
+ pnpm add @contentrain/mcp
25
+ ```
22
26
 
23
- ## Quick Start
27
+ Requirements:
24
28
 
25
- ### 1. Install
29
+ - Node.js `22+`
30
+ - git available on the machine
26
31
 
27
- ```bash
28
- # From npm (when published)
29
- npm install -g @contentrain/mcp
32
+ Optional parser support for higher-quality source scanning:
30
33
 
31
- # Or from source
32
- git clone https://github.com/Contentrain/contentrain-mcp.git
33
- cd contentrain-mcp
34
- pnpm install && pnpm build
35
- ```
34
+ - `@vue/compiler-sfc`
35
+ - `@astrojs/compiler`
36
+ - `svelte`
36
37
 
37
- ### 2. Configure your MCP client
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
- Add to your MCP client configuration:
40
+ ## ✨ What It Does
40
41
 
41
- **Claude Desktop** (`~/Library/Application Support/Claude/claude_desktop_config.json`):
42
+ `@contentrain/mcp` manages a `.contentrain/` directory in your project and exposes MCP tools for:
42
43
 
43
- ```json
44
- {
45
- "mcpServers": {
46
- "contentrain": {
47
- "command": "contentrain-mcp",
48
- "env": {
49
- "CONTENTRAIN_REPO_PATH": "/path/to/your/contentrain-project",
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
- **Cursor** (`.cursor/mcp.json` in your project root):
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
- **Claude Code** (`.mcp.json` in your project root):
74
-
75
- ```json
76
- {
77
- "mcpServers": {
78
- "contentrain": {
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
- > If installed from source instead of globally, replace `"command": "contentrain-mcp"` with `"command": "node"` and add `"args": ["/absolute/path/to/contentrain-mcp/dist/index.mjs"]`.
61
+ Current MCP tools exposed by the server:
90
62
 
91
- ### 3. Start using
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
- Once configured, your AI assistant has access to 17 tools. Here's an example conversation:
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
- You: List all my models
97
- Agent: → calls contentrain_list_models
98
- You have 3 models: blog (MD, localized), faq (JSON), authors (JSON)
99
-
100
- You: Show me the blog model schema
101
- Agent: → calls contentrain_describe_model { modelId: "blog" }
102
- Blog model has fields: title (string, required), description (string),
103
- category (one-to-one → blogcategories), imagesrc (media), author (one-to-one → authors)
104
-
105
- You: Create a new blog post titled "Getting Started with Contentrain"
106
- Agent: → calls contentrain_create_content {
107
- modelId: "blog",
108
- data: { title: "Getting Started with Contentrain", slug: "getting-started-with-contentrain", description: "..." },
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
- ## Environments
103
+ ## 🔄 Example MCP Flow
127
104
 
128
- Contentrain uses **git branches** to manage environments. Each environment maps to a branch:
105
+ Typical agent workflow:
129
106
 
130
- | Environment | Branch | Description |
131
- |-------------|--------|-------------|
132
- | Default | `contentrain` | Main content branch (created automatically) |
133
- | Staging | `contentrain-staging` | Preview/staging environment |
134
- | Production | `contentrain-production` | Production environment |
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
- Environments are created via the Contentrain Web App. The branch naming follows the pattern `contentrain-{environment-name}`.
115
+ ## 🧪 Normalize Flow
137
116
 
138
- ### Targeting a specific environment
117
+ Normalize is intentionally split into two phases:
139
118
 
140
- Set the `CONTENTRAIN_BRANCH` environment variable to the target environment's branch:
119
+ ### 1. Extract
141
120
 
142
- ```json
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
- ### Multiple environments simultaneously
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
- ## Available Tools
182
-
183
- ### Model Management
184
-
185
- | Tool | Description |
186
- |------|-------------|
187
- | `contentrain_list_models` | List all models with metadata |
188
- | `contentrain_describe_model` | Get full schema with field definitions |
189
- | `contentrain_create_model` | Create a new model (JSON, MD, or MDX) |
190
- | `contentrain_add_field` | Add a field to an existing model |
191
- | `contentrain_delete_model` | Delete a model and all its content |
192
-
193
- ### Content Management
194
-
195
- | Tool | Description |
196
- |------|-------------|
197
- | `contentrain_list_content` | List all entries for a model |
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
- ## How Git Sync Works
143
+ The package also exposes low-level modules for embedding and advanced use:
258
144
 
259
- Every write operation runs inside a **transaction**:
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
- 1. Creates an isolated git worktree from the target branch
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
- This means concurrent writes from multiple agents or the Contentrain web app won't conflict.
162
+ ## 🧠 Design Constraints
268
163
 
269
- ## Development
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 install # Install dependencies
273
- pnpm dev # Watch mode build
274
- pnpm test # Run tests (watch mode)
275
- pnpm test:run # Run tests once
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
- ## License
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