Update mcp_server_main.py
This commit is contained in:
+4
-7
@@ -242,15 +242,12 @@ def create_app(auth=None):
|
|||||||
"""Create FastMCP app with standard capabilities and optional auth."""
|
"""Create FastMCP app with standard capabilities and optional auth."""
|
||||||
global app
|
global app
|
||||||
if auth:
|
if auth:
|
||||||
# Replace placeholder app with auth-enabled app, keeping all tools/resources
|
# Set auth on existing app instead of creating new one
|
||||||
auth_app = FastMCP("Yargı MCP Server", auth=auth)
|
app.auth = auth
|
||||||
# Copy all tools and resources from placeholder app to auth-enabled app
|
app.name = "Yargı MCP Server"
|
||||||
auth_app._tool_manager = app._tool_manager
|
|
||||||
auth_app._resource_manager = app._resource_manager
|
|
||||||
app = auth_app
|
|
||||||
logger.info("MCP server created with Bearer authentication enabled")
|
logger.info("MCP server created with Bearer authentication enabled")
|
||||||
else:
|
else:
|
||||||
# Update placeholder app name
|
# Update placeholder app name only
|
||||||
app.name = "Yargı MCP Server"
|
app.name = "Yargı MCP Server"
|
||||||
logger.info("MCP server created with standard capabilities (FastMCP handles tools.listChanged automatically)")
|
logger.info("MCP server created with standard capabilities (FastMCP handles tools.listChanged automatically)")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user