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

git clone https://huggingface.co/spaces/Recovery-Compass-79/README recovery-compass-space
cd recovery-compass-space

2. Run Setup Script

chmod +x setup.sh
./setup.sh

3. Configure Environment

Edit .env file with your credentials:

HF_TOKEN=your_token_here
OAUTH_CLIENT_SECRET=your_secret_here

4. Test Locally

uvicorn app:app --host 0.0.0.0 --port 7860

Visit: http://localhost:7860

5. Deploy to Hugging Face

git add .
git commit -m "Configure deployment"
git push

πŸ”Œ MCP Integration Setup

Connect to Hugging Face MCP Server

  1. OAuth Authentication

  2. Configure MCP Client

Add to your MCP client configuration (e.g., Claude Desktop):

{
  "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

curl https://Recovery-Compass-79-README.hf.space/health

Search Resources

curl "https://Recovery-Compass-79-README.hf.space/api/search?query=recovery"

List Models

curl "https://Recovery-Compass-79-README.hf.space/api/models?task=text-generation&limit=5"

List Datasets

curl "https://Recovery-Compass-79-README.hf.space/api/datasets?task=text-classification&limit=5"

AI Chat

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

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:

{
  "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:

{
  "integration": {
    "recommended_spaces": [
      "your-space-1",
      "your-space-2"
    ]
  }
}

πŸ§ͺ Testing

Local Testing

# 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

🀝 Support

For issues or questions:

πŸŽ‰ 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