mcp-context-engineering
Version:
The intelligent context optimization system for AI coding assistants. Built with Cole's PRP methodology, Context Portal knowledge graphs, and production-ready MongoDB architecture.
303 lines (237 loc) β’ 9.38 kB
Markdown
# Universal Context Engineering MCP Server
[](https://www.typescriptlang.org/)
[](https://www.mongodb.com/)
[](https://nodejs.org/)
[](https://modelcontextprotocol.io/)
**The intelligent context optimization system for AI coding assistants**
Transform your AI coding experience with systematic context engineering that gets smarter over time. Built with Cole's proven PRP methodology, Context Portal knowledge graphs, and production-ready MongoDB architecture.
## π **Why Universal Context Engineering?**
Traditional AI coding assistants work with static context. This MCP server creates **dynamic, intelligent context** that:
- π **Learns and improves** from every interaction
- π― **Optimizes for your specific AI agent** (Cursor, Windsurf, Claude Code, etc.)
- π§ **Applies proven methodologies** (Cole's PRP + Context Portal patterns)
- π **Scales with MongoDB** for production workloads
- π **Builds knowledge graphs** of successful patterns
## β‘ **Quick Start**
### Prerequisites
- Node.js 18.12+
- MongoDB (local or Atlas)
- AI coding assistant with MCP support
### 1. Install & Setup
```bash
git clone https://github.com/romiluz13/mcp-context-engineering.git
cd mcp-context-engineering
npm install
cp .env.example .env
```
### 2. Configure Environment
Edit `.env` with your settings:
```env
MONGODB_URI=mongodb://localhost:27017
MONGODB_DATABASE=universal_context_engineering
VOYAGE_API_KEY=your_voyage_ai_key
OPENAI_API_KEY=your_openai_key
```
### 3. Build & Start
```bash
npm run build
npm start
```
### 4. Add to Your AI Agent
**For Claude Code/Desktop:**
```json
{
"mcpServers": {
"universal-context-engineering": {
"command": "node",
"args": ["dist/src/index.js"],
"cwd": "/path/to/mcp-context-engineering",
"env": {
"MONGODB_URI": "mongodb://localhost:27017",
"MONGODB_DATABASE": "universal_context_engineering",
"VOYAGE_API_KEY": "your_key",
"OPENAI_API_KEY": "your_key"
}
}
}
}
```
**For Cursor/Windsurf:** Similar configuration in your MCP settings.
## π― **Core Features**
### π **MCP Tools Available**
| Tool | Purpose | What It Does |
|------|---------|--------------|
| `generate_universal_prp` | **Generate Smart PRPs** | Creates comprehensive implementation plans using Cole's methodology |
| `get_universal_context` | **Retrieve Context** | Gets optimized context for your specific AI agent and project |
| `search_similar_patterns` | **Find Patterns** | Semantic search for similar successful implementations |
| `store_context_pattern` | **Save Patterns** | Stores successful patterns for future learning |
| `update_pattern_effectiveness` | **Learning Loop** | Updates pattern effectiveness based on results |
| `get_cross_agent_insights` | **Analytics** | Cross-agent performance insights and recommendations |
### π€ **Universal AI Agent Support**
- **Cursor**: Concise, action-focused context
- **Windsurf**: Step-by-step with comprehensive error handling
- **Claude Code**: Full PRP methodology with detailed analysis
- **Generic**: Balanced approach for any MCP-compatible agent
## π **Example Usage**
### Generate a Universal PRP
```javascript
{
"tool": "generate_universal_prp",
"arguments": {
"feature_description": "Implement JWT authentication with role-based access control",
"project_context": {
"project_id": "my-web-app",
"tech_stack": ["react", "typescript", "express", "mongodb"],
"complexity_preference": "medium"
},
"agent_type": "claude_code",
"research_depth": "comprehensive"
}
}
```
### Get Project Context
```javascript
{
"tool": "get_universal_context",
"arguments": {
"project_id": "my-web-app",
"agent_type": "cursor",
"query": "authentication patterns",
"min_effectiveness": 7
}
}
```
### Search Similar Patterns
```javascript
{
"tool": "search_similar_patterns",
"arguments": {
"query": "JWT authentication implementation",
"filters": {
"tech_stacks": ["react", "express"],
"complexity": "medium"
},
"agent_type": "windsurf"
}
}
```
## ποΈ **Architecture**
```
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β AI Agent β β MCP Server β β MongoDB β
β (Cursor, etc.) βββββΊβ Context Engine βββββΊβ Knowledge β
βββββββββββββββββββ ββββββββββββββββββββ β Base β
βββββββββββββββββββ
ββββββββββββββββββββ
β Vector Search β
β (Voyage AI) β
ββββββββββββββββββββ
```
**Core Components:**
- **MCP Server**: TypeScript-based with comprehensive error handling
- **Context Engine**: Cole's PRP methodology + Context Portal patterns
- **Knowledge Base**: MongoDB with vector search capabilities
- **Learning System**: Effectiveness tracking and continuous improvement
- **Universal Optimizer**: Agent-specific context formatting
## π **What Makes It Special**
### π§ **Cole's PRP Methodology**
Systematic approach: **Research** β **Blueprint** β **Validation**
- Comprehensive codebase analysis
- External research integration
- Step-by-step implementation plans
- Quality validation frameworks
### πΈοΈ **Context Portal Knowledge Graphs**
- Relationship-aware context connections
- Decision tracking and history
- Pattern dependencies and conflicts
- Cross-project knowledge sharing
### π **Learning Intelligence**
- Tracks what works for each AI agent
- Improves recommendations over time
- Cross-agent effectiveness insights
- Continuous pattern optimization
## βοΈ **Configuration**
### Environment Variables
```env
# MongoDB Configuration
MONGODB_URI=mongodb://localhost:27017
MONGODB_DATABASE=universal_context_engineering
# AI Services (Required)
VOYAGE_API_KEY=your_voyage_ai_key
OPENAI_API_KEY=your_openai_key
# Optional Configuration
NODE_ENV=development
LOG_LEVEL=info
DEBUG_MONGODB_OPERATIONS=false
VECTOR_DIMENSIONS=1024
```
### MongoDB Setup
**Local MongoDB:**
```bash
# Install MongoDB locally
brew install mongodb/brew/mongodb-community
brew services start mongodb/brew/mongodb-community
```
**MongoDB Atlas:**
- Create cluster at [MongoDB Atlas](https://cloud.mongodb.com/)
- Get connection string
- Update `MONGODB_URI` in `.env`
## π οΈ **Development**
### Scripts
```bash
npm run dev # Development with hot reload
npm run build # TypeScript compilation
npm run start # Production server
npm run test # Run tests
npm run lint # Code linting
npm run format # Code formatting
```
### Project Structure
```
src/
βββ config/ # Environment configuration
βββ context/ # Context engineering logic
β βββ methodology/ # PRP generation & research
βββ mcp/ # MCP server implementation
βββ mongodb/ # Database models & operations
β βββ models/ # Data schemas
β βββ operations/ # CRUD operations
βββ index.ts # Server entry point
```
## π€ **Contributing**
We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
### Quick Contributing Steps:
1. Fork the repository
2. Create feature branch (`git checkout -b amazing-feature`)
3. Commit changes (`git commit -m 'Add amazing feature'`)
4. Push to branch (`git push origin amazing-feature`)
5. Open Pull Request
## π **License**
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## π **Support**
- **Documentation**: Check the `/docs` folder for detailed guides
- **Issues**: [GitHub Issues](https://github.com/romiluz13/mcp-context-engineering/issues)
- **Discussions**: [GitHub Discussions](https://github.com/romiluz13/mcp-context-engineering/discussions)
## π **Acknowledgments**
- **Cole's PRP Methodology** - Systematic context engineering approach
- **Context Portal** - Knowledge graph patterns and relationship management
- **MongoDB MCP Community** - Production-ready database integration patterns
- **Model Context Protocol** - Universal AI agent communication standard
## π **Star History**
[](https://star-history.com/#romiluz13/mcp-context-engineering&Date)
**π Transform your AI coding experience with intelligent context engineering!**
*Built with β€οΈ for the AI coding community*