mcp-server-llmling
具有LLMling后端的MCP(模型上下文协议)服务器。
概述
mcp-server-llmling 是一个基于机器聊天协议(MCP)的服务器,使用 LLMling 作为后端,提供基于 YAML 的配置系统,用于 LLM 应用程序。
主要特性
- 静态声明:在 YAML 中定义 LLM 环境,无需编写代码
- 资源管理:加载和使用文本、文件、CLI 输出、图像等
- 工具系统:注册 Python 函数作为 LLM 工具
- 提示管理:静态提示支持模板和参数验证
安装
# 安装最新版本
pip install mcp-server-llmling
使用方法
基本启动
# 从命令行启动服务器
uvx mcp-server-llmling start path/to/your/config.yml
在 Zed 编辑器中配置
在 settings.json
中添加:
{
"context_servers": {
"llmling": {
"command": {
"env": {},
"label": "llmling",
"path": "uvx",
"args": [
"mcp-server-llmling",
"start",
"path/to/your/config.yml"
]
},
"settings": {}
}
}
}
在 Claude 桌面版中配置
在 claude_desktop_config.json
中添加:
{
"mcpServers": {
"llmling": {
"command": "uvx",
"args": [
"mcp-server-llmling",
"start",
"path/to/your/config.yml"
],
"env": {}
}
}
}
程序化使用
from llmling import RuntimeConfig
from mcp_server_llmling import LLMLingServer
async def main() -> None:
async with RuntimeConfig.open(config_path) as runtime:
server = LLMLingServer(runtime)
await server.start()
配置示例
创建 YAML 配置文件来定义您的 LLM 环境:
resources:
my_text:
type: text
content: "Hello, world!"
prompts:
greeting:
content: "Greet the user using {{my_text}}"
tools:
echo:
function: builtins:print
description: "Echo a message"
了解更多
查看完整文档了解高级配置选项和用例。