关于 MCP Agent Server
MCP Agent Server 是用于构建和管理持久化 AI Agent 的开源平台,面向使用 n8n 等工作流引擎的团队。它结合自然语言任务输入、Agent 专属记忆与反馈接口,并支持通过 Docker 部署及连接器和技能扩展。
主要功能
- 01自然语言任务输入
- 02持久化的 Agent 专属记忆
- 03反馈与学习循环
- 04通过 n8n 等工作流引擎编排
- 05使用 Docker Compose 部署
- 06可插拔连接器和技能
适用场景
- 01将自然语言请求转为工作流任务
- 02在多次操作间保留 Agent 记忆和反馈
- 03构建分析师或管理员等特定角色的 AI Agent
MCP 相关
它提供 MCP 服务端点,默认地址为 http://localhost:4000。其 API 包含 Agent 记忆、反馈和触发接口;触发接口目前标注为 n8n 集成存根。
配置
远程服务无需本地安装。选择你使用的客户端,复制配置或使用一键安装。
http://localhost:4000claude mcp add --transport http agent-server-leadbroaf http://localhost:4000{"mcpServers":{"agent-server-leadbroaf":{"type":"http","url":"http://localhost:4000"}}}在 Cursor 中打开{"servers":{"agent-server-leadbroaf":{"type":"http","url":"http://localhost:4000"}}}在 VS Code 中打开{"mcpServers":{"agent-server-leadbroaf":{"type":"http","url":"http://localhost:4000"}}}{"mcpServers":{"agent-server-leadbroaf":{"serverUrl":"http://localhost:4000"}}}命令在终端中运行;JSON 粘贴到对应客户端的 MCP 配置后重启。需要授权的服务会在首次连接时提示登录。
工具
详细介绍
MCP Agent 服务
这是面向 AI 员工的开源“大脑”,旨在与 n8n 和其他工作流引擎配合使用。
快速开始
-
克隆仓库: git clone https://github.com/yourusername/mcp-agent-server.git cd mcp-agent-server
-
根据需要复制文档和记忆文件夹。
-
使用 Docker Compose 构建并运行: docker-compose up --build
-
MCP 服务将在 http://localhost:4000 上提供
入门
- 确保已安装 Node.js 和 Docker。
- 删除 package.json 中的所有注释(JSON 不支持注释)。
- 运行
npm install安装依赖。 - 使用
docker-compose up --build启动所有服务。 - 服务将在 http://localhost:4000 上提供。
- 有关架构和设计,请参阅 /docs 和 /memory 文件夹,以及 MCP memory 中的“mcp-agent-server project plan”。
项目结构
- /docs — 设计、架构和使用文档
- /memory — 持久记忆、日志和知识
项目愿景:MCP Agent Server
mcp-agent-server 是面向 AI 员工/Agent 的开源模块化“大脑”,旨在与 n8n 和其他工作流引擎无缝协作。
-
AI 员工理念:
让用户能够“雇用”“分配任务”“评估”和“改进”持久化 AI Agent;每个 Agent 都拥有自己的记忆、学习能力和反馈循环。 -
观点鲜明,以 Agent 为中心:
与通用工作流自动化工具不同,MCP Agent 服务观点鲜明,专注于“AI 员工”理念,将记忆、反馈和学习作为核心功能,而不是可选附加项。 -
自然语言界面:
接受自然语言指令(而不仅仅是 API 调用或工作流触发),将其解析为可执行任务,并通过 n8n 或其他连接器编排执行。 -
主动、适应性强且个性化:
Agent 可以提出行动建议、从用户反馈中学习,并随着时间推移不断改进。 -
垂直解决方案与简洁易用:
支持垂直解决方案(例如“AI 分析师”“AI 管理员”),提供预构建技能、工作流和反馈循环;同时为中小企业和个人用户提供简单、无需技术背景的使用体验。 -
持久化、以 Agent 为中心的记忆:
记忆和反馈会持久保存,并以 Agent 为中心,使 Agent 能够记住过去的行动、用户偏好和表现历史。 -
易于部署且可扩展:
专为轻松部署(Docker、Docker Compose)、可扩展性(可插拔连接器和技能)以及 SaaS 变现(多租户、API 密钥管理、账单集成)而设计。 -
不只是又一个工作流工具:
MCP Agent 服务是一个用于构建、管理和改进 AI 员工的平台。AI 员工与人类协同工作,从经验中学习,并创造真正的业务价值。
完整的设计、架构和背景信息,请参阅 MCP memory 中的“mcp-agent-server project plan”实体以及 /docs 和 /memory 文件夹。
API 身份验证
除 /health、/users/register 和 /users/login 外,所有端点都需要 x-api-key 标头。API 密钥按用户管理。用户和 API 密钥管理方式如下。
用户和 API 密钥管理
端点
POST /users/register— 注册新用户(电子邮件、密码)POST /users/login— 登录并获取 API 密钥GET /users/me/api-keys— 列出你的 API 密钥POST /users/me/api-keys— 创建新的 API 密钥DELETE /users/me/api-keys/:id— 撤销 API 密钥
PowerShell 使用示例
# Register a new user
Invoke-RestMethod -Uri "http://localhost:4000/users/register" -Method Post -ContentType "application/json" -Body '{"email": "[email protected]", "password": "yourpassword"}'
# Login and get API key
$login = Invoke-RestMethod -Uri "http://localhost:4000/users/login" -Method Post -ContentType "application/json" -Body '{"email": "[email protected]", "password": "yourpassword"}'
$apiKey = $login.apiKey
# List API keys
Invoke-RestMethod -Uri "http://localhost:4000/users/me/api-keys" -Method Get -Headers @{ "x-api-key" = $apiKey }
# Create a new API key
Invoke-RestMethod -Uri "http://localhost:4000/users/me/api-keys" -Method Post -Headers @{ "x-api-key" = $apiKey }
# Revoke an API key (replace 1 with the actual key id)
Invoke-RestMethod -Uri "http://localhost:4000/users/me/api-keys/1" -Method Delete -Headers @{ "x-api-key" = $apiKey }
curl 使用示例
# Register a new user
curl -X POST http://localhost:4000/users/register -H "Content-Type: application/json" -d '{"email": "[email protected]", "password": "yourpassword"}'
# Login and get API key
curl -X POST http://localhost:4000/users/login -H "Content-Type: application/json" -d '{"email": "[email protected]", "password": "yourpassword"}'
# List API keys
curl http://localhost:4000/users/me/api-keys -H "x-api-key: <your-api-key>"
# Create a new API key
curl -X POST http://localhost:4000/users/me/api-keys -H "x-api-key: <your-api-key>"
# Revoke an API key (replace 1 with the actual key id)
curl -X DELETE http://localhost:4000/users/me/api-keys/1 -H "x-api-key: <your-api-key>"
Agent 记忆和反馈端点
POST /agents/:id/memory— 为 Agent 添加记忆/反馈。GET /agents/:id/memory— 列出 Agent 的所有记忆/反馈。POST /agents/:id/trigger— 触发 Agent 操作(用于 n8n 集成的存根)。
PowerShell 使用示例
$headers = @{ "x-api-key" = "changeme" }
# Create an agent
Invoke-RestMethod -Uri "http://localhost:4000/agents" -Method Post -Headers $headers -ContentType "application/json" -Body '{"name": "Test Agent"}'
# Add memory/feedback
Invoke-RestMethod -Uri "http://localhost:4000/agents/1/memory" -Method Post -Headers $headers -ContentType "application/json" -Body '{"content": "Agent completed onboarding."}'
# List memory/feedback
Invoke-RestMethod -Uri "http://localhost:4000/agents/1/memory" -Method Get -Headers $headers
# Trigger agent
Invoke-RestMethod -Uri "http://localhost:4000/agents/1/trigger" -Method Post -Headers $headers
curl 使用示例
curl -X POST http://localhost:4000/agents/1/memory -H "Content-Type: application/json" -H "x-api-key: changeme" -d '{"content": "Agent completed onboarding."}'
curl http://localhost:4000/agents/1/memory -H "x-api-key: changeme"
curl -X POST http://localhost:4000/agents/1/trigger -H "x-api-key: changeme"
数据库迁移与架构管理
- 所有数据库迁移都会在容器启动时自动应用(参见
docker-entrypoint.sh)。 - 添加新模型或字段:
- 编辑
prisma/schema.prisma。 - 在本地运行
npx prisma migrate dev --name <desc>(确保 Docker Postgres 正在运行)。 - 将生成的迁移文件提交到 git 中的
prisma/migrations/。
- 编辑
- 每次部署或重新构建容器时,都会自动应用所有迁移。
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。