Back to MCP directory
publicPublicdnsLocal runtime

coding-assistant-server

Coding Assistant Server是一个MCP服务器,通过整合项目文档和技术检测,为Cline编码代理提供智能代码建议和知识库支持。

article

README

🚀 编码助手服务器

编码助手服务器是一个MCP(模型上下文协议)服务器,它增强了Cline编码代理的功能。通过整合项目文档、检测代码库中的技术,它能提供智能代码建议,减少幻觉,并记录知识库。

🚀 快速开始

编码助手服务器是强大的MCP服务器,可与Cline编码代理配合,为开发者提供智能编码支持。下面将介绍如何安装和使用该服务器。

✨ 主要特性

  • 代码建议:根据你的代码片段和项目文档提供上下文感知的代码建议。
  • 文档集成:加载并矢量化docs目录中的文档文件或从提供的URL加载的文档。
  • 技术检测:自动检测项目中使用的编程语言、框架和库。
  • 自动文档检索:为检测到的技术查找并添加官方文档链接到知识库。
  • 项目路径自动化:从project_path.txt读取项目路径,以便与Cline中的当前项目无缝集成。
  • 多个文档来源:接受多个文档和链接以丰富知识库。

📦 安装指南

通过Smithery安装

要通过Smithery自动安装编码助手服务器,可使用以下命令:

npx -y @smithery/cli install coding-assistant-server --client cline

先决条件

  • Node.js v14或更高版本
  • npm v6或更高版本
  • OpenAI API密钥

安装步骤

  1. 克隆仓库
git clone [仓库URL]
  1. 进入项目目录
cd coding-assistant-server
  1. 安装依赖项
npm install
  1. 设置环境变量 在根目录中创建一个.env文件,并添加你的OpenAI API密钥:
OPENAI_API_KEY=your_openai_api_key_here
  1. 构建项目
npm run build

💻 使用示例

启动服务器

启动编码助手MCP服务器,使用以下命令:

node build/index.js

与Cline集成

  1. 更新MCP设置 编辑你的MCP设置配置文件(例如cline_mcp_settings.json)以包含编码助手服务器:
{
  "mcpServers": {
    "coding-assistant": {
      "command": "node",
      "args": ["/path/to/coding-assistant-server/build/index.js"],
      "env": {
        "OPENAI_API_KEY": "your_openai_api_key_here"
      }
    }
  }
}
  1. 设置项目路径 创建或更新coding-assistant-server目录中的project_path.txt文件,添加当前项目的绝对路径:
/path/to/your/project
  1. 重启Cline 重启Cline或重新加载MCP设置以连接编码助手服务器。

基础用法

get_suggestions工具

根据提供的代码上下文提供代码建议。

{
    "codeContext": {
      "code": "function helloWorld() { console.log('Hello, world!'); }",
      "language": "JavaScript"
    }
  }

响应示例

{
  "suggestions": [
    {
      "source": "example.txt",
      "content": "# 编码助手文档\n\n这是编码助手服务器的一个示例文档文件。你可以在这里添加更多文档文件供服务器使用。\n"
    }
  ]
}
help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client