Skip to main content
Glama
slcwahn

github-copilot-cli-mcp-server

by slcwahn

github-copilot-cli-mcp-server

⚠️ ALPHA VERSION — This project is experimental and in early development. Testing across different environments is limited. Use at your own risk and expect breaking changes.

A Node.js/TypeScript project that wraps GitHub Copilot CLI as a Model Context Protocol (MCP) server.

Use Copilot CLI as a tool from any MCP-compatible client (VSCode, OpenClaw, Claude Desktop, etc.).

Features

  • Complete Copilot conversations in a single MCP call: Send a prompt → receive results in one tool call

  • Session resumption: Continue previous conversations using session IDs

  • Permission mode selection: Interactive (user confirmation) / Autonomous (auto-approve)

  • Model selection: Use any model supported by Copilot

  • Working directory specification: Set cwd for tasks that require file access

Related MCP server: gemini-cli-mcp-slim

Prerequisites

  • Node.js 20.0.0 or higher

  • GitHub Copilot CLI installed and authenticated

    npm install -g @github/copilot-cli
  • GitHub Copilot subscription (Individual, Business, or Enterprise)

Installation

From source

git clone https://github.com/slcwahn/github-copilot-cli-mcp-server.git
cd github-copilot-cli-mcp-server
npm install
npm run build

Quick start

npm run dev

MCP Tools

run_copilot_conversation

Runs a Copilot CLI conversation with a prompt.

Parameters:

Name

Type

Required

Description

prompt

string

✅

Prompt to send to Copilot

model

string

AI model (e.g., claude-sonnet-4, gpt-4.1)

cwd

string

Working directory

allow_tools

string[]

List of tools to allow

add_dirs

string[]

Additional directories to grant access

timeout_ms

number

Timeout (default: 300000ms = 5 minutes)

permission_mode

string

Permission mode: "autonomous" (default) or "interactive"

Example:

{
  "name": "run_copilot_conversation",
  "arguments": {
    "prompt": "Fix the bug in src/main.ts",
    "cwd": "/path/to/project",
    "model": "claude-sonnet-4"
  }
}

resume_copilot_session

Resumes a previous session to continue the conversation.

Parameters:

Name

Type

Required

Description

session_id

string

✅

Session ID (UUID)

prompt

string

✅

Follow-up prompt

model

string

AI model

cwd

string

Working directory

timeout_ms

number

Timeout

Example:

{
  "name": "resume_copilot_session",
  "arguments": {
    "session_id": "abc12345-1234-5678-9abc-def012345678",
    "prompt": "Now add tests for those changes"
  }
}

list_copilot_sessions

Lists resumable Copilot CLI sessions.

respond_to_copilot

Responds to Copilot's permission prompts in Interactive mode.

Parameters:

Name

Type

Required

Description

session_id

string

✅

Pending session ID

response

string

✅

Response ("yes", "no", or free text)

Configuration

VSCode

Add the following to your .vscode/mcp.json file:

{
  "servers": {
    "github-copilot-cli": {
      "type": "stdio",
      "command": "node",
      "args": ["/path/to/github-copilot-cli-mcp-server/dist/index.js"],
      "env": {
        "COPILOT_PERMISSION_MODE": "interactive"
      }
    }
  }
}

Or use the Command Palette: MCP: Add Server → stdio → enter the configuration above.

Tip: Use ${workspaceFolder} to specify relative paths based on your workspace.

For global configuration, use the Command Palette: MCP: Open User Configuration to add it to your user profile.

OpenClaw (mcporter)

OpenClaw supports MCP servers through the mcporter skill.

Register via mcporter CLI

# Register the server
mcporter config add github-copilot-cli \
  --command node \
  --arg /path/to/github-copilot-cli-mcp-server/dist/index.js \
  --env COPILOT_PERMISSION_MODE=autonomous

# Verify registration
mcporter list

# Check tool schema
mcporter list github-copilot-cli --schema

# Call a tool directly
mcporter call github-copilot-cli.run_copilot_conversation prompt="Fix the bug in main.ts"

Edit mcporter config file directly

~/.mcporter/mcporter.json or project-level config/mcporter.json:

{
  "servers": {
    "github-copilot-cli": {
      "transport": "stdio",
      "command": "node",
      "args": ["/path/to/github-copilot-cli-mcp-server/dist/index.js"],
      "env": {
        "COPILOT_PERMISSION_MODE": "autonomous"
      }
    }
  }
}

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "github-copilot-cli": {
      "command": "node",
      "args": ["/path/to/github-copilot-cli-mcp-server/dist/index.js"]
    }
  }
}

Environment Variables

Variable

Default

Description

COPILOT_CLI_PATH

(auto-detect)

Path to Copilot CLI binary

COPILOT_PERMISSION_MODE

autonomous

Permission mode: autonomous or interactive

Permission Handling

Copilot CLI may request user approval for file modifications, shell command execution, and other actions. This MCP server supports two permission modes:

Autonomous Mode (default)

COPILOT_PERMISSION_MODE=autonomous
  • Runs Copilot CLI with --allow-all-tools --no-ask-user flags

  • Auto-approves all permissions and completes without user prompts

  • Best for: Trusted tasks, automation pipelines, CI/CD

Interactive Mode

COPILOT_PERMISSION_MODE=interactive
  • Runs Copilot CLI with PTY for interactive I/O

  • Returns needsInput: true in the MCP response when a permission prompt is detected

  • The MCP client (user or agent) responds via the respond_to_copilot tool

Interactive Mode Flow:

MCP Client                    MCP Server                   Copilot CLI
    │                              │                            │
    │ run_copilot_conversation     │                            │
    ├─────────────────────────────►│  spawn (PTY)               │
    │                              ├───────────────────────────►│
    │                              │                            │
    │                              │  "Modify this file?"       │
    │                              │◄───────────────────────────┤
    │  { needsInput: true,         │                            │
    │    question: "Modify..." }   │                            │
    │◄─────────────────────────────┤                            │
    │                              │                            │
    │  respond_to_copilot("yes")   │                            │
    ├─────────────────────────────►│  write "yes\n"             │
    │                              ├───────────────────────────►│
    │                              │                            │
    │                              │  (complete)                │
    │                              │◄───────────────────────────┤
    │  { output: "..." }           │                            │
    │◄─────────────────────────────┤                            │

Note: Interactive mode requires node-pty (optional dependency). If not installed, it automatically falls back to autonomous mode.

Architecture

MCP Client (VSCode / OpenClaw / Claude Desktop)
    │
    │ stdio (JSON-RPC)
    ▼
┌──────────────────────────────────────────────┐
│   github-copilot-cli-mcp-server              │
│                                              │
│  ┌────────────────────────────────────────┐  │
│  │  MCP Server (stdio)                    │  │
│  │  - run_copilot_conversation            │  │
│  │  - resume_copilot_session              │  │
│  │  - list_copilot_sessions               │  │
│  │  - respond_to_copilot                  │  │
│  └──────────────┬─────────────────────────┘  │
│                 │                             │
│  ┌──────────────▼─────────────────────────┐  │
│  │  Permission Handler                    │  │
│  │  (autonomous / interactive)            │  │
│  └──────────────┬─────────────────────────┘  │
│                 │                             │
│  ┌──────────────▼─────────────────────────┐  │
│  │  Copilot Runner                        │  │
│  │  (spawn / PTY)                         │  │
│  └──────────────┬─────────────────────────┘  │
│                 │                             │
│  ┌──────────────▼─────────────────────────┐  │
│  │  Session Manager                       │  │
│  │  (session metadata + pending input)    │  │
│  └────────────────────────────────────────┘  │
└──────────────────────────────────────────────┘
    │
    │ spawn / PTY
    ▼
  copilot -p "prompt" -s [--allow-all-tools | interactive]

Development

# Development mode
npm run dev

# Build
npm run build

# Type check
npm run typecheck

# Test
npm test

How It Works

  1. The MCP client calls the run_copilot_conversation tool

  2. Depending on the permission mode:

    • Autonomous: Runs copilot -p "<prompt>" -s --allow-all-tools --no-ask-user

    • Interactive: Runs with PTY, forwarding permission prompts to the MCP client

  3. Copilot CLI performs the task (code generation, modification, analysis, etc.)

  4. Returns the output as an MCP response upon completion

  5. If a session ID is available, the session can be resumed via resume_copilot_session

Copilot CLI Options Used

Flag

Purpose

-p <prompt>

Run prompt in non-interactive mode

-s

Silent mode (response only, no stats)

--allow-all-tools

Auto-approve all tools (autonomous mode)

--no-ask-user

Autonomous operation without prompts (autonomous mode)

--no-custom-instructions

Ignore AGENTS.md and similar files

--no-color

Disable ANSI colors

--no-alt-screen

Disable terminal alternate screen

--resume <id>

Resume a session

--model <model>

Select a model

--add-dir <dir>

Grant access to additional directories

License

MIT

References

Available Tools

4 tools
list_copilot_sessionsA

List available Copilot CLI sessions that can be resumed. Also shows any sessions waiting for permission input.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It does indicate a non-mutating list operation and adds the useful behavior of surfacing sessions waiting for permission input. However, it does not disclose any potential side effects, permission requirements, or limits on the listing.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two concise sentences with no filler. The primary action is front-loaded, and the additional detail about permission-waiting sessions is presented in a separate short sentence.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple and has no parameters or output schema, so the description is mostly sufficient. However, it does not state what the returned list contains (e.g., session IDs, statuses) which would be needed to use sibling tools like resume_copilot_session effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, so the baseline is 4. The description correctly focuses on the output behavior rather than parameter details, which is appropriate since there is nothing to document.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('List') and a specific resource ('available Copilot CLI sessions that can be resumed'), plus an additional behavioral detail about sessions waiting for permission input. This clearly distinguishes it from sibling tools that resume, run, or respond to sessions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage as a precursor to resuming sessions, but it never explicitly states 'use this before resume_copilot_session' or excludes the sibling tools. The context is reasonable but left to inference rather than explicit guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

respond_to_copilotA

Respond to a Copilot CLI permission question in interactive mode. When Copilot asks for permission (e.g., 'Allow file modification?'), use this tool to send the user's response (e.g., 'yes', 'no', or custom text).

ParametersJSON Schema
NameRequiredDescriptionDefault
responseYesResponse to send to Copilot (e.g., 'yes', 'no', 'y', 'n', or custom text)
session_idYesThe session ID of the Copilot process waiting for input

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full behavioral burden. It discloses the core action (sending user input to a waiting Copilot process) and the interactive-mode context, but it does not explain what happens after the response is sent, whether the session continues, or how the tool behaves if Copilot is not waiting for input.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences with the core purpose front-loaded in the first sentence, and the second sentence providing a concrete trigger example. There is minor redundancy between the two sentences (both mention permission), but no filler or wasted content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple 2-parameter tool with complete schema coverage, the description covers the primary use case well. However, with no output schema and no annotations, it omits outcome details (what happens after the response is delivered) and edge-case behavior (failure when no process is waiting), which an agent would need for robust invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description reinforces the schema's response examples ('yes', 'no', or custom text) but adds no new parameter-level meaning beyond what the schema already documents for session_id and response.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific action ('Respond to a Copilot CLI permission question') with a clear resource and context ('in interactive mode'), plus a concrete example ('Allow file modification?'). It distinguishes itself from siblings by framing the task as permission-response rather than session management, though it does not explicitly name any sibling.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives an explicit trigger condition: 'When Copilot asks for permission... use this tool to send the user's response.' This tells an agent exactly when to invoke it. However, it does not explicitly address alternatives or exclusions, such as when to prefer resume_copilot_session or run_copilot_conversation instead.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

resume_copilot_sessionA

Resume a previous Copilot CLI session by session ID. This continues an existing conversation with additional context or follow-up questions.

ParametersJSON Schema
NameRequiredDescriptionDefault
cwdNoWorking directory (overrides previous session cwd)
modelNoAI model to use (overrides previous session model)
promptYesFollow-up prompt or additional instructions
session_idYesThe session ID (UUID) to resume
timeout_msNoTimeout in milliseconds (default: 300000 = 5 minutes)
permission_modeNoPermission handling mode for this session

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the burden. It discloses that the tool continues an existing conversation and accepts follow-up prompts, which is the core behavior. However, it doesn't mention side effects (e.g., whether resuming mutates the session, whether it consumes conversation turns, or whether it requires an active session). It also doesn't mention that cwd/model can override previous session settings, which is a behavioral nuance. The description is adequate but not rich.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with the primary action and resource. The second sentence adds useful context about what resuming entails. No wasted words, though it could have used the space to mention overrides or exclusions.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 6 parameters and no output schema, the description is somewhat thin. It doesn't explain what the response looks like, whether the session must be active, or how the overrides (cwd, model) interact with the previous session. The schema covers parameter syntax, but the description doesn't cover the operational context an agent needs to decide between this and run_copilot_conversation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 6 parameters. The description adds the context that the prompt is a 'follow-up prompt or additional instructions' and that the session is resumed, which aligns with the schema. However, it doesn't add meaning beyond the schema for parameters like timeout_ms or permission_mode. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Resume'), the resource ('a previous Copilot CLI session'), and the mechanism ('by session ID'). It also explains what resuming does: 'continues an existing conversation with additional context or follow-up questions.' This distinguishes it from siblings like run_copilot_conversation (starting new) and list_copilot_sessions (listing).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies when to use this tool: when you have a previous session ID and want to continue it. It doesn't explicitly say 'use run_copilot_conversation for new sessions' or 'use list_copilot_sessions to find session IDs,' but the sibling names and the description's focus on resuming make the usage context reasonably clear. Missing explicit exclusions or alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

run_copilot_conversationA

Execute a prompt with GitHub Copilot CLI. Runs Copilot in non-interactive mode (-p) and returns the complete response. Use this for one-shot tasks like code generation, explanation, debugging, etc. In interactive permission mode, may return with needsInput=true if Copilot asks a permission question — use respond_to_copilot to answer.

ParametersJSON Schema
NameRequiredDescriptionDefault
cwdNoWorking directory for Copilot to operate in (for file access)
modelNoAI model to use (e.g., claude-sonnet-4, gpt-4.1, claude-opus-4.5)
promptYesThe prompt to send to Copilot CLI
add_dirsNoAdditional directories to allow Copilot to access
timeout_msNoTimeout in milliseconds (default: 300000 = 5 minutes)
allow_toolsNoSpecific tools to allow (e.g., 'shell(git:*)', 'write'). If not set, all tools are allowed in autonomous mode.
permission_modeNoPermission handling mode. 'autonomous' (default): auto-approve all tools. 'interactive': ask MCP client for permission via respond_to_copilot tool.

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It openly discloses non-interactive mode and the needsInput=true possibility, which is useful. However, it does not warn that Copilot can execute shell commands or write files (given allow_tools and autonomous mode), so the tool could be misperceived as read-only.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences with no wasted words. The core purpose is front-loaded, use cases follow, and the permission caveat is positioned at the end. Every sentence adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with no output schema and no annotations, the description is incomplete. It says 'returns the complete response' without specifying format (stdout/stderr/exit code) and omits side-effect warnings for a tool that can run arbitrary tools. Given the tool's complexity, more detail is warranted.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the structured schema already documents all parameters. The description adds some context around permission_mode behavior (interactive mode and needsInput), but does not materially enrich the meaning of the other parameters beyond what the schema provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: 'Execute a prompt with GitHub Copilot CLI.' It clarifies the non-interactive mode (-p) and explicitly names respond_to_copilot as the sibling to use for permission questions, which distinguishes it from the other siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description tells the agent to use this for 'one-shot tasks like code generation, explanation, debugging, etc.' and provides a conditional alternative ('use respond_to_copilot to answer') for interactive permission mode. However, it does not explicitly mention when to prefer resume_copilot_session or list_copilot_sessions, leaving those exclusions implied.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updatesv0.2.1
    • First observedlist_copilot_sessions
    • First observedrespond_to_copilot
    • First observedresume_copilot_session
    • First observedrun_copilot_conversation

TDQS

A4/5.0

Scored across 4 tools

Disambiguation5/5

Each tool has a clearly distinct role: run starts a new one-shot conversation, list shows available sessions, resume continues an existing session by ID, and respond answers permission prompts. No two tools overlap in purpose, and the descriptions reinforce the boundaries.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern: resume_copilot_session, run_copilot_conversation, list_copilot_sessions, respond_to_copilot. The pattern makes the action and target of each tool immediately predictable.

Tool Count5/5

Four tools is well-scoped for a thin MCP server wrapping GitHub Copilot CLI. Each tool covers a necessary part of the session workflow—start, list, resume, and respond—without redundant or filler tools.

Completeness4/5

The core session lifecycle is covered: starting, listing, resuming, and handling permission input. Minor gaps exist, such as no explicit way to terminate a session or fetch full session transcripts, but these are not critical for the server's apparent purpose.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers