Overview
The/health endpoint provides a simple health check for the data.gouv.fr MCP server. This endpoint is used by monitoring systems, load balancers, and Docker healthchecks to verify that the server is running and responsive.
Endpoint Details
Returns the current health status of the server
Request
No parameters or headers are required. Simply send a GET request to the endpoint:Response
The endpoint returns a JSON object with the following fields:Current status of the server. Always returns
"ok" when the server is healthy.ISO 8601 timestamp of when the health check was performed (in UTC timezone).
Current version of the running server, managed by setuptools-scm. Returns
"unknown" if the version cannot be determined.Response Format
Response Headers
- Content-Type:
application/json - Status Code:
200 OK
Example Usage
Basic Health Check
Docker Healthcheck
You can use this endpoint in Docker healthchecks:Monitoring Script
Example monitoring script:Python Health Check
Use Cases
Monitoring Systems
Integrate the health endpoint with monitoring tools like:- Prometheus: Use the endpoint as a blackbox exporter target
- Datadog: Configure HTTP checks to poll this endpoint
- Nagios: Create HTTP service checks
- UptimeRobot: Monitor server availability
Load Balancers
Configure load balancers to use this endpoint for health checks:- Remove unhealthy instances from the pool
- Route traffic only to responsive servers
- Automatic failover during deployments
Deployment Verification
After deploying a new version:- Check that the endpoint returns
200 OK - Verify the
versionfield matches the deployed version - Confirm the server is responding within acceptable latency
Monitoring vs. Tracking
Unlike the
/mcp endpoint, health check requests are not tracked by Matomo analytics. This ensures that monitoring systems don’t inflate usage metrics.Implementation Details
The health endpoint is implemented at the ASGI middleware level, ensuring:- Fast response: No MCP protocol overhead
- Minimal processing: Returns immediately without complex logic
- Always available: Responds even if other parts of the system have issues
setuptools-scm, which automatically generates version numbers based on Git tags.