Spaces:
Runtime error
Runtime error
Hugging Face Space Deployment Guide
Quick Deployment Steps
1. Create a New Space
- Visit https://huggingface.co/spaces
- Click "Create new Space"
- Configure:
- Name: Choose a unique name (e.g.,
sec-financial-mcp) - License: MIT
- SDK: Docker β οΈ Important!
- Visibility: Public or Private
- Name: Choose a unique name (e.g.,
2. Clone and Upload
# Clone your Space
git clone https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME
cd YOUR_SPACE_NAME
# Copy all project files
cp /path/to/EasyReportDateMCP/* .
# Commit and push
git add .
git commit -m "Initial deployment: SEC Financial MCP Server"
git push
3. Required Files
Make sure these files are in your Space repository:
β Dockerfile # Docker configuration
β mcp_server.py # FastAPI application
β edgar_client.py # EDGAR client
β requirements.txt # Dependencies
β README.md # Space description
β .gitignore # Git ignore rules
4. Wait for Build
Hugging Face will automatically build your Space (takes 3-5 minutes).
Monitor the build in the "Logs" tab.
5. Access Your API
Once deployed, your API will be available at:
https://YOUR_USERNAME-YOUR_SPACE_NAME.hf.space
Interactive Documentation:
- Swagger UI:
https://YOUR_USERNAME-YOUR_SPACE_NAME.hf.space/docs - ReDoc:
https://YOUR_USERNAME-YOUR_SPACE_NAME.hf.space/redoc
Testing Your Deployment
Health Check
curl https://YOUR_USERNAME-YOUR_SPACE_NAME.hf.space/health
Search Company
curl -X POST "https://YOUR_USERNAME-YOUR_SPACE_NAME.hf.space/api/search_company" \
-H "Content-Type: application/json" \
-d '{"company_name": "NVIDIA"}'
Python Test
import requests
BASE_URL = "https://YOUR_USERNAME-YOUR_SPACE_NAME.hf.space"
# Search company
response = requests.post(
f"{BASE_URL}/api/search_company",
json={"company_name": "NVIDIA"}
)
print(response.json())
Troubleshooting
Build Fails
- Check the Logs tab for errors
- Verify all files are present
- Ensure
Dockerfileis correct
Server Not Responding
- Check if build completed successfully
- Verify port 7860 is exposed in Dockerfile
- Check application logs in Logs tab
API Errors
- Test with Swagger UI at
/docs - Check request JSON format
- Review error messages in response
Notes
- Free Spaces sleep after 48 hours of inactivity
- Port 7860 is standard for Hugging Face Spaces
- Docker SDK is required for this deployment
- All API endpoints use POST method except
/health
Support
- Documentation: See
API_USAGE.md - Interactive Testing: Visit
/docsafter deployment - Hugging Face Docs: https://huggingface.co/docs/hub/spaces