-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
area:coreThe bug / feature is about astrbot's core, backendThe bug / feature is about astrbot's core, backendenhancementNew feature or requestNew feature or request
Description
Discussed in #4663
Originally posted by zzz6839 January 24, 2026
astrbot的MCP一直有连不上就关了然后开摆死活不重连的问题,甚至连局域网内的N8N有时会有不可用的情况,而且Astrbot更迭能带来很多奇怪的问题,所以我的思路就是“让Astrbot把问题抛给N8N,让N8N作答”,Astrbot负责组织最后的语言。
这是我的N8N MCP
[07:58:49] [Core] [DBUG] [provider.func_tool_manager:259]: MCP server subagent list tools response: meta=None nextCursor=None tools=[Tool(name='Call_n8n_astrbot_', title=None, description='Call this tool to serve as a chat or task subagent.', inputSchema={'type': 'object', 'properties': {'User_query': {'type': 'string', 'description': 'Forward current user query.'}, 'Current_datetime': {'type': 'string', 'description': 'Forward current datetime (e.g., "2026-01-13 19:15 (CST)" in "Current datetime: 2026-01-13 19:15 (CST)").'}, 'User_ID': {'type': 'string', 'description': 'Forward the User\'s ID number which made this user query (e.g., "3430" in "User ID: 340, Nickname: 子").'}, 'Query_context': {'type': 'string', 'description': 'A summary of current user query related conversation in chat history.'}}, 'required': ['User_query', 'Current_datetime', 'User_ID', 'Query_context'], 'additionalProperties': True, '$schema': 'http://json-schema.org/draft-07/schema#'}, outputSchema=None, annotations=None, meta=None)]
[07:58:49] [Core] [INFO] [provider.func_tool_manager:278]: 已连接 MCP 服务 subagent, Tools: ['Call_n8n_astrbot_']
对于Astrbot:
- 降低了上下文内容占用,因为只连一个MCP,每次有问题先>检索记忆>没有就tool call n8n>收集答复>回答用户>记忆回答
- 上下文主要用于记忆聊天记录和LLM persona,这样LLM回答在群聊里会更有活人感
- 我的Astrbot主要传递
User_query,Current_datetime,User_ID,Query_context这四项给N8N,这样LLM能提炼问题,让N8N解决问题,返回答案,这样不会有大段的资料占据astrbot的上下文里 - MCP出问题导致LLM回答不上来问题的情况降低
本质上就是让Astrbot有更少的上下文占用,更稳定的输出内容。
我的Astrbot的persona是这样写的:
## 1. Identity & Core Vibe
**Who you are:**
**Personality:**
**Speech Style:**
## 2. Decision Logic (The "Brain")
* **memory retrieval** Recall from contexts to solve repetitive user queries unless user insists a new research.
* **Reminder setting query** If user query type is to set reminder, please call LLM functions to set/edit reminder. #这个是Astrbot的函数工具调用
* **Other queries** Follow the instruction to use the tool 'Call_n8n_astrbot_' and get response, if the tool isn't avilable, Stop any tasks and tell the user to wait for your designer to fix that before they start to ask you again.
* **Evaluation** If you find the response from the tool 'Call_n8n_astrbot_' is irrelevant to the user query, consider retry tool call using different tone and add your feedback to the context.
## 3. Final Output Rules
* **Language:** Strictly match the user's language.
* **Directly quote** the relevant sections from the source. Do not waste token on summarizing if the original text is clear. Precision is key.
* **error** If you encounter any error after retried the tool 'Call_n8n_astrbot_', explain you have encountered error with the tool, stop any tasks and tell the user to wait for your designer to fix that before they start to ask you again.
对于N8N来说:
- 工作流是可控的,自己搭的,不会跟随Astrbot更新出问题
- 更稳定的MCP tool call和更清楚的日志
- 能拿到LLM先总结过的参数,比如用户问题和问题的上下文背景,输出的格式也是固定的
本质上就是一个Subagent,我的这个是负责帮astrbot处理各类tasks。
你还可以让N8N储存聊天记录,这样不会出现Astrbot更换/provider时候出现不能输出LLM的回答,只能/reset才行的问题。我在切Gemini上游和openai之间会有这样的问题。
。写这个给各位一个思路作为参考,当然我的思路还是存在各类问题,比如:
- 没法让上游N8N使用Astrbot的函数工具
- N8N作为唯一的MCP歇菜了那Astrbot的LLM也没法回答(不过可以在提示词里把锅给上游(不是
- 直传图片到N8N我还没搞定,但是应该有办法
暂时想到的就这些,分享这个内容也是提供个搭建bot的参考,顺带吐糟下Astrbot的MCP问题。
DBJD-CR and Li-shi-ling
Metadata
Metadata
Assignees
Labels
area:coreThe bug / feature is about astrbot's core, backendThe bug / feature is about astrbot's core, backendenhancementNew feature or requestNew feature or request