context7
MCP——获取最新、准确的技术文档
https://github.com/upstash/context7
配置如下:
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
为什么要加它?
- 实时获取官方文档:Context7 MCP 会在模型生成代码时,自动从官方库中抓取最新版本的文档和示例,而不是依赖过时的训练数据
- 提高代码质量和效率:通过提供实时、准确的代码片段,减少 hallucination 和版本不兼容问题,提升成功率
- 无缝集成到编辑器:支持在 Cursor、VSCode、Copilot 等环境通过 MCP 协议调用,无需额外插件
sequential-thinking
MCP——强化结构化问题分析
配置如下:
"sequential-thinking": {
"command": "cmd /c npx",
"args": ["-y", "@modelcontextprotocol/server-sequential-thinking"]
}
为什么要加它?
- 分步拆解复杂问题:该服务提供一个
sequential_thinking
工具,帮助模型将问题拆解成多个“思考”步骤,逐步形成解决方案 。 - 支持反思和分支推理:可以回顾前面的思路、在有新输入时修正,甚至探讨不同路径 。
- 增强推理透明度:让 AI 的思考过程可见,可用于复杂设计、规划和策略决策场景 。
如何设置
gemini
{
"theme": "Default",
"selectedAuthType": "gemini-api-key",
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
},
"sequential-thinking": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-sequential-thinking"
]
}
}
}
Cursor
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
},
"sequential-thinking": {
"command": "cmd /c npx",
"args": [
"-y",
"@modelcontextprotocol/server-sequential-thinking"
]
}
}
}
对比总结
服务名称 | 功能 | 作用场景 |
---|---|---|
Context7 MCP | 提供最新代码文档和示例 | 避免旧 API、减少代码错误,提高开发效率 |
Sequential Thinking MCP | 分层结构化思维、支持推理分支和修正 | 用于设计、规划、复杂问题拆解与分析 |
总结建议
引入这两个 MCP 服务后,你的编辑器就能:
- 实时注入权威文档,减少模型 hallucination;
- 显式拆解思考路径,提升复杂任务的可控性和可解释性。
如果工作涉及频繁用到 AI 写代码,又要处理技术更新快和问题复杂的场景,非常推荐同时开启这两个服务。