
# GitHub Copilot CLI (https://openknowledge.ai/docs/integrations/github-copilot-cli)

Use OpenKnowledge with GitHub Copilot CLI.

[GitHub Copilot CLI](https://github.com/features/copilot/cli) is a terminal-native AI coding assistant.

## Install

There are two ways to connect GitHub Copilot CLI, depending on how you run OpenKnowledge:

- **Desktop app** (macOS, Windows, Linux). The first time you open a project, a consent dialog detects GitHub Copilot CLI and configures it for you. To re-trigger the dialog, choose **File → Set up OpenKnowledge integrations…**.
- **Web app / terminal** (any platform, including Intel Macs — see the [web app guide](https://openknowledge.ai/docs/get-started/quickstart#ok-install-web-app)). Run `ok init` in your project: it registers the OpenKnowledge MCP server with GitHub Copilot CLI and the other editors it detects. Every `ok start` repairs the entry if it has drifted (it never adds one you removed).

`ok init` writes the MCP server to `~/.copilot/mcp-config.json`, or to `$COPILOT_HOME/mcp-config.json` when `COPILOT_HOME` is set. That machine-wide file is the one OpenKnowledge manages for Copilot, so it is where the entry goes. Copilot also reads the project `.mcp.json` OpenKnowledge writes for Claude Code, and a project-level definition of the same server takes precedence over the global one.

If the Copilot config directory does not exist yet, launch Copilot CLI once and rerun `ok init` so it can write the MCP configuration.

It also installs the project skill at `.github/skills/open-knowledge/SKILL.md` so Copilot can follow the project's OpenKnowledge workflow.

## Folder trust

The machine-wide entry `ok init` writes to `~/.copilot/mcp-config.json`, or to `$COPILOT_HOME/mcp-config.json` when `COPILOT_HOME` is set, is not affected by folder trust.

The project `.mcp.json` is a different path. Copilot loads project-level MCP servers only after you confirm folder trust on first launch, and skips them silently in untrusted folders, including under `copilot -p`, which cannot show the trust prompt.

When you launch `copilot` in a folder for the first time it asks whether you trust it. Trusting it for the current session is enough to load the project `.mcp.json`; choosing to remember the folder makes the grant permanent, as does adding it to Copilot's trusted directories. See GitHub's [Configuring Copilot CLI](https://docs.github.com/en/copilot/how-tos/copilot-cli/set-up-copilot-cli/configure-copilot-cli) docs for the trusted-directories setting.

> **Warn**
>
> Folder trust is not scoped to MCP: a trusted folder lets Copilot read, modify, and execute files in and below it, and loads that repository's hooks. `ok init` commits `.mcp.json` so the repo is ready for teammates, which means a knowledge base you cloned carries one someone else wrote. Read it before trusting it.

`GITHUB_COPILOT_PROMPT_MODE_WORKSPACE_MCP=true` overrides the skip, but it is an environment variable, not a per-folder grant: while it is set, `copilot -p` starts project MCP servers declared by any untrusted repository it runs in.

## Open with AI

In OpenKnowledge's docked terminal, select **GitHub Copilot** from the new-chat picker. It starts Copilot CLI in interactive mode with context for the current project. The option is hidden when the `copilot` executable is not installed.

## Verify

Open the project in GitHub Copilot CLI and ask:

> List the first 5 documents you come across in this project.

GitHub Copilot CLI should call the OpenKnowledge `exec` tool and respond with some of your documents.

If you don't see the tool, restart Copilot CLI. If `ok init` reported that your config was left unchanged, fix the reported config issue and rerun `ok init`. To add it manually, create an `open-knowledge` entry in `mcpServers` that runs `ok mcp`.