Back to MCP directory
publicPublicdnsLocal runtime

mcp-llm

一个基于LlamaIndexTS库的MCP服务器,提供多种LLM工具功能

article

README

🚀 MCP LLM 语言模型服务器

MCP LLM 语言模型服务器基于 LlamaIndexTS 库构建,为用户提供便捷访问大语言模型(LLM)的途径,助力高效完成代码生成、文档编写等任务。

smithery 徽章

我把一些 LLM 放在你的 MCP 中为你服务

✨ 主要特性

此 MCP 服务器提供了一系列实用工具,帮助用户与大语言模型进行交互:

  • generate_code:根据输入的描述生成相应代码。
  • generate_code_to_file:生成代码并直接写入指定文件的特定行号处。
  • generate_documentation:为代码生成规范的文档。
  • ask_question:向大语言模型提出问题并获取解答。

调用一个 LLM 来生成代码 调用一个推理 LLM 来编写一些文档

📦 安装指南

通过 Smithery 安装

若要通过 Smithery 自动安装适用于 Claude 桌面的 LLM 服务器,可使用以下命令:

npx -y @smithery/cli install @sammcj/mcp-llm --client claude

从源代码手动安装

  1. 克隆仓库。
  2. 安装依赖项:
npm install
  1. 构建项目:
npm run build
  1. 更新你的 MCP 配置。

使用示例脚本

仓库中包含一个示例脚本,用于演示如何程序化调用 MCP 服务器:

node examples/use-mcp-server.js

此脚本会启动 MCP 服务器,并使用 curl 命令向其发送请求。

💻 使用示例

基础用法

生成代码

{
  "description": "创建一个计算数字阶乘的函数",
  "language": "JavaScript"
}

生成代码到文件

{
  "description": "创建一个计算数字阶乘的函数",
  "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": "JavaScript 中的 var、let 和 const 有什么区别?",
  "context": "我是一个刚开始学习 JavaScript 的人,对变量声明感到困惑。"
}

📄 许可证

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