mcp-llm
by: sammcj
An MCP server that provides LLMs access to other LLMs
📌Overview
Purpose: The MCP LLM framework aims to provide seamless access to Large Language Models (LLMs) for code generation, documentation, and querying purposes.
Overview: The MCP server leverages the LlamaIndexTS library, enabling users to interact with LLMs through a suite of powerful tools designed for developers and programmers. It simplifies the process of generating code, creating documentation, and addressing programming queries.
Key Features:
-
generate_code: Generates code based on a user-provided description, helping to accelerate development and reduce manual coding efforts.
-
generate_code_to_file: Creates code and writes it directly to a specified file and line number, which streamlines the integration of newly generated code into existing projects.
-
generate_documentation: Produces documentation for code snippets, aiding in the maintenance and understanding of codebases.
-
ask_question: Allows users to pose questions directly to the LLM, offering guidance and explanations for programming concepts.
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
- Clone the repository.
- Install dependencies:
npm install
- Build the project:
npm run build
- 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
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.
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."
}