# Connect GitHub Copilot CLI to AlwaysOn Memory (MCP Setup Guide)

> AlwaysOn Memory connects to GitHub Copilot CLI (Coding agent (CLI)) over Streamable HTTP MCP using a connection key in ~/.copilot/mcp-config.json. Once connected, GitHub Copilot CLI can read, search, write, and hand off project memory across fresh sessions and other connected tools.

- **Canonical HTML:** https://always-on.cloud/docs/clients/copilot-cli
- **Markdown Mirror:** https://always-on.cloud/docs/clients/copilot-cli.md
- **Public Docs MCP:** https://always-on.cloud/docs/mcp
- **Agent Skill:** https://always-on.cloud/skill.md
- **Last Updated:** 2026-12-01

## How do I connect GitHub Copilot CLI to AlwaysOn Memory?

Connect GitHub Copilot CLI over Streamable HTTP MCP with your workspace URL (`https://always-on.cloud/t/YOUR-WORKSPACE/mcp`) and a workspace-scoped `awm_` connection key in ~/.copilot/mcp-config.json. Create the key under **Setup** or **Connections**, paste the config below, and reload GitHub Copilot CLI to load all 17 memory tools.

- **Transport**: Streamable HTTP MCP (2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05)
- **Authentication**: Workspace-scoped Bearer connection key (`awm_...`) in the `Authorization` header. Cursor and VS Code also support one-click browser OAuth 2.1.
- `Config location`: ~/.copilot/mcp-config.json
- `Universal OAuth URL`: https://always-on.cloud/mcp
- `Workspace URL`: https://always-on.cloud/t/YOUR-WORKSPACE/mcp

1. **Add AlwaysOn to GitHub Copilot CLI:** Paste the JSON below into ~/.copilot/mcp-config.json with your workspace URL and connection key, then start a new Copilot CLI session (or run /mcp).

   _~/.copilot/mcp-config.json_

```json
{
  "mcpServers": {
    "alwayson": {
      "type": "http",
      "url": "https://always-on.cloud/t/YOUR-WORKSPACE/mcp",
      "headers": { "Authorization": "Bearer YOUR_CONNECTION_KEY" }
    }
  }
}
```

2. **Load the memory tools in GitHub Copilot CLI:** Tip: the signed-in AlwaysOn Setup screen also generates a 1-command terminal auto-installer with your real URL and key pre-filled.

### Agent Context: Agent Automation & Verification Recipe (GitHub Copilot CLI)

Use these exact protocol parameters when configuring or testing GitHub Copilot CLI from a script or agent. Never print or commit raw `awm_` keys or `awm_oauth_` tokens.

- Transport: Streamable HTTP JSON-RPC 2.0 POST to `https://always-on.cloud/t/YOUR-WORKSPACE/mcp` (or `https://always-on.cloud/mcp` for OAuth 2.1 clients).
- Required HTTP headers: `Content-Type: application/json`, `Accept: application/json, text/event-stream`, and `Authorization: Bearer <token>`.
- Key prefix: `awm_` (workspace-scoped). If you send a key to a different workspace slug, AlwaysOn returns HTTP 403 `CROSS_TENANT_FORBIDDEN`.
- Every MCP call (including `initialize`, `ping`, and `tools/list`) counts as 1 request against the workspace daily request limit (300/day Free, 5,000/day Pro Solo, 15,000/day Team; resets at 00:00 UTC).
- For Team members, verify with `memory_status` (works with zero grants and returns your granted projects) or `memory_explore`, then call `memory_briefing` with a granted `project` instead of `default`.

_Verify GitHub Copilot CLI workspace endpoint and inspect workspace status / granted projects_

```bash
curl -fsS -X POST "https://always-on.cloud/t/YOUR-WORKSPACE/mcp" \
  -H "Authorization: Bearer $ALWAYSON_MEMORY_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":"1","method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"copilot-cli","version":"1.0"}}}'

curl -fsS -X POST "https://always-on.cloud/t/YOUR-WORKSPACE/mcp" \
  -H "Authorization: Bearer $ALWAYSON_MEMORY_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{ "jsonrpc": "2.0", "id": "verify-1", "method": "tools/call", "params": { "name": "memory_status", "arguments": {} } }'
```

## How do I verify GitHub Copilot CLI recalls memory across sessions?

Save one harmless decision, open a brand-new session so chat history is empty, and ask GitHub Copilot CLI to recall it. If it comes back accurately, the setup works—and the dashboard Setup screen logs the save, the new `initialize` handshake, and the retrieval.

1. **Save one test decision:** In GitHub Copilot CLI, ask: "Save to AlwaysOn memory as a project decision: we ship the smallest useful version first."

2. **Check recall in a fresh session:** Open a new chat or restart GitHub Copilot CLI, then ask: "Check AlwaysOn memory: what did we decide about the first release?"

3. **Confirm it in the dashboard:** Open **Memory** or **Setup** in AlwaysOn to see the saved memory page and the server-observed MCP events.

_Optional terminal MCP initialize check_

```bash
curl -fsS -X POST "https://always-on.cloud/t/YOUR-WORKSPACE/mcp" -H "Authorization: Bearer YOUR_CONNECTION_KEY" -H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" -d '{"jsonrpc":"2.0","id":"setup","method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"copilot-cli","version":"1.0"}}}' >/dev/null && echo "✓ AlwaysOn connection verified!"
```

## How do I fix common GitHub Copilot CLI connection errors?

Most GitHub Copilot CLI setup problems come down to four things: a mistyped or revoked connection key (HTTP 401), hitting the Free browser-approved app limit (HTTP 402), a wrong workspace slug (HTTP 403), or a session that hasn't reloaded ~/.copilot/mcp-config.json yet.

### Why does GitHub Copilot CLI get HTTP 401 from AlwaysOn Memory?

HTTP 401 means the connection key is missing, mistyped, or revoked. **Workspace owners:** create a new connection key under **Connections**, replace `YOUR_CONNECTION_KEY` in ~/.copilot/mcp-config.json, and reload GitHub Copilot CLI. **Team members:** ask your workspace owner to click **Reissue key** next to your handle under **Settings → Members** (your project grants stay intact), update your key in ~/.copilot/mcp-config.json, and reload GitHub Copilot CLI.

### Does GitHub Copilot CLI need a separate connection key for each repo?

No. For workspace owners, one connection key connects GitHub Copilot CLI to your whole workspace; for Team members, one seat key connects GitHub Copilot CLI to every project the workspace owner granted you. Separate repos with the `project` parameter (for example `project: "billing-api"`). Every plan includes up to 25 active connection keys.

### Why didn't GitHub Copilot CLI show AlwaysOn tools right after I edited ~/.copilot/mcp-config.json?

Most editors and CLIs read MCP config only when a session starts. Reload the window, refresh the MCP panel, or open a new GitHub Copilot CLI session so it runs a fresh `initialize` and `tools/list` handshake.

## Related Documentation

- [Quickstart](https://always-on.cloud/docs/quickstart.md): Create a free AlwaysOn Memory workspace, connect Claude Code, Cursor, VS Code, Codex, ChatGPT, Claude, or Grok via MCP, and verify cross-session recall.
- [Authentication](https://always-on.cloud/docs/concepts/authentication.md): Compare OAuth 2.1 PKCE and scoped awm_ connection keys for MCP tools, plus account sign-in with email links, Google/GitHub/GitLab/OpenID SSO, and passkeys.
- [Memory tools (17)](https://always-on.cloud/docs/reference/mcp-tools.md): Parameter tables, safety annotations, and JSON-RPC examples for all 17 AlwaysOn Memory MCP tools: pages, search, briefings, handoffs, and inbox messages.
- [Error codes](https://always-on.cloud/docs/reference/errors.md): Reference for AlwaysOn Memory HTTP status codes, domain error codes, and MCP JSON-RPC error codes with exact causes and fixes.
