facetron
FaceTron is a high-performance face embedding server using ONNX Runtime, supporting dynamic multi-model loading, offline deployment, and scalable environments. It exposes an OpenAPI endpoint with MCP-compatible metadata and integrates with OpenTelemetry for observability.
claude mcp add --transport stdio 13shivam-facetron python main.py \ --env LOG_LEVEL="info" \ --env MODEL_DIR="models directory path containing ONNX models (default: ./facetron/models)" \ --env DISABLE_OTEL="false" \ --env OTEL_EXPORTER_OTLP_ENDPOINT="http://host.docker.internal:4317"
How to use
Facetron is a FastAPI-based MCP server that serves face embedding models from ONNX files. It supports dynamic multi-model loading, enabling multiple ONNX models (e.g., ArcFace, SCRFD, Glint360K) to be loaded and queried via a single API surface. Key endpoints include GET /models to list loaded models, POST /infer to compute embeddings for detected faces in an image, POST /infer_visualize to return an image with bounding boxes and aligned faces, GET /download to retrieve the annotated image, and GET /openapi.json to fetch the MCP-compatible metadata specification. The server also includes built-in OpenTelemetry tracing (configurable via environment variables) and exposes MCP metadata in its OpenAPI spec for agent integration. To get started, run the server, then use the tester script or curl commands to perform inference and visualize results against the loaded models.
How to install
Prerequisites:
- Python 3.9 or later
- pip (Python package manager)
- Optional: Docker and docker-compose for containerized runs
Install and run (local development):
- Clone the repository and navigate into it
git clone https://github.com/13shivam/facetron.git
cd facetron
- Install dependencies
pip install -r requirements.txt
- Ensure ONNX models are present
- Place your ONNX models under the models/ directory. Each model should expose a wrapper interface compatible with get_embedding(np.ndarray) -> np.ndarray.
- Run the server
python main.py
Optional containerized run (docker-compose):
# Ensure .env is configured as needed, then start
docker-compose up -d
Access API docs and test endpoints via:
- Swagger UI: http://127.0.0.1:8000/docs
- OpenAPI spec: http://127.0.0.1:8000/openapi.json
Additional notes
Tips and notes:
- Environment variables: MODEL_DIR, LOG_LEVEL, DISABLE_OTEL, and OTEL_EXPORTER_OTLP_ENDPOINT control model loading, logging, and telemetry. Set DISABLE_OTEL=true to disable tracing.
- If you replace or mount a custom models directory, ensure models implement a wrapper exposing get_embedding(np.ndarray) -> np.ndarray so the registry can call into them.
- To load multiple models, place them in the models/ directory and access them via the /models API endpoint.
- If using Docker, ensure the volume mapping includes your models directory or rebuild the image with updated models.
- OpenTelemetry integration exports traces to OTLP endpoints (Jaeger-compatible). Verify your OTEL_EXPORTER_OTLP_ENDPOINT and firewall settings.
- The API supports downloading annotated images via /download and returning visualized in /infer_visualize for quick validation.
- When upgrading Python dependencies, re-run pip install -r requirements.txt to refresh packages.
Related MCP Servers
fastapi_mcp
Expose your FastAPI endpoints as Model Context Protocol (MCP) tools, with Auth!
CoexistAI
CoexistAI is a modular, developer-friendly research assistant framework . It enables you to build, search, summarize, and automate research workflows using LLMs, web search, Reddit, YouTube, and mapping tools—all with simple MCP tool calls or API calls or Python functions.
supermcp
🚀 SuperMCP - Create multiple isolated MCP servers using a single connector. Build powerful Model Context Protocol integrations for databases (PostgreSQL, MSSQL) with FastAPI backend, React dashboard, and token-based auth. Perfect for multi-tenant apps and AI assistants.
mcp-yfinance
Real-time stock API with Python, MCP server example, yfinance stock analysis dashboard
posebusters
Unofficial MCP server for PoseBusters – validate molecular poses via HTTP or Spaces using the Model Context Protocol (MCP).
openedu
OpenEdu MCP Server for educational resources and curriculum planning, integrates with OpenLibrary, Wikipedia and arXiv