Spaces:
Running
Running
Update app.py
Browse files6 unmodified lines7891011121371 unmodified lines85868788899091926 unmodified linesfrom fastmcp.server import FastMCPfrom contextlib import asynccontextmanagerfrom typing import List, Dict, Optionalfrom fastapi.responses import JSONResponse# 初始化 MCP 服务器(必须在 FastAPI 之前)mcp_server = FastMCP(name="GitHubTrendingAPI")71 unmodified linesasync def get_trending(num: int = 10):if not cached_trending:await fetch_github_trending()return {"trending": cached_trending[:num]}@app.exception_handler(404)async def custom_404_handler(request, exc):return JSONResponse(status_code=404, content={"detail": "Custom Not Found: Check path"})6 unmodified lines78910111271 unmodified lines848586876 unmodified linesfrom fastmcp.server import FastMCPfrom contextlib import asynccontextmanagerfrom typing import List, Dict, Optional# 初始化 MCP 服务器(必须在 FastAPI 之前)mcp_server = FastMCP(name="GitHubTrendingAPI")71 unmodified linesasync def get_trending(num: int = 10):if not cached_trending:await fetch_github_trending()return {"trending": cached_trending[:num]}
app.py+1-6