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:
- ✅ Configure
.vscode/mcp.jsonwith the canon-keeper server - ✅ Enable MCP in
.vscode/settings.json - ✅ Create/update
.github/copilot-instructions.mdwith:- Memory Persistence Protocol (
@Historydirective) - Best practices template
- Session Learnings Log table
- Memory Persistence Protocol (
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:
- Extract learnings from the conversation (using its own LLM)
- Call the MCP tool to deduplicate against existing entries
- Append new learnings to your
copilot-instructions.md - 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/pythonwith the absolute path to your Python executable (e.g.,C:/Users/You/project/.venv/Scripts/python.exeon Windows or/home/you/project/.venv/bin/pythonon 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 namedecision(string): The decision or learningrationale(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 topicdecision(string): The decision/learningcurrent_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
- Copilot extracts learnings from your conversation using its built-in LLM
- MCP tool deduplicates using Jaccard similarity (threshold: 0.6)
- Tool formats new learnings as markdown table rows
- 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f117354a7e8e1953fa7858c1c1a33e64d9951b938a12226431ebaa3b8e4e7e15
|
|
| MD5 |
7e1649e1ae27ce43cd95a71576d7d1f3
|
|
| BLAKE2b-256 |
605cc11585eeceaabe895fe3d7882910e8462216acdf1f762ceb2b760ddd0eb5
|
File details
Details for the file canon_keeper_mcp-0.1.6-py3-none-any.whl.
File metadata
- Download URL: canon_keeper_mcp-0.1.6-py3-none-any.whl
- Upload date:
- Size: 15.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
151b14952e79910ed4f583f82bf7df7784b5929e6a3f2b6ac9c341f5c5a4698e
|
|
| MD5 |
62c568d49329a626d27abf3f181e36df
|
|
| BLAKE2b-256 |
c7a4e09e5d1159f008e273bf097e00e0104e18d471cbf104a41f6b689349ab5d
|