@contentful/mcp-tools 0.12.3-next.2 → 0.12.4

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 (3) hide show
  1. package/dist/index.d.ts +146 -86
  2. package/dist/index.js +834 -687
  3. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _modelcontextprotocol_sdk_server_mcp_js from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import * as contentful_management from 'contentful-management';
3
- import { PlainClientAPI } from 'contentful-management';
3
+ import { ExperienceProps } from 'contentful-management';
4
4
  import * as _contentful_rich_text_types from '@contentful/rich-text-types';
5
5
  import * as _modelcontextprotocol_sdk_shared_protocol_js from '@modelcontextprotocol/sdk/shared/protocol.js';
6
6
  import * as _modelcontextprotocol_sdk_types_js from '@modelcontextprotocol/sdk/types.js';
@@ -13,10 +13,7 @@ type JsonValue = string | number | boolean | null | JsonValue[] | {
13
13
  type Distribute<T> = T extends unknown ? {
14
14
  [K in keyof T]: T[K];
15
15
  } : never;
16
- type ComponentTypeEntity = Awaited<ReturnType<PlainClientAPI['componentType']['get']>>;
17
- type TreeNode = Distribute<NonNullable<ComponentTypeEntity['componentTree']>[number]>;
18
- type ExperienceEntity = Awaited<ReturnType<PlainClientAPI['experience']['get']>>;
19
- type ExperienceSlotNode = Distribute<NonNullable<ExperienceEntity['slots']>[string][number]>;
16
+ type ExperienceSlotNode = Distribute<NonNullable<ExperienceProps['slots']>[string][number]>;
20
17
 
21
18
  /**
22
19
  * Response type for tool handlers
@@ -4371,7 +4368,7 @@ declare class ContentfulMcpTools {
4371
4368
  type: "DesignToken";
4372
4369
  } | undefined;
4373
4370
  }>]>, "many">;
4374
- componentTree: zod.ZodOptional<zod.ZodArray<zod.ZodType<TreeNode, zod.ZodTypeDef, TreeNode>, "many">>;
4371
+ componentTree: zod.ZodOptional<zod.ZodArray<zod.ZodType<contentful_management.TreeNode, zod.ZodTypeDef, contentful_management.TreeNode>, "many">>;
4375
4372
  slots: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
4376
4373
  id: zod.ZodString;
4377
4374
  name: zod.ZodString;
@@ -4540,18 +4537,6 @@ declare class ContentfulMcpTools {
4540
4537
  description: string;
4541
4538
  spaceId: string;
4542
4539
  environmentId: string;
4543
- viewports: {
4544
- id: string;
4545
- query: string;
4546
- displayName: string;
4547
- previewSize: string;
4548
- }[];
4549
- contentProperties: (contentful_management.DataTypeDefinition & {
4550
- name: string;
4551
- required: boolean;
4552
- id: string;
4553
- defaultValue?: unknown;
4554
- })[];
4555
4540
  designProperties: ({
4556
4541
  name: string;
4557
4542
  type: "String";
@@ -4590,6 +4575,18 @@ declare class ContentfulMcpTools {
4590
4575
  type: "DesignToken";
4591
4576
  } | undefined;
4592
4577
  })[];
4578
+ contentProperties: (contentful_management.DataTypeDefinition & {
4579
+ name: string;
4580
+ required: boolean;
4581
+ id: string;
4582
+ defaultValue?: unknown;
4583
+ })[];
4584
+ viewports: {
4585
+ id: string;
4586
+ query: string;
4587
+ displayName: string;
4588
+ previewSize: string;
4589
+ }[];
4593
4590
  metadata?: {
4594
4591
  tags?: {
4595
4592
  sys: {
@@ -4622,7 +4619,7 @@ declare class ContentfulMcpTools {
4622
4619
  allowedTypes: string[];
4623
4620
  }[] | undefined;
4624
4621
  }[] | undefined;
4625
- componentTree?: TreeNode[] | undefined;
4622
+ componentTree?: contentful_management.TreeNode[] | undefined;
4626
4623
  }, extra?: _modelcontextprotocol_sdk_shared_protocol_js.RequestHandlerExtra<_modelcontextprotocol_sdk_types_js.ServerRequest, _modelcontextprotocol_sdk_types_js.ServerNotification>) => Promise<ToolResponse>;
4627
4624
  };
4628
4625
  upsertComponentType: {
@@ -4821,7 +4818,7 @@ declare class ContentfulMcpTools {
4821
4818
  type: "DesignToken";
4822
4819
  } | undefined;
4823
4820
  }>]>, "many">>;
4824
- componentTree: zod.ZodOptional<zod.ZodArray<zod.ZodType<TreeNode, zod.ZodTypeDef, TreeNode>, "many">>;
4821
+ componentTree: zod.ZodOptional<zod.ZodArray<zod.ZodType<contentful_management.TreeNode, zod.ZodTypeDef, contentful_management.TreeNode>, "many">>;
4825
4822
  slots: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
4826
4823
  id: zod.ZodString;
4827
4824
  name: zod.ZodString;
@@ -5008,18 +5005,6 @@ declare class ContentfulMcpTools {
5008
5005
  } | undefined;
5009
5006
  name?: string | undefined;
5010
5007
  description?: string | undefined;
5011
- viewports?: {
5012
- id: string;
5013
- query: string;
5014
- displayName: string;
5015
- previewSize: string;
5016
- }[] | undefined;
5017
- contentProperties?: (contentful_management.DataTypeDefinition & {
5018
- name: string;
5019
- required: boolean;
5020
- id: string;
5021
- defaultValue?: unknown;
5022
- })[] | undefined;
5023
5008
  designProperties?: ({
5024
5009
  name: string;
5025
5010
  type: "String";
@@ -5074,7 +5059,19 @@ declare class ContentfulMcpTools {
5074
5059
  allowedTypes: string[];
5075
5060
  }[] | undefined;
5076
5061
  }[] | undefined;
5077
- componentTree?: TreeNode[] | undefined;
5062
+ contentProperties?: (contentful_management.DataTypeDefinition & {
5063
+ name: string;
5064
+ required: boolean;
5065
+ id: string;
5066
+ defaultValue?: unknown;
5067
+ })[] | undefined;
5068
+ viewports?: {
5069
+ id: string;
5070
+ query: string;
5071
+ displayName: string;
5072
+ previewSize: string;
5073
+ }[] | undefined;
5074
+ componentTree?: contentful_management.TreeNode[] | undefined;
5078
5075
  }, extra?: _modelcontextprotocol_sdk_shared_protocol_js.RequestHandlerExtra<_modelcontextprotocol_sdk_types_js.ServerRequest, _modelcontextprotocol_sdk_types_js.ServerNotification>) => Promise<ToolResponse>;
5079
5076
  };
5080
5077
  deleteComponentType: {
@@ -5393,7 +5390,7 @@ declare class ContentfulMcpTools {
5393
5390
  type: "DesignToken";
5394
5391
  } | undefined;
5395
5392
  }>]>, "many">;
5396
- componentTree: zod.ZodOptional<zod.ZodArray<zod.ZodType<TreeNode, zod.ZodTypeDef, TreeNode>, "many">>;
5393
+ componentTree: zod.ZodOptional<zod.ZodArray<zod.ZodType<contentful_management.TreeNode, zod.ZodTypeDef, contentful_management.TreeNode>, "many">>;
5397
5394
  slots: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
5398
5395
  id: zod.ZodString;
5399
5396
  name: zod.ZodString;
@@ -5562,18 +5559,6 @@ declare class ContentfulMcpTools {
5562
5559
  description: string;
5563
5560
  spaceId: string;
5564
5561
  environmentId: string;
5565
- viewports: {
5566
- id: string;
5567
- query: string;
5568
- displayName: string;
5569
- previewSize: string;
5570
- }[];
5571
- contentProperties: (contentful_management.DataTypeDefinition & {
5572
- name: string;
5573
- required: boolean;
5574
- id: string;
5575
- defaultValue?: unknown;
5576
- })[];
5577
5562
  designProperties: ({
5578
5563
  name: string;
5579
5564
  type: "String";
@@ -5612,6 +5597,18 @@ declare class ContentfulMcpTools {
5612
5597
  type: "DesignToken";
5613
5598
  } | undefined;
5614
5599
  })[];
5600
+ contentProperties: (contentful_management.DataTypeDefinition & {
5601
+ name: string;
5602
+ required: boolean;
5603
+ id: string;
5604
+ defaultValue?: unknown;
5605
+ })[];
5606
+ viewports: {
5607
+ id: string;
5608
+ query: string;
5609
+ displayName: string;
5610
+ previewSize: string;
5611
+ }[];
5615
5612
  metadata?: {
5616
5613
  tags?: {
5617
5614
  sys: {
@@ -5644,7 +5641,7 @@ declare class ContentfulMcpTools {
5644
5641
  allowedTypes: string[];
5645
5642
  }[] | undefined;
5646
5643
  }[] | undefined;
5647
- componentTree?: TreeNode[] | undefined;
5644
+ componentTree?: contentful_management.TreeNode[] | undefined;
5648
5645
  }, extra?: _modelcontextprotocol_sdk_shared_protocol_js.RequestHandlerExtra<_modelcontextprotocol_sdk_types_js.ServerRequest, _modelcontextprotocol_sdk_types_js.ServerNotification>) => Promise<ToolResponse>;
5649
5646
  };
5650
5647
  upsertTemplate: {
@@ -5843,7 +5840,7 @@ declare class ContentfulMcpTools {
5843
5840
  type: "DesignToken";
5844
5841
  } | undefined;
5845
5842
  }>]>, "many">>;
5846
- componentTree: zod.ZodOptional<zod.ZodArray<zod.ZodType<TreeNode, zod.ZodTypeDef, TreeNode>, "many">>;
5843
+ componentTree: zod.ZodOptional<zod.ZodArray<zod.ZodType<contentful_management.TreeNode, zod.ZodTypeDef, contentful_management.TreeNode>, "many">>;
5847
5844
  slots: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
5848
5845
  id: zod.ZodString;
5849
5846
  name: zod.ZodString;
@@ -6030,18 +6027,6 @@ declare class ContentfulMcpTools {
6030
6027
  } | undefined;
6031
6028
  name?: string | undefined;
6032
6029
  description?: string | undefined;
6033
- viewports?: {
6034
- id: string;
6035
- query: string;
6036
- displayName: string;
6037
- previewSize: string;
6038
- }[] | undefined;
6039
- contentProperties?: (contentful_management.DataTypeDefinition & {
6040
- name: string;
6041
- required: boolean;
6042
- id: string;
6043
- defaultValue?: unknown;
6044
- })[] | undefined;
6045
6030
  designProperties?: ({
6046
6031
  name: string;
6047
6032
  type: "String";
@@ -6096,7 +6081,19 @@ declare class ContentfulMcpTools {
6096
6081
  allowedTypes: string[];
6097
6082
  }[] | undefined;
6098
6083
  }[] | undefined;
6099
- componentTree?: TreeNode[] | undefined;
6084
+ contentProperties?: (contentful_management.DataTypeDefinition & {
6085
+ name: string;
6086
+ required: boolean;
6087
+ id: string;
6088
+ defaultValue?: unknown;
6089
+ })[] | undefined;
6090
+ viewports?: {
6091
+ id: string;
6092
+ query: string;
6093
+ displayName: string;
6094
+ previewSize: string;
6095
+ }[] | undefined;
6096
+ componentTree?: contentful_management.TreeNode[] | undefined;
6100
6097
  }, extra?: _modelcontextprotocol_sdk_shared_protocol_js.RequestHandlerExtra<_modelcontextprotocol_sdk_types_js.ServerRequest, _modelcontextprotocol_sdk_types_js.ServerNotification>) => Promise<ToolResponse>;
6101
6098
  };
6102
6099
  deleteTemplate: {
@@ -6470,12 +6467,6 @@ declare class ContentfulMcpTools {
6470
6467
  urn: string;
6471
6468
  };
6472
6469
  };
6473
- viewports: {
6474
- id: string;
6475
- query: string;
6476
- displayName: string;
6477
- previewSize: string;
6478
- }[];
6479
6470
  designProperties: Record<string, Record<string, {
6480
6471
  value: string;
6481
6472
  type: "DesignToken";
@@ -6483,6 +6474,12 @@ declare class ContentfulMcpTools {
6483
6474
  value: string | number | boolean;
6484
6475
  type: "ManualDesignValue";
6485
6476
  }>>;
6477
+ viewports: {
6478
+ id: string;
6479
+ query: string;
6480
+ displayName: string;
6481
+ previewSize: string;
6482
+ }[];
6486
6483
  metadata?: {
6487
6484
  name?: string | undefined;
6488
6485
  tags?: {
@@ -6753,12 +6750,6 @@ declare class ContentfulMcpTools {
6753
6750
  } | undefined;
6754
6751
  name?: string | undefined;
6755
6752
  description?: string | undefined;
6756
- viewports?: {
6757
- id: string;
6758
- query: string;
6759
- displayName: string;
6760
- previewSize: string;
6761
- }[] | undefined;
6762
6753
  designProperties?: Record<string, Record<string, {
6763
6754
  value: string;
6764
6755
  type: "DesignToken";
@@ -6781,6 +6772,12 @@ declare class ContentfulMcpTools {
6781
6772
  };
6782
6773
  }>;
6783
6774
  } | undefined;
6775
+ viewports?: {
6776
+ id: string;
6777
+ query: string;
6778
+ displayName: string;
6779
+ previewSize: string;
6780
+ }[] | undefined;
6784
6781
  }, extra?: _modelcontextprotocol_sdk_shared_protocol_js.RequestHandlerExtra<_modelcontextprotocol_sdk_types_js.ServerRequest, _modelcontextprotocol_sdk_types_js.ServerNotification>) => Promise<ToolResponse>;
6785
6782
  };
6786
6783
  deleteExperience: {
@@ -7917,6 +7914,35 @@ declare class ContentfulMcpTools {
7917
7914
  dryRun?: boolean | undefined;
7918
7915
  }, extra?: _modelcontextprotocol_sdk_shared_protocol_js.RequestHandlerExtra<_modelcontextprotocol_sdk_types_js.ServerRequest, _modelcontextprotocol_sdk_types_js.ServerNotification>) => Promise<ToolResponse>;
7919
7916
  };
7917
+ appendEntryField: {
7918
+ title: string;
7919
+ description: string;
7920
+ inputParams: {
7921
+ spaceId: zod.ZodString;
7922
+ environmentId: zod.ZodString;
7923
+ } & {
7924
+ entryId: zod.ZodString;
7925
+ fieldId: zod.ZodString;
7926
+ locale: zod.ZodString;
7927
+ values: zod.ZodArray<zod.ZodUnknown, "many">;
7928
+ version: zod.ZodOptional<zod.ZodNumber>;
7929
+ };
7930
+ annotations: {
7931
+ readOnlyHint: boolean;
7932
+ destructiveHint: boolean;
7933
+ idempotentHint: boolean;
7934
+ openWorldHint: boolean;
7935
+ };
7936
+ tool: (params: {
7937
+ values: unknown[];
7938
+ spaceId: string;
7939
+ environmentId: string;
7940
+ locale: string;
7941
+ entryId: string;
7942
+ fieldId: string;
7943
+ version?: number | undefined;
7944
+ }, extra?: _modelcontextprotocol_sdk_shared_protocol_js.RequestHandlerExtra<_modelcontextprotocol_sdk_types_js.ServerRequest, _modelcontextprotocol_sdk_types_js.ServerNotification>) => Promise<ToolResponse>;
7945
+ };
7920
7946
  };
7921
7947
  /**
7922
7948
  * Get environment tools
@@ -9119,12 +9145,6 @@ declare class ContentfulMcpTools {
9119
9145
  urn: string;
9120
9146
  };
9121
9147
  };
9122
- viewports: {
9123
- id: string;
9124
- query: string;
9125
- displayName: string;
9126
- previewSize: string;
9127
- }[];
9128
9148
  designProperties: Record<string, Record<string, {
9129
9149
  value: string;
9130
9150
  type: "DesignToken";
@@ -9132,6 +9152,12 @@ declare class ContentfulMcpTools {
9132
9152
  value: string | number | boolean;
9133
9153
  type: "ManualDesignValue";
9134
9154
  }>>;
9155
+ viewports: {
9156
+ id: string;
9157
+ query: string;
9158
+ displayName: string;
9159
+ previewSize: string;
9160
+ }[];
9135
9161
  metadata?: {
9136
9162
  name?: string | undefined;
9137
9163
  tags?: {
@@ -9402,12 +9428,6 @@ declare class ContentfulMcpTools {
9402
9428
  } | undefined;
9403
9429
  name?: string | undefined;
9404
9430
  description?: string | undefined;
9405
- viewports?: {
9406
- id: string;
9407
- query: string;
9408
- displayName: string;
9409
- previewSize: string;
9410
- }[] | undefined;
9411
9431
  designProperties?: Record<string, Record<string, {
9412
9432
  value: string;
9413
9433
  type: "DesignToken";
@@ -9430,6 +9450,12 @@ declare class ContentfulMcpTools {
9430
9450
  };
9431
9451
  }>;
9432
9452
  } | undefined;
9453
+ viewports?: {
9454
+ id: string;
9455
+ query: string;
9456
+ displayName: string;
9457
+ previewSize: string;
9458
+ }[] | undefined;
9433
9459
  }, extra?: _modelcontextprotocol_sdk_shared_protocol_js.RequestHandlerExtra<_modelcontextprotocol_sdk_types_js.ServerRequest, _modelcontextprotocol_sdk_types_js.ServerNotification>) => Promise<ToolResponse>;
9434
9460
  };
9435
9461
  deleteFragment: {
@@ -10699,4 +10725,38 @@ declare class ContentfulMcpTools {
10699
10725
  };
10700
10726
  }
10701
10727
 
10702
- export { type ContentfulConfig, ContentfulMcpTools };
10728
+ /** Feature name for the shared ExO M1 rollout entitlement. */
10729
+ declare const EXO_M1_FEATURE = "exoM1";
10730
+ /**
10731
+ * Checks whether the user (identified solely by their management token) has the
10732
+ * shared ExO M1 entitlement in ANY organization they can access.
10733
+ *
10734
+ * The local server takes `spaceId`/`organizationId` per tool call, not as
10735
+ * required config, so at registration time there is no single authoritative org
10736
+ * to scope to. We therefore derive orgs from the PAT: list every org the token
10737
+ * can reach (`organization.getAll`) and register ExO if at least one is
10738
+ * entitled. Combined with the `ENABLE_EXO_TOOLS` opt-in (the primary gate),
10739
+ * this answers "does this user have ExO access anywhere?".
10740
+ *
10741
+ * The Node-only `@contentful/entitlements-api-client` and its internal cluster
10742
+ * URL are not used (unreachable from a locally-run server).
10743
+ *
10744
+ * Fails CLOSED: any error (offline, network, no accessible orgs) returns false,
10745
+ * so the caller withholds ExO tools rather than exposing them unentitled.
10746
+ */
10747
+ declare function hasExoM1Entitlement(config: ContentfulConfig): Promise<boolean>;
10748
+
10749
+ /**
10750
+ * Contentful MCP operating guidance, returned in full by get_initial_context
10751
+ * on every session.
10752
+ *
10753
+ * All content is verified against the actual registered tool surface
10754
+ * (audit 2026-07-02). Do not reintroduce fictional tool names or limits;
10755
+ * instructions.test.ts guards against regressions.
10756
+ */
10757
+ declare const CORE_INVARIANTS = "# Core operating rules\n\n- **Schema first.** Before creating or finding content, inspect the environment's schema: list available types and inspect their fields. This prevents failed operations and ensures you use the right type and field names.\n- **Edit safely.** Before updating any item, fetch it first to get the current `sys.version`, then pass that version to the update call. The version is required and prevents overwriting concurrent changes.\n- **Bulk cap.** Bulk publish/unpublish/archive/unarchive operations accept at most 10 IDs per call by default. This cap does not apply to creating or updating items.\n- **Ask when ambiguous.** If multiple spaces or environments are available, ask the user which to use. Do not guess.";
10758
+ declare const SEARCHING_GUIDANCE = "# Searching for content\n\n- **Schema first.** When users ask about specific content, discover the relevant schema before searching: list the environment's available types and inspect a type's fields so you query on real field names. This prevents wasted queries. Use whichever primitives the environment exposes \u2014 classic content types and entries, or Experience Orchestration component types and experiences.\n- **Then search.** Query using the correct type and field names. Prefer semantic search when the request is conceptual rather than an exact field match.\n- **Retry thoughtfully.** If a query returns no results, retry 2-3 times: relax filters, use more general terms, or check for typos in field names.\n- **Multi-step reference queries.** For requests that span references (e.g. \"posts by Magnus\"), first inspect the schema to confirm the reference field, then query for the referenced item to get its ID, then filter the primary query on that ID. If several items match, show them all and ask.";
10759
+ declare const CONVENTIONS_GUIDANCE = "# Response and workflow conventions\n\n- **Plan, then act.** Before a tool call, think about what you need, pick the right tool, and briefly tell the user what you are about to do.\n- **Persist.** Keep going until the request is fully resolved; do not stop at the first error. On failure, explain what went wrong and immediately try a different approach \u2014 never apologize for tool errors.\n- **Clarify resources.** If multiple spaces or environments exist, always ask which to use before acting.\n- **Format for readability.** Use markdown for complex data; show the most important fields of an entry first; keep responses concise but complete.\n- **Prefer bulk.** If you would call the same tool many times, check whether it supports multiple IDs and condense into one call (respecting the 10-ID cap on publish-family operations).";
10760
+ declare const EXO_DISPOSITION = "# Tool disposition: Experience Orchestration by default\n\nExperience Orchestration (ExO) tools are enabled. Use ExO primitives \u2014 Component Types, Experiences, Templates, Fragments, and Data Assemblies \u2014 for all content modeling and authoring. Do not create classic content types or entries unless the user explicitly instructs you to. If you are unsure how to model something with ExO, inspect the tool schemas and proceed with ExO.";
10761
+
10762
+ export { CONVENTIONS_GUIDANCE, CORE_INVARIANTS, type ContentfulConfig, ContentfulMcpTools, EXO_DISPOSITION, EXO_M1_FEATURE, SEARCHING_GUIDANCE, hasExoM1Entitlement };