ai-cost-optimizer

Cloudflare Workers MCP server: ai-cost-optimizer

我该使用它吗

质量与安全性

A
描述质量
96%
模式完整度
96%
命名质量
80%
投毒风险
100%
权限匹配度
100%
协议合规性
100%

基于对工具定义和协议合规性的自动分析。

上下文开销

~584token 数(工具定义)
~1.1 KB典型响应大小
对注意力的影响极小(占 128k 上下文窗口的 0.46%)

这是每次将服务器的工具加载到模型上下文窗口时所消耗的大致 token 数。数值越高,可用于其他任务的注意力就越少。

安装

一键安装

将以下内容添加到你的 `claude_desktop_config.json` 文件中:

{
  "mcpServers": {
    "ai-cost-optimizer": {
      "url": "https://api.lazy-mac.com/ai-cost-optimizer/mcp"
    }
  }
}

远程端点

https://api.lazy-mac.com/ai-cost-optimizer/mcpstreamable-http

它能做什么

工具清单

工具(5)

🟢 只读🟡 写入🔴 删除⚪ 未知
🟢cost_tracker(action, model, inputTokens, outputTokens, team, ...)

Record and retrieve AI API call costs by team. Persists to Cloudflare KV — survives cold starts and scale-out.

输入模式

{
  "type": "object",
  "properties": {
    "action": {
      "type": "string",
      "enum": [
        "record",
        "get"
      ],
      "description": "\"record\" to log a call, \"get\" to retrieve recent records"
    },
    "model": {
      "type": "string",
      "description": "Model ID (e.g., claude-3-5-sonnet-20241022, gpt-4o, gemini-2.0-flash)"
    },
    "inputTokens": {
      "type": "number",
      "description": "Number of input/prompt tokens consumed"
    },
    "outputTokens": {
      "type": "number",
      "description": "Number of output/completion tokens generated"
    },
    "team": {
      "type": "string",
      "description": "Team or project identifier (default: \"default\")"
    },
    "metadata": {
      "type": "object",
      "description": "Optional key-value metadata (request ID, user, feature flag, etc.)"
    }
  },
  "required": [
    "action"
  ]
}
🟢token_calculator(model, inputTokens, outputTokens)

Calculate cost from token counts for any supported AI model. Stateless — no KV required.

输入模式

{
  "type": "object",
  "properties": {
    "model": {
      "type": "string",
      "description": "Model ID to price"
    },
    "inputTokens": {
      "type": "number",
      "description": "Input token count"
    },
    "outputTokens": {
      "type": "number",
      "description": "Output token count"
    }
  },
  "required": [
    "model",
    "inputTokens",
    "outputTokens"
  ]
}
🟡budget_alert(action, team, budgetLimit, threshold)

Set and check budget limits for teams. Raises a flag when a configurable spending threshold is reached.

输入模式

{
  "type": "object",
  "properties": {
    "action": {
      "type": "string",
      "enum": [
        "set",
        "check"
      ],
      "description": "\"set\" to configure a budget, \"check\" to get current status"
    },
    "team": {
      "type": "string",
      "description": "Team identifier"
    },
    "budgetLimit": {
      "type": "number",
      "description": "USD budget cap"
    },
    "threshold": {
      "type": "number",
      "description": "Alert threshold percentage 0–100 (default: 80)"
    }
  },
  "required": [
    "action"
  ]
}
🟢model_breakdown(team, days)

Analyze costs broken down by model for a given team over a configurable time window.

输入模式

{
  "type": "object",
  "properties": {
    "team": {
      "type": "string",
      "description": "Team identifier"
    },
    "days": {
      "type": "number",
      "description": "Lookback window in days (default: 30)"
    }
  }
}
⚪cost_forecast(team, forecastDays, historicalDays)

Forecast future AI spend based on historical usage patterns using daily-average linear projection.

输入模式

{
  "type": "object",
  "properties": {
    "team": {
      "type": "string",
      "description": "Team identifier"
    },
    "forecastDays": {
      "type": "number",
      "description": "Days to project ahead (default: 7)"
    },
    "historicalDays": {
      "type": "number",
      "description": "Days of history to base the forecast on (default: 30)"
    }
  }
}

社区

评价此服务器

证据

最近观测

已验证未记录版本5 个工具
已验证未记录版本5 个工具
已验证未记录版本5 个工具