@mybe/contensa-mcp 1.0.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/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -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,35 @@
1
+ #!/usr/bin/env node
2
+ // CLI entry point for Contensa MCP Server
3
+ import { ContensaMCPServer } from "./server.js";
4
+ async function main() {
5
+ // Get configuration from environment variables
6
+ const apiKey = process.env.CONTENSA_API_KEY;
7
+ const baseUrl = process.env.CONTENSA_BASE_URL;
8
+ const projectId = process.env.CONTENSA_PROJECT_ID;
9
+ const userId = process.env.CONTENSA_USER_ID;
10
+ if (!apiKey) {
11
+ console.error("Error: CONTENSA_API_KEY environment variable is required");
12
+ console.error("");
13
+ console.error("Usage:");
14
+ console.error(" CONTENSA_API_KEY=your-api-key CONTENSA_USER_ID=your-user-id contensa-mcp");
15
+ console.error("");
16
+ console.error("Environment variables:");
17
+ console.error(" CONTENSA_API_KEY - Your Contensa API key (required)");
18
+ console.error(" CONTENSA_USER_ID - Your user ID (required for content operations)");
19
+ console.error(" CONTENSA_BASE_URL - API base URL (optional)");
20
+ console.error(" CONTENSA_PROJECT_ID - Default project ID (optional)");
21
+ process.exit(1);
22
+ }
23
+ const server = new ContensaMCPServer({
24
+ apiKey,
25
+ baseUrl,
26
+ projectId,
27
+ userId,
28
+ });
29
+ await server.start();
30
+ }
31
+ main().catch((error) => {
32
+ console.error("Fatal error:", error);
33
+ process.exit(1);
34
+ });
35
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,0CAA0C;AAE1C,OAAO,EA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CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,150 @@
1
+ import type { ContensaConfig, ContentType, ContentField, ContentEntry, MediaAsset, Project, Environment, ListResponse, CreateContentTypeInput, CreateFieldInput, UpdateFieldInput, CreateContentEntryInput, UpdateContentEntryInput, LocaleConfig, CreateLocaleVariantInput, LocaleVariantResponse } from "./types.js";
2
+ export declare const SUPPORTED_LOCALES: LocaleConfig[];
3
+ export declare class ContensaClient {
4
+ private apiKey;
5
+ private baseUrl;
6
+ private projectId?;
7
+ private environmentId?;
8
+ private userId?;
9
+ constructor(config: ContensaConfig);
10
+ private request;
11
+ setProjectId(projectId: string): void;
12
+ getProjectId(): string | undefined;
13
+ setEnvironmentId(environmentId: string): void;
14
+ getEnvironmentId(): string | undefined;
15
+ getProjects(): Promise<Project[]>;
16
+ getProject(projectId: string): Promise<Project>;
17
+ getContentTypes(projectId?: string): Promise<ContentType[]>;
18
+ getContentType(contentTypeId: string): Promise<ContentType>;
19
+ createContentType(input: CreateContentTypeInput, projectId?: string): Promise<ContentType>;
20
+ updateContentType(contentTypeId: string, input: Partial<CreateContentTypeInput>): Promise<ContentType>;
21
+ deleteContentType(contentTypeId: string): Promise<void>;
22
+ getFields(contentTypeId: string): Promise<ContentField[]>;
23
+ createField(input: CreateFieldInput): Promise<ContentField>;
24
+ updateField(fieldId: string, input: UpdateFieldInput): Promise<ContentField>;
25
+ deleteField(fieldId: string): Promise<void>;
26
+ getContentEntries(contentTypeId: string, options?: {
27
+ status?: string;
28
+ limit?: number;
29
+ lastKey?: string;
30
+ }): Promise<ListResponse<ContentEntry>>;
31
+ getContentEntry(entryId: string): Promise<ContentEntry>;
32
+ createContentEntry(input: CreateContentEntryInput): Promise<ContentEntry>;
33
+ updateContentEntry(entryId: string, input: UpdateContentEntryInput): Promise<ContentEntry>;
34
+ deleteContentEntry(entryId: string): Promise<void>;
35
+ publishContentEntry(entryId: string): Promise<ContentEntry>;
36
+ unpublishContentEntry(entryId: string): Promise<ContentEntry>;
37
+ getMediaAssets(projectId?: string): Promise<MediaAsset[]>;
38
+ getMediaAsset(assetId: string): Promise<MediaAsset>;
39
+ deleteMediaAsset(assetId: string): Promise<void>;
40
+ generateFieldSuggestions(contentTypeName: string, existingFields?: Array<{
41
+ apiName: string;
42
+ kind: string;
43
+ }>): Promise<Array<{
44
+ apiName: string;
45
+ kind: string;
46
+ required?: boolean;
47
+ }>>;
48
+ generateSchema(description: string): Promise<Array<{
49
+ apiName: string;
50
+ kind: string;
51
+ required?: boolean;
52
+ }>>;
53
+ getEnvironments(projectId?: string): Promise<Environment[]>;
54
+ getEnvironment(environmentId: string): Promise<Environment>;
55
+ createEnvironment(input: {
56
+ name: string;
57
+ slug: string;
58
+ description?: string;
59
+ sourceEnvironmentId?: string;
60
+ projectId?: string;
61
+ }): Promise<Environment>;
62
+ updateEnvironment(environmentId: string, input: {
63
+ name?: string;
64
+ description?: string;
65
+ status?: "active" | "inactive";
66
+ }): Promise<Environment>;
67
+ deleteEnvironment(environmentId: string): Promise<void>;
68
+ mergeEnvironment(input: {
69
+ targetEnvironmentId: string;
70
+ sourceEnvironmentId: string;
71
+ dryRun?: boolean;
72
+ defaultStrategy?: "replace" | "skip" | "merge" | "create-new";
73
+ contentTypeResolutions?: Array<{
74
+ contentTypeId: string;
75
+ strategy: "replace" | "skip" | "merge" | "create-new";
76
+ }>;
77
+ entryResolutions?: Array<{
78
+ entryId: string;
79
+ fieldName: string;
80
+ strategy: "replace" | "skip" | "merge" | "create-new";
81
+ }>;
82
+ requireMasterApproval?: boolean;
83
+ }): Promise<{
84
+ success: boolean;
85
+ data: {
86
+ contentTypesMerged: number;
87
+ entriesMerged: number;
88
+ conflictsResolved: number;
89
+ conflictsSkipped: number;
90
+ conflicts?: Array<{
91
+ type: string;
92
+ id: string;
93
+ message: string;
94
+ }>;
95
+ errors: Array<{
96
+ type: string;
97
+ id: string;
98
+ message: string;
99
+ }>;
100
+ };
101
+ isDryRun: boolean;
102
+ }>;
103
+ syncEnvironment(input: {
104
+ targetEnvironmentId: string;
105
+ sourceEnvironmentId: string;
106
+ }): Promise<{
107
+ success: boolean;
108
+ message: string;
109
+ }>;
110
+ /**
111
+ * Get all supported locales in the system
112
+ */
113
+ getSupportedLocales(): LocaleConfig[];
114
+ /**
115
+ * Get all locale variants of a content entry
116
+ */
117
+ listLocaleVariants(entryId: string): Promise<ContentEntry[]>;
118
+ /**
119
+ * Create a new locale variant of a content entry
120
+ *
121
+ * @param input - Locale variant creation options
122
+ * @param input.entryId - ID of the entry to create a variant for
123
+ * @param input.locale - Target locale code (e.g., "fr-FR", "es-ES")
124
+ * @param input.translateContent - Whether to use AI to translate content (REQUIRED - must be explicitly set)
125
+ * @param input.translateReferences - Whether to recursively create locale variants for referenced entries (REQUIRED - must be explicitly set)
126
+ * @param input.userId - User ID for the operation (optional, uses config userId if not provided)
127
+ *
128
+ * @returns The created locale variant and list of all created entries (if translateReferences was true)
129
+ *
130
+ * @example
131
+ * // Create a French variant with AI translation
132
+ * const variant = await client.createLocaleVariant({
133
+ * entryId: "entry-123",
134
+ * locale: "fr-FR",
135
+ * translateContent: true,
136
+ * translateReferences: false
137
+ * });
138
+ *
139
+ * @example
140
+ * // Create a Spanish variant without translation
141
+ * const variant = await client.createLocaleVariant({
142
+ * entryId: "entry-123",
143
+ * locale: "es-ES",
144
+ * translateContent: false,
145
+ * translateReferences: false
146
+ * });
147
+ */
148
+ createLocaleVariant(input: CreateLocaleVariantInput): Promise<LocaleVariantResponse>;
149
+ }
150
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,OAAO,EACP,WAAW,EAEX,YAAY,EACZ,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,uB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