那我问你,MCP是什么?回答我!
yaklang
- 关注
那我问你,MCP是什么?回答我!

- 统一连接:通过MCP,AI可访问本地文件、云端数据库甚至实时金融数据。
- 动态协作:多个工具互相协作,例如爬虫任务中一个工具负责爬取网页内容,另外一个工具负责处理爬取信息,最后一个工具用于生成报告。从此,AI从"QA问答机"升级为"全能执行者"。
MCP的通信协议底层基于STDIO(标准输入输出)或SSE(Server-Send Events),顶层则基于JSON-RPC 2.0
此外,MCP的架构设计极简却高效,包含三大组件:
主机(如Claude):调用客户端来获取服务器的资源/工具列表,解析AI响应以调用客户端发送任务请求,将客户端的响应提供给AI
客户端:发送任务请求,处理服务器响应返回给主机
- 服务器:解析任务请求以提供数据或工具服务

MCP | Function Call | |
协议栈 | 应用层协议(OSI Layer 7) | 模型功能扩展 |
服务发现机制 | 可以动态通知并修改 | 预编译函数列表,无法修改 |
工具接入方式 | 支持多个工具热插拔 | 冷加载 |
You must respond to the user's request by using at least one tool call. When formulating your response, follow these guidelines: 1. Begin your response with normal text, explaining your thoughts, analysis, or plan of action. 2. If you need to use any tools, place ALL tool calls at the END of your message, after your normal text explanation. 3. You can use multiple tool calls if needed, but they should all be grouped together at the end of your message. 4. After placing the tool calls, do not add any additional normal text. The tool calls should be the final content in your message. Here's the general structure your responses should follow: ``` [Your normal text response explaining your thoughts and actions] [Tool Call 1] [Tool Call 2 if needed] [Tool Call 3 if needed] ... ``` Remember: - Choose the most appropriate tool(s) based on the task and the tool descriptions provided. - Formulate your tool calls using the XML format specified for each tool. - Provide clear explanations in your normal text about what actions you're taking and why you're using particular tools. - Act as if the tool calls will be executed immediately after your message, and your next response will have access to their results. # Tool Descriptions and JsonSchema 1. { "title": "execute_command", "description": "Execute a CLI command on the system. Use this when you need to perform system operations or run specific commands to accomplish any step in the user's task. You must tailor your command to the user's system and provide a clear explanation of what the command does. Prefer to execute complex CLI commands over creating executable scripts, as they are more flexible and easier to run. Commands will be executed in the current working directory.", "type": "object", "required": [ "command" ], "properties": { "command": { "type": "string", "description": "Your command here" } } } 2. list_files: { "title": "list_files", "description": "List files and directories within the specified directory. If recursive is true, it will list all files and directories recursively. If recursive is false or not provided, it will only list the top-level contents.", "type": "object", "required": [ "path" ], "properties": { "path": { "type": "string", "description": "Directory path here" }, "recursive": { "type": "boolean" } } }实际预见的是,连接的MCP服务器越多,提供的资源/工具越多,那么每次提问所要消耗的token也就越多。

基于Yakit的MCP Host仍在开发中,但是Yaklang的MCP server实际上已经可以使用了。我们可以使用其他的MCP Host来尝鲜一下。
- 打开vscode,下载以下插件之一(前者Roo Code是社区驱动的Cline,新功能和更新比较频繁):
- 打开Roo Code页面,点击MCP Servers设置,Edit MCP Settings:
- 输入配置,其中command改为你实际的yak的路径:
{ "mcpServers": { "yaklang-mcp": { "command": "yak.exe", "args": ["mcp"], "env": {}, "disabled": false, "alwaysAllow": [], "timeout": 3600 } } }
- 开始使用,这里以弱口令爆破为例:
END
Yak 语言官方教程:
https://yaklang.com/docs/intro/
Yakit 视频教程:
https://space.bilibili.com/437503777
Github下载地址:
https://github.com/yaklang/yakit
Yakit官网下载地址:
https://yaklang.com/
Yakit安装文档:
https://yaklang.com/products/download_and_install
Yakit使用文档:
https://yaklang.com/products/intro/
常见问题速查:
https://yaklang.com/products/FAQ
免责声明
1.一般免责声明:本文所提供的技术信息仅供参考,不构成任何专业建议。读者应根据自身情况谨慎使用且应遵守《中华人民共和国网络安全法》,作者及发布平台不对因使用本文信息而导致的任何直接或间接责任或损失负责。
2. 适用性声明:文中技术内容可能不适用于所有情况或系统,在实际应用前请充分测试和评估。若因使用不当造成的任何问题,相关方不承担责任。
3. 更新声明:技术发展迅速,文章内容可能存在滞后性。读者需自行判断信息的时效性,因依据过时内容产生的后果,作者及发布平台不承担责任。
本文为 yaklang 独立观点,未经授权禁止转载。
如需授权、对文章有疑问或需删除稿件,请联系 FreeBuf 客服小蜜蜂(微信:freebee1024)
如需授权、对文章有疑问或需删除稿件,请联系 FreeBuf 客服小蜜蜂(微信:freebee1024)
被以下专辑收录,发现更多精彩内容
+ 收入我的专辑
+ 加入我的收藏
相关推荐
独立SyntaxFlow功能?IRify,启动!
2025-03-31
SyntaxFlow实战CVE漏洞?那很好了
2025-03-14
SyntaxFlow Java实战(一):值的搜索与筛选
2025-03-10