# GitHub Copilot

Connect VS Code and GitHub Copilot through the hosted OAuth configuration when the host supports it.

- Canonical: https://docs.xmemo.dev/docs/mcp/copilot
- Locale: en-US
- Content-Locale: en-US
- Canonical-Content-Digest: e9eac1ad37f07adab615acf42b132c65e87bf846c0958e25ea31296e4f8e27a0
- Edition-Digest: 909aea820a477779b7dd1a76bccdfa59e27857c6fc699bcfa5edca3c264d4145
- Source-Revision: sha256:e7adcc0239ccf0c2db9646c8b85217ee768ab13640615d7637eba52824869752

## Prerequisite

Use VS Code with GitHub Copilot Chat and MCP support. This route is the editor OAuth path; Copilot CLI is a separate direct-token route below.

- Auth mode: OAuth.
- Config file: %APPDATA%\Code\User\mcp.json.
- Uses the servers key rather than mcpServers.
- Endpoint: https://xmemo.dev/mcp.

## Install / setup

Edit %APPDATA%\Code\User\mcp.json under the servers key and add the hosted XMemo URL. Do not use the Copilot CLI config here; its direct path has its own route.

- Keep the editor entry URL-only.
- The first tool call opens browser OAuth.
- Do not add an Authorization header to this VS Code entry.

## Set the credential

No key — complete browser OAuth in VS Code / GitHub Copilot Chat. Do not set XMEMO_KEY or paste a bearer token into mcp.json.

```text
No XMEMO_KEY
Complete browser OAuth in VS Code / GitHub Copilot Chat
```

## Generate / confirm XMEMO_AGENT_INSTANCE_ID

The reviewed VS Code OAuth listing has no client-side identity header. Do not add XMEMO_AGENT_INSTANCE_ID to mcp.json; confirm that this OAuth path uses its grant-managed attribution.

## Preserve the existing config block

Use the existing VS Code / GitHub Copilot XMemo configuration block rendered on this page. Preserve the servers key and URL-only OAuth shape; do not copy the Copilot CLI bearer configuration into it.

## Restart the client

Reload the VS Code window or restart the MCP connection after saving mcp.json so Copilot reads the current server definition.

## Test with a real recall call

Make the first MCP call read-only. This is an actual recall invocation, not a health-check placeholder, and it does not write memory.

```text
recall({ query: "connection check", limit: 1 })
```

## Expected response (literal shape)

A successful call returns the public ranked text shape below; the reference and content are real values from the authorized memory space.

```text
### XMemo Memory Results:
1. Reference: <opaque-memory-id> | Location: <location>
   > <memory content>
```

## Common Errors

VS Code / GitHub Copilot Chat uses the browser OAuth path and should not be debugged with Copilot CLI token settings.

- invalid_grant — the OAuth authorization code is invalid, expired, or already used: reconnect the VS Code MCP server and authorize again.
- invalid_target — the OAuth resource does not match this MCP server: reconnect using https://xmemo.dev/mcp.
- 403 insufficient_scope — the grant does not include memory:read: approve the required scope and reconnect.

## Copilot CLI is a separate, direct path

Use /docs/mcp/copilot-cli for the bearer-token Copilot CLI flow. The editor OAuth flow documented here and the CLI direct flow do not share a credential session.

## VS Code / GitHub Copilot

OAuth client: keep only the hosted server URL in mcp.json; first tool call opens browser OAuth, so no XMEMO_KEY or Authorization header belongs in this file.

```
{
  "servers": {
    "XMemo": {
      "type": "http",
      "url": "https://xmemo.dev/mcp"
    }
  }
}
```
