使用说明
编码助手服务器
编码辅助服务器是一个MCP(模型上下文协议)服务器,它增强了临床编码代理的能力。它提供智能代码建议,减少幻觉,并通过利用项目文档和检测代码库中使用的技术来记录知识库。
特性
- 代码建议 :根据您的代码片段和项目文档提供上下文感知的代码建议。
- 文档集成 :从加载和矢量化文档文件
docs目录或提供的URL。 - 技术检测 :自动检测项目中使用的编程语言、框架和库。
- 自动文档检索 :查找检测到的技术的官方文档链接并将其添加到知识库中。
- 项目路径自动化 :从以下位置读取项目路径
project_path.txt与您当前在Cline中的项目无缝集成。 - 多个文档来源 :接受多个文件和链接,以丰富知识库。
安装
通过Smithery安装
通过以下方式自动安装Cline的Coding Assistant服务器 史密瑟里:
npx -y @smithery/cli install coding-assistant-server --client cline
先决条件
- Node.js v14或更高版本
- npm v6或更高版本
- OpenAI API密钥
步骤
- 克隆存储库
git clone [repository-url] - 导航到项目目录
cd coding-assistant-server - 再进行
npm install - 设置环境变量
- 创建一个
.env根目录中的文件。 - 添加您的OpenAI API密钥:
OPENAI_API_KEY=your_openai_api_key_here
- 创建一个
- 构建项目
npm run build
用法
启动服务器
启动编码助手MCP服务器:
node build/index.js
与Cline整合
- 更新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" } } } }
- 编辑您的MCP设置配置文件(例如。,
- 设置项目路径
- 创建或更新
project_path.txt文件在coding-assistant-server包含当前项目绝对路径的目录:/path/to/your/project
- 创建或更新
- 重新启动Cline
- 重新启动Cline或重新加载MCP设置以连接编码助手服务器。
使用工具
get_suggestions 工具
根据提供的代码上下文提供代码建议。
示例用法 :
克莱恩用工具在 coding-assistant MCP服务器:
get_建议
根据提供的代码上下文获取代码建议
参数
{
"codeContext": {
"code": "function helloWorld() { console.log('Hello, world!'); }",
"language": "JavaScript"
}
}
响应
{
"suggestions": [
{
"source": "example.txt",
"content": "# Coding Assistant Documentation\n\nThis is a sample documentation file for the coding assistant server. You can add more documentation files here for the server to use.\n"
}
]
}
