Supports knowledge export in Markdown format for human-readable documentation of learned patterns, insights, and performance analytics
Click on "Install 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., "@MCP Self-Learning Serveranalyze my recent interactions and suggest optimizations"
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.
MCP Self-Learning Server
A sophisticated Model Context Protocol (MCP) server that autonomously learns from interactions, optimizes performance, and continuously improves its knowledge base through pattern recognition and machine learning techniques.
π Features
π§ Autonomous Learning Engine
Pattern Recognition: Automatically identifies and learns from interaction patterns
Feature Extraction: Analyzes tool sequences, context, performance metrics, and semantic embeddings
Confidence Scoring: Evaluates pattern reliability based on frequency, recency, and consistency
Memory Consolidation: Manages short-term and long-term pattern storage
π Knowledge Synchronization
Auto-sync: Every 60 seconds between MCP servers
Knowledge Export/Import: JSON and Markdown formats
Pattern Merging: With deduplication
Cross-server Learning: Through shared knowledge directory
π Self-Improvement Capabilities
Performance Optimization: Identifies redundancies and bottlenecks
Predictive Suggestions: Anticipates next actions based on learned patterns
Error Pattern Analysis: Learns from failures to improve success rates
Adaptive Recommendations: Generates context-aware optimizations
πΎ Data Persistence
Automatic Data Saving: Every 5 minutes with backup rotation
Learning Data Recovery: Loads previous sessions on startup
Export Knowledge: Multiple formats (JSON, Markdown)
Backup System: Automatic backup creation before saves
π Advanced Logging
Multi-level Logging: Debug, Info, Warn, Error with colors and emojis
File & Console Output: Simultaneous logging to both
Log Rotation: Prevents disk space issues
Performance Monitoring: Tool execution times and memory usage
Related MCP server: browser-mcp
π Quick Start
Prerequisites
Node.js 18+
npm or yarn
Installation
Clone/Download the Project
cd ~/saralegui-solutions-llc/shared/MCPSelfLearningServerInstall Dependencies
npm installConfigure Claude Desktop
Add to
~/.config/Claude/claude_desktop_config.json:{ "mcpServers": { "self-learning": { "command": "node", "args": ["/home/ben/saralegui-solutions-llc/shared/MCPSelfLearningServer/mcp-self-learning-server.js"], "env": { "NODE_ENV": "production", "LEARNING_MODE": "autonomous" } } } }Start the Server
npm start
π Available Commands
Development & Testing
npm run dev # Start in development mode
npm run debug # Start with debug logging
npm test # Run all tests
npm run test:unit # Run unit tests only
npm run test:integration # Run integration tests onlyMonitoring & Health
npm run health # Run comprehensive health check
npm run monitor # Real-time monitoring
npm run monitor:details # Detailed monitoring with change trackingManual Operations
# Health check
node tools/health-check.js
# Real-time monitoring
node tools/monitor.js [--interval 5] [--details]
# Start server directly
node mcp-self-learning-server.jsπ οΈ Available MCP Tools
Core Learning Tools
analyze_pattern
Analyze and learn from interaction patterns
{
"interaction": {
"type": "tool_usage",
"input": "user input",
"output": "tool output",
"context": {},
"performance": { "duration": 100 },
"success": true
}
}get_insights
Get current learning analytics and insights
{}trigger_learning
Manually trigger a learning cycle
{}Knowledge Management
export_knowledge
Export learned knowledge to file
{
"format": "json|markdown" // Optional, defaults to json
}import_knowledge
Import knowledge from external source
{
"source": "file_path_or_url",
"format": "json" // Optional
}Performance & Optimization
optimize_tool
Get optimization suggestions for specific tools
{
"tool_name": "example_tool" // Optional
}predict_next_action
Get predictive suggestions based on current context
{
"context": {
"current_tool": "analyze_pattern",
"user_intent": "optimization"
}
}get_performance_metrics
Get detailed performance analytics
{
"tool_name": "specific_tool" // Optional, for tool-specific metrics
}π Monitoring & Analytics
Health Check Results
The health check tool verifies:
β Server startup functionality
β Data persistence system
β Logging system
β Performance metrics (startup time)
Real-time Monitoring
The monitor displays:
Learning engine status (patterns, knowledge, cycles)
Log file metrics and activity
System resource usage
Change indicators showing growth over time
Performance Expectations
Metric | Target | Excellent |
Startup Time | <5s | <1s |
Memory Usage | <100MB | <50MB |
Response Time | <500ms | <100ms |
Learning Accuracy | >70% | >90% |
ποΈ Directory Structure
MCPSelfLearningServer/
βββ mcp-self-learning-server.js # Main server file
βββ package.json # Dependencies and scripts
βββ README.md # This file
βββ data/ # Persistent learning data
β βββ learning-engine.json # Main learning data
β βββ learning-engine.backup.json # Backup
βββ logs/ # Server logs
β βββ mcp-server.log # Main log file
βββ lib/ # Shared libraries
β βββ logger.js # Enhanced logging system
βββ test/ # Test suites
β βββ unit/ # Unit tests
β βββ integration/ # Integration tests
βββ tools/ # Development tools
βββ health-check.js # Health check tool
βββ monitor.js # Real-time monitoringπ§ Configuration
Environment Variables
Variable | Default | Description |
|
| Environment mode |
|
| Logging level (debug/info/warn/error) |
|
| Enable console logging |
|
| Enable file logging |
|
| Learning behavior mode |
Learning Engine Settings
Max Memory Size: 1000 patterns in memory
Auto-save Interval: 5 minutes
Pattern Confidence Threshold: 0.5
Learning Trigger: Every 100 interactions or 50 tool uses
π¨ Troubleshooting
Common Issues
Server Won't Start
Check Node.js version (18+ required)
Verify all dependencies installed:
npm installCheck file permissions
Data Not Persisting
Verify
data/directory permissionsCheck disk space
Review logs for errors:
tail -f logs/mcp-server.log
High Memory Usage
Run health check:
npm run healthCheck pattern count:
npm run monitorConsider reducing max memory size
Slow Performance
Enable performance logging:
npm run debugCheck system resources
Review learning cycle frequency
Log Analysis
# View recent logs
tail -f logs/mcp-server.log
# Search for errors
grep "ERROR" logs/mcp-server.log
# Count log levels
grep -c "INFO\|WARN\|ERROR" logs/mcp-server.logπ Expected Learning Outcomes
Immediate (0-100 interactions)
Basic pattern recognition active
Initial knowledge base building
Tool usage tracking enabled
Short-term (100-1000 interactions)
Pattern confidence scores stabilizing
First optimization recommendations
Predictive accuracy ~50%
Long-term (1000+ interactions)
Predictive accuracy >70%
Response time improvements ~30%
Comprehensive knowledge graph
Cross-server knowledge sharing
Self-documenting insights
π€ Integration with Claude
Once configured, the server provides these tools in Claude:
Pattern analysis for learning from conversations
Performance insights for optimization
Predictive suggestions for improved responses
Knowledge export for documentation
Real-time learning from every interaction
π License
ISC License
π Support
For issues or questions:
Run health check:
npm run healthCheck logs:
tail -f logs/mcp-server.logReview this documentation
Check server status:
npm run monitor
Built with β€οΈ for autonomous learning and continuous improvement
Resources
Looking for Admin?
Admins can modify the Dockerfile, update the server description, and track usage metrics. If you are the server author, to access the admin panel.