代码生成服务

一个轻量级的MCP服务器,提供基于DeepSeek API的代码生成工具,旨在降低Claude代码委托的API成本。

  • by heyfinal
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 heyfinal/deepseek-coder-mcp

使用说明

DeepSeek编码器MCP服务器

一个轻量级MCP服务器,使用DeepSeek API提供代码生成工具。专为Claude Code委托设计,以降低API成本。

工具

工具 说明
generate_code 从自然语言提示符生成代码
edit_code 根据说明编辑现有代码
explain_code 解释代码或回答相关问题
complete_code 完整的部分代码

安装

pip install httpx

配置

添加到您的Claude桌面配置(~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "deepseek-coder": {
      "command": "python3",
      "args": ["/path/to/mcp-servers/deepseek-coder/server.py"],
      "env": {
        "DEEPSEEK_API_KEY": "your-api-key"
      }
    }
  }
}

环境变量

变量 默认值 描述
DEEPSEEK_API_KEY - 您的DeepSeek API密钥
DEEPSEEK_MODEL deepseek-chat 要使用的模型

用法示例

生成代码

generate_code(
  prompt="Create a Python function that calculates fibonacci numbers",
  language="python"
)

编辑代码

edit_code(
  code="def add(a, b): return a + b",
  instruction="Add type hints and docstring",
  language="python"
)

解释代码

explain_code(
  code="lambda x: x if x <= 1 else fib(x-1) + fib(x-2)",
  question="What is the time complexity?"
)

成本

DeepSeek API定价约为:

  • 输入:每100万代币0.14美元
  • 产出:每100万代币0.28美元

典型代码生成任务:~$0.001-$0.01

许可证

麻省理工学院