Use GitHub Copilot from your phone by chatting in Discord.
You run this bot on a server/PC (home lab, VM, cloud box) that has:
- GitHub Copilot CLI + authentication
- Your repos under a configured root folder (
REPOS_ROOT)
Then you use Discord mobile to:
- Create a session (Discord thread)
- Pick a repo with reactions (1..10)
- Approve/deny tool actions with reactions (thumbs up/thumbs down)
- Watch a single "CLI panel" status message update in-place
Video: media/copilot-discord-bot.mp4
- Emoji-first UX: threads + reactions work great on mobile.
- Single status panel: no spam; one message edits in-place.
- Repo sandbox: agent work is scoped under
REPOS_ROOT. - Interactive approvals: prompts show what's being approved.
- Set
OWNER_DISCORD_USER_ID(recommended). If set, the bot ignores everyone else. - Keep
REPOS_ROOTtight. The bot should only see repos you want it to touch. - Keep approvals on (
cp approve ask) unless you fully trust your tools + repos. - Optional:
AUTO_APPROVE_READ_PERMISSIONS=truereduces prompt spam for read-only actions.
- Node.js 18 or later
- Verify:
node --versionshould be18.xor later
- Verify:
- GitHub Copilot CLI installed on the server and authenticated
- Verify:
copilot --version(should not prompt) - Authenticate (interactive): run
copilotonce and complete sign-in - Authenticate (service-friendly): set
GH_TOKEN/COPILOT_GITHUB_TOKEN
- Verify:
- A Discord application + bot token
In the Discord Developer Portal:
- Create an Application
- Create a Bot and copy the token
- Enable Privileged Gateway Intents:
- Message Content Intent (required)
- Invite the bot to your server (OAuth2 -> URL Generator):
- Scopes:
bot - Permissions (minimum recommended):
- View Channels
- Send Messages
- Read Message History
- Create Public Threads
- Send Messages in Threads
- Add Reactions
- Use External Emojis (optional)
- Scopes:
Copy .env.example to .env and fill in the values:
cp .env.example .envRequired variables:
DISCORD_BOT_TOKEN— your bot tokenOWNER_DISCORD_USER_ID— your Discord user ID (recommended)REPOS_ROOT— root folder containing repos (example:/home/user/git)
All configuration variables (with defaults):
From repo root:
npm install
npm run devHealth endpoint:
http://localhost:5000/health
npm run build
npm startThese scripts build the app, set environment variables, and register an always-on service.
Run from an elevated PowerShell:
powershell -ExecutionPolicy Bypass -File .\scripts\install-service-windows.ps1Common options:
-ReposRoot "E:\Git"-OwnerDiscordUserId 123456789012345678-GhToken "..."(recommended for services)-CopilotCliPath "C:\Path\to\copilot.exe"
Uninstall:
powershell -ExecutionPolicy Bypass -File .\scripts\uninstall-service-windows.ps1Make scripts executable and run with sudo:
chmod +x scripts/*.sh
sudo ./scripts/install-service-linux.sh --user <username> --repos-root /path/to/reposThe installer builds the project, copies output to the install directory, writes an env file at /etc/copilot-discord-bot.env (mode 600) and creates a systemd unit.
Uninstall:
sudo ./scripts/uninstall-service-linux.sh --remove-envIn any normal text channel:
cp new my-session
The bot creates a thread (that thread is the session) and posts a repo picker.
In the session thread:
- React with 1..10 on the repo picker message.
Fallback: cp repo <path>
Just send normal messages in the thread.
You will see a single status panel updated in-place (state/repo/model/doing).
In the session thread:
cp model(shows current)cp model gpt-5.2(sets for this session)
When Copilot requests permission, the bot posts a prompt message.
- React thumbs up to approve
- React thumbs down to deny
This usually means the copilot process exited immediately (often because PATH resolved to a VS Code shim that prints an interactive install prompt).
- Run
which copilot(Linux/Mac) orwhere copilot(Windows) and verify it points to the installedcopilotbinary - Run
copilot --versionin the same shell you launch the bot from - If it prompts to install/reinstall, restart your terminal (PATH update) and try again
- If it still points to a shim, set
COPILOT_CLI_PATHto the full binary path
The Copilot SDK is in preview and permission payload fields can vary. Enable:
DEBUG_PERMISSION_PAYLOAD=true
This adds a debug panel to permission prompts.
cp approve ask(recommended)cp approve always
Enable the GitHub MCP server for a session:
cp config set {"model":"gpt-5.2","mcpServers":{"github":{"type":"http","url":"https://api.githubcopilot.com/mcp/","tools":["*"]}}}



