Xcode IntelligenceでGithub Copilot使ってみた

  • URLをコピーしました!
目次

概要

xcode-copilot-serverは、GitHub CopilotをXcode Intelligenceで利用できるようにするためのローカルサーバーです。

通常、GitHub CopilotはXcode Intelligenceに直接接続することができません。そのため、このサーバーが間に入り、XcodeとCopilotの通信を仲介します。

構成としては以下のようになります。

  • Copilot:AI本体
  • xcode-copilot-server:仲介サーバー
  • Xcode:クライアント

この仕組みにより、単なるコード補完だけでなく、

  • AIチャット
  • コード生成
  • リファクタリング
  • エラー解析

といった、より高度なAI活用が可能になります。

また、Agent機能(Claude AgentやCodex Agent)のバックエンドとしても利用できます。


インストール

まず前提として、GitHub Copilotが利用可能なGitHubアカウントが必要です。

その上で、xcode-copilot-serverをインストールします。インストール方法は公式リポジトリの手順に従うのが確実です。


gh(GitHub CLI)が未インストールの場合

gh auth login を使うために、GitHub CLI(gh)が必要です。

Homebrewが入っている場合

以下でインストールできます。

brew install gh

Homebrewがない場合

Homebrewを先にインストールします。

/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)”

その後、

brew install gh

を実行します。


認証

起動するには「認証」が必要になります。

認証方法は、ターミナルで以下を実行します。

gh auth login

または

copilot login

ログイン後は、以下で状態を確認します。

gh auth status

ここでログイン済みと表示されれば準備完了です。

※認証が通っていないと動作しません


設定

xcode-copilot-serverはローカルサーバーとして動作します。

Mac上でサーバーを起動し、Xcodeがそこに接続する構成になります。

デフォルトでは以下のURLで待ち受けます。

あわせて読みたい

agentのインストール・アンインストール

xcode-copilot-server install-agent

Xcode-copilot-server uninstall-agent


状態確認

launchctl print gui/$(id -u)/com.xcode-copilot-server

再起動

launchctl kickstart -kp gui/$(id -u)/com.xcode-copilot-server

ログ確認

tail -f ~/Library/Logs/xcode-copilot-server.err.log

手動での起動方法

agentをインストールしている場合は不要ですが、ターミナルで以下を実行します。

launchctl bootout gui/$(id -u) ~/Library/LaunchAgents/com.xcode-copilot-server.plist
xcode-copilot-server -p 8080

ポートは指定しなくても起動できます。その場合は8080ポートが使われますが、なんらかの理由で指定して起動する場合は、—portオプションで指定します。

※必ずXcodeより先に起動しておく必要があります

my-config.json5

{
  openai: {
    // No tool bridge needed, as Xcode drives tool execution directly.
    toolBridge: false,
    // Tool bridge timeout in minutes. 0: disabled.
    toolBridgeTimeout: 0,

    mcpServers: {
      xcode: {
        type: "local",
        command: "xcrun",
        args: ["mcpbridge"],
        allowedTools: ["*"],
      },
    },
  },

  claude: {
    // Intercepts tool calls and forwards them to Xcode so Claude Agent
    // drives tool execution through the IDE instead of the Copilot CLI.
    toolBridge: true,
    // Tool bridge timeout in minutes. 0: disabled.
    toolBridgeTimeout: 0,

    // No MCP servers needed, as Claude Agent handles tools natively.
    mcpServers: {},
  },

  codex: {
    // Same as Claude: intercepts tool calls and forwards them to Xcode
    // so Codex drives tool execution through the IDE.
    toolBridge: true,
    // Tool bridge timeout in minutes. 0: disabled.
    toolBridgeTimeout: 0,

    mcpServers: {},
  },

  // Built-in CLI tools allowlist.
  // ["*"] to allow all, [] to deny all, or a list of specific tool names.
  //
  // Empty by default so Xcode can handle all operations (search, read, edit)
  // through its UI. Enabling CLI tools lets the Copilot session perform
  // those operations directly, bypassing Xcode.
  allowedCliTools: [],

  // Maximum request body size in MiB.
  bodyLimit: 10,

  // Server-level request timeout in minutes. 0: disabled.
  requestTimeout: 0,

  // Filename patterns to filter out from search results in the prompt.
  //
  // Xcode can include full file contents for every search match, so add patterns
  // here to strip files that bloat the prompt (e.g. ["mock", "generated"]).
  excludedFilePatterns: [],

  // Reasoning effort for models that support it: "low", "medium", "high", "xhigh"
  reasoningEffort: "xhigh",

  // Auto-approve permission requests.
  // true to approve all, false to deny all,
  // or an array of kinds: "read", "write", "shell", "mcp", "url"
  autoApprovePermissions: ["read", "mcp"],
}

Xcode側の設定

  1. Settingsを開く
  2. Intelligenceへ移動
  3. Add Providerを選択
  4. Locally hostedを選択

以下を入力します。

  • URL:http://localhost:8080
  • 名前:Copilot(任意)

AIモデルの選択方法

XcodeのIntelligence画面で、左上にあるノートアイコンで、追加したプロバイダを選択するとモデル一覧が表示されます。

一般的には以下のようなモデルが選択できます。

  • 高品質モデル(GPT-4系)
  • 軽量モデル

選び方の目安

  • 精度重視 → GPT-4系
  • 速度重視 → 軽量モデル

迷ったらGPT-4系を選べばOKです。


Xcodeでの使い方

設定が完了すると、Xcode InteligenceでGithubCopilotを利用できるようになります。

コード生成

  • SwiftUIでリストを作成して
  • カウントアップボタンを実装して

エラー修正

エラー内容を貼るだけで対応できます。

リファクタリング

  • このコードをシンプルにして
  • 関数に分割して

まとめ

xcode-copilot-serverは、GitHub CopilotをXcode Intelligenceで活用するための橋渡しツールです。

重要なポイントは以下です。

  • ghをインストールする
  • 認証を行う
  • サーバーを起動する
  • Xcodeで接続する
  • モデルを選択する

この5つを押さえれば問題なく使えます。

コード補完だけでなく、AIチャットやエージェント的な操作まで可能になるため、開発効率は大きく向上します。

この記事が気に入ったら
フォローしてね!

よかったらシェアしてね!
  • URLをコピーしました!
目次