|
Project Preview This is a Model Context Protocol server for knowledge graphs designed around neurodivergent thinking patterns. This TypeScript-based MCP server implements a memory system inspired by neurodivergent cognitive styles. It organizes thoughts into five districts (knowledge domains), ranks search results using BM25 semantic ranking, and stores memories as a persistent knowledge graph with bidirectional connections. |
flowchart LR
A[Client MCP Request] --> B[MCP Server Stdio Transport]
B --> C{Request Type}
C -->|Tools| D[Tool Handler]
C -->|Resources| E[Resource Handler]
C -->|Prompts| F[Prompt Handler]
D --> G[NeurodivergentMemory Core]
E --> G
F --> G
G --> H[Memory Graph Store]
G --> I[BM25 Index]
H --> J[Persisted JSON Snapshot]
D --> K[MCP JSON Response]
E --> K
F --> K
K --> A
Flow notes:
- Memory operations update both graph state and BM25 index.
- Persistence writes to the local snapshot file for restart continuity.
- All MCP responses return through stdio transport.
Memories are organized by cognitive domain:
- logical_analysis β Structured thinking, problem solving, and analytical processes
- emotional_processing β Feelings, emotional responses, and affective states
- practical_execution β Action-oriented thoughts, tasks, and implementation
- vigilant_monitoring β Awareness, safety concerns, and protective thinking
- creative_synthesis β Novel connections, creative insights, and innovative thinking
- Explore memory districts and individual memories via
memory://URIs - Each memory includes content, tags, emotional metadata, and connection information
- Access memories as JSON resources with full metadata
store_memoryβ Create new memory nodes with optional emotional valence and intensityretrieve_memoryβ Fetch a specific memory by ID and increment access countupdate_memoryβ Modify content, tags, district, emotional_valence, or intensitydelete_memoryβ Remove a memory and all its connectionsconnect_memoriesβ Create bidirectional edges between memory nodessearch_memoriesβ BM25-ranked semantic search with optional filters (district, tags, emotional valence, intensity, min_score)traverse_fromβ Graph traversal up to N hops from a starting memoryrelated_toβ Find memories by graph proximity + BM25 semantic blendlist_memoriesβ Paginated listing with optional district/archetype filtersmemory_statsβ Aggregate statistics (totals, per-district counts, most-accessed, orphans)import_memoriesβ Bulk-seed memories from JSON array
explore_memory_cityβ Guided exploration of districts and memory organizationsynthesize_memoriesβ Create new insights by connecting existing memories
Each memory is assigned an archetype tied to its district:
- scholar β logical_analysis
- merchant β practical_execution
- mystic β emotional_processing and creative_synthesis
- guard β vigilant_monitoring
Search uses Okapi BM25 ranking (k1=1.5, b=0.75) without requiring embeddings or cloud calls. Results are normalized to 0β1 score range.
Each memory can optionally carry:
- emotional_valence (-1 to 1) β Emotional charge or affective tone
- intensity (0β1) β Mental energy or importance weight
Memories are automatically persisted to ~/.neurodivergent-memory/memories.json on every write. The graph is restored on server startup.
- GitHub Actions runs on Node.js 20 LTS for CI and release automation
- npm publishes use OIDC provenance with
npm publish --provenance --access public - Docker images are built with Buildx, published to Docker Hub, and emitted with SBOM and provenance metadata
- GitHub Actions generates artifact attestations for the npm tarball and the pushed container image digest
- Tagged releases upload the npm tarball, checksums, and attestation bundles as release assets
Install dependencies:
npm installBuild the server:
npm run buildFor development with auto-rebuild:
npm run watchTo use with Claude Desktop, add the server config:
On MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"neurodivergent-memory": {
"command": "/path/to/neurodivergent-memory/build/index.js"
}
}
}You can also run the packaged server image directly:
docker run --rm -i twgbellok/neurodivergent-memory:latestSince MCP servers communicate over stdio, debugging can be challenging. We recommend using the MCP Inspector, which is available as a package script:
npm run inspectorThe Inspector will provide a URL to access debugging tools in your browser.