@contentful/mcp-tools

中文文档
0.12.61发布于 2026/11/06MITTypeScriptES Module近 30 天下载 2.9万

A toolkit package containing reusable MCP (Model Context Protocol) tools for Contentful. This package provides structured tool collections with complete metadata including descriptions, input schemas, semantic annotations, and tool implementations.

原始使用文档
文档目录10 节
  1. Installation
  2. Usage
  3. Using Tool Collections
  4. Data Assembly write inputs
  5. Available Tool Collections
  6. Tool Annotations
  7. 🛠️ Available Tools
  8. Configuration
  9. Testing
  10. License

@contentful/mcp-tools

A toolkit package containing reusable MCP (Model Context Protocol) tools for Contentful. This package provides structured tool collections with complete metadata including descriptions, input schemas, semantic annotations, and tool implementations.

Installation

npm install @contentful/mcp-tools

Usage

Using Tool Collections

The package exports tool collections organized by category. Each tool in a collection includes:

  • title: The tool name
  • description: What the tool does
  • inputParams: Zod schema or raw shape for input validation
  • annotations: Semantic hints about tool behavior (readOnly, destructive, idempotent, openWorld)
  • tool: The actual tool implementation function
import { ContentfulMcpTools } from '@contentful/mcp-tools';
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';

const server = new McpServer({ name: 'my-contentful-mcp', version: '1.0.0' });
const tools = new ContentfulMcpTools({
  accessToken: '<management-token>',
  mcpVersion: '1.0.0',
});

// Register a specific tool
const { searchEntries } = tools.getEntryTools();
server.registerTool(
  searchEntries.title,
  {
    description: searchEntries.description,
    inputSchema: searchEntries.inputParams,
    annotations: searchEntries.annotations,
  },
  searchEntries.tool,
);

// Register all tools from a collection
Object.values(tools.getAssetTools()).forEach((toolConfig) => {
  server.registerTool(
    toolConfig.title,
    {
      description: toolConfig.description,
      inputSchema: toolConfig.inputParams,
      annotations: toolConfig.annotations,
    },
    toolConfig.tool,
  );
});

Data Assembly write inputs

create_data_assembly takes editable configuration without sys, dataType, or variant. The API generates sys.id and infers sys.dataType from return. parameters is an ordered array of declarations with stable id and explicit boolean required. Updates that omit parameters require a canonical array from the current GET response and retain server metadata. Coordinate canonical GET coverage and tool distribution before releasing this array-only contract. This is a breaking input change: callers still passing top-level sys, dataType, or variant receive a validation error. Remove those arguments when upgrading. Nested ResourceLink sys objects remain part of the configuration.

ContentfulMcpTools.getDataAssemblyTools() exposes these tools to MCP hosts. The local server registers ExO tools only when ENABLE_EXO_TOOLS is enabled and the organization has the exoM1 entitlement. The remote server also requires the exoM1 entitlement.

{
  "spaceId": "my-space",
  "environmentId": "master",
  "name": "Page title",
  "description": "A static page title",
  "parameters": [{ "id": "title", "type": "String", "required": false }],
  "resolvers": {},
  "return": { "$object": { "title": { "$literal": "Hello" } } }
}

update_data_assembly takes the assembly ID and the current sys.version from get_data_assembly. Omitted editable fields retain their current values.

{
  "spaceId": "my-space",
  "environmentId": "master",
  "dataAssemblyId": "the-created-sys-id",
  "version": 3,
  "name": "Updated page title"
}

Available Tool Collections

Collections come from ContentfulMcpTools getters such as getEntryTools(), getAssetTools(), getContentTypeTools(), getReleaseTools(), and getDataAssemblyTools(). ExO collections are registered by each server only when its access gates pass.

Tool Annotations

Each tool includes semantic annotations to help MCP clients understand tool behavior:

  • readOnlyHint: true if the tool only reads data without modifications
  • destructiveHint: true if the tool permanently deletes or removes data
  • idempotentHint: true if calling the tool multiple times with the same input produces the same result
  • openWorldHint: true if the tool interacts with external services or systems beyond Contentful

🛠️ Available Tools

CategoryTool NameDescription
Context & Setupget_initial_contextInitialize connection and get usage instructions
Content Typeslist_content_typesList content types (max 10 per request)
get_content_typeGet detailed content type information
create_content_typeCreate new content types
update_content_typeModify existing content types
publish_content_typePublish content type changes
unpublish_content_typeUnpublish content types
delete_content_typeRemove content types
Entriessearch_entriesSearch and filter entries in your space
get_entryRetrieve specific entries
create_entryCreate new content entries with locale support
update_entryModify existing entries with locale support
patch_entryChange specific field locales without resending the others (JSON Patch)
publish_entryPublish entries (single or bulk up to 100)
unpublish_entryUnpublish entries (single or bulk up to 100)
delete_entryRemove entries
Editor Interfaceslist_editor_interfacesList all editor interfaces in a space
get_editor_interfaceGet editor interface for a content type
update_editor_interfaceUpdate field controls, sidebars, and layouts
Assetsupload_assetUpload new assets
list_assetsList and browse assets (max 3 per request)
get_assetRetrieve specific assets
update_assetModify asset metadata
publish_assetPublish assets (single or bulk up to 100)
unpublish_assetUnpublish assets (single or bulk up to 100)
delete_assetRemove assets
Spaces & Environmentslist_spacesList available spaces (max 10 per request)
get_spaceGet space details
list_environmentsList environments in a space
create_environmentCreate new environments
delete_environmentRemove environments
Localeslist_localesList all locales in your environment
get_localeRetrieve specific locale information
create_localeCreate new locales for multi-language content
update_localeModify existing locale settings
delete_localeRemove locales from environment
Tagslist_tagsList all tags in an environment
create_tagCreate new tags with public/private visibility
Organizationslist_orgsList organizations user has access to
get_orgGet details of a specific organization
Releaseslist_releasesList releases (max 10 per request)
get_releaseRetrieve a release
create_releaseCreate a release with Entries/Assets
update_releaseModify a release's title and/or contents
delete_releaseRemove a release (and its linked release actions)
publish_releasePublish a release (async; check via get_release_action)
unpublish_releaseUnpublish a release (async; check via get_release_action)
validate_releaseValidate a release, optionally against publish/unpublish
get_release_actionCheck the status of a queued release action
list_release_actionsList release actions (max 10 per request)
schedule_publish_releaseSchedule a release to publish at a future datetime (or reschedule)
schedule_unpublish_releaseSchedule a release to unpublish at a future datetime (or reschedule)
cancel_scheduled_releaseCancel a scheduled release action (two-phase confirm)
list_scheduled_actionsList scheduled actions (max 10 per request)
Data Assemblies (ExO)get_data_assemblyGet an assembly and its current version
get_published_data_assemblyGet the published assembly
list_data_assembliesList assemblies
list_published_data_assembliesList published assemblies
create_data_assemblyCreate with a sys-free body and API-generated ID
update_data_assemblyUpdate with a sys-free body and current version
delete_data_assemblyDelete an assembly
publish_data_assemblyPublish an assembly
unpublish_data_assemblyUnpublish an assembly
AI Actionscreate_ai_actionCreate custom AI-powered workflows
invoke_ai_actionInvoke AI action with variables (bulk support)
get_ai_action_invocationGet AI action invocation details
get_ai_actionRetrieve AI action details and configuration
list_ai_actionsList AI actions in a space (max 3 per request)
update_ai_actionUpdate existing AI actions
publish_ai_actionPublish AI actions for use
unpublish_ai_actionUnpublish AI actions
delete_ai_actionRemove AI actions
Taxonomy Conceptscreate_conceptCreate new taxonomy concepts with localization
get_conceptRetrieve specific taxonomy concept
list_conceptsList concepts with filtering and hierarchy
update_conceptUpdate taxonomy concept properties
delete_conceptRemove taxonomy concepts
Taxonomy Schemescreate_concept_schemeCreate new taxonomy concept schemes
get_concept_schemeRetrieve specific concept scheme
list_concept_schemesList concept schemes with pagination
update_concept_schemeUpdate concept scheme properties
delete_concept_schemeRemove concept schemes
Space Migrationspace_to_space_migration_handlerEnable/disable space migration workflow
space_to_space_param_collectionCollect parameters for migration workflow
export_spaceExport space to file for migration
import_spaceImport space from exported file
Usageget_usagesGet aggregated usage metrics for an organization, optionally filtered or grouped by space

Configuration

The tools require environment variables to be configured:

CONTENTFUL_MANAGEMENT_ACCESS_TOKEN=your_token_here
CONTENTFUL_HOST=api.contentful.com
SPACE_ID=your_space_id
ENVIRONMENT_ID=master

Testing

All tools include comprehensive unit tests. Run tests with:

npm test

License

MIT

版本与发布记录

@contentful/mcp-tools 共发布 88 个版本,首次发布于 2025/10/20;过去 12 个月发布了 87 个版本。

版本发布日期距今
0.12.61latest2026/11/064 天前
0.12.602026/11/065 天前
0.12.592026/11/028 天前
0.12.582026/10/2912 天前
0.12.572026/10/2813 天前
0.12.562026/10/2714 天前

其他发布通道:beta → 0.1.0-dev-20251016T1739-07b05ef.0,dev → 0.1.0-dev-20251118T2209-4951c6c.0,next → 0.12.3-next.2。

关于 @contentful/mcp-tools 的常见问题

@contentful/mcp-tools 是什么?

A toolkit package containing reusable MCP (Model Context Protocol) tools for Contentful. This package provides structured tool collections with complete metadata including descriptions, input schemas, semantic annotations, and tool implementations.

如何安装 @contentful/mcp-tools?

在项目目录运行 npm install @contentful/mcp-tools,或使用 pnpm add / yarn add / bun add。

@contentful/mcp-tools 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@contentful/mcp-tools 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@contentful/mcp-tools 可以商用吗?

@contentful/mcp-tools 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@contentful/mcp-tools 的下载量有多少?

根据 npm 官方下载统计,@contentful/mcp-tools 在 2026/10/11 – 2026/11/09 这 30 天内被下载 29,389 次,日均约 980 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@contentful/mcp-tools 还在维护吗?

最新版本 0.12.61 发布于 2026/11/06(4 天前);至今共发布 88 个版本,其中过去 12 个月发布了 87 个;首次发布于 2025/10/20。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。