server.py•813 B
import os
import logging
from flask import Flask, render_template
from werkzeug.middleware.proxy_fix import ProxyFix
# Create the Flask app first to avoid circular imports
app = Flask(__name__)
app.secret_key = os.environ.get("SESSION_SECRET", "dev-secret-key")
app.wsgi_app = ProxyFix(app.wsgi_app, x_proto=1, x_host=1)
# Import our modules after app creation
from app.core.logging import setup_logging
from app.transport.http import register_routes
from app.metrics import setup_metrics
# Setup logging
setup_logging()
# Setup metrics
setup_metrics(app)
# Register routes
register_routes(app)
# Basic health check
@app.route('/health')
def health_check():
return {"status": "healthy", "service": "mcp-server"}
# Documentation page
@app.route('/')
def index():
return render_template('index.html')