This directory contains practical examples and templates for integrating GitHub Copilot CLI into your development workflow.
examples/
├── mcp-configs/ # MCP server configuration examples
├── scripts/ # Shell scripts for automation
├── workflows/ # CI/CD workflow examples
└── README.md # This file
Located in mcp-configs/:
basic-mcp-config.json- Basic setup with filesystem, GitHub, and Git MCP serversadvanced-mcp-config.json- Advanced setup with database, search, and communication integrationsdevelopment-mcp-config.json- Development-focused configuration with limited GitHub tools
Copy a configuration file to your home directory:
# For system-wide configuration
cp examples/mcp-configs/basic-mcp-config.json ~/.copilot/mcp-config.json
# For project-specific configuration
cp examples/mcp-configs/development-mcp-config.json .copilot/mcp-config.jsonDon't forget to set required environment variables:
export GITHUB_TOKEN="your-token"
export WORKSPACE="$(pwd)"Located in scripts/:
copilot-review.sh - Review code files or directories for issues
# Make executable
chmod +x examples/scripts/copilot-review.sh
# Review a single file
./examples/scripts/copilot-review.sh src/utils.js
# Review entire directory
./examples/scripts/copilot-review.sh src/generate-commit-message.sh - Generate conventional commit messages
# Make executable
chmod +x examples/scripts/generate-commit-message.sh
# Stage your changes
git add .
# Generate and commit
./examples/scripts/generate-commit-message.shgenerate-tests.sh - Generate unit tests for source files
# Make executable
chmod +x examples/scripts/generate-tests.sh
# Generate tests
./examples/scripts/generate-tests.sh src/utils.js
# Creates: src/utils.test.js
./examples/scripts/generate-tests.sh lib/parser.py
# Creates: lib/parser_test.pySupports:
- JavaScript (
.js) → Jest - TypeScript (
.ts) → Jest - React (
.jsx,.tsx) → React Testing Library - Python (
.py) → pytest - Go (
.go) → Go testing - Rust (
.rs) → Rust testing - Java (
.java) → JUnit 5
generate-docs.sh - Generate API documentation
# Make executable
chmod +x examples/scripts/generate-docs.sh
# Generate docs for single file
./examples/scripts/generate-docs.sh src/utils.js
# Generate docs for directory
./examples/scripts/generate-docs.sh src/ docs/apiLocated in workflows/:
github-actions-review.yml - Automated PR reviews
Copy to your repository:
cp examples/workflows/github-actions-review.yml .github/workflows/Requires:
- GitHub token with Copilot access (automatically provided)
- PR permissions (configured in workflow)
gitlab-ci-review.yml - Automated MR reviews
Copy to your repository:
cp examples/workflows/gitlab-ci-review.yml .gitlab-ci.ymlOr merge with existing .gitlab-ci.yml:
include:
- local: examples/workflows/gitlab-ci-review.ymlRequires:
COPILOT_GITHUB_TOKENvariable (with Copilot access)GITLAB_TOKENvariable (optional, for posting comments)
-
Install Copilot CLI:
npm install -g @github/copilot
-
Set up authentication:
export GITHUB_TOKEN="your-personal-access-token"
-
Copy and customize MCP config:
mkdir -p ~/.copilot cp examples/mcp-configs/basic-mcp-config.json ~/.copilot/mcp-config.json
-
Make scripts executable:
chmod +x examples/scripts/*.sh -
Test it out:
# Review a file ./examples/scripts/copilot-review.sh README.md
Scripts and workflows use these environment variables:
| Variable | Description | Required |
|---|---|---|
GITHUB_TOKEN |
GitHub personal access token with Copilot access | Yes |
WORKSPACE |
Current workspace/project directory | No (defaults to pwd) |
COPILOT_MODEL |
Model to use (e.g., claude-sonnet-4.5) | No |
PGUSER |
PostgreSQL username (for postgres MCP) | If using postgres |
PGPASSWORD |
PostgreSQL password (for postgres MCP) | If using postgres |
BRAVE_API_KEY |
Brave Search API key (for search MCP) | If using Brave Search |
SLACK_BOT_TOKEN |
Slack bot token (for Slack MCP) | If using Slack |
SLACK_TEAM_ID |
Slack team ID (for Slack MCP) | If using Slack |
- Start Simple: Begin with
basic-mcp-config.jsonand add servers as needed - Secure Tokens: Never commit tokens to version control; use environment variables
- Test Scripts: Review generated code/tests/docs before using in production
- Customize Prompts: Adjust prompts in scripts to match your team's standards
- CI/CD Integration: Make CI checks advisory, not blocking, initially
# Check if executables are in PATH
which npx
# Test server startup manually
npx -y @modelcontextprotocol/server-filesystem ~/projects
# Check Copilot logs
COPILOT_DEBUG=true copilot# Ensure scripts are executable
chmod +x examples/scripts/*.sh
# Check Copilot is installed
copilot --version
# Verify authentication
echo $GITHUB_TOKEN- Check GitHub token has Copilot access
- Verify token permissions in repository secrets
- Review workflow logs for specific errors
Have a useful script or configuration? Contributions are welcome!
- Add your example with clear comments
- Update this README with usage instructions
- Test thoroughly before submitting
- Integration Guide - Comprehensive integration documentation
- Official Docs
- MCP Specification
For issues or questions: