angrysky56/kng-mcp-server
If you are the rightful owner of kng-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The KNG MCP Server is a temporal narrative memory service for AI systems based on the Random Tree Model (RTM).
kng_create_book
Create a new temporal book from a saved graph.
kng_get_library_shelves
Get all library shelves organized by category.
kng_get_books_on_shelf
Get all books on a specific shelf.
kng_search_books
Search for books by query and tags.
kng_get_book
Get a specific book by ID.
kng_update_book
Update a book when its underlying graph changes.
kng_delete_book
Safely delete a book while preserving themes.
kng_get_library_stats
Get library statistics for monitoring.
KNG MCP Server
Knowledge-Narrative-Graph MCP Server - A temporal narrative memory service for AI systems based on the Random Tree Model (RTM).
Overview
The KNG MCP Server implements a sophisticated memory organization system inspired by human memory hierarchies. It organizes information into temporal "books" and "shelves" that compress and preserve knowledge across different time scales (minute → hour → day → week → month → year).
Key Features
- Temporal Hierarchies: Information is organized across multiple time scales with intelligent compression
- Persistent Themes: Important concepts and narratives persist across time boundaries
- Smart Organization: Automatic categorization into active, recent, archived, and reference shelves
- Graph-Based Storage: Built on knowledge graphs with rich node and edge relationships
- MCP Integration: Exposed as Model Context Protocol tools for seamless AI integration
Architecture
The service is built on three core concepts:
- Books: Temporal containers that hold related knowledge graphs organized by time
- Shelves: Categories that organize books by their temporal relevance and purpose
- Persistent Themes: Key concepts that carry forward through time boundaries
Available MCP Tools
kng_create_book
- Create a new temporal book from a saved graphkng_get_library_shelves
- Get all library shelves organized by categorykng_get_books_on_shelf
- Get all books on a specific shelfkng_search_books
- Search for books by query and tagskng_get_book
- Get a specific book by IDkng_update_book
- Update a book when its underlying graph changeskng_delete_book
- Safely delete a book while preserving themeskng_get_library_stats
- Get library statistics for monitoring
Installation
# Install dependencies
npm install
# Build the server
npm run build
# Run in development mode
npm run dev
# Start the server
npm start
Usage
As an MCP Server
The server runs as a stdio-based MCP server. Configure your MCP client to connect to it:
{
"kng-mcp-server": {
"command": "node",
"args": ["path/to/kng-mcp-server/dist/stdio.js"],
"transport": "stdio"
}
}
Creating a Book
// Example graph structure
const graph = {
metadata: {
id: "graph-001",
title: "AI Research Notes",
description: "Research on temporal memory systems",
tags: ["research", "memory", "AI"],
created: new Date(),
modified: new Date(),
version: "1.0"
},
nodes: new Map([
["node1", { id: "node1", label: "RTM Model", type: "concept" }],
["node2", { id: "node2", label: "Temporal Compression", type: "theme" }]
]),
edges: new Map([
["edge1", { id: "edge1", source: "node1", target: "node2", label: "implements" }]
])
};
// Create book with 'day' time scale
const result = await kng_create_book({
graph: graph,
timeScale: "day"
});
Configuration
The service uses RTM-inspired parameters:
- maxBranchingFactor: Maximum children per temporal node (default: 4)
- maxNarrativeDepth: Maximum temporal hierarchy depth (default: 6)
- compressionTargets: Target compression ratios per time scale
- continuityRules: Rules for determining what persists across time boundaries
Memory Organization
Shelf Categories
- Active: Currently developing stories and themes (< 1 day old)
- Recent: Recently completed narratives (1-7 days old)
- Reference: Persistent themes that span long periods
- Archived: Older narratives preserved for reference (> 30 days)
Temporal Scales
- Minute: No compression, full detail
- Hour: Slight compression (1.2x)
- Day: Moderate compression (2x)
- Week: Significant compression (4x)
- Month: High compression (8x)
- Year: Maximum compression (16x)
Development
# Type checking
npm run type-check
# Build
npm run build
# Development with hot reload
npm run dev
Integration with Aura Framework
This MCP server is designed to integrate with the Aura AI framework, providing:
- Enhanced search capabilities through structured narratives
- Deeper emotional context via persistent themes
- Enriched user profiles with long-term memory
- Automated memory organization with intelligent archiving
License
MIT
Contributing
Contributions are welcome! Please ensure all TypeScript types are properly defined and follow the existing code structure.