From f66aed63405835d49fe7bd545662292dab8c3b20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A5=BF=E7=93=9C=C2=B0?= Date: Mon, 9 Jun 2025 03:22:53 +0800 Subject: [PATCH] dev --- backend/config/.env | 1 + backend/config/main.py | 1 + backend/mcpServer.py | 10 +++++----- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/backend/config/.env b/backend/config/.env index a5660677..76fc6cb1 100644 --- a/backend/config/.env +++ b/backend/config/.env @@ -1,4 +1,5 @@ PORT=47173 +MCPPORT=47174 DEBUG_MODE=True WORKERS=1 REDIS_URL=redis://localhost:6379/1 \ No newline at end of file diff --git a/backend/config/main.py b/backend/config/main.py index 98f057ab..bf436d68 100644 --- a/backend/config/main.py +++ b/backend/config/main.py @@ -5,6 +5,7 @@ class Config(BaseSettings): DEBUG_MODE: bool = True WORKERS: int = 1 PORT:int = 27173 + MCPPORT: int = 27174 REDIS_URL: str = 'redis://localhost:6379/1' class Config: diff --git a/backend/mcpServer.py b/backend/mcpServer.py index 2616d140..d23396c0 100644 --- a/backend/mcpServer.py +++ b/backend/mcpServer.py @@ -1,8 +1,8 @@ from fastmcp import FastMCP from main import application -from fastmcp.server.openapi import RouteMap, MCPType, HTTPRoute - +from fastmcp.server.openapi import MCPType, HTTPRoute +from config.main import config def custom_route_mapper(route: HTTPRoute, mcp_type: MCPType) -> MCPType | None: """Advanced route type mapping.""" @@ -14,9 +14,9 @@ def custom_route_mapper(route: HTTPRoute, mcp_type: MCPType) -> MCPType | None: mcp = FastMCP.from_fastapi( app=application, - name="My Custom Server", - timeout=5.0, # Custom component names - port=1486, + name="Dcalc_MCP", + timeout=60, + port=config.MCPPORT, route_map_fn=custom_route_mapper, )