MCP LLM
](https://smithery.ai/server/@sammcj/mcp-llm)
使用LlamaIndexTS库提供对LLM访问的MCP服务器。
I put some LLMs in your MCP for your LLMs
特性
此MCP服务器提供以下工具:
generate_code:根据描述生成代码generate_code_to_file:生成代码并将其直接写入特定行号的文件generate_documentation:为代码生成文档ask_question:向法学硕士提问
call a llm to generate code call a reasoning llm to write some documentation
安装
通过Smithery安装
通过以下方式自动安装Claude Desktop的LLM服务器 史密瑟里:
npx -y @smithery/cli install @sammcj/mcp-llm --client claude从源代码手动安装
- 克隆存储库
- 安装依赖项:
npm install- 构建项目:
npm run build- 更新您的MCP配置
使用示例脚本
该存储库包含一个示例脚本,演示如何以编程方式使用MCP服务器:
node examples/use-mcp-server.js此脚本启动MCP服务器,并使用curl命令向其发送请求。
例子
生成代码
{
"description": "Create a function that calculates the factorial of a number",
"language": "JavaScript"
}生成代码以归档
{
"description": "Create a function that calculates the factorial of a number",
"language": "JavaScript",
"filePath": "/path/to/factorial.js",
"lineNumber": 10,
"replaceLines": 0
}这 generate_code_to_file 该工具支持相对和绝对文件路径。如果提供了相对路径,它将相对于MCP服务器的当前工作目录进行解析。
生成文档
{
"code": "function factorial(n) {\n if (n <= 1) return 1;\n return n * factorial(n - 1);\n}",
"language": "JavaScript",
"format": "JSDoc"
}提问
{
"question": "What is the difference between var, let, and const in JavaScript?",
"context": "I'm a beginner learning JavaScript and confused about variable declarations."
}
