update mcp package version

This commit is contained in:
2025-08-26 04:33:33 +09:00
parent 431d012e20
commit a9938396e3
2 changed files with 29 additions and 5 deletions

26
main.py
View File

@@ -307,6 +307,30 @@ class FluxEditMCPServer:
type="text",
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):
"""Run the MCP server"""
@@ -316,7 +340,7 @@ class FluxEditMCPServer:
logger.info(f"Input directory: {self.config.input_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):
logger.info("MCP server started with stdio transport")

View File

@@ -1,7 +1,7 @@
# FLUX.1 Edit MCP Server Dependencies
# Core MCP Server
mcp==1.2.0
# Core MCP Server - Updated to latest
mcp==1.13.1
# HTTP Client for FLUX API - using stable version
aiohttp==3.9.5
@@ -12,8 +12,8 @@ Pillow==11.0.0
# Environment and Configuration
python-dotenv==1.0.1
# Data Validation
pydantic==2.10.3
# Data Validation - Updated with MCP
pydantic==2.11.7
# Development and Testing
pytest==8.3.4