蜡笔成本MCP服务器
MCP服务器提供来自Crayon CloudIQ API的成本和计费分析。
快速入门(5分钟)
1.获取凭据
联系您的蜡笔小新客户团队以获取:
- 客户端ID
- 客户端密钥
- 用户名
- 密码
2.设置环境
Linux/Mac:
# Clone repository
git clone
cd crayon-cost-mcp-server
# Copy environment template
cp .env.example .envWindows(PowerShell):
# Clone repository
git clone
cd crayon-cost-mcp-server
# Copy environment template
Copy-Item .env.example .env3.配置凭据
编辑 .env 文件并填写您的Crayon凭据和身份验证令牌:
# Required - Get from Crayon account team
CRAYON_CLIENT_ID=your_client_id_here
CRAYON_CLIENT_SECRET=your_client_secret_here
CRAYON_USERNAME=your_username_here
CRAYON_PASSWORD=your_password_here
# Required - Generate secure Bearer token (32+ characters)
# Run: node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
AUTH_TOKEN=paste_generated_secure_token_here注: 这 .env.example 该文件包含所有可用的配置选项,并附有详细的注释。以上是入门所需的最低设置。
4.使用Docker在本地运行
docker-compose up -d5.验证它是否正在运行
# Test health endpoint
curl http://localhost:3003/health
# Expected: {"status":"ok","timestamp":"2025-11-11T..."}可用的MCP工具
服务器提供 26工具 进行全面成本分析:
核心工具
get_organizations-列出所有可访问的组织get_billing_statements-带过滤器的月度账单数据get_grouped_billing_statements-按周期汇总计费get_invoices-发票详细信息和状态get_invoice_profiles-计费组配置文件get_cost_summary-综合成本分析get_customer_tenants-用于关联的客户租户信息
Azure特定工具
get_azure_usage-详细的Azure消费(CSV下载)get_azure_subscriptions-按租户划分的Azure订阅get_azure_plan_details-包含订阅的Azure计划信息get_azure_plan_subscriptions-Azure计划中的所有订阅get_azure_costs_by_date_range-日期范围的Azure总成本get_azure_costs_by_subscription-订阅特定的Azure成本
订阅管理
get_subscriptions-所有云订阅(Azure、AWS等)get_subscription_details-包含元数据的详细订阅信息get_subscription_tags-成本分配和跟踪标签update_subscription_tags-更新组织的订阅标签list_all_subscriptions_with_tags-完成订阅和标签清单
高级分析和可视化
get_historical_costs-用于预测的多月成本历史记录get_cost_by_subscription-按订阅情况分列的成本明细 饼图/甜甜圈图track_costs_by_tags-按标签(部门、项目、环境)进行成本分配get_cost_trends-按月趋势 折线图可视化detect_cost_anomalies-识别成本意外飙升的订阅analyze_costs_by_tags-按成本中心、部门、项目等分类的成本明细。find_similar_subscriptions_and_invoices-按名称模式查找相关订阅get_last_month_costs_by_tags-上个月按标签列出的成本明细get_last_month_costs_by_invoice_profile-上个月每张发票的成本get_last_month_costs_by_organization-上个月按组织分列的总数
主要特点
- 使用所有历史成本工具 完整的计费月份 (从月1日开始)
- 图表可视化 用于趋势分析和成本分配
- 正确的字体渲染 使用DejaVu Sans、Liberation和Noto字体
- 关联工具 将计费数据与Azure/AWS资源链接
- 基于标签的分析 用于部门成本分配
支持
对于Crayon CloudIQ API文档: https://apidocs.crayon.com/
对于MCP协议文件: https://modelcontextprotocol.io/
