Spaces:
Running
Running
Deployment Guide for MCP Documentation Server
Prerequisites
- Hugging Face Account: Create an account at huggingface.co
- Git: Ensure Git is installed on your system
- Docker: Required for local testing (optional)
Step 1: Create Hugging Face Space
- Go to Hugging Face Spaces
- Click "Create new Space"
- Fill in the details:
- Space name:
mcp-docs-server(or your preferred name) - License: MIT
- SDK: Docker
- Hardware: CPU Basic (free tier)
- Visibility: Public or Private
- Space name:
Step 2: Clone and Setup
# Clone your space (replace with your username)
git clone https://huggingface.co/spaces/YOUR_USERNAME/mcp-docs-server
cd mcp-docs-server
# Copy all files from this directory to the cloned space
# (Copy all files from mcp-docs-hf-space/ to the cloned directory)
Step 3: Test Locally (Optional)
# Install dependencies
pip install -r requirements.txt
# Test the application
python test_app.py
# Run the server locally
python app.py
Step 4: Deploy to Hugging Face
# Add all files to git
git add .
# Commit changes
git commit -m "Initial MCP Documentation Server deployment"
# Push to Hugging Face
git push origin main
Step 5: Verify Deployment
- Go to your Space URL:
https://huggingface.co/spaces/YOUR_USERNAME/mcp-docs-server - Wait for the build to complete (usually 2-5 minutes)
- Test the API endpoints:
GET /- Health checkPOST /search- Search documentation
API Usage Examples
Health Check
curl https://YOUR_SPACE_URL.hf.space/
Search Documentation
curl -X POST "https://YOUR_SPACE_URL.hf.space/search" \
-H "Content-Type: application/json" \
-d '{"query": "MCP architecture", "limit": 5}'
Get Specific Chunk
curl "https://YOUR_SPACE_URL.hf.space/chunks/md_architecture_b82bfe7e__0"
Troubleshooting
Build Failures
- Check the logs in the Hugging Face Space interface
- Ensure all files are properly committed
- Verify the Dockerfile syntax
Runtime Errors
- Check the application logs
- Verify all data files are present
- Test locally first
Performance Issues
- Consider upgrading to a paid tier for better performance
- Optimize the search algorithm if needed
Next Steps
- Integrate with MCP Clients: Use this server as a data source for MCP clients
- Add Authentication: Implement API keys or OAuth if needed
- Enhance Search: Implement semantic search using the FAISS index
- Add More Features: Implement additional endpoints as needed
Support
For issues or questions:
- Check the Hugging Face Space logs
- Review the application code
- Test locally first
- Check the Hugging Face Spaces documentation