MCP server for extracting and persisting learnings from Copilot conversations
Project description
Canon Keeper MCP Server
An MCP (Model Context Protocol) server that extracts durable learnings from Copilot conversations and persists them to copilot-instructions.md.
No VS Code extension required! Copilot invokes the MCP tool directly.
Quick Install
# From any project directory
python -m canon_keeper_mcp install
# Or specify a workspace
python -m canon_keeper_mcp install --workspace /path/to/project
The installer will:
- ✅ Install dependencies (
mcp,google-genai) - ✅ Configure
.vscode/mcp.jsonwith the canon-keeper server - ✅ Create/update
.github/copilot-instructions.mdwith:- Memory Persistence Protocol (
@Historydirective) - Best practices template
- Session Learnings Log table
- Memory Persistence Protocol (
Features
- Intelligent Extraction: Uses LLM to identify technical decisions, architectural choices, workarounds, and insights
- Deduplication: Compares against existing learnings to avoid duplicates
- Update Detection: Identifies when a learning updates/supersedes an existing entry
- 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:
- Gather the full conversation history
- Call the MCP tool to extract learnings
- 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 dependencies
pip install mcp google-genai
2. Configure MCP server
Add to .vscode/mcp.json:
{
"mcpServers": {
"canon-keeper": {
"command": "python",
"args": ["-m", "canon_keeper_mcp"],
"cwd": "${workspaceFolder}"
}
}
}
3. 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` in any message:
1. Read the current `copilot-instructions.md` file content
2. Collect the full conversation history from this session
3. Call MCP tool `canon_keeper.extract_and_save_learnings` with:
- `conversation`: The complete conversation text
- `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`
4. Add Session Learnings Log table
## Session Learnings Log
| Date | Topic | Decision | Rationale |
|------|-------|----------|----------|
MCP Tools
extract_and_save_learnings
Extracts learnings from conversation and deduplicates against existing entries.
Input:
conversation(string): Full conversation textcurrent_instructions(string): Current copilot-instructions.md content
Output:
{
"status": "success",
"message": "Found 2 new learning(s), skipped 1 duplicate(s).",
"new_learnings": [...],
"duplicates_skipped": [...],
"markdown_to_append": "| 2026-01-17 | Topic | Decision | Rationale |",
"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",
"reason": "Semantically equivalent to existing entry"
}
LLM Providers
Supports:
- Google GenAI (default): Uses
gemini-2.0-flash-001 - OpenAI (fallback): Uses
gpt-4o-mini
Set appropriate API keys:
GOOGLE_API_KEYfor Google GenAIOPENAI_API_KEYfor OpenAI
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.2.tar.gz.
File metadata
- Download URL: canon_keeper_mcp-0.1.2.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
644e52cf0f13c7cd5b81eec7cb18f52d68055f2571da1f0f5a43cda150168b92
|
|
| MD5 |
a3e7b463fc4f0534d343d8e35b8326f6
|
|
| BLAKE2b-256 |
d99662f43ada0af820ca313cb817a3aa5decc42a6f7d9d43b74e2c749648b675
|
File details
Details for the file canon_keeper_mcp-0.1.2-py3-none-any.whl.
File metadata
- Download URL: canon_keeper_mcp-0.1.2-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e924d9313362f8ae6e3144ba473644c888645f2d46239c673ca9f580b9d88d76
|
|
| MD5 |
ff3ed3d73ecf44bf0714221e4d8c0b17
|
|
| BLAKE2b-256 |
4336a28c7bf60dd969699c0f2efb3410e88aad601b93073ffe78a18c5ff34fa8
|