A Model Context Protocol (MCP) server that learns and emulates your personality, thinking patterns, communication style, goals, and preferences. This server enables AI agents to understand and respond as if they were you, making interactions more personalized and authentic.
- Personality Learning: Analyzes your communication patterns, preferences, and decision-making style
- Goal Management: Tracks and manages your personal and professional goals
- Communication Emulation: Generates responses in your unique voice and style
- Compatibility Analysis: Evaluates how well content aligns with your persona
- PostgreSQL Integration: Robust data storage with full ACID compliance
- MCP Protocol: Compatible with n8n AI agents and other MCP clients
- Docker Support: Easy deployment with Docker and Docker Compose
- Coolify Ready: One-click deployment on Coolify platform
- Node.js 18+ and npm
- PostgreSQL 12+ (or use Docker)
- Git
-
Clone the repository
git clone <your-repo-url> cd persona-mcp-server
-
Install dependencies
npm install
-
Set up environment variables
cp .env.example .env # Edit .env with your database credentials -
Set up PostgreSQL database
# Create database createdb persona_mcp # Run migrations npm run migrate
-
Start the development server
npm run dev
-
Using Docker Compose (Recommended)
# Copy environment file cp .env.example .env # Start all services docker-compose up -d # View logs docker-compose logs -f persona-mcp
-
Access the services
- MCP Server:
http://localhost:3000 - PostgreSQL:
localhost:5432 - pgAdmin (optional):
http://localhost:8080
- MCP Server:
Option 1: Coolify (Recommended for Production)
- Connect your Git repository to Coolify
- Configure environment variables in Coolify's Environment Variables section (not .env files)
- Required variables:
DATABASE_PASSWORD,DOMAIN,JWT_SECRET,API_KEY,NODE_ENV=production - Click "Deploy" - Coolify automatically detects the
coolify.ymlconfiguration - PostgreSQL and the MCP server will be set up automatically with SSL and backups
-
In your Coolify dashboard:
- Create a new project
- Connect your Git repository
- Coolify will automatically detect the
coolify.ymlconfiguration
-
Set environment variables in Coolify Environment Variables section:
DATABASE_PASSWORD: Strong password for PostgreSQLDOMAIN: Your domain name (e.g.,persona-mcp.yourdomain.com)JWT_SECRET: Random secret for JWT tokensAPI_KEY: API key for external accessNODE_ENV: Set toproductionAUTO_MIGRATE: Set totruefor automatic database setupLOG_LEVEL: Set toinfoorwarnfor production
Important: Do NOT use
.envfiles for Coolify deployment. All environment variables must be configured through Coolify's Environment Variables interface. -
Deploy:
- Click "Deploy" in Coolify
- The system will automatically set up PostgreSQL and the MCP server
- Database migrations will run automatically if
AUTO_MIGRATE=true
The server provides these MCP tools for AI agents:
Learn about your personality from provided content.
{
"name": "learn_persona",
"arguments": {
"content": "I prefer working in quiet environments and like to plan things in advance.",
"content_type": "preference",
"context": "work preferences"
}
}Retrieve persona information for AI understanding.
{
"name": "get_persona",
"arguments": {
"query_type": "communication",
"context": "writing email",
"format": "detailed"
}
}Generate responses in your style.
{
"name": "emulate_response",
"arguments": {
"prompt": "How should I respond to this meeting invitation?",
"context": "professional email",
"response_type": "email",
"tone": "professional"
}
}Analyze how well content matches your persona.
{
"name": "analyze_compatibility",
"arguments": {
"content": "Let's schedule a quick call to discuss this.",
"analysis_type": "communication_fit"
}
}Manage your goals and objectives.
{
"name": "update_goals",
"arguments": {
"action": "add",
"goal_data": {
"title": "Learn Spanish",
"description": "Become conversational in Spanish within 6 months",
"category": "learning",
"priority": "medium"
}
}
}-
Install n8n MCP node (if available) or use HTTP requests
-
Configure MCP connection:
- Server URL:
http://your-server:3000 - Protocol: MCP
- Authentication: API Key (if configured)
- Server URL:
-
Example n8n workflow:
{ "nodes": [ { "name": "Learn from Email", "type": "MCP", "parameters": { "tool": "learn_persona", "content": "{{$json.email_content}}", "content_type": "text" } }, { "name": "Generate Response", "type": "MCP", "parameters": { "tool": "emulate_response", "prompt": "{{$json.original_message}}", "response_type": "email" } } ] }
The server uses PostgreSQL with the following main tables:
- personality_traits: Core personality characteristics
- communication_patterns: Writing and speaking patterns
- goals: Personal and professional objectives
- preferences: User preferences and settings
- thinking_patterns: Decision-making and problem-solving approaches
- learning_inputs: Historical learning data
- persona_snapshots: Versioned persona states
- mcp_interactions: Interaction logs and analytics
| Variable | Description | Default |
|---|---|---|
DB_HOST |
PostgreSQL host | localhost |
DB_PORT |
PostgreSQL port | 5432 |
DB_NAME |
Database name | persona_mcp |
DB_USER |
Database user | postgres |
DB_PASSWORD |
Database password | `` |
AUTO_MIGRATE |
Run migrations on start | true |
PORT |
Server port | 3000 |
NODE_ENV |
Environment | development |
LOG_LEVEL |
Logging level | info |
# Run migrations
npm run migrate
# Reset database (WARNING: Deletes all data)
ts-node src/database/migrate.ts reset
# Drop all tables
ts-node src/database/migrate.ts downWhile primarily an MCP server, basic HTTP endpoints are available:
GET /health- Health checkPOST /mcp- MCP protocol endpointGET /persona/overview- Get persona summaryPOST /persona/learn- Learn from input
- Database Security: Use strong passwords and enable SSL in production
- Network Security: Run behind a reverse proxy (nginx, Traefik)
- API Security: Implement API key authentication for HTTP endpoints
- Data Privacy: Persona data is sensitive - ensure proper access controls
- Backup Strategy: Regular database backups are essential
- Application Logs: Stored in
/app/logs/directory - Database Logs: PostgreSQL logs for query analysis
- Health Checks: Built-in health endpoints for monitoring
- Metrics: MCP interaction logs for usage analytics
-
Database Connection Failed
# Check PostgreSQL is running pg_isready -h localhost -p 5432 # Verify credentials psql -h localhost -U postgres -d persona_mcp
-
Migration Errors
# Reset and retry npm run migrate -- reset -
MCP Connection Issues
- Verify server is running on correct port
- Check firewall settings
- Validate MCP client configuration
# View application logs
docker-compose logs -f persona-mcp
# View database logs
docker-compose logs -f postgres
# View all logs
docker-compose logs -fsrc/
├── database/ # Database configuration and migrations
│ ├── config.ts # Database connection
│ ├── migrate.ts # Migration runner
│ └── schema.sql # Database schema
├── services/ # Business logic
│ └── PersonaService.ts
├── types/ # TypeScript type definitions
│ ├── persona.ts # Persona-related types
│ └── mcp.ts # MCP protocol types
├── server.ts # MCP server implementation
└── index.ts # Application entry point
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
# Run tests
npm test
# Run with coverage
npm run test:coverage
# Lint code
npm run lintMIT License - see LICENSE file for details.
For issues and questions:
- Check the troubleshooting section
- Search existing GitHub issues
- Create a new issue with detailed information
Note: This server learns and stores personal information. Ensure you comply with relevant privacy laws and regulations in your jurisdiction.