MCP LLM Integration Server
Un servidor MCP para integrar modelos de lenguaje grandes locales con clientes compatibles con MCP.
GitHub
1
Prueba este MCPPatrocinadoDocumentación
MCP LLM Integration Server
Este es un servidor de Protocolo de Contexto de Modelo (MCP) que te permite integrar capacidades de LLM local con clientes compatibles con MCP.
Características
- llm_predict: Procesa indicaciones de texto a través de un LLM local
- echo: Devuelve texto para fines de prueba
Configuración
-
Instala las dependencias:
source .venv/bin/activate uv pip install mcp -
Prueba el servidor:
python -c " import asyncio from main import server, list_tools, call_tool async def test(): tools = await list_tools() print(f'Available tools: {[t.name for t in tools]}') result = await call_tool('echo', {'text': 'Hello!'}) print(f'Result: {result[0].text}') asyncio.run(test()) "
Integración con clientes LLM
Para Claude Desktop
Añade esto a tu configuración de Claude Desktop (~/.config/claude-desktop/claude_desktop_config.json):
{
"mcpServers": {
"llm-integration": {
"command": "/home/tandoori/Desktop/dev/mcp-server/.venv/bin/python",
"args": ["/home/tandoori/Desktop/dev/mcp-server/main.py"]
}
}
}
Para Continue.dev
Añade esto a tu configuración de Continue (~/.continue/config.json):
{
"mcpServers": [
{
"name": "llm-integration",
"command": "/home/tandoori/Desktop/dev/mcp-server/.venv/bin/python",
"args": ["/home/tandoori/Desktop/dev/mcp-server/main.py"]
}
]
}
Para Cline
Añade esto a tu configuración de MCP de Cline:
{
"llm-integration": {
"command": "/home/tandoori/Desktop/dev/mcp-server/.venv/bin/python",
"args": ["/home/tandoori/Desktop/dev/mcp-server/main.py"]
}
}
Personalización de la integración LLM
Para integrar tu propio LLM local, modifica la función perform_llm_inference en main.py:
async def perform_llm_inference(prompt: str, max_tokens: int = 100) -> str:
Example: Using transformers
from transformers import pipeline
generator = pipeline('text-generation', model='your-model')
result = generator(prompt, max_length=max_tokens)
return result[0]['generated_text']
Example: Using llama.cpp python bindings
from llama_cpp import Llama
llm = Llama(model_path="path/to/your/model.gguf")
output = llm(prompt, max_tokens=max_tokens)
return output['choices'][0]['text']
Current placeholder implementation
return f"Processed prompt: '{prompt}' (max_tokens: {max_tokens})"
Pruebas
Ejecuta el servidor directamente para probar la comunicación JSON-RPC:
source .venv/bin/activate
python main.py
Luego envía solicitudes JSON-RPC a través de stdin:
{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2024-11-05", "capabilities": {}, "clientInfo": {"name": "test-client", "version": "1.0.0"}}}