编码助手服务器是一个MCP(模型上下文协议)服务器,它增强了Cline编码代理的功能。通过整合项目文档、检测代码库中的技术,它能提供智能代码建议,减少幻觉,并记录知识库。
编码助手服务器是强大的MCP服务器,可与Cline编码代理配合,为开发者提供智能编码支持。下面将介绍如何安装和使用该服务器。
docs目录中的文档文件或从提供的URL加载的文档。project_path.txt读取项目路径,以便与Cline中的当前项目无缝集成。要通过Smithery自动安装编码助手服务器,可使用以下命令:
npx -y @smithery/cli install coding-assistant-server --client cline
git clone [仓库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_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"
}
}
}
}
coding-assistant-server目录中的project_path.txt文件,添加当前项目的绝对路径:/path/to/your/project
get_suggestions工具根据提供的代码上下文提供代码建议。
{
"codeContext": {
"code": "function helloWorld() { console.log('Hello, world!'); }",
"language": "JavaScript"
}
}
响应示例:
{
"suggestions": [
{
"source": "example.txt",
"content": "# 编码助手文档\n\n这是编码助手服务器的一个示例文档文件。你可以在这里添加更多文档文件供服务器使用。\n"
}
]
}