README / SETUP_GUIDE.md
Compass79's picture
Add MCP integration, OAuth support, and comprehensive API endpoints
5849687
|
Raw History Blame Contribute Delete
6.15 kB
# Recovery Compass MCP Hub - Complete Setup Guide
## 🎯 Overview
This guide will help you set up the Recovery Compass MCP Hub with full Hugging Face integration, OAuth login, and MCP server capabilities.
## πŸ“‹ Prerequisites
- Python 3.9+
- Git
- Hugging Face account
- Hugging Face access token (with read/write permissions)
## πŸš€ Quick Setup
### 1. Clone the Repository
```bash
git clone https://huggingface.co/spaces/Recovery-Compass-79/README recovery-compass-space
cd recovery-compass-space
```
### 2. Run Setup Script
```bash
chmod +x setup.sh
./setup.sh
```
### 3. Configure Environment
Edit `.env` file with your credentials:
```bash
HF_TOKEN=your_token_here
OAUTH_CLIENT_SECRET=your_secret_here
```
### 4. Test Locally
```bash
uvicorn app:app --host 0.0.0.0 --port 7860
```
Visit: http://localhost:7860
### 5. Deploy to Hugging Face
```bash
git add .
git commit -m "Configure deployment"
git push
```
## πŸ”Œ MCP Integration Setup
### Connect to Hugging Face MCP Server
1. **OAuth Authentication**
- Visit: https://huggingface.co/mcp?login
- Authorize the application
- Token will be stored automatically
2. **Configure MCP Client**
Add to your MCP client configuration (e.g., Claude Desktop):
```json
{
"mcpServers": {
"huggingface": {
"url": "https://huggingface.co/mcp",
"oauth": true
},
"recovery-compass": {
"url": "https://huggingface.co/spaces/Recovery-Compass-79/README",
"oauth": true
}
}
}
```
### Available MCP Tools
1. **Spaces Semantic Search**
- Find AI Apps via natural language
- Example: "Find mental health support spaces"
2. **Papers Semantic Search**
- Search ML research papers
- Example: "Papers about recovery prediction models"
3. **Model Search**
- Find ML models with filters
- Example: "Find sentiment analysis models"
4. **Dataset Search**
- Search datasets
- Example: "Mental health conversation datasets"
5. **Documentation Search**
- Search HF documentation
- Example: "How to fine-tune a model"
6. **Hub Repository Details**
- Get info about repos
- Include README files
## πŸ”— Connect Valuable Apps
### Recommended Spaces to Connect
1. **evalstate/flux1_schnell** - Fast image generation
2. **Mental Health Support Spaces** - Crisis counseling
3. **Wellness Tracking** - Progress monitoring
4. **Mindfulness Tools** - Meditation guidance
### How to Connect Apps
1. Visit: https://huggingface.co/settings/connected-applications
2. Authorize each app
3. Grant appropriate permissions:
- Public profile (always)
- View repo contents (for integration)
- Edit repo contents (if needed)
- List MCP tools (for MCP access)
### Currently Connected Apps
Based on your setup:
- βœ… Claude (MCP tools + repo access)
- βœ… DeepSite (repo management)
## πŸ“± API Endpoints
### Health Check
```bash
curl https://Recovery-Compass-79-README.hf.space/health
```
### Search Resources
```bash
curl "https://Recovery-Compass-79-README.hf.space/api/search?query=recovery"
```
### List Models
```bash
curl "https://Recovery-Compass-79-README.hf.space/api/models?task=text-generation&limit=5"
```
### List Datasets
```bash
curl "https://Recovery-Compass-79-README.hf.space/api/datasets?task=text-classification&limit=5"
```
### AI Chat
```bash
curl -X POST https://Recovery-Compass-79-README.hf.space/api/chat \
-H "Content-Type: application/json" \
-d '{"message": "I need support today"}'
```
### List Recovery Spaces
```bash
curl https://Recovery-Compass-79-README.hf.space/api/spaces
```
## πŸ” OAuth Configuration
### Set Up OAuth App
1. Go to: https://huggingface.co/settings/applications
2. Create new OAuth application
3. Set redirect URI: `https://huggingface.co/spaces/Recovery-Compass-79/README/callback`
4. Get client ID and secret
5. Add to `.env` file
### Required Scopes
- `profile` - User profile information
- `read` - Read access to repos
- `write` - Write access for data storage
- `mcp` - MCP tools access
## πŸ› οΈ Advanced Configuration
### Enable All MCP Tools
Edit `mcp-config.json` to enable/disable tools:
```json
{
"capabilities": {
"semantic_search": { "enabled": true },
"model_inference": { "enabled": true },
"dataset_access": { "enabled": true },
"space_integration": { "enabled": true },
"progress_tracking": { "enabled": true }
}
}
```
### Add Custom Spaces
Add recommended spaces in `mcp-config.json`:
```json
{
"integration": {
"recommended_spaces": [
"your-space-1",
"your-space-2"
]
}
}
```
## πŸ§ͺ Testing
### Local Testing
```bash
# Test health endpoint
curl http://localhost:7860/health
# Test MCP info
curl http://localhost:7860/mcp
# Test search
curl "http://localhost:7860/api/search?query=test"
```
### Production Testing
Replace `localhost:7860` with `Recovery-Compass-79-README.hf.space`
## πŸ“Š Monitoring
### Check Space Status
Visit: https://huggingface.co/spaces/Recovery-Compass-79/README/logs
### API Usage
Monitor requests through FastAPI docs:
https://Recovery-Compass-79-README.hf.space/docs
## πŸ”§ Troubleshooting
### OAuth Issues
- Verify redirect URI matches exactly
- Check token permissions
- Ensure client secret is correct
### MCP Connection Issues
- Confirm OAuth is completed
- Check MCP client configuration
- Verify Space is running
### API Errors
- Check Space logs
- Verify HF token is valid
- Test endpoints locally first
## πŸ“š Resources
- [Hugging Face MCP Server](https://huggingface.co/mcp)
- [OAuth Documentation](https://huggingface.co/docs/hub/oauth)
- [Spaces Documentation](https://huggingface.co/docs/hub/spaces)
- [FastAPI Documentation](https://fastapi.tiangolo.com/)
- [MCP Protocol](https://modelcontextprotocol.io/)
## 🀝 Support
For issues or questions:
- GitHub Issues: [Create an issue]
- Hugging Face Discussions: [Community forum]
- Email: support@recoverycompass.example
## πŸŽ‰ Next Steps
1. βœ… Complete OAuth setup
2. βœ… Connect recommended apps
3. βœ… Test all API endpoints
4. βœ… Configure MCP client
5. βœ… Start using with AI assistants!
---
Built with ❀️ for the recovery community