Skip to main content
Glama
jjsteffen23

CME Prediction Markets MCP Server

by jjsteffen23
main.py2.4 kB
from fastapi import FastAPI from fastapi.staticfiles import StaticFiles from fastapi.responses import RedirectResponse from contextlib import asynccontextmanager import structlog from src.config import get_settings from src.data.models import init_db, close_db from src.data.storage.cache import cache from src.mcp.tools import register_all_tools from src.api.mcp_routes import router as mcp_router from src.api.health_routes import router as health_router from src.api.gui_routes import router as gui_router from src.api.chat_routes import router as chat_router from src.api.tastytrade_routes import router as tastytrade_router from src.api.cme_routes import router as cme_router from src.utils.logger import setup_logging settings = get_settings() setup_logging() logger = structlog.get_logger() @asynccontextmanager async def lifespan(app: FastAPI): """Application lifecycle manager.""" # Startup logger.info("application_starting") # Initialize database await init_db() # Connect to Redis await cache.connect() # Register MCP tools register_all_tools() logger.info("application_started") yield # Shutdown logger.info("application_stopping") # Close connections await cache.disconnect() await close_db() logger.info("application_stopped") # Create FastAPI app app = FastAPI( title="CME Prediction Markets MCP Server", description="MCP Server for verifying claims against CME prediction market data", version="1.0.0", lifespan=lifespan ) # Mount static files app.mount("/static", StaticFiles(directory="src/static"), name="static") # Include routers app.include_router(gui_router, prefix="/gui", tags=["GUI"]) app.include_router(mcp_router, prefix="/mcp", tags=["MCP"]) app.include_router(health_router, prefix="/health", tags=["Health"]) app.include_router(chat_router, prefix="/api", tags=["Chat"]) app.include_router(tastytrade_router, prefix="/api", tags=["TastyTrade"]) app.include_router(cme_router, prefix="/api", tags=["CME Data"]) @app.get("/") async def root(): """Root endpoint - redirect to GUI dashboard.""" return RedirectResponse(url="/gui/") if __name__ == "__main__": import uvicorn uvicorn.run( "src.main:app", host=settings.API_HOST, port=settings.API_PORT, reload=True, log_level=settings.LOG_LEVEL.lower() )

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jjsteffen23/dk_mcp_2'

If you have feedback or need assistance with the MCP directory API, please join our Discord server