mcp-server-llmling(这个词汇组合在中文中没有直接对应的翻译,因为它看起来像是一个特定项目或系统名称的一部分,可能包含技术或专业术语。但我们可以尝试将其拆解并翻译其可能的含义部分):可以大致翻译为“MCP服务器-LLM模型语言处理(或类似技术/功能)”,不过具体翻译还需根据该词汇组合在实际应用中的具体含义来确定。如果这是一个特定项目或系统的名称,建议保留原样或根据官方翻译进行调整
 ](https://pypi.org/project/mcp-server-llmling/) ](https://pypi.org/project/mcp-server-llmling/)   ](https://pypi.org/project/mcp-server-llmling/)   ](https://github.com/phil65/mcp-server-llmling/graphs/contributors) ](https://github.com/phil65/mcp-server-llmling/discussions) ](https://github.com/phil65/mcp-server-llmling/forks) ](https://github.com/phil65/mcp-server-llmling/issues) ](https://github.com/phil65/mcp-server-llmling/pulls) ](https://github.com/phil65/mcp-server-llmling/watchers) ](https://github.com/phil65/mcp-server-llmling/stars) ](https://github.com/phil65/mcp-server-llmling) ](https://github.com/phil65/mcp-server-llmling/commits) ](https://github.com/phil65/mcp-server-llmling/releases) ](https://github.com/phil65/mcp-server-llmling) ](https://github.com/phil65/mcp-server-llmling) ](https://codecov.io/gh/phil65/mcp-server-llmling/) 
LLMling 服务器手册
概述
mcp-server-llmling 是一个用于机器聊天协议(MCP)的服务器,它为大型语言模型(LLM)应用提供了一个基于YAML的配置系统。
LLMLing(注:此词可能为特定上下文或品牌名,直接翻译为“LLM语言处理”或保持原样,具体含义需结合上下文确定)后端为大型语言模型(LLM)应用提供了一个基于YAML的配置系统。 它允许设置自定义MCP服务器,以提供在YAML文件中定义的内容。
- 静态声明在YAML中定义你的大型语言模型(LLM)环境——无需编写代码
- MCP协议基于机器聊天协议(MCP)构建,实现标准化的大型语言模型(LLM)交互
- 组件类型:
- 资源内容提供者(文件、文本、CLI输出等) - 提示带参数的消息模板 - 工具LLM 可调用的 Python 函数
YAML配置创建了一个完整的环境,为大型语言模型(LLM)提供:
- 通过资源访问内容
- 结构化提示以实现一致的交互
- 扩展功能的工具
关键特性
1. 资源管理
- 加载和管理不同类型的资源:
- 文本文件(PathResource) - 原始文本内容(TextResource) - CLI 命令输出(CLIResource) - Python源代码(SourceResource) - Python 可调用结果(CallableResource) - 图像(ImageResource)
- 支持资源监视/热重载
- 资源处理流水线
- 基于URI的资源访问
2. 工具系统
- 将Python函数注册并作为大型语言模型(LLM)工具执行
- 支持基于OpenAPI的工具
- 基于入口点的工具发现
- 工具验证和参数检查
- 结构化的工具响应
3. 提示管理
- 带有模板支持的静态提示
- 来自Python函数的动态提示
- 基于文件的提示
- 即时参数验证
- 提示参数的完成建议
4. 多种运输方式选择
- 基于标准I/O的通信(默认)
- 服务器发送事件(SSE)/适用于网页客户端的可流式HTTP
- 支持自定义传输实现
使用方法
使用Zed编辑器
将LLMLing添加为您的(系统/应用)中的上下文服务器 settings.json:
{
"context_servers": {
"llmling": {
"command": {
"env": {},
"label": "llmling",
"path": "uvx",
"args": [
"mcp-server-llmling",
"start",
"path/to/your/config.yml"
]
},
"settings": {}
}
}
}使用 Claude Desktop
在您的环境中配置LLMLing claude_desktop_config.json:
{
"mcpServers": {
"llmling": {
"command": "uvx",
"args": [
"mcp-server-llmling",
"start",
"path/to/your/config.yml"
],
"env": {}
}
}
}手动启动服务器
直接从命令行启动服务器:
# Latest version
uvx mcp-server-llmling@latest1. 程序化使用
from llmling import RuntimeConfig
from mcp_server_llmling import LLMLingServer
async def main() -> None:
async with RuntimeConfig.open(config) as runtime:
server = LLMLingServer(runtime, enable_injection=True)
await server.start()
asyncio.run(main())2. 使用自定义传输
from llmling import RuntimeConfig
from mcp_server_llmling import LLMLingServer
async def main() -> None:
async with RuntimeConfig.open(config) as runtime:
server = LLMLingServer(
config,
transport="sse",
transport_options={
"host": "localhost",
"port": 3001,
"cors_origins": ["http://localhost:3000"]
}
)
await server.start()
asyncio.run(main())3. 资源配置
resources:
python_code:
type: path
path: "./src/**/*.py"
watch:
enabled: true
patterns:
- "*.py"
- "!**/__pycache__/**"
api_docs:
type: text
content: |
API Documentation
================
...4. 工具配置
tools:
analyze_code:
import_path: "mymodule.tools.analyze_code"
description: "Analyze Python code structure"
toolsets:
api:
type: openapi
spec: "https://api.example.com/openapi.json"\[!TIP\](提示) 对于OpenAPI模式,您可以安装 Redocly 命令行界面 (CLI) 在使用LLMLing之前,需要对OpenAPI规范进行打包和解析。这有助于确保您的模式引用得到正确解析,并且规范格式正确。如果已安装redocly,它将自动被使用。
服务器配置
服务器通过包含以下部分的YAML文件进行配置:
global_settings:
timeout: 30
max_retries: 3
log_level: "INFO"
requirements: []
pip_index_url: null
extra_paths: []
resources:
# Resource definitions...
tools:
# Tool definitions...
toolsets:
# Toolset definitions...
prompts:
# Prompt definitions...MCP协议
服务器实现了支持以下功能的MCP协议:
- 资源运营
- 列出可用资源 - 读取资源内容 - 留意资源变化
- 工具操作
- 列出可用工具 - 执行带有参数的工具 - 获取工具模式(或工具架构)
- 即时操作
- 列出可用的提示 - 获取格式化提示 - 获取提示参数的完成建议
- 通知
- 资源变化 - 工具/提示列表更新 - 进度更新 - 日志消息
