スクラッチで始めるGithub Copilot CLI
とうとう Github Copilot CLI が使用できるようになった(いつかできるようになると信じてた)ようで、普段 Copilot を個人的に使用している私は早速試してみました。
Github Copilot CLI の公式リポジトリ。
注意点として、有料プランでないと使用できないようです。
GitHub Copilot CLI は、GitHub Copilot Pro、GitHub Copilot Pro+、GitHub Copilot Business、GitHub Copilot Enterprise プランで使用できます。
導入手順
npm install -g @github/copilot
copilot
以上、導入自体は簡単ですね。
copilot
┌── ──┐
│ ▄██████▄ │
Welcome to GitHub ▄█▀▀▀▀▀██▀▀▀▀▀█▄
█████┐ █████┐ █████┐ ██┐██┐ █████┐ ██████┐ ▐█ ▐▌ █▌
██┌───┘██┌──██┐██┌─██┐██│██│ ██┌──██┐└─██┌─┘ ▐█▄ ▄██▄ ▄█▌
██│ ██│ ██│█████┌┘██│██│ ██│ ██│ ██│ ▄▄███████▀▀███████▄▄
██│ ██│ ██│██┌──┘ ██│██│ ██│ ██│ ██│ ████ ▄ ▄ ████
└█████┐└█████┌┘██│ ██│██████┐└█████┌┘ ██│ ████ █ █ ████
└────┘ └────┘ └─┘ └─┘└─────┘ └────┘ └─┘ ▀███▄ ▄███▀
│ CLI Version 0.0.334 ▀▀████████████▀▀ │
└── ──┘
Version 0.0.334 · Commit 26896a6
Copilot can write, test and debug code right from your terminal. Describe a
task to get started or enter ? for help. Copilot uses AI, check for mistakes.
どういったコマンドがあるのか。使用サンプルも
copilot help
Help Topics:
config Configuration Settings
environment Environment Variables
logging Logging
permissions Tool Permissions
Examples:
# Start interactive mode
$ copilot
# Start with a specific model
$ copilot --model gpt-5
# Execute a prompt directly
$ copilot -p "Fix the bug in main.js" --allow-all-tools
# Execute a prompt with a specific model
$ copilot -p "Fix the bug in main.js" --model claude-sonnet-4 --allow-all-tools
# Resume the latest session
$ copilot --resume
# Resume a specific session by ID
$ copilot --resume session-id
# Resume the most recent session
$ copilot --continue
# Resume with auto-approval
$ copilot --allow-all-tools --resume
# Show the animated banner
$ copilot --banner
# Set logging to ./logs
$ copilot --log-dir ./logs
# Enable debug level logging
$ copilot --log-level debug
# Allow access to additional directory
$ copilot --add-dir /home/user/projects
# Allow multiple directories
$ copilot --add-dir ~/workspace --add-dir /tmp
# Allow all git commands except git push
$ copilot --allow-tool 'shell(git:*)' --deny-tool 'shell(git push)'
# Allow all file editing
$ copilot --allow-tool 'write'
# Allow all but one specific tool from MCP server with name "MyMCP"
$ copilot --deny-tool 'MyMCP(denied_tool)' --allow-tool 'MyMCP'
Interactive Mode Commands:
/add-dir <directory> Add a directory to the allowed list for file access
/clear Clear the conversation history
/cwd [directory] Change working directory or show current directory
/exit Exit the CLI
/feedback Provide feedback about the CLI
/help Show help for interactive commands
/list-dirs Display all allowed directories for file access
/login Log in to Copilot
/logout Log out of Copilot
/mcp [show|add|edit|delete|disable|enable] [server-name] Manage MCP server configuration
/model [model] Select AI model to use
/reset-allowed-tools Reset the list of allowed tools
/session Show information about the current CLI session
/theme [show|set|list] [auto|dark|light] View or configure terminal theme
/usage Display session usage metrics and statistics
/user [show|list|switch] Manage GitHub user list
Copilotのグローバル設定ディレクトリ
- copilot-instructions.md
- mcp-config.json
は自分で空のファイルを作成しました。
.
├── command-history-state.json // ここにコマンドの履歴が保存される
├── config.json // ここに設定が保存される
├── copilot-instructions.md // ここに指示を書ける
├── history-session-state // ここにセッションの状態が保存される
├── logs // ログがここに保存される
└── mcp-config.json // ここにMCPサーバーの設定が保存される
MCPサーバーの設定
ハンズオンなので CLI 上で MCP サーバーの設定をしてみます。
/mcp add
Add New MCP Server
Server Name:
Unique name for this MCP server
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Server Type:
Press 1 for Local, 2 for HTTP, 3 for SSE
[1] Local [2] HTTP [3] SSE
Command:
Command to start the server (e.g., "python")
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Arguments:
Command arguments, comma-separated (e.g., -m, my_server)
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Environment Variables:
Path is automatically inherited. All other environment variables must be configured
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Tools:
Tools to include: "*" for all, or comma-separated list (no quotes needed)
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│* │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
fetch
- Server Name: fetch
- Server Type: 1 (LOCAL)
- Command: uvx
- Arguments: mcp-server-fetch
- Environment Variables: (空欄)
- Tools: *
// mcp-config.json
"fetch": {
"tools": [
"*"
],
"type": "local",
"command": "uvx",
"args": [
"mcp-server-fetch"
]
},
これで登録しました。
軽く動作確認してみます。
> fetch を使ってhttps://zenn.dev/otot_devを参照して、基本的なサイト情報を教えてください。
↓
これは技術記事共有プラットフォームZennにおけるotot_devさんのプロフィールページです。ユーザーは自身を「Digital
Craftsman(ソフトウェアエンジニア / デザインエンジニア /
デザイナー)」と紹介しており、コーヒーが大好きで、苔を眺めるのが好きという趣味も記載されています。
ポートフォリオサイトとしてotot.dev (https://otot.dev/)へのリンクも掲載されていることが確認できます。
このプロフィールから、技術的なスキルだけでなくデザイン面にも強みを持つエンジニアであることが伺えます。ZennではおそらくWeb開発、デザイン、エンジニアリング
に関する技術記事を投稿されているものと思われます。
ちゃんと情報を参照してくれてそうです。
※UVX がインストールされていない方は以下のコマンドでインストールできます(Mac の場合)
brew install uvx
serena
- Server Name: serena
- Server Type: 1 (LOCAL)
- Command: uvx
- Arguments: --from,git+https://github.com/oraios/serena,serena,start-mcp-server
- Environment Variables: (空欄)
- Tools: *
// mcp-config.json
"serena": {
"tools": [
"*"
],
"type": "local",
"command": "uvx",
"args": [
"--from",
"git+https://github.com/oraios/serena",
"serena",
"start-mcp-server"
],
"env": {}
},

こんな画面が表示できればちゃんと起動できてる。
context7
- Server Name: context7
- Server Type: 1 (LOCAL)
- Command: npx
- Arguments: -y,@upstash/context7-mcp,--api-key,YOUR_API_KEY
- Environment Variables: (空欄)
- Tools: *
// mcp-config.json
"context7": {
"type": "local",
"command": "npx",
"tools": [
"*"
],
"args": [
"-y",
"@upstash/context7-mcp",
"--api-key",
"YOUR_API_KEY"
]
}
> context7を使ってfetch APIのファイルをアップロードする方法を教えてください。
● Fetch APIを使用したファイルアップロードの方法について、Context7を使って詳しい情報を取得します。
✓ Resolve Context7 Library ID
↪ Available Libraries (top matches):
● Fetch APIは標準のWeb APIなので、MDNのドキュメントを参照しつつ、実践的なファイルアップロードの例を提供します。
✓ Get Library Docs
〜〜省略〜〜
その他のMCPサーバーリスト
Github Copilot CLIで消費するPremiumリクエストについても心に留めておく
Copilot CLI へのプロンプトごとに、1 つの Premium リクエストが使われます。
Copilot CLI は 2025 年 10 月現在プロンプトごとに 1 つの Premium リクエストを消費するようです。
ちなみにプラン毎に Premium リクエストの上限が異なります。下に公式ドキュメントを貼っておきます。
所感
個人では Github Copilot を中心に使っていたので、Github Copilot CLI が出たのはとても嬉しいかったです(それもあって早速試したというのもある)。
Github MCP Server が標準で接続されているというのも他にはない強みにも感じました。ほとんどのリポジトリは Github にあるでしょうし、それらの情報は非常にアクセスしやすいかなと。
参考にさせていただいた記事
Discussion
copilot cliでserena使おうとしてたまたま行きつきました、感謝です 🙏