update mcp package version
This commit is contained in:
26
main.py
26
main.py
@@ -307,6 +307,30 @@ class FluxEditMCPServer:
|
|||||||
type="text",
|
type="text",
|
||||||
text=f"[ERROR] Tool execution error: {str(e)}"
|
text=f"[ERROR] Tool execution error: {str(e)}"
|
||||||
)]
|
)]
|
||||||
|
|
||||||
|
# Add cancellation notification handler
|
||||||
|
try:
|
||||||
|
# This handles request cancellations gracefully
|
||||||
|
@self.server.set_logging_level()
|
||||||
|
async def handle_set_logging_level(level: types.LoggingLevel):
|
||||||
|
"""Handle logging level changes"""
|
||||||
|
try:
|
||||||
|
logger.info(f"Setting logging level to: {level}")
|
||||||
|
# Update logger level based on MCP level
|
||||||
|
if level == types.LoggingLevel.DEBUG:
|
||||||
|
logging.getLogger().setLevel(logging.DEBUG)
|
||||||
|
elif level == types.LoggingLevel.INFO:
|
||||||
|
logging.getLogger().setLevel(logging.INFO)
|
||||||
|
elif level == types.LoggingLevel.WARNING:
|
||||||
|
logging.getLogger().setLevel(logging.WARNING)
|
||||||
|
elif level == types.LoggingLevel.ERROR:
|
||||||
|
logging.getLogger().setLevel(logging.ERROR)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Error setting logging level: {e}", exc_info=True)
|
||||||
|
|
||||||
|
except AttributeError:
|
||||||
|
# If set_logging_level is not available, skip
|
||||||
|
logger.info("set_logging_level not available in this MCP version")
|
||||||
|
|
||||||
async def run(self):
|
async def run(self):
|
||||||
"""Run the MCP server"""
|
"""Run the MCP server"""
|
||||||
@@ -316,7 +340,7 @@ class FluxEditMCPServer:
|
|||||||
logger.info(f"Input directory: {self.config.input_path}")
|
logger.info(f"Input directory: {self.config.input_path}")
|
||||||
logger.info(f"Output directory: {self.config.generated_images_path}")
|
logger.info(f"Output directory: {self.config.generated_images_path}")
|
||||||
|
|
||||||
# Run server using stdio with proper initialization
|
# Run server using stdio
|
||||||
async with stdio_server() as (read_stream, write_stream):
|
async with stdio_server() as (read_stream, write_stream):
|
||||||
logger.info("MCP server started with stdio transport")
|
logger.info("MCP server started with stdio transport")
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# FLUX.1 Edit MCP Server Dependencies
|
# FLUX.1 Edit MCP Server Dependencies
|
||||||
|
|
||||||
# Core MCP Server
|
# Core MCP Server - Updated to latest
|
||||||
mcp==1.2.0
|
mcp==1.13.1
|
||||||
|
|
||||||
# HTTP Client for FLUX API - using stable version
|
# HTTP Client for FLUX API - using stable version
|
||||||
aiohttp==3.9.5
|
aiohttp==3.9.5
|
||||||
@@ -12,8 +12,8 @@ Pillow==11.0.0
|
|||||||
# Environment and Configuration
|
# Environment and Configuration
|
||||||
python-dotenv==1.0.1
|
python-dotenv==1.0.1
|
||||||
|
|
||||||
# Data Validation
|
# Data Validation - Updated with MCP
|
||||||
pydantic==2.10.3
|
pydantic==2.11.7
|
||||||
|
|
||||||
# Development and Testing
|
# Development and Testing
|
||||||
pytest==8.3.4
|
pytest==8.3.4
|
||||||
|
|||||||
Reference in New Issue
Block a user