copilot-session-sync
v0.1.2
Published
MCP server to sync GitHub Copilot sessions across machines via a private GitHub repo
Readme
copilot-session-sync
MCP server that syncs GitHub Copilot CLI and VS Code sessions across machines via a private GitHub repository.
How It Works
Your Copilot sessions live in ~/.copilot/session-state/ and ~/.copilot/session-store.db. This MCP server syncs them to a private {username}/.copilot repository on GitHub, so you can access the same sessions from any machine or Codespace.
- Bidirectional sync — pushes new/updated local sessions and pulls new/updated remote sessions
- Session-level merge — uses
updated_attimestamps fromworkspace.yamlto determine which side wins - DB merge — row-level merge of the
session-store.dbSQLite database with FTS5 index rebuild - Auto-creates the
.copilotprivate repo if it doesn't exist
Setup
Prerequisites
- Node.js >= 20
- GitHub CLI (
gh) authenticated, orGITHUB_TOKENenvironment variable
Install
cd copilot-sync
npm install
npm run buildConfigure for GitHub Copilot CLI
Add to your Copilot CLI MCP configuration:
{
"mcpServers": {
"copilot-session-sync": {
"command": "node",
"args": ["/path/to/copilot-sync/dist/index.js"],
"env": {}
}
}
}Configure for VS Code
Add to your VS Code settings.json:
{
"mcp": {
"servers": {
"copilot-session-sync": {
"command": "node",
"args": ["/path/to/copilot-sync/dist/index.js"]
}
}
}
}MCP Tools
sync_sessions
Bidirectional sync of all sessions. Compares local and remote by session ID and timestamps.
| Parameter | Type | Description |
|-----------|------|-------------|
| dry_run | boolean (optional) | Preview what would be synced without making changes |
list_remote_sessions
Lists all sessions (local and remote) with their sync status.
| Parameter | Type | Description |
|-----------|------|-------------|
| filter | string (optional) | Filter by summary text or repository name |
Status icons:
- ✅ Synced
- 📤 Local only
- 📥 Remote only
- ⬆️ Local newer
- ⬇️ Remote newer
pull_session
Pull a specific session from the remote repo.
| Parameter | Type | Description |
|-----------|------|-------------|
| session_id | string (required) | UUID of the session to pull |
push_session
Push a specific local session to the remote repo.
| Parameter | Type | Description |
|-----------|------|-------------|
| session_id | string (required) | UUID of the session to push |
sync_status
Show sync status overview — last sync time, session counts, what needs syncing.
Usage Examples
From Copilot CLI or VS Code chat:
> Sync my copilot sessions
> Show me what sessions need syncing
> List my remote sessions
> Pull session abc12345-...
> Push the current session to remoteEnvironment Variables
| Variable | Description | Default |
|----------|-------------|---------|
| GITHUB_TOKEN | GitHub personal access token | Falls back to gh auth token |
| GITHUB_USER | GitHub username | Auto-detected from token |
| COPILOT_HOME | Path to Copilot config directory | ~/.copilot |
| COPILOT_SYNC_REPO | Name of the sync repository | .copilot |
Architecture
~/.copilot/
├── session-state/ ← synced
├── session-store.db ← synced (row-level merge)
├── sync-cache/ ← local clone of the remote repo
├── config.json ← NOT synced (machine-specific)
└── logs/ ← NOT syncedThe sync cache (~/.copilot/sync-cache/) is a local git clone of the remote repo. It's reused across syncs for efficiency.
License
MIT
