目标:打造一个管理项目的基础框架,屏蔽开发人员不需要关注的非业务逻辑,例如日志、异常、缓存、消息队列等
sequenceDiagram
participant User as 用户
participant Server as MCP Server
(例如:weather)
participant Client as MCP Client
(例如:Cline)
participant LLM as 大模型 (LLM)
rect rgb(191, 223, 255)
note right of Server: 连接和注册
Client->>Server: 你好!我是 Client
Server->>Client: 你好,我是weather
Client->>Server: 你有哪些tools?
Server->>Client: 我有get_forecast, get_alerts
end
Note over Client: 掌握了weather所有信息<br>(方法、参数、入参类型等)
User->>Client: 深圳天气怎么样?
Client-->>LLM: 问题(深圳天气怎么样) + <br>可用工具列表(weather所有信息)
LLM-->>Client: thinking + 调用 get_forecast<br>(入参数city="深圳",类型=字符)
Client->>Server: 执行 get_forecast
Server->>Client: 调用完,返回结果{"气温": 18, "天气": "晴朗"}
Client-->>LLM: 结果是{"气温": 18, "天气": "晴朗"}
LLM-->>Client: 深圳天晴,气温18度+ <br>结束标识(attempt_completion)
Client->>User: 深圳天晴,气温18度。