Crownpeak DQM MCP服务器
一种可移植的模型上下文协议(MCP)服务器,用于封装Crownpeak DQM CMS REST API。此服务器提供了对代理友好的工具,用于质量检查、资产管理、检查点监控等。
特性
- API全面覆盖:实施并测试了所有15个DQM API端点
- 双重运输支持:以stdio(桌面客户端)或HTTP服务器(云托管)运行
- 生产就绪:TypeScript、错误处理、速率限制、请求超时
- Docker原生:带有健康检查的容器化部署
- 便携的:部署在任何地方-AWS、Azure、GCP、Netlify、Vercel、Fly.io、Kubernetes
- 默认安全:默认情况下为只读操作,功能标志后面的破坏性工具
- 代理优化:为AI代理设计的面向任务的工具
- 经过全面测试:针对实时DQM API的100%集成测试覆盖率
快速开始
先决条件
- Node.js 20+
- npm(包含在Node.js中)
- Crownpeak DQM API密钥
安装
# Clone repository
git clone
cd crownpeak-dqm-node-mcp
# Install dependencies
npm install
# Copy environment template
cp .env.example .env
# Edit .env and add your API key
# DQM_API_KEY=your_api_key_here构建
npm run build用法
本地标准模式(桌面客户端)
适用于Claude desktop等桌面MCP客户端:
# Run directly
npm start
# Or with environment variables
DQM_API_KEY=your_key npm startClaude桌面配置
添加到您的Claude Desktop配置文件中:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
视窗: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"crownpeak-dqm": {
"command": "node",
"args": ["/absolute/path/to/crownpeak-dqm-node-mcp/dist/index.js"],
"env": {
"DQM_API_KEY": "your_api_key_here"
}
}
}
}Claude桌面使用示例
配置后,您可以使用自然语言通过Claude与DQM API交互:
示例1:网站质量检查
"Get the content from https://www.crownpeak.com and test it against DQM for quality issues"克劳德将:
- 使用
run_quality_check使用您的网站ID和URL - 在DQM中创建资产
- 检索并显示发现的所有质量问题
示例2:检查页面拼写
"Run a spellcheck on https://www.example.com using my DQM website"克劳德将:
- 使用
spellcheck_asset检查URL - 报告发现的任何拼写错误
示例3:审查质量问题
"Show me all the quality checkpoints configured for my website and then check the homepage against them"克劳德将:
- 列出您的网站
list_websites - 列出检查点
list_checkpoints - 在您的主页上进行质量检查
- 提交详细报告
示例4:资产管理
"Search for all assets from www.crownpeak.com in my DQM account and show me the ones with the most issues"克劳德将:
- 搜索资产
search_assets - 为每个人解决问题
get_asset_issues - 排序并显示结果
示例5:获取突出显示的内容
"Get the HTML content for asset [ID] with all quality issues highlighted"克劳德将:
- 使用
get_asset_pagehighlight以突出显示HTML - 显示标记有问题的内容
HTTP服务器模式(云主机)
对于远程托管和API访问:
# Start HTTP server
npm run start:http
# Server will start on port 3000 (configurable via PORT env var)测试终点:
# Health check
curl http://localhost:3000/healthz
# List available tools
curl http://localhost:3000/tools
# Call a tool
curl -X POST http://localhost:3000/call \
-H "Content-Type: application/json" \
-d '{
"tool": "list_websites",
"arguments": {}
}'Docker部署
使用Docker Compose(推荐)
# Create .env file with your API key
echo "DQM_API_KEY=your_api_key_here" > .env
# Start the server
docker-compose up -d
# View logs
docker-compose logs -f
# Stop the server
docker-compose down直接使用Docker
# Build the image
docker build -t crownpeak-dqm-mcp .
# Run the container
docker run -d \
--name crownpeak-dqm-mcp \
-p 3000:3000 \
-e DQM_API_KEY=your_api_key_here \
crownpeak-dqm-mcp
# View logs
docker logs -f crownpeak-dqm-mcp
# Stop the container
docker stop crownpeak-dqm-mcp云部署
亚马逊云服务
AWS ECS/Fargate
# Build and push to ECR
aws ecr create-repository --repository-name crownpeak-dqm-mcp
docker tag crownpeak-dqm-mcp:latest .dkr.ecr..amazonaws.com/crownpeak-dqm-mcp:latest
docker push .dkr.ecr..amazonaws.com/crownpeak-dqm-mcp:latest
# Create task definition with:
# - Image:
# - Port: 3000
# - Environment: DQM_API_KEY (use Secrets Manager)
# - Health check: /healthz
# Deploy using ECS console or CLIAWS应用程序运行程序
# Use App Runner with ECR source
# Configure:
# - Port: 3000
# - Health check: /healthz
# - Environment variable: DQM_API_KEYAzure
Azure容器实例
az container create \
--resource-group myResourceGroup \
--name crownpeak-dqm-mcp \
--image crownpeak-dqm-mcp:latest \
--dns-name-label crownpeak-dqm \
--ports 3000 \
--environment-variables DQM_API_KEY=your_key \
--cpu 1 --memory 0.5Azure容器应用
az containerapp create \
--name crownpeak-dqm-mcp \
--resource-group myResourceGroup \
--environment myEnvironment \
--image crownpeak-dqm-mcp:latest \
--target-port 3000 \
--ingress external \
--env-vars DQM_API_KEY=secretref:dqm-api-key谷歌云平台
云运行
# Build and push to GCR
gcloud builds submit --tag gcr.io/
/crownpeak-dqm-mcp
# Deploy to Cloud Run
gcloud run deploy crownpeak-dqm-mcp \
--image gcr.io/
/crownpeak-dqm-mcp \
--platform managed \
--region us-central1 \
--allow-unauthenticated \
--set-env-vars DQM_API_KEY=your_key \
--port 3000GKE(Kubernetes)
apiVersion: apps/v1
kind: Deployment
metadata:
name: crownpeak-dqm-mcp
spec:
replicas: 2
selector:
matchLabels:
app: crownpeak-dqm-mcp
template:
metadata:
labels:
app: crownpeak-dqm-mcp
spec:
containers:
- name: crownpeak-dqm-mcp
image: gcr.io/
/crownpeak-dqm-mcp:latest
ports:
- containerPort: 3000
env:
- name: DQM_API_KEY
valueFrom:
secretKeyRef:
name: dqm-secrets
key: api-key
livenessProbe:
httpGet:
path: /healthz
port: 3000
readinessProbe:
httpGet:
path: /healthz
port: 3000
---
apiVersion: v1
kind: Service
metadata:
name: crownpeak-dqm-mcp
spec:
type: LoadBalancer
ports:
- port: 80
targetPort: 3000
selector:
app: crownpeak-dqm-mcp维塞尔
创建 vercel.json:
{
"version": 2,
"builds": [
{
"src": "dist/http.js",
"use": "@vercel/node"
}
],
"routes": [
{
"src": "/(.*)",
"dest": "dist/http.js"
}
],
"env": {
"DQM_API_KEY": "@dqm-api-key"
}
}部署:
vercel --prodNetlify
创建 netlify.toml:
[build]
command = "npm run build"
publish = "dist"
[functions]
node_bundler = "esbuild"
[[redirects]]
from = "/*"
to = "/.netlify/functions/server"
status = 200在中创建无服务器功能包装器 netlify/functions/server.ts.
Fly.io
创建 fly.toml:
app = "crownpeak-dqm-mcp"
primary_region = "iad"
[build]
dockerfile = "Dockerfile"
[env]
PORT = "3000"
[[services]]
internal_port = 3000
protocol = "tcp"
[[services.ports]]
port = 80
handlers = ["http"]
[[services.ports]]
port = 443
handlers = ["tls", "http"]
[[services.http_checks]]
interval = 10000
timeout = 2000
grace_period = "5s"
method = "get"
path = "/healthz"部署:
fly launch
fly secrets set DQM_API_KEY=your_key
fly deploy可用工具
发现
- list_网站:列出您DQM帐户中的所有网站
- get_网站:获取特定网站的详细信息
检查点(质量规则)
- list_检查点:列出所有质量检查点,可选择按网站过滤
- get_checkpoint:获取特定检查点的详细信息
资产(扫描页)
- 搜索资产:使用可选筛选器搜索资产
- 获取资产:获取特定资产的详细信息
- 获取资产状态:检查资产扫描的状态
- 获取资产问题:获取资产的所有质量问题
- 获取资产内容:获取资源的HTML内容
- 获取资产错误:获取具有突出显示内容的特定检查点的资产错误
- get_asset_pagehighlight:(Beta)获取资产内容,突出显示所有页面突出显示的问题
- update_asset:更新现有资产的内容
- 删除资产:从DQM存储中删除特定资产
质量检查
- 运行_质量_检查:对URL或HTML内容进行质量检查
- 接受: websiteId, url (可选), html (可选), metadata (可选) - 创建资产,立即归还问题 - 限制速率以防止过载
检查拼写
- 拼写检查_资产:对资产运行拼写检查
- 接受: assetId, websiteId, url, html, language (可选) - 可以使用现有资产或自动创建新资产
配置
所有配置均通过环境变量进行。看 .env.example 对于所有选项。
必需
DQM_API_KEY:您的Crownpeak DQM API密钥
可选的
DQM_API_BASE_URL:覆盖基本URL(默认值:https://api.crownpeak.net/dqm-cms/v1)PORT:HTTP服务器端口(默认值:3000)ENABLE_DESTRUCTIVE_TOOLS:启用删除操作(默认值:false)DQM_REQUEST_TIMEOUT:请求超时(毫秒)(默认值:30000)MAX_CONCURRENT_QUALITY_CHECKS:并发质量检查限制(默认值:3)
测试配置
DQM_WEBSITE_ID:集成测试的网站IDDQM_TEST_URL:要测试的URL(默认值:https://www.crownpeak.com)
发展
以开发模式运行
npm run dev运行测试
# Run unit tests
npm test
# Watch mode
npm run test:watch
# Run integration tests (requires API key and website ID in .env)
npm run test:integration集成测试套件针对实时DQM API验证所有15个API端点,测试覆盖率为100%。
掉毛
npm run lint类型检查
npm run typecheck建筑
src/
├── types.ts # TypeScript type definitions
├── config.ts # Configuration management
├── dqmClient.ts # DQM API client
├── tools.ts # MCP tool definitions
├── server.ts # MCP server (stdio transport)
├── http.ts # HTTP server entry point
├── index.ts # Stdio entry point
└── *.test.ts # Test files
tests/
└── integration/
└── api-test.ts # Integration tests for all 15 endpointsAPI客户端功能
- 自动双重身份验证(x-api-key标头+查询参数)
- 请求超时
- 结构化错误的错误处理
- 质量检查的速率限制
- 问题规范化
- 正确处理文本/HTML和JSON响应
- 支持表单编码的POST/PUT请求
安全
- 从环境加载的API密钥(从不硬编码)
- 非root Docker用户
- 默认情况下为只读操作
- 请求超时防止挂起
- 限速防止滥用
- 全面的错误处理(无秘密泄露)
故障排除
“DQM_API_KEY环境变量是必需的”
在中设置API密钥 .env 或直接传递:
DQM_API_KEY=your_key npm start连接超时
增加超时时间:
DQM_REQUEST_TIMEOUT=60000 npm run start:httpDocker健康检查失败
确保集装箱正在运行,并且端口3000可访问:
docker logs crownpeak-dqm-mcp
curl http://localhost:3000/healthz集成测试失败
确保您已在中设置了测试配置 .env:
DQM_API_KEY=your_api_key_here
DQM_WEBSITE_ID=your_website_id_here
DQM_TEST_URL=https://www.crownpeak.com法律声明
这是一个示例解决方案,受 MIT许可证.
免责声明
本文件仅供参考。Paul Taylor可能会更改本协议的内容,恕不另行通知。本文件不保证无错误,也不受任何其他口头或法律暗示的保证或条件的约束,包括对适销性或特定用途适用性的暗示保证和条件。Paul Taylor明确声明不对本文件承担任何责任,本文件不直接或间接构成任何合同义务。本文所述的技术、功能、服务和流程如有更改,恕不另行通知。
