A Model Context Protocol (MCP) server that gives Claude Desktop long-term memory and knowledge graph reasoning capabilities. It analyzes conversations, extracts entities and relationships, builds a knowledge graph, and uses this structured knowledge to provide intelligent, context-aware answers.
This MCP server acts as an intelligent memory layer for AI assistants. Instead of each conversation starting from scratch, this server:
- Remembers key information from conversations
- Builds connections between people, topics, preferences, and facts
- Reasons over relationships using graph algorithms
- Enhances answers by providing structured context to Claude
Think of it as giving Claude a persistent brain that grows smarter over time.
- Persistent Storage: Key-value memory that persists across sessions (saved to
memory.json) - Categorization: Organize memories by category (preferences, facts, etc.)
- Confidence Scoring: Track the reliability of stored information
- Entity Extraction: Automatically identifies people, topics, preferences, facts, and events from conversations
- Relationship Mapping: Discovers connections between entities (who likes what, who knows whom, etc.)
- Graph Analysis: Finds clusters, paths, most connected entities, and strongest relationships
- Context-Aware Queries: When you ask a question, the graph is analyzed and relevant insights are passed to Claude
- Intelligent Answers: Claude generates comprehensive answers using both your question AND the knowledge graph context
- Transcript Analysis: Parse PDF transcripts and extract conversations for analysis
- Flexible Input: Works with various transcript formats
- Node.js 18+
- npm or yarn
- (Optional) Anthropic API key for LLM-enhanced features
# Clone the repository
git clone https://github.com/yourusername/claude-hackathon.git
cd claude-hackathon
# Install dependencies
npm install
# Build the project
npm run build
# (Optional) Set up Anthropic API key for enhanced LLM features
export ANTHROPIC_API_KEY=your_api_key_here# Test the graph reasoning system
npm run test:analysis
# Test the memory manager
npm run test
# Development mode with auto-reload
npm run devAdd this server to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"graph-memory": {
"command": "node",
"args": ["/absolute/path/to/claude-hackathon/build/index.js"],
"env": {
"ANTHROPIC_API_KEY": "your_api_key_here"
}
}
}
}Then restart Claude Desktop.
| Tool | Description | Parameters |
|---|---|---|
store_memory |
Save a memory with key, value, category, and confidence | key (string), value (any), category (string), confidence (0.0-1.0) |
retrieve_memory |
Search memories by query | query (string) |
forget_memory |
Delete a specific memory | key (string) |
| Tool | Description | Parameters |
|---|---|---|
generate_sample_data |
Generate sample conversations for testing | count (1-5, default: 3) |
analyze_conversation |
Extract entities and relationships, build knowledge graph | conversationId (string) |
query_insights |
Ask questions with graph-enhanced LLM answers | question (string), useGraph (boolean) |
get_graph |
Export the knowledge graph | format ("full" or "summary") |
Here's how to use the graph reasoning system in Claude Desktop:
"Generate 3 sample conversations"
"Analyze conv_1, conv_2, and conv_3"
"What are Sarah's main interests?"
"Who does Sarah work with?"
"What technologies does Sarah like vs dislike?"
The system will:
- Analyze the knowledge graph for relevant entities
- Extract insights about connections and preferences
- Provide these insights as context to Claude
- Generate a comprehensive answer
ββββββββββββββββββββββββ
β User Conversation β
ββββββββββββ¬ββββββββββββ
βΌ
ββββββββββββββββββββββββ
β Entity Extraction β βββ People, Topics, Preferences, Facts, Events
ββββββββββββ¬ββββββββββββ
βΌ
ββββββββββββββββββββββββ
β Relationship Mapping β βββ likes, dislikes, knows, mentions, related_to
ββββββββββββ¬ββββββββββββ
βΌ
ββββββββββββββββββββββββ
β Knowledge Graph β βββ Nodes (entities) + Edges (relationships)
ββββββββββββ¬ββββββββββββ
βΌ
ββββββββββββββββββββββββ
β Graph Analysis β βββ Clusters, Paths, Centrality, Weights
ββββββββββββ¬ββββββββββββ
βΌ
ββββββββββββββββββββββββ
β LLM Enhancement β βββ Graph insights provide context for Claude
ββββββββββββ¬ββββββββββββ
βΌ
ββββββββββββββββββββββββ
β Intelligent Response β
ββββββββββββββββββββββββ
This MCP server can be adapted for numerous powerful applications:
- Remember user preferences, past discussions, and context
- Provide personalized recommendations based on historical interactions
- Never ask the same questions twice
- Build knowledge graphs from support tickets and customer conversations
- Identify common issues and their solutions
- Provide agents with relevant context from past interactions
- Analyze research papers, notes, or transcripts
- Build concept maps showing how ideas connect
- Answer questions using accumulated knowledge
- Analyze Slack/Teams conversations
- Map who knows what and who works with whom
- Identify knowledge silos and experts in specific domains
- Parse meeting transcripts (including PDFs)
- Extract action items, decisions, and key topics
- Build a searchable knowledge base of organizational decisions
- Analyze user interview transcripts
- Extract themes, pain points, and feature requests
- Visualize relationships between user needs and product features
- Track user interests and preferences over time
- Build preference graphs for personalized recommendations
- Understand why users like certain content based on connected concepts
- Analyze discussions in PRs, issues, and documentation
- Map relationships between contributors, features, and components
- Answer questions about project history and decisions
claude-hackathon/
βββ src/
β βββ index.ts # MCP server with all tool implementations
β βββ analyzer.ts # Entity extraction & relationship mapping
β βββ graph.ts # Knowledge graph data structure & algorithms
β βββ llm.ts # Anthropic Claude API client
β βββ memory.ts # Persistent key-value memory storage
β βββ pdf-parser.ts # PDF transcript parsing
β βββ sample-data.ts # Sample conversation generator
β βββ types.ts # TypeScript type definitions
βββ build/ # Compiled JavaScript (generated)
βββ USAGE_GUIDE.md # Quick start guide
βββ TERMINAL_USAGE.md # Terminal integration docs
βββ README.md # This file
| File | Purpose |
|---|---|
index.ts |
Main MCP server that exposes all tools and handles requests |
analyzer.ts |
Pattern matching to extract entities (people, topics, preferences) and relationships |
graph.ts |
Graph data structure with algorithms for clustering, path finding, centrality analysis |
llm.ts |
Anthropic SDK integration for enhanced query answering |
memory.ts |
Simple persistent memory storage with file-based persistence |
pdf-parser.ts |
Parses PDF transcripts into conversation format for analysis |
types.ts |
TypeScript interfaces for Memory, Node, Edge, Conversation, etc. |
# Run all graph reasoning tests
npm run test:analysis
# Run memory manager tests
npm run test
# Build the project
npm run build| Variable | Description | Required |
|---|---|---|
ANTHROPIC_API_KEY |
Anthropic API key for LLM features | Optional (enhances query_insights) |
Without an API key, the query_insights tool will return graph insights but cannot generate LLM-powered answers.
ISC
Contributions are welcome! Areas for improvement:
- Enhanced NLP: Replace pattern matching with proper NER/NLP models
- Graph Persistence: Save and load the knowledge graph across sessions
- Visualization: Add graph visualization tools
- More Data Sources: Support for more transcript and document formats
- Advanced Algorithms: PageRank, community detection, temporal analysis
- Model Context Protocol (MCP) - The protocol this server implements
- Claude Desktop - AI assistant that can use this server
- Anthropic API - API documentation for LLM features