ryaker/KMSmcp
If you are the rightful owner of KMSmcp 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 Unified KMS MCP Server is a next-generation Knowledge Management System that intelligently routes knowledge to optimal storage systems with sub-100ms FACT caching.
Unified KMS MCP Server
A next-generation Knowledge Management System MCP server that intelligently routes knowledge to optimal storage systems with sub-100ms FACT caching.
π§ What is unified_store
?
The unified_store
tool is the brain of the system that automatically decides where to store each piece of knowledge:
How It Works:
-
Content Analysis: AI analyzes text patterns:
"Client prefers morning sessions"
β Mem0 (memory pattern)"Reframing technique effective for anxiety"
β Neo4j (relationship/insight)"Session config: duration 60min"
β MongoDB (structured data)
-
Storage Decision: Returns intelligent routing:
{ "primary": "mem0", "secondary": ["mongodb"], "reasoning": "Memory patterns optimize for Mem0 semantic search", "cacheStrategy": "L1" }
-
Multi-System Storage: Stores in primary + secondary for redundancy
-
FACT Caching: Caches based on importance (richard_yaker = L1, coaching = L2, general = L3)
π Features
- π§ Intelligent Storage Routing: AI decides optimal storage system
- β‘ FACT Caching: 3-layer cache for sub-100ms responses
- π Cross-System Linking: Automatic data relationships
- π― Unified API: 6 powerful tools instead of separate servers
- π Analytics: Comprehensive performance monitoring
- π‘οΈ Error Resilience: Graceful degradation when systems are offline
- π Remote MCP Support: HTTP/SSE transport for remote access
- π OAuth 2.1 Authentication: Secure access with JWT and token introspection
- π¦ Rate Limiting & CORS: Production-ready security features
ποΈ Architecture
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Mem0 Storage β β Neo4j Storage β β MongoDB Storage β
β (Memories) β β (Relationships) β β (Structured) β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β β β
βββββββββββββββββββββββββΌββββββββββββββββββββββββ
β
βββββββββββββββββββββββ
β Intelligent Router β
β (Pattern Matching) β
βββββββββββββββββββββββ
β
βββββββββββββββββββββββ
β FACT Cache β
β L1βL2βL3βDatabase β
βββββββββββββββββββββββ
β
βββββββββββββββββββββββ
β Unified MCP API β
β 6 Tools β
βββββββββββββββββββββββ
π Prerequisites
This unified KMS requires four cloud services for optimal performance. We recommend using managed services (PAAS) for reliability and scalability:
π§ Mem0 - AI Memory Layer
What it does: Semantic memory storage with natural language understanding
Get it: Sign up at Mem0 - Free tier available
Need: API key from your dashboard
πΈοΈ Neo4j - Knowledge Graph
What it does: Stores relationships between concepts and insights
Get it: Neo4j Aura (Cloud) - Free tier with 50k nodes
Need: Connection URI, username, password
ποΈ MongoDB - Structured Data
What it does: Document storage for structured data and configurations
Get it: MongoDB Atlas - Free 512MB cluster
Need: Connection string (mongodb+srv://...)
β‘ Redis - L2 Cache (Optional)
What it does: Fast caching layer for sub-100ms responses
Get it: Redis Cloud or Upstash - Free tiers available
Need: Connection URI (redis://... or rediss://...)
π‘ Pro Tip: All these services offer generous free tiers perfect for getting started. You can upgrade as your knowledge base grows!
π οΈ Installation
# Clone and install
cd /Volumes/Dev/localDev/KMSmcp
npm install
# Configure environment
cp .env.example .env
# Edit .env with your service credentials (see Prerequisites above)
# Build
npm run build
# Development
npm run dev
# Production
npm start
π§ Configuration
Client Configuration
Claude Code
Add to your Claude Code configuration:
{
"mcpServers": {
"personal-kms": {
"type": "http",
"url": "https://your-kms-server.com/mcp"
}
}
}
Claude Desktop
- Go to Settings β MCP Connectors
- Click "Add custom connector"
- Enter:
- Name:
personal-kms
- Remote MCP server URL:
https://your-kms-server.com/mcp
- Name:
- Click "Add"
Transport Modes
The server supports three transport modes:
1. STDIO Mode (Default)
Traditional MCP for local use with Claude Desktop:
TRANSPORT_MODE=stdio
2. HTTP Mode
Remote MCP server accessible via HTTP/REST:
TRANSPORT_MODE=http
HTTP_PORT=3001
HTTP_HOST=0.0.0.0
3. Dual Mode
Both STDIO and HTTP simultaneously:
TRANSPORT_MODE=dual
HTTP_PORT=3001
HTTP_HOST=0.0.0.0
OAuth 2.1 Authentication
For secure remote access, enable OAuth 2.1:
# Enable OAuth
OAUTH_ENABLED=true
OAUTH_ISSUER=https://your-auth-server.com
OAUTH_AUDIENCE=https://your-mcp-server.com
# Token validation (choose one)
OAUTH_JWKS_URI=https://your-auth-server.com/.well-known/jwks.json
# OR
OAUTH_TOKEN_INTROSPECTION_ENDPOINT=https://your-auth-server.com/oauth/introspect
# Optional: Client credentials for introspection
OAUTH_CLIENT_ID=your-client-id
OAUTH_CLIENT_SECRET=your-client-secret
Required Environment Variables
Core Configuration:
MEM0_API_KEY
: Your Mem0 API key (required)MONGODB_URI
: MongoDB connection stringNEO4J_URI
,NEO4J_USERNAME
,NEO4J_PASSWORD
: Neo4j credentialsREDIS_URI
: Redis connection for L2 cache
HTTP Transport (if enabled):
HTTP_PORT
: Server port (default: 3001)HTTP_HOST
: Bind address (default: 0.0.0.0)
OAuth (if enabled):
OAUTH_ISSUER
: Authorization server URLOAUTH_AUDIENCE
: MCP server resource identifier
π― Tools Available
1. unified_store
- Intelligent Storage
{
"name": "unified_store",
"params": {
"content": "Client responds well to morning meditation sessions",
"contentType": "memory",
"source": "coaching",
"userId": "client_123",
"confidence": 0.9
}
}
2. unified_search
- Cross-System Search
{
"name": "unified_search",
"params": {
"query": "meditation techniques anxiety",
"filters": {
"contentType": ["insight", "memory"],
"minConfidence": 0.7
},
"options": {
"maxResults": 10,
"cacheStrategy": "conservative"
}
}
}
3. get_storage_recommendation
- Routing Preview
{
"name": "get_storage_recommendation",
"params": {
"content": "Bug fix: authentication middleware timeout issue"
}
}
4. get_kms_analytics
- Performance Metrics
{
"name": "get_kms_analytics",
"params": {
"timeRange": "24h",
"includeCache": true
}
}
5. cache_invalidate
- Cache Management
{
"name": "cache_invalidate",
"params": {
"pattern": "user:richard_yaker",
"level": "all"
}
}
6. test_routing
- Routing Tests
{
"name": "test_routing",
"params": {
"runTests": true
}
}
π― Migration from Current Setup
Phase 1: Deploy Alongside
- Deploy unified server alongside existing MCP servers
- Start using unified tools for new knowledge
- Existing data remains accessible
Phase 2: Data Migration
- Use built-in sync tools to migrate existing data
- Validate data integrity across systems
- Test performance improvements
Phase 3: Full Transition
- Retire individual MCP servers
- Optimize cache settings
- Enable cross-coach learning features
π Performance Targets
- β Sub-100ms responses via FACT caching
- β Intelligent routing based on content analysis
- β Cross-system redundancy for data safety
- β Graceful degradation when systems are offline
- β Real-time analytics for optimization
π HTTP Endpoints (Remote MCP)
When HTTP transport is enabled, the server exposes these endpoints:
Core Endpoints
POST /mcp
- MCP JSON-RPC endpointGET /mcp/events
- Server-Sent Events for real-time updatesGET /health
- Health check endpoint
OAuth Discovery (if enabled)
GET /.well-known/oauth-protected-resource
- OAuth resource metadata
Example HTTP Usage
# Health check
curl http://localhost:3001/health
# MCP request (with OAuth)
curl -X POST http://localhost:3001/mcp \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "tools/list",
"id": 1
}'
# Tool call
curl -X POST http://localhost:3001/mcp \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "unified_store",
"arguments": {
"content": "Client responds well to morning meditation sessions",
"contentType": "memory",
"source": "coaching"
}
},
"id": 2
}'
π§ͺ Testing
Run the comprehensive test suite:
# Install dependencies
npm install
# Run unit tests
npm test
# Run tests with coverage
npm run test:coverage
# Run specific test suites
npm test -- --testPathPattern=OAuth2Authenticator
npm test -- --testPathPattern=HttpTransport
π Example Usage
// Store a coaching insight
const result = await unified_store({
content: "Client shows 40% improvement with morning routine consistency",
contentType: "insight",
source: "coaching",
coachId: "sophia",
confidence: 0.85
});
// Search across all systems
const results = await unified_search({
query: "morning routine effectiveness",
filters: { contentType: ["insight", "pattern"] },
options: { cacheStrategy: "aggressive" }
});
// Get storage recommendation
const recommendation = await get_storage_recommendation({
content: "User authentication session expired"
});
π This is Your Competitive Moat
The unified KMS creates intelligent, learning coaching systems that:
- Remember everything about each client
- Discover effective techniques automatically
- Share insights across coaches
- Respond in sub-100ms
- Continuously improve from every interaction
Your AI coaches become extensions of human expertise that grow smarter over time! π§ β¨
π License
MIT - Build amazing coaching platforms!