contentful-mcp
内容丰富的 MCP 服务器
MCP 服务器实现与 Contentful 的内容管理 API 集成,提供全面的内容管理功能。
请注意*;如果您对代码不感兴趣,只想在 Claude Desktop(或任何其他能够使用 MCP 服务器的工具)中使用此 MCP,则您不必克隆此 repo,您只需在 Claude Desktop 中进行设置即可,请参阅“与 Claude Desktop 一起使用”部分以获取有关如何安装它的说明。
特征
内容管理:对条目和资产进行完整的 CRUD 操作
空间管理:创建、更新和管理空间和环境
内容类型:管理内容类型定义
本地化:支持多种语言环境
发布:控制内容发布工作流程
批量操作:对多个条目和资产执行批量发布、取消发布和验证
智能分页:列表操作每个请求最多返回 3 个项目,以防止上下文窗口溢出,并具有内置分页支持
Related MCP server: Storyblok MCP Server
分页
为防止 LLM 中的上下文窗口溢出,列表操作(例如 search_entries 和 list_assets)每个请求限制为 3 个项目。每个响应包含:
可用商品总数
当前页面项目(最多 3 个)
剩余商品数量
下一页的跳过值
提示 LLM 提供检索更多项目的消息
该分页系统允许 LLM 有效地处理大型数据集,同时保持上下文窗口限制。
批量操作
批量操作功能可同时高效管理多个内容项:
异步处理:操作异步运行并提供状态更新
高效的内容管理:通过一次 API 调用处理多个条目或资产
状态跟踪:通过成功和失败计数监控进度
资源优化:减少 API 调用并提高批量操作的性能
这些批量操作工具非常适合内容迁移、大规模更新或批量发布工作流程。
工具
入境管理
search_entries :使用查询参数搜索条目
create_entry :创建新条目
get_entry :检索现有条目
update_entry :更新输入字段
delete_entry :删除条目
publish_entry :发布条目
unpublish_entry :取消发布条目
批量操作
bulk_publish :一次性发布多个条目和资产。接受一个实体数组(条目和资产),并批量处理它们的发布。
bulk_unpublish :一次性取消发布多个条目和资产。与 bulk_publish 类似,但会从分发 API 中移除内容。
bulk_validate :验证多个条目的内容一致性、引用和必填字段。返回验证结果,但不修改内容。
资产管理
list_assets :分页列出资产(每页 3 项)
upload_asset :上传带有元数据的新资产
get_asset :检索资产详细信息和信息
update_asset :更新资产元数据和文件
delete_asset :从空间中删除资产
publish_asset :将资产发布到交付 API
unpublish_asset :从交付 API 取消发布资产
空间与环境管理
list_spaces :列出可用空间
get_space :获取空间详细信息
list_environments :列出空间中的环境
create_environment :创建新环境
delete_environment :删除环境
内容类型管理
list_content_types :列出可用的内容类型
get_content_type :获取内容类型详细信息
create_content_type :创建新的内容类型
update_content_type :更新内容类型
delete_content_type :删除内容类型
publish_content_type :发布内容类型
开发工具
MCP 检查器
该项目包括一个有助于开发和调试的 MCP Inspector 工具:
检查模式:运行
npm run inspect启动检查器,您可以通过http://localhost:5173打开检查器监视模式:使用
npm run inspect:watch在文件更改时自动重启检查器可视化界面:检查器提供了一个 Web 界面来测试和调试 MCP 工具
实时测试:试用工具并立即查看其响应
批量操作测试:通过进度和结果的视觉反馈来测试和监控批量操作
该项目还包含一个npm run dev命令,该命令会在每次更改时重建并重新加载 MCP 服务器。
配置
先决条件
在Contentful上创建 Contentful 帐户
从您的帐户设置生成内容管理 API 令牌
环境变量
这些变量也可以设置为参数
CONTENTFUL_HOST/--host:Contentful 管理 API 端点(默认为https://api.contentful.com )CONTENTFUL_MANAGEMENT_ACCESS_TOKEN/--management-token:您的内容管理 API 令牌ENABLE_HTTP_SERVER/--http:设置为“true”以启用 HTTP/SSE 模式HTTP_PORT/--port:HTTP 服务器的端口(默认值:3000)HTTP_HOST/--http-host:HTTP 服务器的主机(默认值:localhost)
空间和环境范围
您可以设置 spaceId 和 EnvironmentId 的范围,以确保 LLM 仅对定义的空间/环境 ID 执行操作。这主要是为了支持在特定空间内运行的代理。如果同时设置了SPACE_ID和ENVIRONMENT_ID环境变量,工具将不会报告需要这些值,处理程序将使用环境变量执行 CMA 操作。由于这些工具跨空间,您还将失去对空间处理程序中工具的访问权限。您还可以使用参数--space-id和--environment-id添加SPACE_ID和ENVIRONMENT_ID 。
使用 App Identity
除了提供管理令牌之外,您还可以利用App Identity来处理身份验证。您需要设置并安装一个 Contentful App,并在调用 MCP 服务器时设置以下参数:
--app-id= 提供 Apptoken 的应用程序 ID--private-key= 您在应用程序用户界面中创建的私钥,与app_id绑定--space-id= 安装应用程序的spaceId--environment-id= 安装应用程序的环境 ID(空间内)。
使用这些值,MCP 服务器将请求一个临时的 AppToken,以便在定义的空间/环境 ID 中执行内容操作。当在充当 MCP 客户端(例如聊天代理)的后端系统中使用此 MCP 服务器时,此功能尤其有用。
与 Claude Desktop 一起使用
您不需要克隆此 repo 来使用此 MCP,您只需将其添加到您的claude_desktop_config.json即可:
添加或编辑~/Library/Application Support/Claude/claude_desktop_config.json并添加以下行:
{
"mcpServers": {
"contentful": {
"command": "npx",
"args": ["-y", "@ivotoby/contentful-management-mcp-server"],
"env": {
"CONTENTFUL_MANAGEMENT_ACCESS_TOKEN": "<Your CMA token>"
}
}
}
}如果您的 MCPClient 不支持设置环境变量,您也可以使用如下参数设置管理令牌:
{
"mcpServers": {
"contentful": {
"command": "npx",
"args": [
"-y",
"@ivotoby/contentful-management-mcp-server",
"--management-token",
"<your token>",
"--host",
"http://api.contentful.com"
]
}
}
}通过 Smithery 安装
要通过Smithery自动为 Claude Desktop 安装 Contentful 管理服务器:
npx -y @smithery/cli install @ivotoby/contentful-management-mcp-server --client claude开发并使用Claude桌面
如果您想贡献并测试 Claude 如何处理您的贡献;
运行
npm run dev,这将启动观察程序,在每次更改时重建 MCP 服务器更新
claude_desktop_config.json以直接引用项目,即;
{
"mcpServers": {
"contentful": {
"command": "node",
"args": ["/Users/ivo/workspace/contentful-mcp/bin/mcp-server.js"],
"env": {
"CONTENTFUL_MANAGEMENT_ACCESS_TOKEN": "<Your CMA Token>"
}
}
}
}这将允许您直接使用 Claude 测试 MCP 服务器中的任何修改;但是,如果您添加新的工具/资源,则需要重新启动 Claude Desktop
交通方式
MCP 服务器支持两种传输模式:
stdio 传输
默认传输模式使用标准输入/输出流进行通信。这非常适合与支持标准输入/输出传输的 MCP 客户端(例如 Claude Desktop)集成。
要使用 stdio 模式,只需运行不带--http标志的服务器:
npx -y contentful-mcp --management-token YOUR_TOKEN
# or alternatively
npx -y @ivotoby/contentful-management-mcp-server --management-token YOUR_TOKEN可流式传输的HTTP传输
该服务器还支持 MCP 协议中定义的 StreamableHTTP 传输。此模式对于基于 Web 的集成或将服务器作为独立服务运行时非常有用。
要使用 StreamableHTTP 模式,请使用--http标志运行:
npx -y contentful-mcp --management-token YOUR_TOKEN --http --port 3000
# or alternatively
npx -y @ivotoby/contentful-management-mcp-server --management-token YOUR_TOKEN --http --port 3000StreamableHTTP 详细信息
使用官方 MCP StreamableHTTP 传输
支持标准MCP协议操作
包括用于维护状态的会话管理
正确处理初始化/通知模式
与标准 MCP 客户端兼容
用现代方法取代已弃用的 SSE 传输
该实现遵循标准 MCP 协议规范,允许任何 MCP 客户端无需特殊处理即可连接到服务器。
错误处理
服务器实现了全面的错误处理:
身份验证失败
速率限制
无效请求
网络问题
API 特定错误
执照
MIT 许可证
细则
此 MCP 服务器允许 Claude(或其他可以使用 MCP 资源的代理)更新、删除内容、空间和内容模型。因此,请务必确认您允许 Claude 对您的 Contentful 空间执行的操作!
此 MCP 服务器尚未获得 Contentful 官方支持(目前)
Available Tools
40 toolsbulk_validateC
Validate multiple entries at once
Inputs: entryIds (required), spaceId (required), environmentId (required).
create_ai_actionC
Create a new AI Action
Inputs: name (required), description (required), instruction (required), configuration (required), +3 more.
create_commentA
Create a new comment on an entry. The comment will be created with the specified body and status. To create a threaded conversation (reply to an existing comment), provide the parent comment ID. This allows you to work around the 512-character limit by creating threaded replies.
Inputs: entryId (required), body (required), spaceId (required), environmentId (required), +2 more.
create_content_typeD
Create a new content type
Inputs: name (required), fields (required), spaceId (required), environmentId (required), +2 more.
create_entryA
Create a new entry in Contentful. Before executing this function, you need to know the contentTypeId (not the content type NAME) and the fields of that contentType. You can get the fields definition by using the GET_CONTENT_TYPE tool. IMPORTANT: All field values MUST include a locale key (e.g., 'en-US') for each value, like: { title: { 'en-US': 'My Title' } }. Every field in Contentful requires a locale even for single-language content.
Inputs: contentTypeId (required), fields (required), spaceId (required), environmentId (required).
create_environmentD
Create a new environment
Inputs: spaceId (required), environmentId (required), name (required).
delete_ai_actionB
Delete an AI Action
Inputs: aiActionId (required), spaceId (required), environmentId (required).
delete_assetC
Delete an asset
Inputs: assetId (required), spaceId (required), environmentId (required).
delete_commentC
Delete a specific comment from an entry.
Inputs: entryId (required), commentId (required), spaceId (required), environmentId (required).
delete_content_typeC
Delete a content type
Inputs: contentTypeId (required), spaceId (required), environmentId (required).
delete_entryC
Delete an entry
Inputs: entryId (required), spaceId (required), environmentId (required).
delete_environmentC
Delete an environment
Inputs: spaceId (required), environmentId (required).
get_ai_actionB
Get a specific AI Action by ID
Inputs: aiActionId (required), spaceId (required), environmentId (required).
get_ai_action_invocationB
Get the result of a previous AI Action invocation
Inputs: aiActionId (required), invocationId (required), spaceId (required), environmentId (required).
get_assetC
Retrieve an asset
Inputs: assetId (required), spaceId (required), environmentId (required).
get_commentsB
Retrieve comments for an entry with pagination support. Returns comments with their status and body content.
Inputs: entryId (required), spaceId (required), environmentId (required), bodyFormat, +3 more.
get_content_typeB
Get details of a specific content type
Inputs: contentTypeId (required), spaceId (required), environmentId (required).
get_entryC
Retrieve an existing entry
Inputs: entryId (required), spaceId (required), environmentId (required).
get_single_commentB
Retrieve a specific comment by its ID for an entry.
Inputs: entryId (required), commentId (required), spaceId (required), environmentId (required), +1 more.
get_spaceC
Get details of a space
Inputs: spaceId (required).
invoke_ai_actionC
Invoke an AI Action with variables
Inputs: aiActionId (required), spaceId (required), environmentId (required), variables, +3 more.
list_ai_actionsC
List all AI Actions in a space
Inputs: spaceId (required), environmentId (required), limit, skip, +1 more.
list_assetsA
List assets in a space. Returns a maximum of 3 items per request. Use skip parameter to paginate through results.
Inputs: limit (required), skip (required), spaceId (required), environmentId (required).
list_content_typesB
List content types in a space. Returns a maximum of 10 items per request. Use skip parameter to paginate through results.
Inputs: limit (required), skip (required), spaceId (required), environmentId (required).
list_environmentsC
List all environments in a space
Inputs: spaceId (required).
list_spacesA
List all available spaces
Inputs: no named parameters.
publish_ai_actionC
Publish an AI Action
Inputs: aiActionId (required), spaceId (required), environmentId (required).
publish_assetC
Publish an asset
Inputs: assetId (required), spaceId (required), environmentId (required).
publish_content_typeC
Publish a content type
Inputs: contentTypeId (required), spaceId (required), environmentId (required).
publish_entryA
Publish an entry or multiple entries. Accepts either a single entryId (string) or an array of entryIds (up to 100 entries). For a single entry, it uses the standard publish operation. For multiple entries, it automatically uses bulk publishing.
Inputs: entryId (required), spaceId (required), environmentId (required).
search_entriesA
Search for entries using query parameters. Returns a maximum of 3 items per request. Use skip parameter to paginate through results.
Inputs: query (required), spaceId (required), environmentId (required).
unpublish_ai_actionC
Unpublish an AI Action
Inputs: aiActionId (required), spaceId (required), environmentId (required).
unpublish_assetC
Unpublish an asset
Inputs: assetId (required), spaceId (required), environmentId (required).
unpublish_entryA
Unpublish an entry or multiple entries. Accepts either a single entryId (string) or an array of entryIds (up to 100 entries). For a single entry, it uses the standard unpublish operation. For multiple entries, it automatically uses bulk unpublishing.
Inputs: entryId (required), spaceId (required), environmentId (required).
update_ai_actionC
Update an existing AI Action
Inputs: aiActionId (required), name (required), description (required), instruction (required), +4 more.
update_assetD
Update an asset
Inputs: assetId (required), spaceId (required), environmentId (required), title, +2 more.
update_commentA
Update an existing comment on an entry. The handler will merge your updates with the existing comment data.
Inputs: entryId (required), commentId (required), spaceId (required), environmentId (required), +3 more.
update_content_typeB
Update an existing content type. The handler will merge your field updates with existing content type data, so you only need to provide the fields and properties you want to change.
Inputs: contentTypeId (required), fields (required), spaceId (required), environmentId (required), +3 more.
update_entryA
Update an existing entry. The handler will merge your field updates with the existing entry fields, so you only need to provide the fields and locales you want to change. IMPORTANT: All field values MUST include a locale key (e.g., 'en-US') for each value, like: { title: { 'en-US': 'My Updated Title' } }. Every field in Contentful requires a locale even for single-language content.
Inputs: entryId (required), fields (required), spaceId (required), environmentId (required).
upload_assetC
Upload a new asset
Inputs: title (required), file (required), spaceId (required), environmentId (required), +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 40 tools
Each tool targets a distinct resource and action (e.g., create_entry vs. get_entry, publish_asset vs. unpublish_asset). There is no overlap in purpose, and descriptions clearly differentiate similar operations like get_ai_action vs. get_ai_action_invocation.
All tools follow a consistent verb_noun snake_case pattern (e.g., create_entry, list_assets, update_comment). No mixing of conventions like camelCase or different verb styles.
With 40 tools, the count exceeds the typical well-scoped range (3-15) and the '25+' threshold for too many. Even considering Contentful's complexity, the number feels heavy and may overwhelm agents.
The tool set covers full CRUD plus publish/unpublish, search, and validation for entries; CRUD plus upload for assets; lifecycle for comments, environments, AI actions; and space listing. No obvious gaps such as missing delete for content types or bulk operations.
Maintenance
Related MCP Connectors
Headless CMS. Search the docs and read, draft, publish, and schedule entries via OAuth.
Run read-only GraphQL queries and list documents and media assets in Caisy.
Manage repositories, users, releases, and automate GitHub workflows
Hosted Kontent.ai MCP server to manage content, types, taxonomies, and workflows
Related MCP Servers
- AlicenseAqualityDmaintenanceAn MCP server for interacting with Contentstack's Content Management API1511 npm2TypeScriptMIT
- FlicenseNot gradedqualityNot gradedmaintenanceEnables comprehensive management of Storyblok CMS through natural language interactions. Supports story creation and publishing, asset management, component schema updates, release workflows, and content discovery across all major Storyblok APIs.8 npm-
- AlicenseAqualityDmaintenanceEnables efficient content retrieval from Contentful's Content Delivery API using GraphQL queries. Supports schema exploration, query generation, and flexible data fetching with read-only access.69 npm1MIT
- AlicenseAqualityNot gradedmaintenanceEnables AI agents to manage Contentrain CMS content, models, and assets with automatic git branch synchronization across different environments. It provides standardized tools for performing CRUD operations on git-based headless CMS projects through natural language.14-