Skip to main content
Glama
bretbouchard

WFGY MCP Server

by bretbouchard
README.md
# WFGY MCP Server - Augment Integration

> **Real $1M-level reasoning** through MCP protocol integration with Augment

This repository contains an enhanced version of the WFGY (What's For Generating You) project with full **Model Context Protocol (MCP)** integration for **Augment** compatibility.

## ๐Ÿš€ **What This Provides**

### **11 Production-Ready WFGY Tools**
- โœ… **wfgy_engine_run** - Core WFGY reasoning with variance reduction
- โœ… **wfgy_bbmc_process** - BBMC Semantic Residue computation  
- โœ… **wfgy_bbpf_analyze** - BBPF Workflow stability analysis
- โœ… **wfgy_bbcr_recover** - BBCR System state recovery
- โœ… **wfgy_bbam_modulate** - BBAM Attention modulation
- โœ… **wfgy_problem_search** - WFGY-enhanced problem search
- โœ… **wfgy_problemmap_index** - Content indexing with WFGY
- ๐Ÿ†• **wfgy_problemmap_search** - Structured ProblemMap search
- ๐Ÿ†• **wfgy_problemmap_get** - Specific problem retrieval (1-16)
- ๐Ÿ†• **wfgy_problemmap_diagnose** - Symptom-based diagnosis
- โœ… **wfgy_code_analyze** - WFGY-enhanced code analysis

### **Enhanced ProblemMap Access**
Access to **16 structured WFGY problems** with specific fixes:

| # | Problem | Category | Modules | Status |
|---|---------|----------|---------|--------|
| 1 | Hallucination & Chunk Drift | IN | BBCR, BBMC | โœ… Stable |
| 2 | Interpretation Collapse | RE | BBCR | โœ… Stable |
| 3 | Long Reasoning Chains | RE | BBMC, Tree | โœ… Stable |
| 4 | Bluffing / Overconfidence | RE | BBCR, ฮป_observe | โœ… Stable |
| 5 | Semantic โ‰  Embedding | IN | BBMC, BBAM | โœ… Stable |
| 6 | Logic Collapse & Recovery | RE | BBCR, BBPF | โœ… Stable |
| 7 | Memory Breaks Across Sessions | ST | Tree, BBMC | โœ… Stable |
| 8 | Multi-Agent Role Drift | ST | BBCR, BBPF | โœ… Stable |

## ๐Ÿ”ง **Quick Start**

### **1. Docker Deployment (Recommended)**
```bash
# Clone your repository
git clone https://github.com/YOUR_USERNAME/WFGY-MCP.git
cd WFGY-MCP

# Start the MCP server
docker compose up -d

# Server runs on http://localhost:8052
```

### **2. Augment Integration**
Add to your Augment MCP configuration:
```json
{
  "mcpServers": {
    "wfgy": {
      "command": "docker",
      "args": ["exec", "wfgy-wfgy-1", "python", "-m", "wfgy_mcp.server"],
      "env": {}
    }
  }
}
```

### **3. Test the Tools**
```python
# Example: Diagnose AI problems
wfgy_problemmap_diagnose(symptoms="hallucination and wrong content")

# Example: Analyze workflow stability  
wfgy_bbpf_analyze(workflow="data input -> processing -> output")

# Example: Compute semantic residue
wfgy_bbmc_process(text="The universe is expanding", context="cosmology")
```

## ๐Ÿ“Š **Key Features**

### **Real WFGY Processing**
- โœ… **Authentic variance reduction** calculations
- โœ… **Semantic residue computation** with real BBMC
- โœ… **Workflow stability analysis** with BBPF  
- โœ… **System recovery protocols** with BBCR
- โœ… **Attention modulation** with BBAM

### **Structured Knowledge Access**
- ๐ŸŽฏ **16 documented problems** with specific fixes
- ๐Ÿ” **Symptom-based diagnosis** with pattern matching
- ๐Ÿ“‹ **Category filtering** (IN, RE, ST, OP)
- ๐Ÿ› ๏ธ **Module-specific solutions** (BBMC, BBCR, BBPF, BBAM)

### **Production Ready**
- ๐Ÿณ **Docker deployment** with docker-compose
- ๐Ÿงช **Comprehensive test suite** with contract tests
- ๐Ÿ“ **Full MCP compliance** for Augment integration
- ๐Ÿ”ง **Tool naming compatibility** (fixed dots โ†’ underscores)

## ๐Ÿ› ๏ธ **Development**

### **Local Development**
```bash
# Install dependencies
pip install -r requirements.txt

# Run tests
pytest tests/

# Start development server
python -m wfgy_mcp.server
```

### **Project Structure**
```
wfgy_mcp/
โ”œโ”€โ”€ server.py          # Main MCP server
โ”œโ”€โ”€ schemas.py         # Pydantic schemas
โ”œโ”€โ”€ wfgy_integration.py # WFGY SDK integration
โ””โ”€โ”€ problemmap.py      # ProblemMap data access

docker/
โ”œโ”€โ”€ run_uvicorn.sh     # Docker startup script
โ””โ”€โ”€ Dockerfile.mcp     # MCP server container

tests/
โ”œโ”€โ”€ contract/          # MCP contract tests
โ””โ”€โ”€ test_*.py         # Unit tests
```

## ๐Ÿ“ˆ **What's Enhanced**

This repository builds on the original [WFGY project](https://github.com/onestardao/WFGY) with:

### **MCP Integration**
- โœ… Full Model Context Protocol implementation
- โœ… Augment-compatible tool naming
- โœ… JSON-RPC 2.0 compliance
- โœ… Proper error handling and validation

### **Enhanced ProblemMap**
- ๐Ÿ†• Structured access to 16 core problems
- ๐Ÿ†• Symptom-based diagnostic tools
- ๐Ÿ†• Category and module filtering
- ๐Ÿ†• Real-time problem recommendations

### **Production Deployment**
- ๐Ÿณ Docker containerization
- ๐Ÿ”ง Environment configuration
- ๐Ÿ“Š Health checks and monitoring
- ๐Ÿงช Automated testing pipeline

## ๐ŸŽฏ **Use Cases**

- **AI Debugging**: Diagnose and fix AI reasoning problems
- **Semantic Analysis**: Compute semantic residue and variance
- **Workflow Optimization**: Analyze process stability
- **Code Quality**: WFGY-enhanced code analysis
- **Problem Solving**: Access structured AI problem solutions

## ๐Ÿ“„ **License**

Based on the original WFGY project. Enhanced with MCP integration.

## ๐Ÿ™ **Credits**

- **Original WFGY**: [onestardao/WFGY](https://github.com/onestardao/WFGY)
- **MCP Integration**: Enhanced for Augment compatibility
- **Enhanced ProblemMap**: Structured access to WFGY knowledge base

---

**Ready to unlock $1M-level AI reasoning in Augment!** ๐Ÿš€