personal-kg-mcp
Integration with GitHub to capture decision context from issues, pull requests, and MCP tool calls, enabling traceability and auditability for development workflows.
Integration with Notion to capture context from MCP tool calls, preserving decision reasoning and knowledge from project management activities.
Integration with Obsidian to capture context from MCP tool calls, preserving decision reasoning and knowledge from note-taking activities.
Integration with OpenAI's API for generating semantic embeddings of captured knowledge, enabling semantic search and context retrieval.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@personal-kg-mcp show me the reasoning behind the last architecture decision"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Decision intelligence for multi-agent workflows
⸻
🚨 The Problem: Context Evaporates
Multi-agent development is fast—but context gets lost at every handoff: • Planning sessions → compressed into short GitHub issues • Architecture debates → collapsed into one-line directives in Cursor • Implementation agents → see what to do, not why
Result: Tasks move quickly, but decisions lose their reasoning. Context exists somewhere—it just doesn't travel.
⸻
✅ The Solution: Auto-Captured Decision Context
Personal KG preserves the "why" behind every decision—automatically, without extra work.
Captured context includes: • Full reasoning chains • Alternatives considered + rejected • Constraints & trade-offs that shaped choices • Idea evolution across planning sessions • Nuanced context beyond specs
⸻
🔁 The Learning Loop
Personal KG isn't just storage—it's a continuous improvement engine: • Accountability → Every directive is traceable to its reasoning • Auditability → Agent actions are explainable and reviewable • Reflection & Analysis → See what worked, what failed, and improve continuously
⸻
🌊 Impact: From Compressed Tasks to Full Context
Before Personal KG • Stripped-down tasks • Fragmented context • Agents move fast but blind
After Personal KG • Tasks + reasoning, constraints, and alternatives • Rich context flows seamlessly across tools • Agents move fast with full understanding
⸻
👉 Personal KG = Never lose the why. Capture it once, use it everywhere.
Installation
NPM Package
The Personal KG MCP server is available as an NPM package:
npm install @tomschell/personal-kg-mcpMCP Configuration
Configure MCP Server in
.cursor/mcp.jsonor your MCP client configuration:
{
"mcpServers": {
"personal-kg-mcp": {
"command": "node",
"args": [
"node_modules/@tomschell/personal-kg-mcp/dist/server.js"
],
"cwd": "/path/to/your/project",
"env": {
"PKG_STORAGE_DIR": ".kg",
"PKG_AUTO_BACKUP_MINUTES": "0",
"PKG_USE_ANN": "true",
"PKG_GITHUB_INTEGRATION_ENABLED": "true",
"PKG_MCP_CAPTURE_ENABLED": "true",
"PKG_MCP_CAPTURE_TOOLS": "github",
"PKG_MCP_CAPTURE_EXCLUDE": "",
"PKG_MCP_CAPTURE_AUTO": "true"
}
}
}
}Set up GitHub Integration (optional):
Create a GitHub Personal Access Token
Add to
.envfile:PKG_GITHUB_TOKEN=github_pat_your_token_hereOr set as environment variable
Restart your MCP client (Cursor, Claude Desktop, etc.)
⚠️ Important: MCP servers are only loaded at session startup. After adding or modifying the MCP configuration, you must restart your Claude Code, Cursor, or Claude Desktop session for the tools to become available. Simply saving the config file is not enough.
Configuration Options
Environment Variable | Default | Description |
|
| Directory for storing knowledge graph data |
|
| Auto-backup interval (0 = disabled) |
|
| Use approximate nearest neighbor search |
|
| Enable GitHub issue/PR integration |
|
| Auto-capture MCP tool calls |
|
| Tools to capture (comma-separated) |
|
| Tools to exclude (comma-separated) |
|
| Auto-capture without explicit calls |
| - | OpenAI API key for semantic embeddings |
|
| OpenAI embedding model |
Environment Setup
For a complete list of environment variables, see .env.example.
Setup Options:
Conductor Workspaces (recommended for 1Password users):
./scripts/setup-conductor.shThis creates symlinks to your 1Password-managed environment files.
Manual Setup:
cp .env.example .env # Edit .env with your valuesMCP Config: Add environment variables directly to your MCP configuration (see above).
Related MCP server: VibeTape MCP Server
Quick Start
npm install @tomschell/personal-kg-mcp
Installation
Configure MCP Server in
.cursor/mcp.json:
{
"mcpServers": {
"personal-kg-mcp": {
"command": "node",
"args": [
"node_modules/@tomschell/personal-kg-mcp/dist/server.js"
],
"cwd": "/path/to/your/project",
"env": {
"PKG_STORAGE_DIR": ".kg",
"PKG_AUTO_BACKUP_MINUTES": "0",
"PKG_USE_ANN": "true",
"PKG_GITHUB_INTEGRATION_ENABLED": "true",
"PKG_MCP_CAPTURE_ENABLED": "true",
"PKG_MCP_CAPTURE_TOOLS": "github",
"PKG_MCP_CAPTURE_EXCLUDE": "",
"PKG_MCP_CAPTURE_AUTO": "true"
}
}
}
}Set up GitHub Integration (optional):
Create a GitHub Personal Access Token
Add to
.envfile:PKG_GITHUB_TOKEN=github_pat_your_token_hereOr set as environment variable
Restart your MCP client (Cursor, Claude Desktop, etc.)
Basic Usage
Start with these essential tools:
Purpose | Tool |
Session warmup |
|
Capture decisions/progress |
|
Session summaries |
|
Search |
|
Project overview |
|
Get context |
|
Track questions |
|
Link nodes |
|
Configuration
The Personal KG MCP server is configured through environment variables set in .cursor/mcp.json.
Storage Configuration
PKG_STORAGE_DIR
Description: Directory path for Personal KG storage
Default:
.kgExample:
"PKG_STORAGE_DIR": "data/knowledge/personal"
GitHub Integration
PKG_GITHUB_INTEGRATION_ENABLED
Description: Enable/disable GitHub integration in session warmup
Default:
false(disabled by default for security)Values:
"true"or"false"Note: Requires
PKG_GITHUB_TOKENto be set to actually enable
PKG_GITHUB_TOKEN
Description: GitHub Personal Access Token for Personal KG integration
Default: Not set
Security: Store in
.envfile, not in version control
MCP Capture Configuration
PKG_MCP_CAPTURE_ENABLED
Description: Enable/disable automatic capture of MCP tool calls
Default:
true
PKG_MCP_CAPTURE_TOOLS
Description: Comma-separated list of MCP tool names to capture
Default:
"github"Example:
"PKG_MCP_CAPTURE_TOOLS": "obsidian,notion,github"
PKG_MCP_CAPTURE_EXCLUDE
Description: Comma-separated list of MCP tool names to exclude
Default:
""(empty)
PKG_MCP_CAPTURE_AUTO
Description: Enable automatic capture without explicit calls
Default:
"true"
Example Configuration
{
"mcpServers": {
"personal-kg-mcp": {
"command": "node",
"args": [
"node_modules/@tomschell/personal-kg-mcp/dist/server.js"
],
"cwd": "/path/to/your/project",
"env": {
"PKG_STORAGE_DIR": ".kg",
"PKG_AUTO_BACKUP_MINUTES": "0",
"PKG_USE_ANN": "true",
"PKG_GITHUB_INTEGRATION_ENABLED": "true",
"PKG_MCP_CAPTURE_ENABLED": "true",
"PKG_MCP_CAPTURE_TOOLS": "github",
"PKG_MCP_CAPTURE_EXCLUDE": "",
"PKG_MCP_CAPTURE_AUTO": "true"
}
}
}
}Usage Guide
Tag Conventions
Normalised tags:
proj:<name>,ws:<workstream>,ticket:<id>Examples:
proj:kgws:kg-devticket:78
Agent Training Reminders
Important for Developers: The kg_session_warmup tool includes an agentTrainingReminders field. These reminders are NOT user-facing documentation - they are designed to train AI agents on proper development workflows during coding sessions.
Purpose:
Train agents on commit frequency and git best practices
Guide agents to follow project workflow conventions
Improve agent behavior through consistent guidance
Ensure code quality and proper git usage
Who sees this:
AI agents during session warmup (embedded in context)
Developers reading the code
NOT end users browsing documentation
Users benefit from these reminders indirectly through improved agent behavior, not by reading them directly.
Proactive Behavior
Capture key moments with kg_capture (decisions, progress, insights, questions).
At session boundaries use kg_capture_session (include
next_actions[]).When resuming a topic call kg_get_relevant_context or kg_get_project_state.
Track open questions with kg_open_questions and resolve with kg_resolve_question.
Link entries with kg_edges (operation: "create", relation: "blocks" or "derived_from").
Core Tools
Capture
Tool | Args (required bold) | Notes |
kg_capture | content, type, tags?, project?, workstream?, ticket?, importance?, visibility?, includeGit?, auto_link?, sessionId? | Primary knowledge creation |
kg_capture_session | summary, duration?, artifacts?, next_actions[], visibility?, importance? | Session summaries |
kg_link_session | sessionId, nodeId | Link session to node |
kg_update_node | id, content?, tags?, importance?, visibility? | Update existing nodes |
Search & Retrieval
Tool | Args | Notes |
kg_search | query, mode∈text|semantic|time_range, tags?, type?, limit?, threshold? | Unified search |
kg_query_context | topic | Summarize topic-relevant nodes |
kg_get_relevant_context | query, project?, max_items?, include_questions? | Proactive context injection |
kg_get_project_state | project | Overview, blockers, decisions |
kg_session_warmup | project?, workstream?, limit?, discover? | Session context warmup |
kg_list_tags | prefix?, minCount?, limit? | List all tags with counts |
Node Operations
Tool | Args | Notes |
kg_node | operation∈get|delete|find_similar, id, deleteEdges?, limit?, threshold? | Unified node ops |
Relationships
Tool | Args | Notes |
kg_edges | operation∈create|list|maintain, fromNodeId?, toNodeId?, relation?, nodeId?, maintainOp? | Unified edge ops |
Question Tracking
Tool | Args | Notes |
kg_open_questions | project?, include_stale?, limit? | List unresolved questions |
kg_resolve_question | question_id, resolved_by_id, resolution_note? | Mark question resolved |
Admin & Maintenance
Tool | Args | Notes |
kg_admin | operation∈health|backup|validate|repair|export|import|rename_tag|merge_tags, ... | Unified admin ops |
Analysis
Tool | Args | Notes |
kg_analyze | operation∈clusters|emerging|path|graph_export, limit?, threshold?, startId?, endId? | Unified analysis ops |
Relationship Type Guide
Relation | When to use | Example |
references | Loose citation / mention | Session note references design doc |
relates_to | General topical overlap | Two progress nodes on same feature |
derived_from | Work or idea builds on another | Refactor derived_from original design decision |
blocks | Hard dependency ordering | Bug fix blocks release task |
duplicates | Identical or redundant content | Duplicate question captured twice |
Best-Practice Flow
Start / resume →
kg_session_warmup({ project: "my-project" })(discovery mode if no project)Before starting work →
kg_get_relevant_context({ query: "topic" })for backgroundDuring dev →
kg_capturedecisions, progress, insights, questionsTrack questions →
kg_open_questionsto see unresolved itemsLink related work →
kg_edges({ operation: "create", ... })End session →
kg_capture_sessionwith summary and next_actions
Claude Code Integration
Add these instructions to your project's CLAUDE.md to enable automatic knowledge graph usage:
## Knowledge Graph
This project uses personal-kg-mcp for decision tracking and context management.
### Session Start
- Run `kg_session_warmup` with project name at the start of each session
- Use discovery mode (no project) to see all available projects
### During Work
- Capture important decisions with `kg_capture` (type: "decision")
- Log progress on features with `kg_capture` (type: "progress")
- Record insights and learnings with `kg_capture` (type: "insight")
- Track open questions with `kg_capture` (type: "question")
### Context Retrieval
- Use `kg_get_relevant_context` before starting work on a topic
- Check `kg_open_questions` for unresolved items
- Use `kg_query_context` for topic summaries
### Session End
- Summarize work with `kg_capture_session`
- Include `next_actions` for continuityRecommended CLAUDE.md Snippet
For projects using personal-kg-mcp, add to your CLAUDE.md:
## Knowledge Graph
- **MCP Server**: personal-kg-mcp
- **Storage**: `.kg/` (gitignored)
- **Usage**: Capture decisions, track questions, maintain context across sessions
- **Session Start**: Always run `kg_session_warmup` with project name
- **Key Tools**: kg_capture, kg_session_warmup, kg_get_relevant_context, kg_open_questionsExamples
Session Warmup
{
"tool": "kg_session_warmup",
"args": { "project": "kg", "limit": 20 }
}Capture Progress
{
"tool": "kg_capture",
"args": {
"content": "Progress: added query tools for Issue 64",
"type": "progress",
"sessionId": "<sessionId>",
"tags": ["proj:kg", "ws:kg-dev", "ticket:64"],
"importance": "medium"
}
}Session Summary
{
"tool": "kg_capture_session",
"args": {
"summary": "Completed KG tool analysis and documentation updates",
"next_actions": ["Implement simplified system prompt", "Update .cursorrules"],
"artifacts": ["Issue #215", "Updated documentation"]
}
}Link Related Work
{
"tool": "kg_edges",
"args": {
"operation": "create",
"fromNodeId": "<decisionId>",
"toNodeId": "<taskId>",
"relation": "blocks"
}
}Get Context Before Starting
{
"tool": "kg_query_context",
"args": { "topic": "CI/CD pipeline improvements" }
}Consolidated Tools (v3.0)
Tools have been consolidated for easier use:
Tool | Operations | Description |
| clusters, emerging, path, graph_export | Analysis operations |
| health, backup, validate, repair, export, import, rename_tag, merge_tags | Admin/maintenance |
| create, list, maintain | Relationship management |
| get, delete, find_similar | Node operations |
| text, semantic, time_range | Unified search |
New Features
kg_open_questions- Track unresolved questions with staleness detectionkg_resolve_question- Mark questions as resolvedkg_get_relevant_context- Proactive context injection for queries
Development
Building
cd packages/personal-kg-mcp
npm install
npm run buildTesting
npm test
npm run test:unit
npm test -- config.test.ts --runDevelopment Mode
npm run devChangelog
[2.1.0] - 2025-08-16
Configuration System: Centralized configuration management via environment variables
GitHub Integration: Configurable GitHub integration with secure token handling
MCP Capture: Configurable automatic capture of MCP tool calls
Security: GitHub integration disabled by default, secure token storage recommendations
[2.0.0] - 2025-08-14
Modular Architecture: Refactored from monolithic 1,625-line server to modular structure
Core Tools Module: kg_health, kg_capture, kg_capture_session, kg_link_session
Search Tools Module: kg_list_recent, kg_search, kg_semantic_search, kg_find_similar, kg_query_time_range, kg_query_context
Relationship Tools Module: 10 relationship management tools
Maintenance Tools Module: 5 maintenance tools
Analysis Tools Module: 4 analysis tools
Project Tools Module: 3 project tools
Deprecated Tools Module: 6 deprecated tools
Comprehensive Documentation: Detailed architecture guide
GitHub Repository: Standalone repository at https://github.com/tomschell/personal-kg-mcp
CI/CD Pipeline: GitHub Actions for testing, building, and deployment
[1.0.0] - 2025-01-01
Initial Personal KG MCP server implementation
43 tools for knowledge graph management
File-based storage system
Vector similarity search
Relationship management
Session management
Project state tracking
License
MIT License - see LICENSE file for details.
Available Tools
17 toolskg_adminA
Unified admin tool for maintenance operations. Supports: 'health' for system status, 'backup' for data protection, 'validate' for integrity checks, 'repair' for fixing issues, 'export'/'import' for data migration, 'rename_tag'/'merge_tags' for tag management, 'migrate_embeddings' for backfilling OpenAI embeddings.
Inputs: operation (required), force, dryRun, newTag, +6 more.
kg_analyzeA
Unified analysis tool. Supports: 'clusters' for topic grouping, 'emerging' for trend detection, 'graph_export' for full export, 'path' for finding connections between nodes.
Inputs: operation (required), endId, limit, startId, +3 more.
kg_captureA
Primary tool for capturing knowledge nodes. Use this to record decisions, progress updates, insights, questions, and ideas. Automatically creates relationships, normalizes tags, and links to sessions. This is your main entry point for adding knowledge to the graph.
Inputs: content (required), tags, type, ticket, +8 more.
kg_capture_sessionA
Captures session summaries with structured metadata. Use at the end of work sessions to record what was accomplished, artifacts created, and next actions. Essential for maintaining context between sessions and tracking progress over time.
Inputs: summary (required), duration, artifacts, importance, +2 more.
kg_diagnosticA
Generate a diagnostic HTML dashboard for debugging knowledge graph context selection, search results, and node visibility. Opens in browser to help understand why certain nodes are included/excluded from context.
Inputs: project, output_path, open_browser.
kg_edgesA
Unified tool for relationship operations. Supports: 'create' to link nodes, 'list' to view relationships, 'maintain' for cleanup and rebuilding.
Inputs: operation (required), limit, nodeId, relation, +5 more.
kg_get_project_stateA
Provides a comprehensive overview of a project's current state including active focus areas, recent decisions, open questions, blockers, and completed tasks. Perfect for project status checks and planning.
Inputs: project (required).
kg_get_relevant_contextA
Retrieves relevant past context for a given query. Returns brief summaries of related decisions, insights, and open questions. Perfect for proactive context injection before starting work on a topic.
Inputs: query (required), project, max_items, include_questions.
kg_link_sessionA
Creates a relationship between a session node and another knowledge node. Use to explicitly link work items, decisions, or progress to a specific session for better organization.
Inputs: nodeId (required), sessionId (required).
kg_list_tagsA
Lists all tags in the knowledge graph with usage counts. Use to discover available tags, find inconsistencies, or identify commonly used categories.
Inputs: limit, prefix, minCount.
kg_nodeA
Unified tool for node operations. Supports three operations: 'get' to retrieve a node with its relationships, 'delete' to remove a node, 'find_similar' to find semantically similar nodes.
Inputs: id (required), operation (required), limit, threshold, +1 more.
kg_open_questionsA
Lists unresolved questions with aging information. Questions are considered 'stale' after 3 days. Use to track what needs follow-up and identify forgotten questions.
Inputs: limit, project, include_stale.
kg_query_contextA
Reconstructs context around a specific topic by analyzing related knowledge nodes. Use to understand the full context and background of a particular subject area.
Inputs: topic (required).
kg_resolve_questionA
Marks a question as resolved by linking it to a decision, insight, or other node that answers it. Creates a 'resolved_by' relationship.
Inputs: question_id (required), resolved_by_id (required), resolution_note.
kg_searchA
Unified search tool for finding knowledge nodes. Supports three modes: 'text' for keyword/tag filtering with ranking, 'semantic' for AI-powered meaning-based search, 'time_range' for date-based queries. Default mode is 'semantic' for best results.
Inputs: end, mode, tags, type, +9 more.
kg_session_warmupA
Start every session with this tool! Loads comprehensive context about your project including recent work, active questions, and blockers. Essential for maintaining continuity between work sessions.
Inputs: limit, compact, project, discover, +1 more.
kg_update_nodeA
Updates an existing knowledge node. Use to modify content, tags, importance, or visibility of a node. Supports partial updates - only specified fields are changed.
Inputs: id (required), tags, content, mergeTags, +4 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 17 tools
Most tools have clearly distinct purposes, but some overlap exists: kg_search, kg_query_context, and kg_get_relevant_context all retrieve information in different ways, and kg_capture vs kg_capture_session have similar names. The detailed descriptions help disambiguate, but an agent could still misselect between context retrieval tools.
All tools share the 'kg_' prefix, but the naming pattern is mixed: some are verb_noun (kg_list_tags, kg_update_node), some are bare verbs (kg_capture, kg_search), and some are noun-based unified tools (kg_edges, kg_admin, kg_node). This inconsistency makes the set feel less predictable, though the prefix provides a common thread.
With 17 tools, the server is slightly above the ideal range of 3-15, but the count is reasonable for a personal knowledge graph managing nodes, relationships, sessions, questions, and admin operations. The tools collectively cover a broad domain without being excessive.
The tool surface covers the full lifecycle: creation (kg_capture), retrieval (kg_search, kg_node get), update (kg_update_node), deletion (kg_node delete), plus relationship management, session handling, question tracking, project state, admin, and diagnostics. No obvious gaps prevent an agent from performing core knowledge graph operations.
Maintenance
Related MCP Connectors
Persistent engineering memory designed to follow developers across coding agents.
Decision memory for AI agents: record, revisit, and resolve consequential choices.
Shared memory for teams: every AI agent works from your company's knowledge, decisions and history.
Persistent memory and knowledge graphs for AI agents. Hybrid search, context checkpoints, and more.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides observability for multi-agent workflows by tracking hierarchical task structure, architectural decisions, reasoning, encountered problems, code modifications with Git diffs, and temporal metrics.44 npmMIT
- AlicenseCqualityDmaintenanceCaptures key development moments, enables multi-agent traceability, provides intelligent context curation, and facilitates seamless agent-to-agent handoffs.2917MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to log, evaluate, and ground consequential decisions against an organization's authority graph, creating a traceable audit trail for governance.1MIT
- AlicenseNot gradedqualityCmaintenanceCaptures AI agent runs and turns them into tamper-evident execution records showing tool use, timing, failures, recoveries, and human interventions. Records can be inspected, exported, and verified offline.MIT