mcp-server-llmling

mcp-server-llmling

镜像源

概述

mcp-server-llmling 是基于机器聊天协议(MCP)的服务器,为LLM应用程序提供基于YAML的配置系统。通过LLMling,您可以静态声明LLM环境,无需编写代码。

核心特性

  • 基于YAML的配置:静态定义您的LLM环境
  • 资源管理:文本、文件、CLI输出、图像等
  • 工具系统:注册并执行Python函数作为LLM工具
  • 提示管理:静态和动态提示,支持模板

安装

pip install mcp-server-llmling

使用方法

1. 从命令行启动

# 使用指定配置文件
uvx mcp-server-llmling start path/to/your/config.yml

# 使用最新版本
uvx mcp-server-llmling@latest

2. 在Zed编辑器中配置

settings.json中添加:

{
  "context_servers": {
    "llmling": {
      "command": {
        "path": "uvx",
        "args": [
          "mcp-server-llmling",
          "start",
          "path/to/your/config.yml"
        ]
      },
      "settings": {}
    }
  }
}

3. 在Claude桌面版中配置

claude_desktop_config.json中添加:

{
  "mcpServers": {
    "llmling": {
      "command": "uvx",
      "args": [
        "mcp-server-llmling",
        "start",
        "path/to/your/config.yml"
      ],
      "env": {}
    }
  }
}

4. 程序化使用

from llmling import RuntimeConfig
from mcp_server_llmling import LLMLingServer

async def main():
    async with RuntimeConfig.from_file("path/to/config.yml") as config:
        server = LLMLingServer(config)
        await server.run()

资源定义示例 (YAML)

resources:
  my_text:
    type: text
    content: "Hello, LLMling!"
  
  python_docs:
    type: path
    path: "./docs/python.md"
    
tools:
  calculator:
    callable: my_module.calculate
    
prompts:
  greeting:
    content: "Hello, {{name}}!"

更多详细信息,请访问官方文档


注: LLMling使用MCP协议,为LLM应用程序提供标准化交互方式,配置采用YAML格式,使环境设置更加简洁明了。