使用说明
xcode上下文mcp🛠️
让AI理解你的Xcode项目——而不仅仅是阅读它。
用于Xcode、Swift和iOS项目的AI驱动的MCP服务器。 使LLM能够分析、理解和推理真实的代码库,而不是猜测。
🌐 语言
- 🇺🇸 英语
- 🇪🇸 西班牙语(下)
🧠 为什么这很重要
Xcode的大多数AI工具可以:
- 读取文件
- 运行命令
但他们 不理解你的应用程序.
xcode-context-mcp 通过公开结构化项目数据来弥合这一差距,以便人工智能能够推理:
- 架构(MVVM、层、流)
- 依赖关系(SPM、CocoaPods)
- 构建配置风险
- 跨文件的代码关系
⚡ 这有什么不同
与其他专注于构建/运行自动化的Xcode MCP服务器不同, 该项目侧重于 理解代码.
它将您的项目转化为 人工智能代理的推理层.
✨ 它的作用
xcode-context-mcp 是一个MCP服务器,它通过工具公开你的Xcode项目,这样你的AI助手就可以处理真实的项目数据,而不是幻觉。
🧪 示例
用户:
Where is authentication handled?
AI(使用此MCP):
- 发现
AuthManager.swift - 地图依赖关系
- 解释API的流程→ 视图模型→ UI
🧰 工具
| 工具 | 说明 |
|---|---|
get_project_structure |
返回项目树+Swift快照 |
get_build_settings |
提取部署目标、包ID、Swift版本等。 |
get_dependencies |
读取SPM/COCAPods/Cartfile(包括嵌套) |
get_entitlements |
退货 .entitlements |
find_swift_file |
按名称查找Swift文件 |
analyze_swift_file |
🤖 AI代码审查(架构、气味、内存风险) |
generate_unit_tests |
🤖 生成XCTest测试 |
🤖 AI提供者配置
支持多个LLM提供商:
# Claude / Anthropic
LLM_PROVIDER=anthropic
LLM_MODEL=claude-sonnet-4-20250514
LLM_API_KEY=sk-ant-...
# OpenAI
LLM_PROVIDER=openai
LLM_MODEL=gpt-4o
LLM_API_KEY=sk-...
# Gemini
LLM_PROVIDER=gemini
LLM_MODEL=gemini-2.0-flash
LLM_API_KEY=AI...
# Mistral
LLM_PROVIDER=mistral
LLM_MODEL=mistral-large-latest
LLM_API_KEY=...
🚀 设置
git clone https://github.com/frxcisxo/xcode-context-mcp.git
cd xcode-context-mcp
npm install
cp .env.example .env
npm run build
⚙️ MCP客户端设置
光标(.cursor/mcp.json)
{
"mcpServers": {
"xcode-context-mcp": {
"command": "node",
"args": ["/absolute/path/to/xcode-context-mcp/dist/index.js"]
}
}
}
克劳德桌面(~/Library/Application Support/Claude/claude_desktop_config.json)
{
"mcpServers": {
"xcode-context-mcp": {
"command": "node",
"args": ["/absolute/path/to/xcode-context-mcp/dist/index.js"]
}
}
}
VS代码(.vscode/mcp.json)
{
"servers": {
"xcode-context-mcp": {
"type": "stdio",
"command": "node",
"args": ["/absolute/path/to/xcode-context-mcp/dist/index.js"]
}
}
}
💬 提示示例
Analyze the structure of my Xcode project
Find AuthManager.swift and generate XCTest tests
Check entitlements and build settings, highlight risks
🧱 用例
- 人工智能辅助iOS开发
- 对大型项目的代码库理解
- 自动代码审查
- 测试生成
- 架构分析
📈 路线图
- []语义代码搜索(嵌入)
- []Swift AST解析(SwiftSyntax)
- []架构检测(MVVM、Clean)
- []跨文件依赖关系图
- []Xcode插件集成
🇪🇸 西班牙语
✨ 他是做什么的
xcode-context-mcp 这是一个MCP服务器,它将您的Xcode项目公开为AI使用实际项目数据而不是假设的工具。
🧠 为什么重要
Xcode的大多数AI工具:
- 他们只阅读文件
- 或执行命令
但他们不明白你的应用程序。
该项目使人工智能能够对以下方面进行推理:
- 建筑
- 依赖性
- 风险
- 档案关系
🧰 工具
| 工具 | 描述 |
|---|---|
get_project_structure |
项目树+快照SWIFT |
get_build_settings |
部署目标,捆绑ID,SWIFT版本 |
get_dependencies |
SPM/COCAPods/Cartfile |
get_entitlements |
的内容 .entitlements |
find_swift_file |
搜索SWIFT文件 |
analyze_swift_file |
🤖 人工智能分析 |
generate_unit_tests |
🤖 测试生成 |
🚀 安装
git clone https://github.com/frxcisxo/xcode-context-mcp.git
cd xcode-context-mcp
npm install
cp .env.example .env
npm run build
💬 例子
Analiza la estructura de mi proyecto Xcode
Busca AuthManager.swift y genera tests
👨💻 作者
由Francisco Molina建造🚀 iOS和Android开发人员| Kotlin | Swift |人工智能工具
📄 许可证
麻省理工学院