Copilot CLI: Hooks, MCP Servers, Skills, and Customization

JSON snippets and commands for extending GitHub Copilot CLI with hooks, MCP servers, skills, and repository initialization.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all
## Hooks basics
Store hooks in the repository
.github/hooks/hooks.json

# Hooks are loaded from a repository folder.

Minimal command hook template
{
  "version": 1,
  "hooks": {
    "preToolUse": [
      {
        "type": "command",
        "bash": "./scripts/pre-tool.sh",
        "powershell": "./scripts/pre-tool.ps1",
        "cwd": "scripts",
        "timeoutSec": 30
      }
    ]
  }
}

# Start with a JSON hook file.

Run a session-start hook script
{
  "type": "command",
  "bash": "./scripts/session-start.sh",
  "powershell": "./scripts/session-start.ps1",
  "cwd": "scripts",
  "timeoutSec": 30
}

# Trigger repo automation when a session begins.

Log prompts for auditing
{
  "version": 1,
  "hooks": {
    "sessionStart": [
      {
        "type": "command",
        "bash": "./scripts/audit-log.sh"
      }
    ]
  }
}

# Call a script that records prompt activity.

## MCP servers and built-ins
Add an MCP server for one session from a file
copilot --additional-mcp-config=@./mcp-extra.json

# Load additional MCP server config at runtime.

Disable all built-in MCP servers
copilot --disable-builtin-mcps

# Run without the default built-in servers.

Disable a specific MCP server
copilot --disable-mcp-server=github-mcp-server

# Turn off one named server.

Enable a specific GitHub MCP tool
copilot --add-github-mcp-tool=search_issues

# Grant access to one GitHub MCP capability.

Enable a GitHub MCP toolset
copilot --add-github-mcp-toolset=all

# Grant a named toolset instead of individual tools.

Persistent MCP config location
~/.copilot/mcp-config.json

# Store servers in the user MCP config file.

Local MCP server template
{
  "my-local-server": {
    "type": "local",
    "command": "node",
    "args": ["./tools/mcp-server.js"],
    "tools": ["*"]
  }
}

# Define a local stdio MCP server.

## Skills and custom agents
Project skill directory
.github/skills/

# Store project skills in the standard directory.

Minimal skill frontmatter
---
name: repo-audit
description: Review a repository for risky shell scripts, weak CI defaults, and missing docs.
allowed-tools:
  - shell(git:*)
user-invocable: true
---

Focus on reproducible, low-risk recommendations.

# Define a reusable skill.

List installed skills
/skills list

# Inspect active skills from the session.

Initialize Copilot repo features
/init

# Set up custom instructions and agentic repo features.

Initialize Copilot instructions from the command line
copilot init

# Run init without first entering a full session.

Recommended next

No recommendations yet.