BX

block/xcode-index-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

67 stars 12 forks 质量 61 趋势 0Apache-2.0

block/xcode-index-mcp 是从 https://github.com/block/xcode-index-mcp. 导入的 MCP 服务器候选

概览

block/xcode-index-mcp 是从 https://github.com/block/xcode-index-mcp. 导入的 MCP 服务器候选

概述(AI 翻译)

通过模型控制协议(MCP)和IndexStoreDB,Goose/Cursor可以访问你的iOS/macOS项目索引。这提供了详尽的函数调用站点列表,帮助你的代理进行重构和代码导航。

示例提示

“从MyViewController.swift第48行的初始化器中移除myParameter。使用Xcode索引MCP确保所有引用均已更新。”

如何使用

  1. 安装uv(Python包管理器)并运行uv sync

  2. 构建Swift服务(必须安装Xcode)

此步骤是必要的,因为它提供了与 Xcode 索引的接口。

  1. 安装你选择的代理

鹅:

进入设置,添加自定义扩展。在弹出的模态中,在command字段下添加这行:

注意:将 替换为你的实际系统用户名,或用你机器上的正确路径xcode-index-mcp。

其余部分应该大致是这样的:

光标:

点击Settings > MCP > Add new global MCP server。更新mcp.json(通常位于你的光标配置文件目录中)看起来像这样:

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Xcode Index MCP

Gives Goose/Cursor access to your iOS/macOS project index through the Model Control Protocol (MCP) and IndexStoreDB. This provides exhaustive lists of function call sites to help your agent with refactoring and code navigation.

Example prompt

“Remove myParameter from the initializer on line 48 of MyViewController.swift. Use the Xcode Index MCP to ensure all references are updated.”

How to use

  1. Install uv (Python package manager) and run uv sync

    brew install uv
    cd /path/to/this/repo
    uv sync
    
  2. Build the Swift service (Xcode must be installed)

    cd swift-service
    swift build
    

    This step is required as it provides the interface to Xcode’s index.

  3. Install in Agent of your choice

    Goose:

    Go to settings and add a custom extension. In the modal that pops up, under the command field, add this line:

    /Users//Development/xcode-index-mcp/.venv/bin/xcode-index-mcp
    

    Note: Replace `` with your actual system username, or with the correct path xcode-index-mcp on your machine.

    The rest should look something like this:

    Cursor:

    Go to Settings > MCP > Add new global MCP server. Update mcp.json (typically located in your Cursor configuration directory) to look something like this:

        {
            "mcpServers": {
                "Xcode Index MCP": {
                    "command": "/Users//Development/xcode-index-mcp/.venv/bin/xcode-index-mcp"
                }
            }
        }
    

    Note: Replace `` with your actual system username, or with the correct path xcode-index-mcp on your machine.

    Claude Code:

    Run this command in the terminal to add the mcp to Claude Code

    claude mcp add xcode-index-mcp -- /Users//Development/xcode-index-mcp/.venv/bin/xcode-index-mcp
    

    Note: Replace `` with your actual system username, or with the correct path xcode-index-mcp on your machine.

  4. Update .gooseHints, cursorRules, or CLAUDE.MD in your project to tell your agent how to use the plugin. Replace the project name with the name of your project as it appears in the derived data folder.

    Use tool `xcode-index-mcp` if available. Use project name . The tool can locate call sites of functions, and function definitions from call sites. If you need a filepath to make a request, use `rg` to find the file and `rg -n` to find the line number. Use the absolute path when requesting symbols from a file.
    

    For Cursor, you may want to add these instructions in their own rule file - at the time of writing I don’t think cursor reads the MCP instructions field.

Running tests

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "Xcode Index MCP": { "command": "/Users/<USERNAME>/Development/xcode-index-mcp/.venv/bin/xcode-index-mcp" } } }