Skip to main content

MCP server for persisting learnings from Copilot conversations - no API key required

Project description

Canon Keeper MCP Server

An MCP (Model Context Protocol) server that persists learnings from Copilot conversations to copilot-instructions.md.

No API key required! Copilot extracts learnings using its own LLM, this tool handles deduplication and formatting.

Quick Install

pip install canon-keeper-mcp
python -m canon_keeper_mcp install

# Or specify a workspace
python -m canon_keeper_mcp install --workspace /path/to/project

The installer will:

  1. ✅ Configure .vscode/mcp.json with the canon-keeper server
  2. ✅ Enable MCP in .vscode/settings.json
  3. ✅ Create/update .github/copilot-instructions.md with:
    • Memory Persistence Protocol (@History directive)
    • Best practices template
    • Session Learnings Log table

Features

  • Zero Configuration: No API keys needed - uses Copilot's built-in LLM
  • Smart Deduplication: Uses Jaccard similarity to avoid duplicate entries
  • Simple Integration: Works with Copilot's existing capabilities
  • Markdown Formatting: Returns properly formatted table rows for the Session Learnings Log

Usage

After installation, reload VS Code and use these trigger phrases in any Copilot chat:

User: @History save what we learned
User: save this learning  
User: remember this
User: add to memory

Copilot will:

  1. Extract learnings from the conversation (using its own LLM)
  2. Call the MCP tool to deduplicate against existing entries
  3. Append new learnings to your copilot-instructions.md
  4. Report what was saved/skipped

Manual Installation

If you prefer to install manually:

1. Install the package

pip install canon-keeper-mcp

2. Configure MCP server

Add to .vscode/mcp.json:

{
  "servers": {
    "canon-keeper": {
      "type": "stdio",
      "command": "/path/to/your/python",
      "args": ["-m", "canon_keeper_mcp"]
    }
  }
}

Note: Replace /path/to/your/python with the absolute path to your Python executable (e.g., C:/Users/You/project/.venv/Scripts/python.exe on Windows or /home/you/project/.venv/bin/python on Linux/Mac).

3. Enable MCP in VS Code

Add to .vscode/settings.json:

{
  "github.copilot.chat.modelContextProtocol.enabled": true
}

4. Add directive to copilot-instructions.md

Add this to your .github/copilot-instructions.md:

### Memory Persistence Protocol (@History)

**Rule:** When the user includes `@History`, `save this`, `remember this`, or `add to memory`:

1. Extract learnings from the conversation as an array of objects with: topic, decision, rationale
2. Read the current `copilot-instructions.md` file content
3. Call MCP tool `canon_keeper.extract_and_save_learnings` with:
   - `learnings`: Array of extracted learnings
   - `current_instructions`: The full content of copilot-instructions.md
4. If `markdown_to_append` is non-empty, append it to the Session Learnings Log table
5. Report what was saved and what was skipped as duplicates

**Trigger phrases:** `@History`, `save this`, `remember this`, `add to memory`

5. Add Session Learnings Log table

## Session Learnings Log

| Date | Topic | Decision | Rationale |
|------|-------|----------|----------|

MCP Tools

extract_and_save_learnings

Deduplicates learnings against existing entries and formats for markdown.

Input:

  • learnings (array): Array of learning objects, each with:
    • topic (string): Short topic name
    • decision (string): The decision or learning
    • rationale (string): Why this decision was made
  • current_instructions (string): Current copilot-instructions.md content

Example Input:

{
  "learnings": [
    {
      "topic": "MCP Config Format",
      "decision": "Use 'servers' key not 'mcpServers'",
      "rationale": "VS Code MCP expects this exact format"
    }
  ],
  "current_instructions": "... content of copilot-instructions.md ..."
}

Output:

{
  "status": "success",
  "message": "Found 1 new learning(s), skipped 0 duplicate(s).",
  "new_learnings": [...],
  "duplicates_skipped": [],
  "markdown_to_append": "| 2026-01-18 | MCP Config Format | Use 'servers' key not 'mcpServers' | VS Code MCP expects this exact format |",
  "target_section": "Session Learnings Log"
}

check_learning_exists

Check if a specific learning already exists.

Input:

  • topic (string): Learning topic
  • decision (string): The decision/learning
  • current_instructions (string): Current copilot-instructions.md content

Output:

{
  "exists": true,
  "similar_to": "Existing Topic Name",
  "similarity_score": 0.85,
  "reason": "High similarity to existing entry"
}

How It Works

  1. Copilot extracts learnings from your conversation using its built-in LLM
  2. MCP tool deduplicates using Jaccard similarity (threshold: 0.6)
  3. Tool formats new learnings as markdown table rows
  4. Copilot appends the formatted rows to your copilot-instructions.md

This approach means:

  • ✅ No API keys needed
  • ✅ No external LLM calls
  • ✅ Fast deduplication
  • ✅ Works offline (except for Copilot itself)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

canon_keeper_mcp-0.1.6.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

canon_keeper_mcp-0.1.6-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file canon_keeper_mcp-0.1.6.tar.gz.

File metadata

  • Download URL: canon_keeper_mcp-0.1.6.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for canon_keeper_mcp-0.1.6.tar.gz
Algorithm Hash digest
SHA256 f117354a7e8e1953fa7858c1c1a33e64d9951b938a12226431ebaa3b8e4e7e15
MD5 7e1649e1ae27ce43cd95a71576d7d1f3
BLAKE2b-256 605cc11585eeceaabe895fe3d7882910e8462216acdf1f762ceb2b760ddd0eb5

See more details on using hashes here.

File details

Details for the file canon_keeper_mcp-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for canon_keeper_mcp-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 151b14952e79910ed4f583f82bf7df7784b5929e6a3f2b6ac9c341f5c5a4698e
MD5 62c568d49329a626d27abf3f181e36df
BLAKE2b-256 c7a4e09e5d1159f008e273bf097e00e0104e18d471cbf104a41f6b689349ab5d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page