EasyReportDataMCP / DEPLOYMENT.md
JC321's picture
Upload 8 files
98e3256 verified
|
raw
history blame
2.87 kB

Hugging Face Space Deployment Guide

Quick Deployment Steps

1. Create a New Space

  1. Visit https://huggingface.co/spaces
  2. Click "Create new Space"
  3. Configure:
    • Name: Choose a unique name (e.g., sec-financial-mcp)
    • License: MIT
    • SDK: Docker ⚠️ Important!
    • Visibility: Public or Private

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 Dockerfile is 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