Add HTTP transport support for cloud deployment
Enables deployment to cloud platforms (Render, Railway, etc.) while maintaining backward compatibility with existing stdio transport for Claude Desktop. New features: - HTTP server entry point (run_http_server.py) using uvicorn - Docker containerization with Python 3.13 - Health check endpoint at /health - Comprehensive deployment documentation for Render, Railway, and Docker Technical changes: - Added uvicorn dependency for ASGI server - Created Dockerfile with optimized multi-stage build (343MB) - Added .dockerignore for efficient Docker builds - Implemented /health endpoint using Starlette JSONResponse - Updated README.md and DEPLOYMENT.md with HTTP deployment guides 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@ import logging
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
from mcp.server.fastmcp import FastMCP
|
||||
from starlette.responses import JSONResponse
|
||||
|
||||
from nadlan_mcp.govmap import GovmapClient
|
||||
from nadlan_mcp.govmap.models import Deal
|
||||
@@ -966,6 +967,18 @@ def get_market_activity_metrics(address: str, years_back: int = 2, radius_meters
|
||||
return f"Error analyzing market activity: {str(e)}"
|
||||
|
||||
|
||||
# Health check endpoint for HTTP deployments
|
||||
@mcp.custom_route("/health", methods=["GET"])
|
||||
async def health_check(request):
|
||||
"""
|
||||
Health check endpoint for container orchestration platforms (Render, Railway, etc.).
|
||||
|
||||
Returns a simple OK status to indicate the server is running.
|
||||
This endpoint is accessible at GET /health when using HTTP transport.
|
||||
"""
|
||||
return JSONResponse({"status": "ok", "service": "nadlan-mcp"})
|
||||
|
||||
|
||||
# Run the server
|
||||
if __name__ == "__main__":
|
||||
mcp.run()
|
||||
|
||||
Reference in New Issue
Block a user