This project provides a FastAPI application with an MCP (Model Context Protocol) server. It returns the current time and date for a submitted timezone.
- API endpoint:
/api/timedate(POST) - Health endpoint:
/health(GET) - Usage endpoint:
/api/usage(GET) - Timezone discovery:
/api/timezones(GET, with optionalregionandqueryfilters) - Extended time metadata: local datetime, UTC datetime, Unix timestamp, UTC offset, and timezone abbreviation
- OpenAPI docs: request/response schemas and examples at
/docs - MCP server:
/mcp(exposes all API endpoints) - Docker & Docker Compose support
- Healthcheck for production readiness
- Pinned dependencies for reproducible installs/builds
# From the project root
sudo docker compose up -d --buildcurl -X POST http://localhost:8200/api/timedate \
-H "Content-Type: application/json" \
-d '{"timezone": "Europe/London"}'curl http://localhost:8200/healthcurl http://localhost:8200/api/usagecurl http://localhost:8200/api/timezonescurl "http://localhost:8200/api/timezones?region=America&query=denver"pip install -r requirements-dev.txt
pytest test_timedate_app.py{
"datetime": "2026-05-15T19:50:03.173125-06:00",
"timezone": "America/Denver",
"utc_datetime": "2026-05-16T01:50:03.173125+00:00",
"unix_timestamp": 1789437003,
"utc_offset": "-06:00",
"abbreviation": "MDT"
}GET /healthreturns service health and timezone catalog count.GET /api/usagereturns endpoint descriptions and example requests/responses.GET /api/timezonesreturns the supported IANA timezone names. Optional query params:region: filters by timezone region prefix, such asAmerica,Europe, orAsia.query: filters by case-insensitive substring.
POST /api/timedateaccepts{"timezone": "Europe/London"}and returns current time metadata for that timezone.
Invalid timezone responses use a structured error body:
{
"error": "Invalid Timezone",
"message": "Use GET /api/timezones to discover supported IANA timezone names."
}timedate_app.py— Main FastAPI apptest_timedate_app.py— Tests for the APIDockerfile— Container builddocker-compose.yml— Orchestration and healthcheckrequirements.txt— Python dependenciesrequirements-dev.txt— Test dependencies