# Merget in GitHub Copilot

Step 2 of https://sema.merget.ai/agent-setup/prompt.md, for Copilot CLI, Copilot in VS Code and the Copilot cloud coding agent. Run the commands yourself; the human signs in. When `merget_status` is among your tools, continue at the prompt's step 3.

## Install

Plugin, the usual route: Merget's MCP server and skills in one unit (Copilot reads the marketplace's `.claude-plugin/marketplace.json`).

- Copilot CLI: `copilot plugin marketplace add MergetAI/merget-plugin`, then `copilot plugin install merget@merget-queue` (or `/plugin marketplace add MergetAI/merget-plugin` and `/plugin install merget@merget-queue` in a session).
- VS Code: `"chat.plugins.marketplaces": ["MergetAI/merget-plugin"]` in the user settings (or Agent Customizations editor › Browse › Configure Marketplaces › Add Marketplace), then the human installs Merget from that editor's Browse; or, in the chat, `/plugin marketplace add MergetAI/merget-plugin` then `/plugin install merget@merget-queue`. The editor and the `/plugin` commands keep separate plugin lists: add the marketplace where you install.

MCP server only (no skills):

- Copilot CLI: `copilot mcp add --transport http merget https://sema.merget.ai/mcp`
- VS Code: `code --add-mcp '{"name":"merget","type":"http","url":"https://sema.merget.ai/mcp"}'`; or the human opens vscode:mcp/install?%7B%22name%22%3A%22merget%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fsema.merget.ai%2Fmcp%22%7D; or `"merget": {"type": "http", "url": "https://sema.merget.ai/mcp"}` under `"servers"` in `.vscode/mcp.json`.

Skills by hand: `npx -y skills add MergetAI/merget-plugin -a github-copilot -g -y` — not with the plugin, it ships them. One route or the other: the plugin and a hand-added server at the same URL list every tool twice.

## Sign in

The server opens the browser the first time it starts: VS Code, MCP: List Servers › merget › Start; the CLI, `/mcp` in a session. On Merget's sign-in page the human picks the organization and your permissions; signing out of the server and in again changes either.

## Check

Look for the `merget` server's tools: in VS Code under the chat's tools picker, in the CLI under `/mcp`. If none appear, restart the server (MCP: List Servers › Restart) or start a new session.

## Updates

Copilot CLI: `copilot plugin update merget`; when it finds nothing new, `copilot plugin marketplace update merget-queue` re-fetches the catalog first. Skills by hand: run the `npx -y skills add` line again.

## Dead ends

- No shell: hand the commands to the human. `-g` writes under the home directory; the sandbox may ask them to approve it.
- `invalid_redirect_uri`, or a saved connection that stops connecting: stop and point the human to https://sema.merget.ai/orgs/<slug>/docs/mcp.
- The Copilot cloud coding agent cannot open a browser: it takes an agent key, below.

## Cloud and headless

The Copilot cloud coding agent reads its MCP servers from the repository's Settings › Copilot › MCP servers and never signs in with OAuth, so it takes an agent key in a header. The human creates one at https://sema.merget.ai/orgs/<slug>/settings/agents › Create agent key (Merget's sign-in page shows it once; you never see it, and it goes in no URL or prompt), saves it as the repository's Agents secret `COPILOT_MCP_MERGET_KEY` (only `COPILOT_MCP_*` names reach the configuration), then pastes this under MCP configuration and saves:

```json
{"mcpServers": {"merget": {"type": "http", "url": "https://sema.merget.ai/mcp", "headers": {"Authorization": "Bearer $COPILOT_MCP_MERGET_KEY"}, "tools": ["*"]}}}
```

The agent's next task lists Merget's tools, with the key's permissions.
