编码助手服务器是一个MCP(模型上下文协议)服务器,旨在增强Cline编码代理的功能。它通过利用项目文档并检测代码库中使用的编程语言和技术,提供智能代码建议、减少幻觉,并记录知识库。
docs目录或提供的URL的文档文件。project_path.txt读取项目路径,无缝集成到Cline中的当前项目。要通过Smithery自动安装Cline的编码助手服务器:
npx -y @smithery/cli install coding-assistant-server --client cline
git clone [repository-url]
cd coding-assistant-server
npm install
.env文件。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 工具基于提供的代码上下文提供代码建议。
示例用法 :
<iframe></iframe>Cline在coding-assistant MCP服务器上使用了一个工具:
get_suggestions
基于提供的代码上下文获取代码建议
参数
{
"codeContext": {
"code": "function helloWorld() { console.log('Hello, world!'); }",
"language": "JavaScript"
}
}
<iframe></iframe>
响应
{
"suggestions": [
{
"source": "example.txt",
"content": "# 编码助手文档\n\n这是一个用于编码助手服务器的示例文档文件。您可以在此处添加更多文档供服务器使用。\n"
}
]
}