Skip to main content
Glama

🚀 LW MCP 代理

LW MCP Agents是一个轻量级的模块化框架,用于使用**模型上下文协议 (MCP)**构建和编排 AI 代理。它使您能够快速设计多代理系统,其中每个代理都可以进行专门化、协作、委托和推理,而无需编写复杂的编排逻辑。

仅使用配置文件构建可扩展、可组合的 AI 系统。


🔍 为什么要使用 LW MCP 代理?

  • 即插即用代理:使用简单的 JSON 配置启动零样板的智能代理。

  • 多代理编排:将代理链接在一起以解决复杂的任务 - 无需额外的代码。

  • 共享和重用:轻松跨环境分发和运行代理配置。

  • MCP-Native :与任何 MCP 兼容平台无缝集成,包括 Claude Desktop。


Related MCP server: SupaUI MCP Server

🧠 您可以构建什么?

  • 总结文档或搜索网络的研究代理

  • 将任务委托给特定领域代理的协调器

  • 递归扩展推理并动态聚合能力的系统


🏗️ 架构概览

LW-MCP-代理图


📚 目录


🚀 入门

🔧 安装

git clone https://github.com/Autumn-AIs/LW-MCP-agents.git
cd LW-MCP-agents
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -r requirements.txt

▶️ 运行你的第一个代理

python src/agent/agent_runner.py --config examples/base_agent/base_agent_config.json

🤖 尝试多代理设置

终端 1(研究代理服务器):

python src/agent/agent_runner.py --config examples/orchestrator_researcher/research_agent_config.json --server-mode

终端 2(Orchestrator 代理):

python src/agent/agent_runner.py --config examples/orchestrator_researcher/master_orchestrator_config.json

您的协调器现在可以智能地将研究任务委托给研究代理。


🖥️ Claude 桌面集成

配置代理在Claude Desktop内运行:

1. 找到您的 Claude 配置文件:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

  • Linux: ~/.config/Claude/claude_desktop_config.json

2. 在mcpServers下添加您的代理:

{
  "mcpServers": {
    "research-agent": {
      "command": "/bin/bash",
      "args": ["-c", "/path/to/venv/bin/python /path/to/agent_runner.py --config=/path/to/agent_config.json --server-mode"],
      "env": {
        "PYTHONPATH": "/path/to/project",
        "PATH": "/path/to/venv/bin:/usr/local/bin:/usr/bin"
      }
    }
  }
}

📦示例代理

  • 基础代理
    通过 MCP 连接到工具的最小代理。
    📁 examples/base_agent/

  • 策划者+研究员
    展示分层委托和能力共享。
    📁 examples/orchestrator_researcher/

💡**贡献你自己的示例!**提交 PR 或联系维护人员。


⚙️ 运行代理

🔹基本命令

python src/agent/agent_runner.py --config <your_config.json>

🔸 高级选项

选项

描述

--server-mode

将代理公开为 MCP 服务器

--server-name

分配自定义 MCP 服务器名称


🛠️ 自定义代理创建

🧱 最小配置

{
  "agent_name": "my-agent",
  "llm_provider": "groq",
  "llm_api_key": "YOUR_API_KEY",
  "server_mode": false
}

🧠 添加功能

定义代理可以推理的专门函数:

"capabilities": [
  {
    "name": "summarize_document",
    "description": "Summarize a document in a concise way",
    "input_schema": {
      "type": "object",
      "properties": {
        "document_text": { "type": "string" },
        "max_length": { "type": "integer", "default": 200 }
      },
      "required": ["document_text"]
    },
    "prompt_template": "Summarize the following document in {max_length} words:\n\n{document_text}"
  }
]

🔄 Orchestrator 代理

{
  "agent_name": "master-orchestrator",
  "servers": {
    "research-agent": {
      "command": "python",
      "args": ["src/agent/agent_runner.py", "--config=research_agent_config.json", "--server-mode"]
    }
  }
}

🧬 工作原理

🧩 能力作为推理单元

每个功能:

  1. 使用提供的参数填写提示

  2. 使用 LLM 执行内部推理

  3. 使用工具或外部代理

  4. 返回结果

📖 研究示例

[INFO] agent:master-orchestrator - Executing tool: research_topic
[INFO] agent:research-agent - Using tool: brave_web_search
[INFO] agent:research-agent - Finished capability: research_topic

🧱 技术架构

🧠 关键组件

成分

角色

AgentServer

启动、配置并运行代理

MCPServerWrapper

包裹代理以将其暴露在 MCP 上

CapabilityRegistry

从配置中加载推理任务

ToolRegistry

发现其他代理的工具

🌐 架构亮点

  • 分层设计:用递归推理组成代理系统

  • 委派功能:代理智能地委派给同行

  • 工具共享:一个代理中可用的工具可供其他代理使用

  • 无代码组合:通过配置创建整个系统


🙌 致谢

该项目从 LastMile AI 在mcp-agents上的出色工作中汲取了灵感。

A
license - permissive license
-
quality - not tested
C
maintenance

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Autumn-AIs/LW-MCP-agents'

If you have feedback or need assistance with the MCP directory API, please join our Discord server