@prenta/mcp-server 0.23.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 +583 -0
- package/LICENSE +21 -0
- package/README.md +130 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +44 -0
- package/dist/cli.js.map +1 -0
- package/dist/client.d.ts +1348 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +1019 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/instructions.d.ts +13 -0
- package/dist/instructions.d.ts.map +1 -0
- package/dist/instructions.js +61 -0
- package/dist/instructions.js.map +1 -0
- package/dist/navigation.d.ts +76 -0
- package/dist/navigation.d.ts.map +1 -0
- package/dist/navigation.js +228 -0
- package/dist/navigation.js.map +1 -0
- package/dist/resources.d.ts +28 -0
- package/dist/resources.d.ts.map +1 -0
- package/dist/resources.js +88 -0
- package/dist/resources.js.map +1 -0
- package/dist/server.d.ts +25 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +90 -0
- package/dist/server.js.map +1 -0
- package/dist/tools.d.ts +25 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +1920 -0
- package/dist/tools.js.map +1 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# @prenta/mcp-server
|
|
2
|
+
|
|
3
|
+
A [Model Context Protocol](https://modelcontextprotocol.io) server that lets AI agents (Claude, Cursor, ChatGPT, etc.) read and write content in your Prenta CMS.
|
|
4
|
+
|
|
5
|
+
## Install & connect
|
|
6
|
+
|
|
7
|
+
You don't need to install this globally — your MCP client will run it via `npx`.
|
|
8
|
+
|
|
9
|
+
**Cursor / Claude Desktop:**
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"mcpServers": {
|
|
14
|
+
"prenta": {
|
|
15
|
+
"command": "npx",
|
|
16
|
+
"args": ["-y", "@prenta/mcp-server"],
|
|
17
|
+
"env": {
|
|
18
|
+
"PRENTA_BASE_URL": "https://your-site.com",
|
|
19
|
+
"PRENTA_API_KEY": "act_sk_..."
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Generate an `PRENTA_API_KEY` from your CMS admin under **API Keys → New API Key**. Grant it the scopes the agent needs (e.g. content + media + pageBuilder).
|
|
27
|
+
|
|
28
|
+
## Tools exposed
|
|
29
|
+
|
|
30
|
+
| Tool | What it does |
|
|
31
|
+
| ------------------------------ | ---------------------------------------------------- |
|
|
32
|
+
| `list_collections` | Discover available collections and their fields |
|
|
33
|
+
| `list_documents` | Paginated list of documents in a collection |
|
|
34
|
+
| `get_document` | Fetch a document by ID |
|
|
35
|
+
| `create_document` | Create a new document with explicit fields (DRAFT) |
|
|
36
|
+
| `update_document` | Patch an existing document |
|
|
37
|
+
| `delete_document` | Soft-delete a document |
|
|
38
|
+
| `get_global` / `update_global` | Read/update globals (site settings, etc.) |
|
|
39
|
+
| `list_media` | Browse the media library |
|
|
40
|
+
| `generate_page` | AI page-builder: prompt → page tree (no persistence) |
|
|
41
|
+
| `create_page_from_prompt` | One-shot: prompt → tree → persisted page document |
|
|
42
|
+
| `generate_block` | AI generate a single page-builder block |
|
|
43
|
+
| `resolve_url` | Map a public URL path to its CMS document |
|
|
44
|
+
|
|
45
|
+
### AI content authoring (any non-page collection)
|
|
46
|
+
|
|
47
|
+
The agent can also author structured content for blog posts, case studies, services, locations, team profiles, FAQs, testimonials — any collection that isn't a page builder. Each tool maps a free-form prompt onto the collection's field schema and persists the result.
|
|
48
|
+
|
|
49
|
+
| Tool | Default collection | Notes |
|
|
50
|
+
| ---------------------- | ------------------ | --------------------------------------------------------------------------------------------------- |
|
|
51
|
+
| `create_in_collection` | _(required arg)_ | Generic. Pass `template: service \| location \| team_member` for built-in prompt-enrichment recipes |
|
|
52
|
+
| `create_blog_post` | `posts` | Blog post sugar |
|
|
53
|
+
| `create_case_study` | `case-studies` | Plus `clientName` / `industry` hints |
|
|
54
|
+
|
|
55
|
+
All authoring tools share the same base inputs (`prompt`, `tone`, `targetAudience`, `context`, `title`, `slug`, `publish`) and accept a `collection` override when your site uses non-conventional slugs.
|
|
56
|
+
|
|
57
|
+
> The standalone `create_service` / `create_location` / `create_team_member` tools were collapsed into `create_in_collection`. Use `create_in_collection({ template: "service" | "location" | "team_member", ... })` instead.
|
|
58
|
+
|
|
59
|
+
### Building pages section-by-section
|
|
60
|
+
|
|
61
|
+
Pages are authored as an ordered list of sections (the same model the visual Page Editor reads/writes), so an agent can build a real, previewable, editable page rather than disposable HTML.
|
|
62
|
+
|
|
63
|
+
| Tool | What it does |
|
|
64
|
+
| ----------------------------------------------- | ------------------------------------------------------- |
|
|
65
|
+
| `list_section_types` / `get_section_schema` | Discover registered section types + their field schema |
|
|
66
|
+
| `validate_section_content` | Validate content against a type schema (no persistence) |
|
|
67
|
+
| `list_page_sections` | List a page's ordered sections |
|
|
68
|
+
| `add_page_section` / `update_page_section` | Add or patch a single section in place |
|
|
69
|
+
| `reorder_page_sections` / `remove_page_section` | Reorder / remove a section |
|
|
70
|
+
| `toggle_page_section_visibility` | Show or hide a section without deleting it |
|
|
71
|
+
|
|
72
|
+
### Resolving relationships
|
|
73
|
+
|
|
74
|
+
Relationship fields store a **target document ID**, but prompts speak in slugs ("set the author to jane-doe"). These tools let an agent resolve them instead of guessing IDs.
|
|
75
|
+
|
|
76
|
+
| Tool | What it does |
|
|
77
|
+
| --------------------------- | ----------------------------------------------------------------------------------- |
|
|
78
|
+
| `get_relationship_fields` | List a collection's relationship/media/select fields + each field's `relationTo` |
|
|
79
|
+
| `resolve_relationship` | Resolve an exact slug → `{ id, slug, title, status }` within a collection |
|
|
80
|
+
| `list_relationship_targets` | Browse candidate documents (`{ id, slug, title, status }`) when the slug is unknown |
|
|
81
|
+
|
|
82
|
+
Typical flow: `get_relationship_fields(collection)` → find the field's `relationTo` → `resolve_relationship(relationTo, slug)` → `update_document` with the returned ID.
|
|
83
|
+
|
|
84
|
+
### Navigation menus
|
|
85
|
+
|
|
86
|
+
Menus live in the `navigations` collection (link tree on `data.items`). These tools wrap the document API with tree-aware conveniences so an agent builds a real, editable menu — and can wire a published page into one without hand-deriving its URL.
|
|
87
|
+
|
|
88
|
+
| Tool | What it does |
|
|
89
|
+
| --------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
90
|
+
| `list_navigations` / `get_navigation` | List menus (`{ id, name, slug, location, itemCount }`) or read one + its tree |
|
|
91
|
+
| `create_navigation` / `update_navigation` / `delete_navigation` | Create, edit metadata / replace tree, or soft-delete a menu |
|
|
92
|
+
| `add_navigation_item` | Add a link — explicit `{ label, url }` or a `page` ref ("link page X into menu Y"); optional `parentId` nests it |
|
|
93
|
+
| `remove_navigation_item` / `reorder_navigation_items` | Remove one item (+ sub-tree), or reorder one level by id permutation |
|
|
94
|
+
| `validate_navigation_tree` | Validate a menu or candidate `items` (no save): `{ valid, errors, warnings, stats }` |
|
|
95
|
+
|
|
96
|
+
### Forms
|
|
97
|
+
|
|
98
|
+
The agent can author forms and manage the submissions inbox end-to-end (write-role API key required).
|
|
99
|
+
|
|
100
|
+
| Tool | What it does |
|
|
101
|
+
| ---------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
|
|
102
|
+
| `list_forms` / `get_form` | Discover form definitions and read one |
|
|
103
|
+
| `create_form` / `update_form` / `delete_form` | Create, edit metadata, or delete a form |
|
|
104
|
+
| `duplicate_form` | Copy a form into a new draft |
|
|
105
|
+
| `get_form_schema` / `save_form_schema` | Read or replace the (versioned) field schema |
|
|
106
|
+
| `list_form_submissions` / `list_form_entries` / `get_form_entry` | Read submissions (PII-sensitive; explicit `formId` required) |
|
|
107
|
+
| `set_form_entry_status` / `bulk_set_form_entry_status` / `delete_form_entry` | Manage inbox state (read/star/archive) and delete entries |
|
|
108
|
+
| `export_form_entries` | Export all submissions as CSV (bulk PII egress; requires `confirm: true`) |
|
|
109
|
+
|
|
110
|
+
## Scoping
|
|
111
|
+
|
|
112
|
+
The agent inherits whatever scopes you grant to its API key. Use the **Content** preset to allow read/create/update across all collections without admin powers. Use **Custom** to lock down to specific collections.
|
|
113
|
+
|
|
114
|
+
## Direct (non-MCP) use
|
|
115
|
+
|
|
116
|
+
You can also import the underlying `PrentaClient` programmatically:
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
import { PrentaClient } from '@prenta/mcp-server'
|
|
120
|
+
|
|
121
|
+
const cms = new PrentaClient({
|
|
122
|
+
baseUrl: 'https://your-site.com',
|
|
123
|
+
apiKey: process.env.PRENTA_API_KEY!,
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
const page = await cms.createPageFromPrompt({
|
|
127
|
+
prompt: 'A landing page for a New York City house cleaning service',
|
|
128
|
+
publish: false,
|
|
129
|
+
})
|
|
130
|
+
```
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* stdio entrypoint for the Prenta CMS MCP server. Wire this into your AI
|
|
4
|
+
* tool's MCP config:
|
|
5
|
+
*
|
|
6
|
+
* {
|
|
7
|
+
* "mcpServers": {
|
|
8
|
+
* "prenta": {
|
|
9
|
+
* "command": "npx",
|
|
10
|
+
* "args": ["-y", "@prenta/mcp-server"],
|
|
11
|
+
* "env": {
|
|
12
|
+
* "PRENTA_BASE_URL": "https://your-site.com",
|
|
13
|
+
* "PRENTA_API_KEY": "act_sk_..."
|
|
14
|
+
* }
|
|
15
|
+
* }
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
*/
|
|
19
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
20
|
+
import { createPrentaMcpServer } from './server.js';
|
|
21
|
+
async function main() {
|
|
22
|
+
const baseUrl = process.env.PRENTA_BASE_URL;
|
|
23
|
+
const apiKey = process.env.PRENTA_API_KEY;
|
|
24
|
+
if (!baseUrl) {
|
|
25
|
+
console.error('PRENTA_BASE_URL environment variable is required');
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
if (!apiKey) {
|
|
29
|
+
console.error('PRENTA_API_KEY environment variable is required (act_sk_... from /api-keys)');
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
if (!apiKey.startsWith('act_sk_')) {
|
|
33
|
+
console.error('PRENTA_API_KEY does not look like an Prenta API key (expected act_sk_ prefix)');
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
const { server } = createPrentaMcpServer({ baseUrl, apiKey });
|
|
37
|
+
const transport = new StdioServerTransport();
|
|
38
|
+
await server.connect(transport);
|
|
39
|
+
}
|
|
40
|
+
main().catch((err) => {
|
|
41
|
+
console.error('[prenta-mcp] fatal:', err);
|
|
42
|
+
process.exit(1);
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAEnD,KAAK,UAAU,IAAI;IACjB,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAA;IAC3C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAA;IAEzC,IAAI,C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