dev
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
PORT=47173
|
PORT=47173
|
||||||
|
MCPPORT=47174
|
||||||
DEBUG_MODE=True
|
DEBUG_MODE=True
|
||||||
WORKERS=1
|
WORKERS=1
|
||||||
REDIS_URL=redis://localhost:6379/1
|
REDIS_URL=redis://localhost:6379/1
|
||||||
@@ -5,6 +5,7 @@ class Config(BaseSettings):
|
|||||||
DEBUG_MODE: bool = True
|
DEBUG_MODE: bool = True
|
||||||
WORKERS: int = 1
|
WORKERS: int = 1
|
||||||
PORT:int = 27173
|
PORT:int = 27173
|
||||||
|
MCPPORT: int = 27174
|
||||||
REDIS_URL: str = 'redis://localhost:6379/1'
|
REDIS_URL: str = 'redis://localhost:6379/1'
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
from fastmcp import FastMCP
|
from fastmcp import FastMCP
|
||||||
from main import application
|
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:
|
def custom_route_mapper(route: HTTPRoute, mcp_type: MCPType) -> MCPType | None:
|
||||||
"""Advanced route type mapping."""
|
"""Advanced route type mapping."""
|
||||||
@@ -14,9 +14,9 @@ def custom_route_mapper(route: HTTPRoute, mcp_type: MCPType) -> MCPType | None:
|
|||||||
|
|
||||||
mcp = FastMCP.from_fastapi(
|
mcp = FastMCP.from_fastapi(
|
||||||
app=application,
|
app=application,
|
||||||
name="My Custom Server",
|
name="Dcalc_MCP",
|
||||||
timeout=5.0, # Custom component names
|
timeout=60,
|
||||||
port=1486,
|
port=config.MCPPORT,
|
||||||
route_map_fn=custom_route_mapper,
|
route_map_fn=custom_route_mapper,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user