SM

sammcj/mcp-llm

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

83 stars 14 forks 质量 58 趋势 0MIT

sammcj/mcp-llm 是从 https://github.com/sammcj/mcp-llm. 导入的 MCP 服务器候选

概览

sammcj/mcp-llm 是从 https://github.com/sammcj/mcp-llm. 导入的 MCP 服务器候选

概述(AI 翻译)

一个MCP服务器,利用LlamaIndexTS库提供对LLM的访问。

特色

该MCP服务器提供以下工具:

  • generate_code:基于描述生成代码
  • generate_code_to_file:生成代码并直接写入特定行号的文件
  • generate_documentation:生成代码文档
  • ask_question:向LLM提问

安装

通过Smithery安装

要通过Smithery自动安装Claude Desktop的LLM服务器:

源代码手动安装

  1. 克隆仓库

  2. 安装依赖:

  3. 建设项目:

  4. 更新您的MCP配置

使用示例脚本

该仓库包含一个示例脚本,演示如何以程序方式使用 MCP 服务器:

该脚本启动MCP服务器,并通过curl命令向服务器发送请求。

示例

生成代码

生成代码以提交文件

generate_code_to_file 工具支持相对和绝对文件路径。如果提供了相对路径,则会相对于 MCP 服务器当前的工作目录进行解析。

生成文档

提问

许可证

本页由 AI 翻译,技术细节请以原文为准。

README

MCP LLM

An MCP server that provides access to LLMs using the LlamaIndexTS library.

Features

This MCP server provides the following tools:

  • generate_code: Generate code based on a description
  • generate_code_to_file: Generate code and write it directly to a file at a specific line number
  • generate_documentation: Generate documentation for code
  • ask_question: Ask a question to the LLM

Installation

Installing via Smithery

To install LLM Server for Claude Desktop automatically via Smithery:

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

Manual Install From Source

  1. Clone the repository
  2. Install dependencies:
npm install
  1. Build the project:
npm run build
  1. Update your MCP configuration

Using the Example Script

The repository includes an example script that demonstrates how to use the MCP server programmatically:

node examples/use-mcp-server.js

This script starts the MCP server and sends requests to it using curl commands.

Examples

Generate Code

{
  "description": "Create a function that calculates the factorial of a number",
  "language": "JavaScript"
}

Generate Code to File

{
  "description": "Create a function that calculates the factorial of a number",
  "language": "JavaScript",
  "filePath": "/path/to/factorial.js",
  "lineNumber": 10,
  "replaceLines": 0
}

The generate_code_to_file tool supports both relative and absolute file paths. If a relative path is provided, it will be resolved relative to the current working directory of the MCP server.

Generate Documentation

{
  "code": "function factorial(n) {\n  if (n <= 1) return 1;\n  return n * factorial(n - 1);\n}",
  "language": "JavaScript",
  "format": "JSDoc"
}

Ask Question

{
  "question": "What is the difference between var, let, and const in JavaScript?",
  "context": "I'm a beginner learning JavaScript and confused about variable declarations."
}

License

在 GitHub 查看完整 README

安装

npx -y @smithery/cli install @sammcj/mcp-llm --client claude
新手?先看 mcpskill.org 教程 →